Main Page   Data Structures   File List   Globals  

relay_MouseClicks.c File Reference

Relays mouse_click messages to the input module. More...

#include "white_interface.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 pass_mouse_clicks
 Pass mouse clicks to the input module? More...


Detailed Description

Relays mouse_click messages to the input module.

This block receives mouse_click messages from the user, and either forwards them to the input module or sends them to the receive_input block of the lobby.

Initially when the lobby is running, mouse clicks are handled by the lobby. However, once the game starts, they must be sent to the input module instead, so that the user's moves and button presses can be recognised. This happens as soon as a "1" is received through the trigger_in port.

Definition in file relay_MouseClicks.c.


Function Documentation

void poin_entry_Init  
 

VCC Init function.

This function runs when the VCC simulation is first started.

Definition at line 52 of file relay_MouseClicks.c.

References pass_mouse_clicks.

00053 {
00054   /* Initially mouse_clicks should be handled by the lobby and
00055      not passed to the input module. */
00056   pass_mouse_clicks = 0;
00057 }

void poin_entry_Run  
 

VCC Run function.

This runs whenever a message arrives at the mouse_in or trigger_in port.

Definition at line 65 of file relay_MouseClicks.c.

References pass_mouse_clicks.

00066 {
00067   mouse_click mouse_input;
00068  
00069   /* if something arrives on the trigger_in port, update the
00070      value of pass_mouse_clicks. */
00071 
00072   if (trigger_in_Enabled())
00073   {
00074     pass_mouse_clicks = trigger_in_Value();
00075   }
00076   
00077   /* if mouse clicks are received: */
00078   if (mouse_in_Enabled())
00079   {
00080     mouse_click mouse_input;
00081     mouse_input = *mouse_in_Value();
00082 
00083     /* either pass them to the input module or the lobby. */
00084 
00085     if (pass_mouse_clicks == 1)
00086       mouse_out_Post(&mouse_input);
00087     else
00088       lobby_mouse_out_Post(&mouse_input);
00089   }
00090 }


Variable Documentation

int pass_mouse_clicks
 

Pass mouse clicks to the input module?

When pass_mouse_clicks > 0, mouse_click messages are forwarded to the input module. Otherwise they are handled by the lobby module.

Definition at line 35 of file relay_MouseClicks.c.

Referenced by poin_entry_Init, and poin_entry_Run.


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