|
|
@ -57,18 +57,15 @@ enum InputType{ |
|
|
|
//A generic class that represents any type of input.
|
|
|
|
//A generic class that represents any type of input.
|
|
|
|
class Input{ |
|
|
|
class Input{ |
|
|
|
friend class InputGroup; |
|
|
|
friend class InputGroup; |
|
|
|
|
|
|
|
friend class State_MainMenu; |
|
|
|
InputType type; |
|
|
|
InputType type; |
|
|
|
int key; //This will be interpreted differently depending on input type.
|
|
|
|
int key; //This will be interpreted differently depending on input type.
|
|
|
|
static bool usingGamepad; |
|
|
|
static bool usingGamepad; |
|
|
|
static void SetUsingGamepad(const bool usingGamepad); |
|
|
|
static void SetUsingGamepad(const bool usingGamepad); |
|
|
|
|
|
|
|
|
|
|
|
float holdDownTime=0.f; |
|
|
|
|
|
|
|
float initialHoldDownTime=0.f; |
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
Input(InputType type,int key); |
|
|
|
Input(InputType type,int key); |
|
|
|
bool Pressed(); |
|
|
|
bool Pressed(); |
|
|
|
//A version of Pressed() that will continuously return true after holding down for some time. Useful for scrolling through menus.
|
|
|
|
//A version of Pressed() that will continuously return true after holding down for some time. Useful for scrolling through menus.
|
|
|
|
bool PressedDAS(); |
|
|
|
|
|
|
|
bool Held(); |
|
|
|
bool Held(); |
|
|
|
bool Released(); |
|
|
|
bool Released(); |
|
|
|
float Analog(); |
|
|
|
float Analog(); |
|
|
@ -94,11 +91,15 @@ class InputGroup{ |
|
|
|
friend class State_OverworldMap; |
|
|
|
friend class State_OverworldMap; |
|
|
|
friend class InputListener; |
|
|
|
friend class InputListener; |
|
|
|
friend class SaveFile; |
|
|
|
friend class SaveFile; |
|
|
|
|
|
|
|
friend class State_MainMenu; |
|
|
|
std::set<Input>keys; |
|
|
|
std::set<Input>keys; |
|
|
|
std::vector<Input>keyOrder; //A list of keys inserted in order, for primary key mapping.
|
|
|
|
std::vector<Input>keyOrder; //A list of keys inserted in order, for primary key mapping.
|
|
|
|
static safemap<std::string,InputGroup*>menuNamesToInputGroups; |
|
|
|
static safemap<std::string,InputGroup*>menuNamesToInputGroups; |
|
|
|
void RemovePrimaryKeybind(InputType type); |
|
|
|
void RemovePrimaryKeybind(InputType type); |
|
|
|
void AddPrimaryKeybind(Input key); |
|
|
|
void AddPrimaryKeybind(Input key); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float holdDownTime=0.f; |
|
|
|
|
|
|
|
float initialHoldDownTime=0.f; |
|
|
|
public: |
|
|
|
public: |
|
|
|
InputGroup(); |
|
|
|
InputGroup(); |
|
|
|
void AddKeybind(Input bind); |
|
|
|
void AddKeybind(Input bind); |
|
|
@ -106,9 +107,9 @@ public: |
|
|
|
void SetNewPrimaryKeybind(Input key); |
|
|
|
void SetNewPrimaryKeybind(Input key); |
|
|
|
const bool Pressed()const; |
|
|
|
const bool Pressed()const; |
|
|
|
//A version of Pressed() that will continuously return true after holding down for some time. Useful for scrolling through menus.
|
|
|
|
//A version of Pressed() that will continuously return true after holding down for some time. Useful for scrolling through menus.
|
|
|
|
const bool PressedDAS()const; |
|
|
|
const bool PressedDAS(); |
|
|
|
const bool Held()const; |
|
|
|
const bool Held()const; |
|
|
|
const bool Released()const; |
|
|
|
const bool Released(); |
|
|
|
const float Analog()const; |
|
|
|
const float Analog()const; |
|
|
|
std::string GetDisplayName(); |
|
|
|
std::string GetDisplayName(); |
|
|
|
//Draws an input display with accompanying text centered at given position.
|
|
|
|
//Draws an input display with accompanying text centered at given position.
|
|
|
|