more work ig

This commit is contained in:
june 2025-02-15 00:03:05 +13:00
parent 9795b38e9e
commit eebda096bf
No known key found for this signature in database
4 changed files with 10 additions and 5 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -38,7 +38,7 @@ void Level::exit() {
} }
bool Level::active() { bool Level::active() {
this->isActive;// && aptMainLoop(); return this->isActive;// && aptMainLoop();
} }
void Level::cleanup() { void Level::cleanup() {

View File

@ -15,6 +15,7 @@
#define NUM_PIPES 5 #define NUM_PIPES 5
struct MainLevel: Level { struct MainLevel: Level {
private:
float a = 0.4; // acceleration float a = 0.4; // acceleration
float v = 0; // velocity float v = 0; // velocity
float pipeSpeed = -1; float pipeSpeed = -1;
@ -27,7 +28,8 @@ struct MainLevel: Level {
C2D_TextBuf g_staticBuf; C2D_TextBuf g_staticBuf;
C2D_Text scoreText; C2D_Text scoreText;
C2D_Font font; C2D_Font font;
public:
MainLevel(C3D_RenderTarget* top, C3D_RenderTarget* bottom): Level(this, "romfs:/gfx/sprites.t3x", top, bottom) {} MainLevel(C3D_RenderTarget* top, C3D_RenderTarget* bottom): Level(this, "romfs:/gfx/sprites.t3x", top, bottom) {}
void setup() { void setup() {
@ -58,11 +60,10 @@ struct MainLevel: Level {
//* FONT INIT *// //* FONT INIT *//
// Load fonts and text // Load fonts and text
g_staticBuf = C2D_TextBufNew(4096); g_staticBuf = C2D_TextBufNew(65536);
font = C2D_FontLoad("romfs:/gfx/fbfont.bcfnt"); font = C2D_FontLoad("romfs:/gfx/fbfont.bcfnt");
C2D_TextFontParse(&scoreText, font, g_staticBuf, "0"); C2D_TextFontParse(&scoreText, font, g_staticBuf, "0");
C2D_TextOptimize(&scoreText); C2D_TextOptimize(&scoreText);
}; };
void update() { void update() {
@ -74,6 +75,10 @@ struct MainLevel: Level {
// svcExitProcess(); // break in order to return to hbmenu // svcExitProcess(); // break in order to return to hbmenu
this->exit(); this->exit();
u32 kHeld = hidKeysHeld();
if (kHeld & KEY_X)
score++;
// gravity calcs // gravity calcs
v += a; v += a;

View File

@ -31,7 +31,7 @@ int main(int argc, char* argv[]) {
level = game; level = game;
// Main loop // Main loop
while (aptMainLoop() && level->isActive) { while (aptMainLoop() && level->active()) {
level->run(); level->run();
} }