diff options
author | hnOsmium0001 <[email protected]> | 2022-04-06 20:52:51 -0700 |
---|---|---|
committer | hnOsmium0001 <[email protected]> | 2022-04-06 20:52:51 -0700 |
commit | 3fdc6eb4f2cbeffce9b250beec4d3a2d52a3f534 (patch) | |
tree | 05991741844aa2814b3ac71e2c843ebe07244845 /source/Player.hpp | |
parent | ebd42760caaec8330a3c028f31adc7bc0b339d16 (diff) |
Work on moving infrastruture to this project
Diffstat (limited to 'source/Player.hpp')
-rw-r--r-- | source/Player.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source/Player.hpp b/source/Player.hpp new file mode 100644 index 0000000..1ed30cd --- /dev/null +++ b/source/Player.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include "GameObject.hpp" +#include "GameObjectTypeTag.hpp" + +#define GLFW_INCLUDE_NONE +#include <GLFW/glfw3.h> + +#include <span> +#include <vector> + +struct PlayerKeyBinds { + int keyLeft = GLFW_KEY_A; + int keyRight = GLFW_KEY_D; + int keyJump = GLFW_KEY_SPACE; + int keyAttack = GLFW_KEY_J; + + bool pressedLeft = 0; + bool pressedRight = 0; + bool pressedJump = 0; + bool pressedAttack = 0; + + std::span<int> GetKeyArray(); + std::span<bool> GetKeyStatusArray(); +}; + +class Player : public GameObject { +public: + std::vector<GLFWkeyboard*> boundKeyboards; + PlayerKeyBinds keybinds; + +public: + using GameObject::GameObject; + + virtual Tags::GameObjectType GetTypeTag() const override { return Tags::GOT_Player; } + + virtual void Awaken() override; + virtual void Resleep() override; + virtual void Update() override; + + void HandleKeyInput(int key, int action); +}; |