diff --git a/.DS_Store b/.DS_Store index 4498e60..86788ec 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/include/Level.cpp b/include/Level.cpp index 6d48f09..1a753d5 100644 --- a/include/Level.cpp +++ b/include/Level.cpp @@ -38,7 +38,7 @@ void Level::exit() { } bool Level::active() { - this->isActive;// && 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(); }