Lugre::cInput Class Reference

Listener pattern for callbacks. More...

#include <lugre_input.h>

List of all members.

Public Types

enum  { kListenerEvent_KeyPress, kListenerEvent_KeyRepeat, kListenerEvent_KeyRelease }
 eventcodes for cListenable More...
enum  kKey {
  kkey_mouse1 = 0x01, kkey_mouse2 = 0x02, kkey_mouse3 = 0x03, kkey_mouse4 = 0x04,
  kkey_mouse5 = 0x05, kkey_wheelup = 0x06, kkey_wheeldown = 0x07, kkey_escape = 0x1B,
  kkey_f1 = 0x70, kkey_f2 = 0x71, kkey_f3 = 0x72, kkey_f4 = 0x73,
  kkey_f5 = 0x74, kkey_f6 = 0x75, kkey_f7 = 0x76, kkey_f8 = 0x77,
  kkey_f9 = 0x78, kkey_f10 = 0x79, kkey_f11 = 0x7A, kkey_f12 = 0x7B,
  kkey_f13 = 0x7C, kkey_f14 = 0x7D, kkey_f15 = 0x7E, kkey_screen = 0x2C,
  kkey_scroll = 0x91, kkey_pause = 0x13, kkey_console = 0xDC, kkey_0 = 0x30,
  kkey_1 = 0x31, kkey_2 = 0x32, kkey_3 = 0x33, kkey_4 = 0x34,
  kkey_5 = 0x35, kkey_6 = 0x36, kkey_7 = 0x37, kkey_8 = 0x38,
  kkey_9 = 0x39, kkey_bslash = 0xDB, kkey_accent = 0xDD, kkey_back = 0x08,
  kkey_prior = 0x21, kkey_next = 0x22, kkey_end = 0x23, kkey_home = 0x24,
  kkey_ins = 0x2D, kkey_del = 0x2E, kkey_left = 0x25, kkey_up = 0x26,
  kkey_right = 0x27, kkey_down = 0x28, kkey_numpad0 = 0x60, kkey_numpad1 = 0x61,
  kkey_numpad2 = 0x62, kkey_numpad3 = 0x63, kkey_numpad4 = 0x64, kkey_numpad5 = 0x65,
  kkey_numpad6 = 0x66, kkey_numpad7 = 0x67, kkey_numpad8 = 0x68, kkey_numpad9 = 0x69,
  kkey_np_mult = 0x6A, kkey_np_add = 0x6B, kkey_np_sub = 0x6D, kkey_np_komma = 0x6E,
  kkey_np_div = 0x6F, kkey_np_stopclear = 0x0C, kkey_numlock = 0x90, kkey_a = 0x41,
  kkey_b = 0x42, kkey_c = 0x43, kkey_d = 0x44, kkey_e = 0x45,
  kkey_f = 0x46, kkey_g = 0x47, kkey_h = 0x48, kkey_i = 0x49,
  kkey_j = 0x4A, kkey_k = 0x4B, kkey_l = 0x4C, kkey_m = 0x4D,
  kkey_n = 0x4E, kkey_o = 0x4F, kkey_p = 0x50, kkey_q = 0x51,
  kkey_r = 0x52, kkey_s = 0x53, kkey_t = 0x54, kkey_u = 0x55,
  kkey_v = 0x56, kkey_w = 0x57, kkey_x = 0x58, kkey_y = 0x59,
  kkey_z = 0x5A, kkey_lshift = 0x10, kkey_lcontrol = 0x11, kkey_lalt = 0x12,
  kkey_lwin = 0x5B, kkey_capslock = 0x14, kkey_rshift = 0xA1, kkey_rcontrol = 0xA3,
  kkey_ralt = 0xA5, kkey_rwin = 0x5C, kkey_menu = 0x5D, kkey_tab = 0x09,
  kkey_return = 0x0D, kkey_np_enter = 0x0E, kkey_space = 0x20, kkey_plus = 0xBB,
  kkey_grid = 0xBF, kkey_minus = 0xBD, kkey_point = 0xBE, kkey_komma = 0xBC,
  kkey_greater = 0xE2, kkey_ue = 0xBA, kkey_ae = 0xDE, kkey_oe = 0xC0
}
 named iKey values More...

Public Member Functions

 cInput ()
void Reset ()
void FocusChange (const bool bGain)
 called when the application loses or gains focus (minimization, activation)
void Step ()
 called every event loop
unsigned char KeyConvertWin (const int iVKey, const bool bRight)
unsigned char KeyConvertOIS (const int iKeyCode)
unsigned int KeyConvertOISInv (const char iKey)
unsigned char GetNamedKey (const char *szName)
const char * GetKeyName (const unsigned char iKey)
 returns the human readable (english) name for a key
void KeyDown (const unsigned char iKey, const int iLetter=0)
void KeyUp (const unsigned char iKey)

Static Public Member Functions

static int GetKeyNameCount ()
static const char * GetKeyNameByIndex (const int i)
static void RegisterListener (cInputListener *p)
static cInputGetSingleton ()

Static Public Attributes

static const char * szKeyNames [256]
static bool bKeys [256]
static bool bButton [3]
static int iMouseWheel
static int iMouseWheel_pressed
static int iMouseWheel_all_since_last_step
static int iMouseWheel_pressed_since_last_step
static int iMouse [2]
static std::list
< cInputListener * > 
mListeners


Detailed Description

Listener pattern for callbacks.

Definition at line 38 of file lugre_input.h.


Member Enumeration Documentation

anonymous enum

eventcodes for cListenable

Enumerator:
kListenerEvent_KeyPress 
kListenerEvent_KeyRepeat 
kListenerEvent_KeyRelease 

Definition at line 80 of file lugre_input.h.

named iKey values

Enumerator:
kkey_mouse1 
kkey_mouse2 
kkey_mouse3 
kkey_mouse4 
kkey_mouse5 
kkey_wheelup 
kkey_wheeldown 
kkey_escape 
kkey_f1 
kkey_f2 
kkey_f3 
kkey_f4 
kkey_f5 
kkey_f6 
kkey_f7 
kkey_f8 
kkey_f9 
kkey_f10 
kkey_f11 
kkey_f12 
kkey_f13 
kkey_f14 
kkey_f15 
kkey_screen 
kkey_scroll 
kkey_pause 
kkey_console 
kkey_0 
kkey_1 
kkey_2 
kkey_3 
kkey_4 
kkey_5 
kkey_6 
kkey_7 
kkey_8 
kkey_9 
kkey_bslash 
kkey_accent 
kkey_back 
kkey_prior 
kkey_next 
kkey_end 
kkey_home 
kkey_ins 
kkey_del 
kkey_left 
kkey_up 
kkey_right 
kkey_down 
kkey_numpad0 
kkey_numpad1 
kkey_numpad2 
kkey_numpad3 
kkey_numpad4 
kkey_numpad5 
kkey_numpad6 
kkey_numpad7 
kkey_numpad8 
kkey_numpad9 
kkey_np_mult 
kkey_np_add 
kkey_np_sub 
kkey_np_komma 
kkey_np_div 
kkey_np_stopclear 
kkey_numlock 
kkey_a 
kkey_b 
kkey_c 
kkey_d 
kkey_e 
kkey_f 
kkey_g 
kkey_h 
kkey_i 
kkey_j 
kkey_k 
kkey_l 
kkey_m 
kkey_n 
kkey_o 
kkey_p 
kkey_q 
kkey_r 
kkey_s 
kkey_t 
kkey_u 
kkey_v 
kkey_w 
kkey_x 
kkey_y 
kkey_z 
kkey_lshift 
kkey_lcontrol 
kkey_lalt 
kkey_lwin 
kkey_capslock 
kkey_rshift 
kkey_rcontrol 
kkey_ralt 
kkey_rwin 
kkey_menu 
kkey_tab 
kkey_return 
kkey_np_enter 
kkey_space 
kkey_plus 
kkey_grid 
kkey_minus 
kkey_point 
kkey_komma 
kkey_greater 
kkey_ue 
kkey_ae 
kkey_oe 

Definition at line 87 of file lugre_input.h.


Constructor & Destructor Documentation

Lugre::cInput::cInput (  ) 

Definition at line 206 of file lugre_input.cpp.

References Lugre::InitKeyMapOIS(), PROFILE, and Reset().

Referenced by GetSingleton().


Member Function Documentation

static int Lugre::cInput::GetKeyNameCount (  )  [inline, static]

Definition at line 40 of file lugre_input.h.

static const char* Lugre::cInput::GetKeyNameByIndex ( const int  i  )  [inline, static]

Definition at line 41 of file lugre_input.h.

References szKeyNames.

static void Lugre::cInput::RegisterListener ( cInputListener p  )  [inline, static]

Definition at line 51 of file lugre_input.h.

References mListeners.

Referenced by Lugre::cScripting::Init().

static cInput& Lugre::cInput::GetSingleton (  )  [inline, static]

Definition at line 60 of file lugre_input.h.

References cInput().

void Lugre::cInput::Reset (  ) 

Reset desc : resets all keys, mousebuttons, and the wheel params : none

Definition at line 211 of file lugre_input.cpp.

References bButton, bKeys, iMouse, iMouseWheel, iMouseWheel_all_since_last_step, iMouseWheel_pressed, iMouseWheel_pressed_since_last_step, and PROFILE.

Referenced by cInput(), and FocusChange().

void Lugre::cInput::FocusChange ( const bool  bGain  ) 

called when the application loses or gains focus (minimization, activation)

Definition at line 230 of file lugre_input.cpp.

References PROFILE, and Reset().

void Lugre::cInput::Step (  ) 

called every event loop

Definition at line 223 of file lugre_input.cpp.

References iMouseWheel_all_since_last_step, iMouseWheel_pressed_since_last_step, and PROFILE.

unsigned char Lugre::cInput::KeyConvertWin ( const int  iVKey,
const bool  bRight 
)

KeyConvertWin desc : convert a win32 virtual keycode to platform independant representation params :

  • iVKey virtual keycode
  • bRight bRight extended key -> right control differentiation

Definition at line 240 of file lugre_input.cpp.

References kkey_lalt, kkey_lcontrol, kkey_lshift, kkey_np_enter, kkey_ralt, kkey_rcontrol, kkey_return, kkey_rshift, and PROFILE.

unsigned char Lugre::cInput::KeyConvertOIS ( const int  iKeyCode  ) 

unsigned int Lugre::cInput::KeyConvertOISInv ( const char  iKey  ) 

Definition at line 255 of file lugre_input.cpp.

References Lugre::gKeyMapOISInv, and PROFILE.

unsigned char Lugre::cInput::GetNamedKey ( const char *  szName  ) 

GetNamedKey desc : get key number for a given key name params :

  • szName key name

Definition at line 435 of file lugre_input.cpp.

References Lugre::mystricmp(), PROFILE, and szKeyNames.

const char * Lugre::cInput::GetKeyName ( const unsigned char  iKey  ) 

returns the human readable (english) name for a key

Definition at line 444 of file lugre_input.cpp.

References PROFILE, and szKeyNames.

void Lugre::cInput::KeyDown ( const unsigned char  iKey,
const int  iLetter = 0 
)

KeyDown desc : register keypush (and autokeyrepeat) params :

  • iKey key number
  • iLetter text-character resulting from this keypress considering modifiers, can be unicode

Definition at line 454 of file lugre_input.cpp.

References bButton, bKeys, iMouseWheel, iMouseWheel_all_since_last_step, iMouseWheel_pressed, iMouseWheel_pressed_since_last_step, kkey_mouse1, kkey_mouse2, kkey_mouse3, kkey_wheeldown, kkey_wheelup, mListeners, and PROFILE.

Referenced by Lugre::cMyOISListener::keyPressed(), Lugre::cMyOISListener::mouseMoved(), and Lugre::cMyOISListener::mousePressed().

void Lugre::cInput::KeyUp ( const unsigned char  iKey  ) 

KeyUp desc : register keyrelease params :

  • iKey key number

Definition at line 492 of file lugre_input.cpp.

References bButton, bKeys, kkey_mouse1, kkey_mouse2, kkey_mouse3, mListeners, and PROFILE.

Referenced by Lugre::cMyOISListener::keyReleased(), Lugre::cMyOISListener::mouseMoved(), and Lugre::cMyOISListener::mouseReleased().


Member Data Documentation

const char * Lugre::cInput::szKeyNames [static]

Definition at line 42 of file lugre_input.h.

Referenced by GetKeyName(), GetKeyNameByIndex(), and GetNamedKey().

bool Lugre::cInput::bKeys [static]

Definition at line 43 of file lugre_input.h.

Referenced by KeyDown(), KeyUp(), and Reset().

bool Lugre::cInput::bButton [static]

Definition at line 44 of file lugre_input.h.

Referenced by KeyDown(), KeyUp(), and Reset().

Definition at line 45 of file lugre_input.h.

Referenced by KeyDown(), and Reset().

Definition at line 46 of file lugre_input.h.

Referenced by KeyDown(), and Reset().

Definition at line 47 of file lugre_input.h.

Referenced by KeyDown(), Reset(), and Step().

Definition at line 48 of file lugre_input.h.

Referenced by KeyDown(), Reset(), and Step().

int Lugre::cInput::iMouse [static]

std::list< cInputListener * > Lugre::cInput::mListeners [static]

Definition at line 50 of file lugre_input.h.

Referenced by KeyDown(), KeyUp(), and RegisterListener().


The documentation for this class was generated from the following files:

Generated on Wed Feb 8 06:00:21 2012 for cpp by  doxygen 1.5.6