Mana
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
KeyboardConfig Class Reference

#include <keyboardconfig.h>

Public Types

enum  KeyAction {
  KEY_NO_VALUE = -1 , KEY_MOVE_UP , KEY_MOVE_DOWN , KEY_MOVE_LEFT ,
  KEY_MOVE_RIGHT , KEY_ATTACK , KEY_TARGET_ATTACK , KEY_EMOTE ,
  KEY_TALK , KEY_TARGET , KEY_TARGET_CLOSEST , KEY_TARGET_NPC ,
  KEY_TARGET_PLAYER , KEY_PICKUP , KEY_HIDE_WINDOWS , KEY_SIT ,
  KEY_SCREENSHOT , KEY_TRADE , KEY_SHORTCUT_1 , KEY_SHORTCUT_2 ,
  KEY_SHORTCUT_3 , KEY_SHORTCUT_4 , KEY_SHORTCUT_5 , KEY_SHORTCUT_6 ,
  KEY_SHORTCUT_7 , KEY_SHORTCUT_8 , KEY_SHORTCUT_9 , KEY_SHORTCUT_10 ,
  KEY_SHORTCUT_11 , KEY_SHORTCUT_12 , KEY_WINDOW_HELP , KEY_WINDOW_STATUS ,
  KEY_WINDOW_INVENTORY , KEY_WINDOW_EQUIPMENT , KEY_WINDOW_SKILL , KEY_WINDOW_QUESTS ,
  KEY_WINDOW_MINIMAP , KEY_WINDOW_CHAT , KEY_WINDOW_SHORTCUT , KEY_WINDOW_SETUP ,
  KEY_WINDOW_DEBUG , KEY_WINDOW_SOCIAL , KEY_WINDOW_EMOTE_SHORTCUT , KEY_WINDOW_OUTFIT ,
  KEY_WEAR_OUTFIT , KEY_COPY_OUTFIT , KEY_EMOTE_1 , KEY_EMOTE_2 ,
  KEY_EMOTE_3 , KEY_EMOTE_4 , KEY_EMOTE_5 , KEY_EMOTE_6 ,
  KEY_EMOTE_7 , KEY_EMOTE_8 , KEY_EMOTE_9 , KEY_EMOTE_10 ,
  KEY_EMOTE_11 , KEY_EMOTE_12 , KEY_TOGGLE_CHAT , KEY_SCROLL_CHAT_UP ,
  KEY_SCROLL_CHAT_DOWN , KEY_PREV_CHAT_TAB , KEY_NEXT_CHAT_TAB , KEY_OK ,
  KEY_QUIT , KEY_IGNORE_INPUT_1 , KEY_IGNORE_INPUT_2 , KEY_TOTAL
}
 All the key functions. More...
 

Public Member Functions

void init ()
 Initializes the keyboard config explicitly.
 
void retrieve ()
 Retrieve the key values from config file.
 
void store ()
 Store the key values to config file.
 
void makeDefault ()
 Make the keys their default values.
 
bool hasConflicts ()
 Determines if any key assignments are the same as each other.
 
void callbackNewKey ()
 Calls a function back so the key re-assignment(s) can be seen.
 
int getKeyValue (int index) const
 Obtain the value stored in memory.
 
int getNewKeyIndex () const
 Get the index of the new key to be assigned.
 
bool isEnabled () const
 Get the enable flag, which will stop the user from doing actions.
 
const std::string & getKeyCaption (int index) const
 Get the key caption, providing more meaning to the user.
 
int getKeyIndex (SDL_Keycode keyValue) const
 Get the key function index by providing the keys value.
 
std::string_view getKeyName (std::string_view configName) const
 Get the key name by providing the keys config name.
 
int getKeyEmoteOffset (SDL_Keycode keyValue) const
 Get the key function index for an emote by providing the offset value.
 
void setEnabled (bool flag)
 Set the enable flag, which will stop the user from doing actions.
 
void setNewKeyIndex (int value)
 Set the index of the new key to be assigned.
 
void setNewKey (SDL_Keycode value)
 Set the value of the new key.
 
void setSetupKeyboard (Setup_Keyboard *setupKey)
 Set a reference to the key setup window.
 
bool isKeyActive (int index) const
 Checks if the key is active, by providing the key function index.
 
void refreshActiveKeys ()
 Takes a snapshot of all the active keys.
 
std::string getBindError () const
 

Private Attributes

int mNewKeyIndex
 Index of new key to be assigned.
 
bool mEnabled
 Flag to respond to key input.
 
Setup_KeyboardmSetupKey
 Reference to setup window.
 
KeyFunction mKey [KEY_TOTAL]
 Pointer to all the key data.
 
const uint8_tmActiveKeys
 Stores a list of all the keys.
 
std::string mBindError
 

Detailed Description

Definition at line 42 of file keyboardconfig.h.

Member Enumeration Documentation

◆ KeyAction

All the key functions.

KEY_NO_VALUE is used in initialization, and should be unchanged. KEY_TOTAL should always be last (used as a conditional in loops). The key assignment view gets arranged according to the order of these values.

Enumerator
KEY_NO_VALUE 
KEY_MOVE_UP 
KEY_MOVE_DOWN 
KEY_MOVE_LEFT 
KEY_MOVE_RIGHT 
KEY_ATTACK 
KEY_TARGET_ATTACK 
KEY_EMOTE 
KEY_TALK 
KEY_TARGET 
KEY_TARGET_CLOSEST 
KEY_TARGET_NPC 
KEY_TARGET_PLAYER 
KEY_PICKUP 
KEY_HIDE_WINDOWS 
KEY_SIT 
KEY_SCREENSHOT 
KEY_TRADE 
KEY_SHORTCUT_1 
KEY_SHORTCUT_2 
KEY_SHORTCUT_3 
KEY_SHORTCUT_4 
KEY_SHORTCUT_5 
KEY_SHORTCUT_6 
KEY_SHORTCUT_7 
KEY_SHORTCUT_8 
KEY_SHORTCUT_9 
KEY_SHORTCUT_10 
KEY_SHORTCUT_11 
KEY_SHORTCUT_12 
KEY_WINDOW_HELP 
KEY_WINDOW_STATUS 
KEY_WINDOW_INVENTORY 
KEY_WINDOW_EQUIPMENT 
KEY_WINDOW_SKILL 
KEY_WINDOW_QUESTS 
KEY_WINDOW_MINIMAP 
KEY_WINDOW_CHAT 
KEY_WINDOW_SHORTCUT 
KEY_WINDOW_SETUP 
KEY_WINDOW_DEBUG 
KEY_WINDOW_SOCIAL 
KEY_WINDOW_EMOTE_SHORTCUT 
KEY_WINDOW_OUTFIT 
KEY_WEAR_OUTFIT 
KEY_COPY_OUTFIT 
KEY_EMOTE_1 
KEY_EMOTE_2 
KEY_EMOTE_3 
KEY_EMOTE_4 
KEY_EMOTE_5 
KEY_EMOTE_6 
KEY_EMOTE_7 
KEY_EMOTE_8 
KEY_EMOTE_9 
KEY_EMOTE_10 
KEY_EMOTE_11 
KEY_EMOTE_12 
KEY_TOGGLE_CHAT 
KEY_SCROLL_CHAT_UP 
KEY_SCROLL_CHAT_DOWN 
KEY_PREV_CHAT_TAB 
KEY_NEXT_CHAT_TAB 
KEY_OK 
KEY_QUIT 
KEY_IGNORE_INPUT_1 
KEY_IGNORE_INPUT_2 
KEY_TOTAL 

Definition at line 157 of file keyboardconfig.h.

Member Function Documentation

◆ callbackNewKey()

void KeyboardConfig::callbackNewKey ( )

Calls a function back so the key re-assignment(s) can be seen.

Definition at line 208 of file keyboardconfig.cpp.

◆ getBindError()

std::string KeyboardConfig::getBindError ( ) const
inline

Definition at line 147 of file keyboardconfig.h.

◆ getKeyCaption()

const std::string & KeyboardConfig::getKeyCaption ( int  index) const

Get the key caption, providing more meaning to the user.

Definition at line 213 of file keyboardconfig.cpp.

◆ getKeyEmoteOffset()

int KeyboardConfig::getKeyEmoteOffset ( SDL_Keycode  keyValue) const

Get the key function index for an emote by providing the offset value.

Definition at line 242 of file keyboardconfig.cpp.

◆ getKeyIndex()

int KeyboardConfig::getKeyIndex ( SDL_Keycode  keyValue) const

Get the key function index by providing the keys value.

Definition at line 218 of file keyboardconfig.cpp.

◆ getKeyName()

std::string_view KeyboardConfig::getKeyName ( std::string_view  configName) const

Get the key name by providing the keys config name.

Definition at line 227 of file keyboardconfig.cpp.

◆ getKeyValue()

int KeyboardConfig::getKeyValue ( int  index) const
inline

Obtain the value stored in memory.

Definition at line 78 of file keyboardconfig.h.

◆ getNewKeyIndex()

int KeyboardConfig::getNewKeyIndex ( ) const
inline

Get the index of the new key to be assigned.

Definition at line 84 of file keyboardconfig.h.

◆ hasConflicts()

bool KeyboardConfig::hasConflicts ( )

Determines if any key assignments are the same as each other.

No need to parse the square matrix: only check one triangle that's enough to detect conflicts

Definition at line 160 of file keyboardconfig.cpp.

◆ init()

void KeyboardConfig::init ( )

Initializes the keyboard config explicitly.

Definition at line 108 of file keyboardconfig.cpp.

◆ isEnabled()

bool KeyboardConfig::isEnabled ( ) const
inline

Get the enable flag, which will stop the user from doing actions.

Definition at line 90 of file keyboardconfig.h.

◆ isKeyActive()

bool KeyboardConfig::isKeyActive ( int  index) const

Checks if the key is active, by providing the key function index.

Definition at line 251 of file keyboardconfig.cpp.

◆ makeDefault()

void KeyboardConfig::makeDefault ( )

Make the keys their default values.

Definition at line 154 of file keyboardconfig.cpp.

◆ refreshActiveKeys()

void KeyboardConfig::refreshActiveKeys ( )

Takes a snapshot of all the active keys.

Definition at line 259 of file keyboardconfig.cpp.

◆ retrieve()

void KeyboardConfig::retrieve ( )

Retrieve the key values from config file.

Definition at line 122 of file keyboardconfig.cpp.

◆ setEnabled()

void KeyboardConfig::setEnabled ( bool  flag)
inline

Set the enable flag, which will stop the user from doing actions.

Definition at line 116 of file keyboardconfig.h.

◆ setNewKey()

void KeyboardConfig::setNewKey ( SDL_Keycode  value)
inline

Set the value of the new key.

Definition at line 128 of file keyboardconfig.h.

◆ setNewKeyIndex()

void KeyboardConfig::setNewKeyIndex ( int  value)
inline

Set the index of the new key to be assigned.

Definition at line 122 of file keyboardconfig.h.

◆ setSetupKeyboard()

void KeyboardConfig::setSetupKeyboard ( Setup_Keyboard setupKey)
inline

Set a reference to the key setup window.

Definition at line 134 of file keyboardconfig.h.

◆ store()

void KeyboardConfig::store ( )

Store the key values to config file.

Definition at line 141 of file keyboardconfig.cpp.

Member Data Documentation

◆ mActiveKeys

const uint8_t* KeyboardConfig::mActiveKeys
private

Stores a list of all the keys.

Definition at line 237 of file keyboardconfig.h.

◆ mBindError

std::string KeyboardConfig::mBindError
private

Definition at line 239 of file keyboardconfig.h.

◆ mEnabled

bool KeyboardConfig::mEnabled
private

Flag to respond to key input.

Definition at line 231 of file keyboardconfig.h.

◆ mKey

KeyFunction KeyboardConfig::mKey[KEY_TOTAL]
private

Pointer to all the key data.

Definition at line 235 of file keyboardconfig.h.

◆ mNewKeyIndex

int KeyboardConfig::mNewKeyIndex
private

Index of new key to be assigned.

Definition at line 230 of file keyboardconfig.h.

◆ mSetupKey

Setup_Keyboard* KeyboardConfig::mSetupKey
private

Reference to setup window.

Definition at line 233 of file keyboardconfig.h.


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