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 
00005 #define MOUSE_DOWN 0
00006 
00008 int down_x, down_y, up_x, up_y;
00009 
00034 /* Init Function */
00035 void poin_entry_Init()
00036 {
00037 }
00038 
00039 
00044 /* Run Function */
00045 void poin_entry_Run()
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 }
00081 

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