Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AInput.cpp File Reference


Detailed Description

Implements the 'input_' functions of AEngine.h.

Definition in file AInput.cpp.

#include "AEngine.h"
#include "AState.h"

Include dependency graph for AInput.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void input_init ()
bool input_isKeyDown (int key)
 The input system latches the status of all keys at some frequency. Checks whether a specific key is down, pressed or released 'down' means the key was held down at the time we last latch 'pressed' means the key was previously 'up', but just became 'down' 'released' means the key was previously 'down' but just became 'up'.

bool input_isKeyPressed (int key)
bool input_isKeyReleased (int key)
void input_resetVKeyMapping ()
 this resets all mapping to default values. i.e. the virtual key 'A' is the same as the absolute key 'A'

void input_mapVKey (int key, int VKey)
bool input_isVKeyDown (int VKey)
bool input_isVKeyPressed (int VKey)
bool input_isVKeyReleased (int VKey)
bool input_isMouseLBDown ()
 check whether the left/middle/right mouse button is down, clicked or double clicked

bool input_isMouseMBDown ()
bool input_isMouseRBDown ()
bool input_isMouseLBClicked ()
bool input_isMouseMBClicked ()
bool input_isMouseRBClicked ()
bool input_isMouseLBDblClicked ()
bool input_isMouseMBDblClicked ()
bool input_isMouseRBDblClicked ()
float input_getMouseX ()
float input_getMouseY ()
float input_getMouseWheel ()
float input_mouseIdleTime ()

Variables

const FLOAT mouseSpeed = 2.5f


Function Documentation

float input_getMouseWheel  
 

Definition at line 151 of file AInput.cpp.

Referenced by BattleEntry::input(), and Overhead::processOverheadInput().

00152 {
00153         return AS.input_mouseWheel;
00154 }

float input_getMouseX  
 

Definition at line 135 of file AInput.cpp.

References mouseSpeed.

Referenced by Icon::drawHelpString(), BattleEntry::input(), BattleEntry::inputIssueGroupCommand(), BattleEntry::inputIssueJetsCommand(), BattleEntry::inputSelectGroups(), BattleEntry::inputSelectJets(), HUD::isButtonCallRFMUnitTypeClicked(), HUD::isButtonStopClicked(), Overhead::overhead_render(), Overhead::overhead_update(), Overhead::overheadRender(), HUD::processOverheadInput(), Overhead::processOverheadInput(), HUD::render(), BattleEntry::renderInterface(), renderMainMenu(), BattleEntry::renderMiniMap(), renderMultiplayMenu(), updateInput(), updateMainMenu(), and updateMultiplayMenu().

00136 {
00137         FLOAT x = AS.ndxInput.MouseXPos *mouseSpeed / AS.windowWidth;
00138         //x = 0.5f + (x-0.5f)*2.0f;
00139         if( x<0 ) x=0; else if (x>1) x=1;
00140         return x;
00141 }

float input_getMouseY  
 

Definition at line 143 of file AInput.cpp.

References mouseSpeed.

Referenced by Icon::drawHelpString(), BattleEntry::input(), BattleEntry::inputIssueGroupCommand(), BattleEntry::inputIssueJetsCommand(), BattleEntry::inputSelectGroups(), BattleEntry::inputSelectJets(), HUD::isButtonCallRFMUnitTypeClicked(), HUD::isButtonStopClicked(), Overhead::overhead_render(), Overhead::overhead_update(), Overhead::overheadRender(), HUD::processOverheadInput(), Overhead::processOverheadInput(), HUD::render(), BattleEntry::renderInterface(), renderMainMenu(), BattleEntry::renderMiniMap(), renderMultiplayMenu(), updateInput(), updateMainMenu(), and updateMultiplayMenu().

00144 {
00145         FLOAT y = AS.ndxInput.MouseYPos *mouseSpeed / AS.windowHeight;
00146         //y = 0.5f + (y-0.5f)*2.0f;
00147         if( y<0 ) y=0; else if (y>1) y=1;
00148         return y;
00149 }

void input_init  
 

Definition at line 29 of file AInput.cpp.

References DWORD, input_resetVKeyMapping(), and mouseSpeed.

Referenced by sys_go().

00030 {
00031         DWORD rc = AS.ndxInput.Create( AS.hInst, AS.hWnd );
00032         if(rc!=NDXERR_OK) throw Error("Please do not switch application while game is loading.  Try again");
00033         ZeroMemory( AS.keyDownLastCycle, sizeof(AS.keyDownLastCycle) );
00034         ZeroMemory( AS.keyDownThisCycle, sizeof(AS.keyDownThisCycle) ); 
00035         input_resetVKeyMapping();
00036 
00037         AS.ndxInput.MouseLimit.left   = 0;
00038         AS.ndxInput.MouseLimit.right  = (int)(AS.windowWidth /mouseSpeed);
00039         AS.ndxInput.MouseLimit.top    = 0;
00040         AS.ndxInput.MouseLimit.bottom = (int)(AS.windowHeight/mouseSpeed);
00041 
00042         AS.input_mouseWheel = 0.5f;
00043 }

bool input_isKeyDown int    key
 

The input system latches the status of all keys at some frequency. Checks whether a specific key is down, pressed or released 'down' means the key was held down at the time we last latch 'pressed' means the key was previously 'up', but just became 'down' 'released' means the key was previously 'down' but just became 'up'.

Definition at line 45 of file AInput.cpp.

Referenced by checkSysKeys(), Overhead::doVictoryTest(), Typer::input(), BattleEntry::input(), input_isVKeyDown(), BattleEntry::inputCtrlGroup(), BattleEntry::inputIssueGroupCommand(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), and HUD::processOverheadInput().

00046 {
00047         return AS.keyDownThisCycle[key];
00048 }

bool input_isKeyPressed int    key
 

Definition at line 50 of file AInput.cpp.

Referenced by checkSysKeys(), Typer::input(), BattleEntry::input(), input_isVKeyPressed(), BattleEntry::inputCtrlGroup(), BattleEntry::inputIssueGroupCommand(), BattleEntry::inputIssueJetsCommand(), BattleEntry::inputSelectByHotKey(), Overhead::overhead_update(), Overhead::processOverheadInput(), HUD::processOverheadInput(), updateCredit(), updateMultiplayMenu(), and updateSponsor().

00051 {
00052         return !AS.keyDownLastCycle[key] && AS.keyDownThisCycle[key];
00053 }

bool input_isKeyReleased int    key
 

Definition at line 55 of file AInput.cpp.

Referenced by input_isVKeyReleased().

00056 {
00057         return AS.keyDownLastCycle[key] && !AS.keyDownThisCycle[key];
00058 }

bool input_isMouseLBClicked  
 

Definition at line 105 of file AInput.cpp.

Referenced by BattleEntry::input(), BattleEntry::inputSelectGroups(), BattleEntry::inputSelectJets(), HUD::isButtonCallRFMUnitTypeClicked(), HUD::isButtonStopClicked(), Overhead::overhead_update(), HUD::processMiniMapInput(), HUD::processOverheadInput(), Overhead::processOverheadInput(), updateMainMenu(), and updateMultiplayMenu().

00106 {
00107         return AS.ndxInput.MouseLBClick;
00108 }

bool input_isMouseLBDblClicked  
 

Definition at line 120 of file AInput.cpp.

Referenced by Overhead::processOverheadInput().

00121 {
00122         return AS.ndxInput.MouseLBDblClick;
00123 }

bool input_isMouseLBDown  
 

check whether the left/middle/right mouse button is down, clicked or double clicked

Definition at line 90 of file AInput.cpp.

Referenced by Overhead::processOverheadInput().

00091 {
00092         return AS.ndxInput.MouseLB;
00093 }

bool input_isMouseMBClicked  
 

Definition at line 110 of file AInput.cpp.

00111 {
00112         return AS.ndxInput.MouseMBClick;
00113 }

bool input_isMouseMBDblClicked  
 

Definition at line 125 of file AInput.cpp.

00126 {
00127         return AS.ndxInput.MouseMBDblClick;
00128 }

bool input_isMouseMBDown  
 

Definition at line 95 of file AInput.cpp.

00096 {
00097         return AS.ndxInput.MouseMB;
00098 }

bool input_isMouseRBClicked  
 

Definition at line 115 of file AInput.cpp.

Referenced by BattleEntry::inputIssueGroupCommand(), BattleEntry::inputIssueJetsCommand(), HUD::processMiniMapInput(), and Overhead::processOverheadInput().

00116 {
00117         return AS.ndxInput.MouseRBClick;
00118 }

bool input_isMouseRBDblClicked  
 

Definition at line 130 of file AInput.cpp.

00131 {
00132         return AS.ndxInput.MouseRBDblClick;
00133 }

bool input_isMouseRBDown  
 

Definition at line 100 of file AInput.cpp.

00101 {
00102         return AS.ndxInput.MouseRB;
00103 }

bool input_isVKeyDown int    VKey
 

Definition at line 73 of file AInput.cpp.

References input_isKeyDown().

00074 {
00075         return input_isKeyDown( AS.VKmapping[VKey] );
00076 }

bool input_isVKeyPressed int    VKey
 

Definition at line 78 of file AInput.cpp.

References input_isKeyPressed().

00079 {
00080         return input_isKeyPressed( AS.VKmapping[VKey] );
00081 }

bool input_isVKeyReleased int    VKey
 

Definition at line 83 of file AInput.cpp.

References input_isKeyReleased().

00084 {
00085         return input_isKeyReleased( AS.VKmapping[VKey] );
00086 }

void input_mapVKey int    key,
int    VKey
 

Definition at line 66 of file AInput.cpp.

00067 {
00068         assert( key>=0  && key<MAX_KEY );
00069         assert( VKey>=0 && VKey<MAX_KEY );
00070         AS.VKmapping[VKey] = key;
00071 }

float input_mouseIdleTime  
 

Definition at line 156 of file AInput.cpp.

00157 {
00158         return AS.input_mouseIdleTickCount / 62.5f;
00159 }

void input_resetVKeyMapping  
 

this resets all mapping to default values. i.e. the virtual key 'A' is the same as the absolute key 'A'

Definition at line 60 of file AInput.cpp.

References MAX_KEY.

Referenced by input_init().

00061 {
00062         for( int i=0; i<MAX_KEY; i++ )
00063                 AS.VKmapping[i] = i;
00064 }


Variable Documentation

const FLOAT mouseSpeed = 2.5f
 

Definition at line 26 of file AInput.cpp.

Referenced by input_getMouseX(), input_getMouseY(), and input_init().


Generated on Wed Apr 23 05:50:28 2003 for Modern Warfare by doxygen1.3-rc2