Main Page   Data Structures   File List   Globals  

receive_input.c File Reference

Converts mouse clicks into mouse drags. More...

#include "white_interface.h"
#include "e:\AndrewWorkspace\Stratego\input.h"

Go to the source code of this file.

Functions

void poin_entry_Init ()
 VCC Init function. More...

void poin_entry_Run ()
 VCC Run function. More...


Variables

int down_x
int down_y
int up_x
int up_y


Detailed Description

Converts mouse clicks into mouse drags.

This block receives mouse_click messages, which specify the position of the mouse button (up or down) and the coordinates where the user pressed/released the button. Once a down and up mouse_click message has been received, a mouse_drag message is sent. This specifies the start and end coordinates of where the mouse was dragged.

Definition in file receive_input.c.


Function Documentation

void poin_entry_Init  
 

VCC Init function.

This function runs when the VCC simulation is first started.

Definition at line 65 of file receive_input.c.

00065                        {
00066 }

void poin_entry_Run  
 

VCC Run function.

This runs whenever a message arrives at the receive_input block's in port.

Definition at line 73 of file receive_input.c.

References down_x, down_y, MOUSE_DOWN, up_x, and up_y.

00074 {
00075   mouse_click input;
00076   mouse_drag output;
00077 
00078   /* If a mouse_click message arrives: */
00079 
00080   if (in_Enabled())
00081   {
00082     input = *in_Value();
00083         
00084     if (input.status == MOUSE_DOWN)
00085     {
00086       /* if the mouse button has been pressed,
00087          just record the starting coordinates. */
00088       down_x = input.x;
00089       down_y = input.y;
00090     }
00091     else
00092     {
00093       /* if the mouse has been released, 
00094          record the end coordinates. */
00095       up_x = input.x;
00096       up_y = input.y;
00097 
00098       /* also create and send a mouse_drag message showing the 
00099          start and end points of where the user has dragged the mouse. */
00100       output.down_x = down_x;
00101       output.down_y = down_y;
00102       output.up_x = up_x;
00103       output.up_y = up_y;
00104       out_Post(&output);
00105     }
00106   }
00107 }


Variable Documentation

int down_x
 

variables to store the x and y coordinates of where the mouse is clicked and released.

Definition at line 57 of file receive_input.c.

Referenced by poin_entry_Run.

int down_y
 

variables to store the x and y coordinates of where the mouse is clicked and released.

Definition at line 57 of file receive_input.c.

Referenced by poin_entry_Run.

int up_x
 

variables to store the x and y coordinates of where the mouse is clicked and released.

Definition at line 57 of file receive_input.c.

Referenced by poin_entry_Run.

int up_y
 

variables to store the x and y coordinates of where the mouse is clicked and released.

Definition at line 57 of file receive_input.c.

Referenced by poin_entry_Run.


Copyright © 2002 Andrew Bates
Last Updated 03/04/02