diff options
author | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
commit | 791b3f354b378769bffe623b05f1305c91b77101 (patch) | |
tree | 5409b311e6232eb4a6d3f8259b780d76b8ee1c59 /ProjectBrussel/Game/Player.hpp | |
parent | 60ccc62f4934e44ad5b905fdbcf458302b8d8a09 (diff) |
Changeset: 64 [WIP] Rename directoriesmaster-switch-to-build2
Diffstat (limited to 'ProjectBrussel/Game/Player.hpp')
-rw-r--r-- | ProjectBrussel/Game/Player.hpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ProjectBrussel/Game/Player.hpp b/ProjectBrussel/Game/Player.hpp new file mode 100644 index 0000000..d003a25 --- /dev/null +++ b/ProjectBrussel/Game/Player.hpp @@ -0,0 +1,55 @@ +#pragma once + +#include "GameObject.hpp" +#include "Material.hpp" +#include "RcPtr.hpp" +#include "Sprite.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; + Sprite sprite; + RenderObject renderObject; + int mId; + +public: + Player(GameWorld* world, int id); + + virtual void Awaken() override; + virtual void Resleep() override; + virtual void Update() override; + + Material* GetMaterial() const; + void SetMaterial(Material* material); + virtual std::span<const RenderObject> GetRenderObjects() const override; + + int GetId() const { return mId; } + + void HandleKeyInput(int key, int action); + + // File is designated by player ID + bool LoadFromFile(); + bool SaveToFile(); +}; |