summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelik Houij <houijmelik08@protonmail.com>2022-09-05 14:23:04 +0200
committerMelik Houij <houijmelik08@protonmail.com>2022-09-05 14:23:04 +0200
commit1be23de45836b86223bc4bd6c92ddecab8c2d385 (patch)
tree6e2f9cb36a3b25608089d5542e87dc5222f49785
parent15fbb2a11c8a8af77cda9491d72cf67dc3a51e20 (diff)
added polymorphism, but it's buggyPolymorphismUIFix
-rw-r--r--gobject.h28
-rw-r--r--readme.org18
-rw-r--r--scene.h6
3 files changed, 40 insertions, 12 deletions
diff --git a/gobject.h b/gobject.h
index ca22a4d..08d2195 100644
--- a/gobject.h
+++ b/gobject.h
@@ -19,6 +19,7 @@ PRESSED,
HELD
};
+// TODO maybe update returns a list of hitboxes?
struct inGameInput{
ginput bState = UNPRESSED; // button State
uint16_t timeHeld = 0; // time held
@@ -68,6 +69,8 @@ class gobject
{
// NOTE game Object, this will probably be the one changed the most often
// TODO might have to give my try at polymorthy
+
+ protected:
std::vector<Animation2D> anilist;
float xPos, yPos, scale;
unsigned int currentanim = 0;
@@ -107,7 +110,7 @@ class gobject
this->xPos = xP;
this->yPos = yP;
}
- void update(GLFWwindow *window, bool paused, std::array<inGameInput,8> gameInput)
+ void update(/*GLFWwindow *window,*/ bool paused, std::array<inGameInput,8> gameInput)
{
// NOTE Update function, almost all of this code is temporary and for testing
// TODO add a proper reaction to inputs
@@ -140,4 +143,27 @@ class gobject
};
+class Projectile : public gobject
+{
+ public:
+ Projectile(const float scale, Shader *shader, float xStart = 0.5, float yStart = 0.5):gobject(scale, shader)
+ {
+ // NOTE game object Constructor
+ this->xPos = xStart;
+ this->yPos = yStart;
+ this->scale = scale;
+ this->shader = shader;
+ }
+
+ void update(/*GLFWwindow *window,*/ bool paused, std::array<inGameInput,8> gameInput)
+ {
+
+ shader->use();
+ anilist.at(currentanim).draw();
+ }
+
+
+
+};
+
#endif
diff --git a/readme.org b/readme.org
index 147c4e7..85f5ec6 100644
--- a/readme.org
+++ b/readme.org
@@ -39,20 +39,20 @@ fix: in the definition of uiMenus, i made a variable that persists, i replaced i
Basic Game engine For Fighting game, with the Idea of having minimalist functionality
TODO Add more that come to mind
*** Game State [0/3]
- + [ ] Input
- + [ ] Universal Input for Game
+ + [-] Input
+ + [X] Universal Input for Game
+ [ ] Input Stream and buffering
+ [ ] Ability To have Specials, Supers, etc
- + [ ] Keyboard Support
+ + [X] Keyboard Support
+ [ ] Joystick Support
- + [ ] Scenes
- + [ ] Basic Scene Loading, and killing
- + [ ] Scene For... [0/3]
- + [ ] Game
+ + [-] Scenes
+ + [X] Basic Scene Loading, and killing
+ + [-] Scene For... [1/3]
+ + [X] Game
+ [ ] Character Select
+ [ ] Main Menu
- + [ ] Game Loading
- + [ ] Loading Fonts
+ + [-] Game Loading
+ + [X] Loading Fonts
+ [ ] loading Character...
+ [ ] Animations
+ [ ] Sound Effects
diff --git a/scene.h b/scene.h
index 452ca3f..53eba3f 100644
--- a/scene.h
+++ b/scene.h
@@ -106,9 +106,11 @@ class Scene
// NOTE temporary Code,used for Testing
// TODO test how the Engine handles multiple objects at the same time
objects.push_back(gobject(0.5f, shade));
+ objects.push_back(Projectile(0.5f, shade));
objects.at(0).addAnim("resources/sprite1.png", 10, VAO, 4);
objects.at(0).addAnim("resources/sprite2.png", 10, VAO, 4);
- printf("scene created\n \n");
+ objects.at(1).addAnim("resources/sprite2.png", 10, VAO, 4);
+ printf("scene created\n");
}
@@ -134,7 +136,7 @@ class Scene
for(gobject& x:objects)
{
//NOTE simple, runs an update to each game Object on the Vector
- x.update(window, paused, buttons);
+ x.update(paused, buttons);
}
if(this->paused == false)