Main Page   Data Structures   File List   Globals  

mouse_input.c

Go to the documentation of this file.
00001 #include "white_interface.h"
00002 
00018 /* Init Function */
00019 void poin_entry_Init()
00020 {
00021 }
00022 
00023 
00028 /* Run Function */
00029 void poin_entry_Run()
00030 {
00031   int y, grid_line, screen_line;
00032   mouse_drag input;
00033 
00034   /* When a mouse_drag message arrives, extract the y
00035      coordinate of where the user clicked. */
00036   if (mouse_in_Enabled())
00037   {
00038     input = *mouse_in_Value();
00039     y = input.down_y;
00040 
00041     /* The lobby screen is a 10 line display, with
00042        each line 24 pixels high. The bottom line
00043        starts at the 80th pixel up the screen. */
00044 
00045     /* get the number of pixels up the 10 line display
00046        that the user clicked on. */
00047     y = y - 80;
00048 
00049     /* now work out how many lines up the display
00050        they clicked. */
00051     grid_line = y / 24;
00052 
00053     /* convert this to the number of lines down
00054        the display they clicked, excluding a
00055        title line and spacing line at the top. */       
00056     screen_line = grid_line - 8;        
00057     screen_line = -screen_line;
00058 
00059     /* as long as the user clicked on a valid
00060        area of the screen, output the line
00061        number to the start_game block. */
00062     if (screen_line > 0)
00063     {
00064       line_out_Post(screen_line);
00065     }
00066   }
00067 }

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