summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelik Houij <houijmelik08@protonmail.com>2022-08-30 15:55:02 +0200
committerMelik Houij <houijmelik08@protonmail.com>2022-08-30 15:55:02 +0200
commit19d215559b0093380efd72c9363e652e0f871739 (patch)
tree7b190d42cd3eba37fced79e920e2748de6f0fae1
parent7851c955ee118c212696a12f86667a8e9b4605c3 (diff)
UI effects for choosing options, no actualfunction
-rw-r--r--UI.hpp35
-rw-r--r--scene.h2
2 files changed, 33 insertions, 4 deletions
diff --git a/UI.hpp b/UI.hpp
index 3a49b78..3f176ee 100644
--- a/UI.hpp
+++ b/UI.hpp
@@ -6,6 +6,7 @@
#include <string>
#include "text.h"
#include "shader.h"
+#include <bitset>
enum uiMenus {
PAUSE,
EXIT
@@ -61,16 +62,44 @@ class UI
}
- void draw()
+ void draw(std::bitset<8> ginputs)
{
// NOTE draws the black border around
glBindVertexArray(VAO);
this->uiShader->use();
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
+ if (ginputs.test(0)) {
+ if (selectedUI == 0) {
+ selectedUI = drawnUI.size();
+ }
+ else {
+ selectedUI--;
+ }
+ }
+ if (ginputs.test(1)) {
+ if (selectedUI == drawnUI.size())
+ {
+ selectedUI = 0;
+ }
+ else
+ {
+ selectedUI++;
+ }
+
+ }
+
+
// NOTE draws the text itself
- for (int i = 0; i < drawnUI.size(); i++) {
- textObj.Render(drawnUI.at(i), 25.0f, 800.0f - (120.0f * i), 2.0f, glm::vec3(1.0, 0.8f, 0.2f));
+ for (unsigned int i = 0; i < drawnUI.size(); i++) {
+ if(i == selectedUI)
+ {
+ textObj.Render(drawnUI.at(i), 25.0f, 800.0f - (240.0f * i), 2.5f, glm::vec3(1.0, 0.5f, 0.5f));
+ }
+ else {
+ textObj.Render(drawnUI.at(i), 25.0f, 800.0f - (120.0f * i), 2.0f, glm::vec3(1.0, 0.8f, 0.2f));
+ }
+ //
}
};
diff --git a/scene.h b/scene.h
index 05fc082..2b6d3c4 100644
--- a/scene.h
+++ b/scene.h
@@ -184,7 +184,7 @@ class Scene
sound.play();
}
else {
- uiObj->draw();
+ uiObj->draw(gameInput);
}
// NOTE to test audio playback