Main Page   Data Structures   File List   Globals  

receive_input.c

Go to the documentation of this file.
00001 #include "white_interface.h"
00002 #include "e:\AndrewWorkspace\Stratego\input.h"
00003 
00004 
00057 int down_x, down_y, up_x, up_y;
00058 
00059 
00064 /* Init Function */
00065 void poin_entry_Init() {
00066 }
00067 
00072 /* Run Function */
00073 void poin_entry_Run()
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 }
00108 

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