aboutsummaryrefslogtreecommitdiff
path: root/src/brussel.engine/Player.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2023-10-19 22:50:07 -0700
committerrtk0c <[email protected]>2025-08-16 11:31:16 -0700
commit297232d21594b138bb368a42b5b0d085ff9ed6aa (patch)
tree075d5407e1e12a9d35cbee6e4c20ad34e0765c42 /src/brussel.engine/Player.hpp
parentd5cd34ff69f7fd134d5450696f298af1a864afbc (diff)
The great renaming: switch to "module style"
Diffstat (limited to 'src/brussel.engine/Player.hpp')
-rw-r--r--src/brussel.engine/Player.hpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/brussel.engine/Player.hpp b/src/brussel.engine/Player.hpp
new file mode 100644
index 0000000..5a6bab7
--- /dev/null
+++ b/src/brussel.engine/Player.hpp
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "GameObject.hpp"
+#include "Material.hpp"
+#include "Sprite.hpp"
+
+#include <MacrosCodegen.hpp>
+#include <RcPtr.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 {
+ BRUSSEL_CLASS()
+
+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();
+};