From 6ee1e08e2a5965adf9dde9218be16dbc62e6467d Mon Sep 17 00:00:00 2001 From: Ethan Adams Date: Tue, 20 Aug 2024 14:43:34 -0400 Subject: [PATCH] added an ammo indicator(for debug purposes) --- Resources/animations/machine_gun_anim.xml | 2 +- Resources/scenes/debugScene.xml | 2 +- YuppleMayham/include/gameplay/weapons/weapon.h | 2 ++ YuppleMayham/src/gameplay/game.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Resources/animations/machine_gun_anim.xml b/Resources/animations/machine_gun_anim.xml index 964e334..3ce6e89 100644 --- a/Resources/animations/machine_gun_anim.xml +++ b/Resources/animations/machine_gun_anim.xml @@ -4,7 +4,7 @@ - 2 + 6 diff --git a/Resources/scenes/debugScene.xml b/Resources/scenes/debugScene.xml index e596a7d..11d39e8 100644 --- a/Resources/scenes/debugScene.xml +++ b/Resources/scenes/debugScene.xml @@ -34,7 +34,7 @@ - + diff --git a/YuppleMayham/include/gameplay/weapons/weapon.h b/YuppleMayham/include/gameplay/weapons/weapon.h index 40b1723..fb7fd64 100644 --- a/YuppleMayham/include/gameplay/weapons/weapon.h +++ b/YuppleMayham/include/gameplay/weapons/weapon.h @@ -59,6 +59,8 @@ public: float getBulletSpeed() const { return bulletSpeed; } glm::vec2 getBulletSize() const { return bulletSize; } std::shared_ptr getWielder() const { return wielder; } + const Uint32 getMagazine() const { return weaponMag; } + const Uint32 getAmmo() const { return weaponAmmo; } Weapon::BulletData genBulletData (); void createBullet (const BulletData& data); diff --git a/YuppleMayham/src/gameplay/game.cpp b/YuppleMayham/src/gameplay/game.cpp index 26d38cf..ce6b999 100644 --- a/YuppleMayham/src/gameplay/game.cpp +++ b/YuppleMayham/src/gameplay/game.cpp @@ -1,6 +1,10 @@ #include "gameplay/game.h" #include "gameplay/input.h" #include "gameplay/scene.h" +/*due for possible removal!*/ +#include "gameplay/gameactor.h" +#include "gameplay/weapons/weapon.h" +/*-------------------------*/ #include "utility/command.h" #include "utility/resourcemanager.h" @@ -82,7 +86,13 @@ void Game::render() glClear(GL_COLOR_BUFFER_BIT); if (currentScene) + { currentScene->render(); + /*Debug ammo indicator*/ + textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->get()->getMagazine()), glm::vec2(10, 10), 0.5f); + textHandler->DrawText("comic.ttf", "/", glm::vec2(50, 10), 0.5f); + textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->get()->getAmmo()), glm::vec2(90, 10), 0.5f); + } window->swap(); }