$treeview $search $mathjax
Stratagus  2.2.7
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

gcn::Key Class Reference

#include <key.h>

List of all members.


Public Types

enum  {
  K_SPACE = ' ', K_TAB = '\t', K_ENTER = '\n', K_LEFT_ALT = 1000,
  K_RIGHT_ALT, K_LEFT_SHIFT, K_RIGHT_SHIFT, K_LEFT_CONTROL,
  K_RIGHT_CONTROL, K_LEFT_META, K_RIGHT_META, K_LEFT_SUPER,
  K_RIGHT_SUPER, K_INSERT, K_HOME, K_PAGE_UP,
  K_DELETE, K_END, K_PAGE_DOWN, K_ESCAPE,
  K_CAPS_LOCK, K_BACKSPACE, K_F1, K_F2,
  K_F3, K_F4, K_F5, K_F6,
  K_F7, K_F8, K_F9, K_F10,
  K_F11, K_F12, K_F13, K_F14,
  K_F15, K_PRINT_SCREEN, K_SCROLL_LOCK, K_PAUSE,
  K_NUM_LOCK, K_ALT_GR, K_LEFT, K_RIGHT,
  K_UP, K_DOWN
}

Public Member Functions

 Key ()
 Key (int value)
bool isCharacter () const
bool isNumber () const
bool isLetter () const
bool isShiftPressed () const
void setShiftPressed (bool pressed)
bool isControlPressed () const
void setControlPressed (bool pressed)
bool isAltPressed () const
void setAltPressed (bool pressed)
bool isMetaPressed () const
void setMetaPressed (bool pressed)
bool isNumericPad () const
void setNumericPad (bool numpad)
int getValue () const
void setValue (int value)
std::string toString () const

Protected Attributes

int mValue
bool mShiftPressed
bool mControlPressed
bool mAltPressed
bool mMetaPressed
bool mNumericPad

Detailed Description

Represents a key or a character.

Member Enumeration Documentation

anonymous enum

An enum with key values.

Enumerator:
K_SPACE 
K_TAB 
K_ENTER 
K_LEFT_ALT 
K_RIGHT_ALT 
K_LEFT_SHIFT 
K_RIGHT_SHIFT 
K_LEFT_CONTROL 
K_RIGHT_CONTROL 
K_LEFT_META 
K_RIGHT_META 
K_LEFT_SUPER 
K_RIGHT_SUPER 
K_INSERT 
K_HOME 
K_PAGE_UP 
K_DELETE 
K_END 
K_PAGE_DOWN 
K_ESCAPE 
K_CAPS_LOCK 
K_BACKSPACE 
K_F1 
K_F2 
K_F3 
K_F4 
K_F5 
K_F6 
K_F7 
K_F8 
K_F9 
K_F10 
K_F11 
K_F12 
K_F13 
K_F14 
K_F15 
K_PRINT_SCREEN 
K_SCROLL_LOCK 
K_PAUSE 
K_NUM_LOCK 
K_ALT_GR 
K_LEFT 
K_RIGHT 
K_UP 
K_DOWN 


Constructor & Destructor Documentation

gcn::Key::Key (  ) 

Constructor.

gcn::Key::Key ( int  value  ) 

Constructor.

Parameters:
value the ascii or enum value for the key.


Member Function Documentation

bool gcn::Key::isCharacter (  )  const

Checks whether a key is a character.

Returns:
true if the key is a letter, number or whitespace.

bool gcn::Key::isNumber (  )  const

Checks whether a key is a number.

Returns:
true if the key is a number (0-9).

bool gcn::Key::isLetter (  )  const

Checks whether a key is a letter.

Returns:
true if the key is a letter (a-z,A-Z).

bool gcn::Key::isShiftPressed (  )  const

Checks whether shift is pressed.

Returns:
true if shift was pressed at the same time as the key.

void gcn::Key::setShiftPressed ( bool  pressed  ) 

Sets the shift pressed flag.

Parameters:
pressed the shift flag value.

bool gcn::Key::isControlPressed (  )  const

Checks whether control is pressed.

Returns:
true if control was pressed at the same time as the key.

void gcn::Key::setControlPressed ( bool  pressed  ) 

Sets the control pressed flag.

Parameters:
pressed the control flag value.

bool gcn::Key::isAltPressed (  )  const

Checks whether alt is pressed.

Returns:
true if alt was pressed at the same time as the key.

void gcn::Key::setAltPressed ( bool  pressed  ) 

Sets the alt pressed flag.

Parameters:
pressed the alt flag value.

bool gcn::Key::isMetaPressed (  )  const

Checks whether meta is pressed.

Returns:
true if meta was pressed at the same time as the key.

void gcn::Key::setMetaPressed ( bool  pressed  ) 

Sets the meta pressed flag.

Parameters:
pressed the meta flag value.

bool gcn::Key::isNumericPad (  )  const

Checks whether the key was pressed at the numeric pad.

Returns:
true if key pressed at the numeric pad.

void gcn::Key::setNumericPad ( bool  numpad  ) 

Sets the numeric pad flag.

Parameters:
numpad the numeric pad flag value.

int gcn::Key::getValue (  )  const

Gets the value of the key. If an ascii value exists it will be returned. Otherwise an enum value will be returned.

Returns:
the value of the key.

void gcn::Key::setValue ( int  value  ) 

Sets the value of the key. An ascii value or an enum value.

Parameters:
value the key value.

std::string gcn::Key::toString (  )  const

Convert to a UTF8 string


Member Data Documentation

int gcn::Key::mValue [protected]

bool gcn::Key::mShiftPressed [protected]

bool gcn::Key::mControlPressed [protected]

bool gcn::Key::mAltPressed [protected]

bool gcn::Key::mMetaPressed [protected]

bool gcn::Key::mNumericPad [protected]


The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.