summaryrefslogtreecommitdiffstats
path: root/apps/game_falldown/main.hpp
blob: 6e8cbf07c364862151c52b7cb79f6dac17008777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <vector>

// Includes also buttons, API and ss_oled
#include "../../app/base_app.hpp"

#include "ball.hpp"
#include "platform.hpp"

class app_game_falldown : public BaseApp {
    private:
        enum GameStates {menu, game, gameover};

        GameStates m_gamestate = menu;
        Api* m_app_api;

        Ball m_player_ball = {0,0};
        std::vector<Platform> m_platforms;

        void draw_main_menu();
        void draw_game();
        void draw_gameover_menu();
        void init_game();
        void update_game();

        AppAttributes app_attributes = {1, true,
            30}; // Around 30 fps
    public:
        const AppAttributes& app_get_attributes() {
            return app_attributes;
        }

        app_game_falldown(Api *app_api);
        AppReturnValues render(Api *app_api);
        AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta);
        AppReturnValues btn_released(Api *app_api, uint gpio, unsigned long delta);
        ~app_game_falldown();
};