Files
FastCarPlay/src/application.h
T
2026-03-26 04:53:05 +02:00

52 lines
1.0 KiB
C++

#ifndef SRC_APPLICATION
#define SRC_APPLICATION
#include <SDL2/SDL.h>
#include "protocol/protocol_const.h"
#include "protocol/connection.h"
#include "renderer.h"
#define REDRAW_REQUEST 5
class Application
{
public:
Application(/* args */);
~Application();
void start(const char *title);
private:
struct State
{
bool dirty = false;
bool frameRendered = false;
int requestFrame = 0;
bool showVideo = true;
bool fullscreen = false;
bool mouseDown = false;
int8_t latestState = PROTOCOL_STATUS_UNKNOWN;
};
bool setAudioDriver();
int processKey(SDL_Keysym key);
bool processSystemEvent(const SDL_Event &e);
bool processFrameEvents(AtomicQueue<Message> &queue, Renderer &renderer);
const std::string status() const;
void loop();
SDL_Window *_window;
SDL_Renderer *_renderer;
bool _active;
SDL_DisplayMode _displayMode;
State _state;
int _width;
int _height;
bool _debug;
};
#endif /* SRC_APPLICATION */