-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added StandardInput class inheriting abstract class Input.
- Loading branch information
Showing
7 changed files
with
91 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
|
||
#include "Input.h" | ||
|
||
struct ALLEGRO_EVENT_QUEUE; | ||
union ALLEGRO_EVENT; | ||
struct ALLEGRO_KEYBOARD_STATE; | ||
enum class InputAction : char; | ||
|
||
class StandardInput : public Input | ||
{ | ||
public: | ||
StandardInput(); | ||
|
||
static void init(); | ||
|
||
InputAction getMenuAction() override; | ||
|
||
std::set<InputAction> getGameActions() override; | ||
|
||
std::pair<int, int> getMousePosition() const override; | ||
|
||
private: | ||
static InputAction getCommonAction(const ALLEGRO_EVENT& event); | ||
|
||
static bool itemPicked(const ALLEGRO_EVENT& event); | ||
|
||
static bool fired(const ALLEGRO_KEYBOARD_STATE& keyState); | ||
|
||
static bool userWantToExit(const ALLEGRO_EVENT& event); | ||
|
||
static bool keyEscapeUsed(const ALLEGRO_EVENT& event); | ||
|
||
static bool keyUpUsed(const ALLEGRO_EVENT& event); | ||
|
||
static bool keyDownUsed(const ALLEGRO_EVENT& event); | ||
|
||
static bool keyUpPressed(const ALLEGRO_KEYBOARD_STATE& keyState); | ||
|
||
static bool keyDownPressed(const ALLEGRO_KEYBOARD_STATE& keyState); | ||
|
||
static bool keyLeftPressed(const ALLEGRO_KEYBOARD_STATE& keyState); | ||
|
||
static bool keyRightPressed(const ALLEGRO_KEYBOARD_STATE& keyState); | ||
|
||
static bool keyEnterUsed(const ALLEGRO_EVENT& event); | ||
|
||
static bool keySpaceUsed(const ALLEGRO_EVENT& event); | ||
|
||
static bool mouseClickUsed(const ALLEGRO_EVENT& event); | ||
|
||
ALLEGRO_EVENT_QUEUE* events_; | ||
|
||
int mouseX_{0}; | ||
|
||
int mouseY_{0}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters