summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelik Houij <houijmelik08@protonmail.com>2022-11-14 13:22:26 +0100
committerMelik Houij <houijmelik08@protonmail.com>2022-11-14 13:22:26 +0100
commit5cfd251cd5099c1d89967e5be21d3ef072694048 (patch)
tree11f96f650e5fc3d3669650ac5ba1cfa17d0a96b2
parent4373a07f662e6f9dc4f8f4f2a8b34df7151c47ce (diff)
-rw-r--r--gobject.h12
-rw-r--r--main.cpp8
2 files changed, 19 insertions, 1 deletions
diff --git a/gobject.h b/gobject.h
index d7467e2..3fe6f15 100644
--- a/gobject.h
+++ b/gobject.h
@@ -102,6 +102,10 @@ class gobject
// NOTE shader is a pointer
Shader *shader;
public:
+ float getxPos()
+ {
+ return xPos;
+ }
gobject(const float scale, Shader *shader)
{
// NOTE game object Constructor
@@ -248,9 +252,17 @@ class nothing:public gobject
// NOTE lord forgive me
if (!paused)
{
+
+ if (getxPos() >= 1.5f)
+ {
+
+ setPos(0.0f, this->yPos);
+ }
+ move(0.1f);
shader->use();
play(this->currentanim, reset);
reset = false;
+
}
else {
draw();
diff --git a/main.cpp b/main.cpp
index aadf615..46a9651 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,7 @@
#include "animation.h"
#include "gobject.h"
#include "scene.h"
+#include <vector>
#ifdef _WIN32
#include <Windows.h>
@@ -24,7 +25,7 @@ int targetFps = 20;
// NOTE another way of input is probably better int Input = 0;
// TODO Add Scaling, this is probably done on the shader level
-
+void addObj(gobject obj);
void framebuffer_size_callback(GLFWwindow *window, int width, int height);
int main()
@@ -105,3 +106,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
glViewport(0, 0, width, height);
}
+void addObj(gobject obj)
+{
+ current->objects.push_back(&obj);
+
+}