more work ig
This commit is contained in:
parent
9795b38e9e
commit
eebda096bf
@ -38,7 +38,7 @@ void Level::exit() {
|
||||
}
|
||||
|
||||
bool Level::active() {
|
||||
this->isActive;// && aptMainLoop();
|
||||
return this->isActive;// && aptMainLoop();
|
||||
}
|
||||
|
||||
void Level::cleanup() {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define NUM_PIPES 5
|
||||
|
||||
struct MainLevel: Level {
|
||||
private:
|
||||
float a = 0.4; // acceleration
|
||||
float v = 0; // velocity
|
||||
float pipeSpeed = -1;
|
||||
@ -28,6 +29,7 @@ struct MainLevel: Level {
|
||||
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;
|
||||
|
@ -31,7 +31,7 @@ int main(int argc, char* argv[]) {
|
||||
level = game;
|
||||
|
||||
// Main loop
|
||||
while (aptMainLoop() && level->isActive) {
|
||||
while (aptMainLoop() && level->active()) {
|
||||
level->run();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user