From eebda096bf892ec96901f4862366cbbb4f7237c1 Mon Sep 17 00:00:00 2001 From: june Date: Sat, 15 Feb 2025 00:03:05 +1300 Subject: [PATCH] more work ig --- .DS_Store | Bin 10244 -> 10244 bytes include/Level.cpp | 2 +- source/MainLevel.cpp | 11 ++++++++--- source/main.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.DS_Store b/.DS_Store index 4498e60e938070089e5984e0a296c9f38a96c6c2..86788ecb3479fa192b91cf3c8ccacee36d405755 100644 GIT binary patch delta 892 zcmZn(XbG6$aFU^hRb>SP`Psrsjy3=9k`40;Ud44Diix%nWKW}2 zQAZt7NkNGceZ>Zf5UL3YIY z%{g@|A&x*ZC^sMB6x^y%9K;|1au6#+5<@A_vpEbYIqCICuHn9DjVg`oka+e>`s*ML zK{5c@5!h9rIDkh1mB$XEzByAQJEM>1}2RbJY7(zKfhhc<~WFb%wnhIo> zF>VVsSOg0q6myVWhg(%a267-UI6$1319VanYGi>VfQ|>tAUoh4W18;$NN_@d%Oc_i zQx+viKxWp1BBcnJK5~KKQjB7$p!hwY0wh^vi*Mv8cR(#hQGu`=y9yKs2s$u01Fc{K zCeeIg@D~B20WFaVm!QidJ0jOrQ}aRO(a9c?vg|N+j-))J!sZ^y*DRaa6@Ia7E)-#A F1^}Y*&^rJC delta 477 zcmZn(XbG6$&nUSuU^hRbZt5L5tK;K;znPz-cHDbN|o45=tiU{LrARDmLo?1isActive;// && aptMainLoop(); + return this->isActive;// && aptMainLoop(); } void Level::cleanup() { diff --git a/source/MainLevel.cpp b/source/MainLevel.cpp index 110773a..bd26999 100644 --- a/source/MainLevel.cpp +++ b/source/MainLevel.cpp @@ -15,6 +15,7 @@ #define NUM_PIPES 5 struct MainLevel: Level { +private: float a = 0.4; // acceleration float v = 0; // velocity float pipeSpeed = -1; @@ -27,7 +28,8 @@ struct MainLevel: Level { C2D_TextBuf g_staticBuf; C2D_Text scoreText; C2D_Font font; - + +public: MainLevel(C3D_RenderTarget* top, C3D_RenderTarget* bottom): Level(this, "romfs:/gfx/sprites.t3x", top, bottom) {} void setup() { @@ -58,11 +60,10 @@ struct MainLevel: Level { //* FONT INIT *// // Load fonts and text - g_staticBuf = C2D_TextBufNew(4096); + g_staticBuf = C2D_TextBufNew(65536); font = C2D_FontLoad("romfs:/gfx/fbfont.bcfnt"); C2D_TextFontParse(&scoreText, font, g_staticBuf, "0"); C2D_TextOptimize(&scoreText); - }; void update() { @@ -74,6 +75,10 @@ struct MainLevel: Level { // svcExitProcess(); // break in order to return to hbmenu this->exit(); + u32 kHeld = hidKeysHeld(); + if (kHeld & KEY_X) + score++; + // gravity calcs v += a; diff --git a/source/main.cpp b/source/main.cpp index fd3f81e..200379a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char* argv[]) { level = game; // Main loop - while (aptMainLoop() && level->isActive) { + while (aptMainLoop() && level->active()) { level->run(); }