aboutsummaryrefslogtreecommitdiffstats
path: root/hal/sdl2/display.hpp
blob: 55d82b71d4f0b108f834ee95e552f2327c506193 (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
#pragma once
#ifdef SDL2_BUILD
#include <SDL.h>

class SDLDisplay {
public:
    SDLDisplay();
    ~SDLDisplay();
    // bool init_display();
    // When returning false, please quit the program (return from main)
    bool update_display(const uint8_t* oled_screen);
private:
    SDL_Window* m_window = nullptr;
    SDL_Renderer* m_renderer = nullptr;
    SDL_Surface* m_surface = nullptr;
    SDL_Texture* m_texture = nullptr;

    bool m_should_quit = false;
    bool m_testbool = false;

    // Convert the surface's pixels from the internal SSOLED display representation
    // to a valid representation that can be correctly displayed
    void convert_display(const uint8_t* oled_screen);

    // Get the gpio button that corresponds to the key that has been pressed
    uint get_button(SDL_Keycode key);
};

#endif