FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::Key Class Reference

#include <key.hpp>

Public Types

enum  : std::int16_t {
  Space = ' ' , Tab = '\t' , Enter = '\n' , LeftAlt = -1000 ,
  RightAlt , LeftShift , RightShift , LeftControl ,
  RightControl , LeftMeta , RightMeta , LeftSuper ,
  RightSuper , Insert , Home , PageUp ,
  Delete , End , PageDown , Escape ,
  CapsLock , Backspace , F1 , F2 ,
  F3 , F4 , F5 , F6 ,
  F7 , F8 , F9 , F10 ,
  F11 , F12 , F13 , F14 ,
  F15 , PrintScreen , ScrollLock , Pause ,
  NumLock , AltGr , Left , Right ,
  Up , Down , At
}

Public Member Functions

int getValue () const
bool isCharacter () const
bool isLetter () const
bool isNumber () const
 Key (int value=0)
bool operator!= (Key const &key) const
bool operator== (Key const &key) const

Protected Attributes

int mValue

Detailed Description

Represents a keyboard key or character code.

Definition at line 19 of file key.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : std::int16_t

An enum with key values.

Definition at line 80 of file key.hpp.

Constructor & Destructor Documentation

◆ Key()

fcn::Key::Key ( int value = 0)
explicit

Constructor.

Parameters
valueThe ascii or enum value for the key.

Definition at line 9 of file key.cpp.

References mValue.

Referenced by operator!=(), and operator==().

Member Function Documentation

◆ getValue()

int fcn::Key::getValue ( ) const

◆ isCharacter()

bool fcn::Key::isCharacter ( ) const

Checks if a key is a character.

Returns
True if the key is a letter, number or whitespace, false otherwise.

Definition at line 11 of file key.cpp.

References mValue.

Referenced by fcn::PasswordField::keyPressed(), fcn::TextBox::keyPressed(), and fcn::TextField::keyPressed().

◆ isLetter()

bool fcn::Key::isLetter ( ) const

Checks if a key is a letter.

Returns
True if the key is a letter (a-z,A-Z), false otherwise.

Definition at line 21 of file key.cpp.

References mValue.

◆ isNumber()

bool fcn::Key::isNumber ( ) const

Checks if a key is a number.

Returns
True if the key is a number (0-9), false otherwise.

Definition at line 16 of file key.cpp.

References mValue.

◆ operator!=()

bool fcn::Key::operator!= ( Key const & key) const

Compares two keys.

Parameters
keyThe key to compare this key with.
Returns
True if the keys are not equal, false otherwise.

Definition at line 38 of file key.cpp.

References Key(), and mValue.

◆ operator==()

bool fcn::Key::operator== ( Key const & key) const

Compares two keys.

Parameters
keyThe key to compare this key with.
Returns
True if the keys are equal, false otherwise.

Definition at line 33 of file key.cpp.

References Key(), and mValue.

Member Data Documentation

◆ mValue

int fcn::Key::mValue
protected

Holds the value of the key.

It may be an ascii value or an enum value.

Definition at line 136 of file key.hpp.

Referenced by getValue(), isCharacter(), isLetter(), isNumber(), Key(), operator!=(), and operator==().


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