summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/physical.cpp15
-rw-r--r--game/physical.h31
-rw-r--r--game/world.h11
-rw-r--r--game/worldobject.h19
4 files changed, 76 insertions, 0 deletions
diff --git a/game/physical.cpp b/game/physical.cpp
new file mode 100644
index 0000000..f4c17d4
--- /dev/null
+++ b/game/physical.cpp
@@ -0,0 +1,15 @@
+#include "physical.h"
+#include <gfx/gl/shader.h>
+
+Physical::Physical(glm::vec3 where, const std::string & m, const std::string & t) :
+ location {where}, mesh {m}, texture {t}
+{
+}
+
+void
+Physical::render(const Shader & shader, const Camera & camera) const
+{
+ shader.Update(location, camera);
+ texture.Bind();
+ mesh.Draw();
+}
diff --git a/game/physical.h b/game/physical.h
new file mode 100644
index 0000000..ff9d316
--- /dev/null
+++ b/game/physical.h
@@ -0,0 +1,31 @@
+#ifndef PHYSICAL_H
+#define PHYSICAL_H
+
+#include "gfx/models/mesh.h"
+#include "gfx/models/texture.h"
+#include <gfx/gl/transform.h>
+#include <glm/glm.hpp>
+#include <string>
+
+class Camera;
+class Shader;
+
+class Physical {
+public:
+ Physical(glm::vec3 where, const std::string & m, const std::string & t);
+
+ void render(const Shader & shader, const Camera & camera) const;
+
+ [[nodiscard]] const auto &
+ getPosition() const
+ {
+ return location.GetPos();
+ }
+
+protected:
+ Transform location;
+ Mesh mesh;
+ Texture texture;
+};
+
+#endif
diff --git a/game/world.h b/game/world.h
new file mode 100644
index 0000000..a0185e7
--- /dev/null
+++ b/game/world.h
@@ -0,0 +1,11 @@
+#ifndef WORLD_H
+#define WORLD_H
+
+#include "worldobject.h"
+#include <collection.hpp>
+
+class World : public Collection<WorldObject> {
+public:
+};
+
+#endif
diff --git a/game/worldobject.h b/game/worldobject.h
new file mode 100644
index 0000000..6c75b8a
--- /dev/null
+++ b/game/worldobject.h
@@ -0,0 +1,19 @@
+#ifndef WORLDOBJECT_H
+#define WORLDOBJECT_H
+
+#include <chrono>
+#include <special_members.hpp>
+
+class WorldObject {
+public:
+ using TickDuration = std::chrono::milliseconds;
+
+ WorldObject() = default;
+ virtual ~WorldObject() = default;
+ NO_COPY(WorldObject);
+ NO_MOVE(WorldObject);
+
+ virtual void tick(TickDuration elapsed) = 0;
+};
+
+#endif