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.

Defines

#define MOUSE_DOWN   0
 True when the mouse button is pressed down. More...


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.


Define Documentation

#define MOUSE_DOWN   0
 

True when the mouse button is pressed down.

Definition at line 5 of file receive_input.c.

Referenced by poin_entry_Run.


Function Documentation

void poin_entry_Init  
 

VCC Init function.

This function runs when the VCC simulation is first started.

Definition at line 35 of file receive_input.c.

00036 {
00037 }

void poin_entry_Run  
 

VCC Run function.

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

Definition at line 45 of file receive_input.c.

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

00046 {
00047   mouse_click input;
00048   mouse_drag output;
00049 
00050   /* If a mouse_click message arrives: */
00051 
00052   if (in_Enabled())
00053   {
00054     input = *in_Value();
00055         
00056     if (input.status == MOUSE_DOWN)
00057     {
00058       /* if the mouse button has been pressed,
00059            just record the starting coordinates. */
00060       down_x = input.x;
00061       down_y = input.y;
00062     }
00063     else
00064     {
00065       /* if the mouse has been released, 
00066            record the end coordinates. */
00067       up_x = input.x;
00068       up_y = input.y;
00069 
00070       /* also create and send a mouse_drag message showing the 
00071            start and end points of where the user has dragged the mouse. */
00072       output.down_x = down_x;
00073       output.down_y = down_y;
00074       output.up_x = up_x;
00075       output.up_y = up_y;
00076 
00077       out_Post(&output);
00078     }
00079   }
00080 }


Variable Documentation

int down_x
 

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

Definition at line 8 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 8 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 8 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 8 of file receive_input.c.

Referenced by poin_entry_Run.


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