Optimise and refactor protocol, better logging, optimise rendering, double buffering.

This commit is contained in:
Niellune
2026-03-23 07:00:36 +02:00
parent b9047f65b8
commit b7e131bc38
41 changed files with 1746 additions and 1748 deletions
+7 -7
View File
@@ -3,11 +3,13 @@
#include <SDL2/SDL.h>
#include "helper/protocol_const.h"
#include "protocol/protocol_const.h"
#include "protocol.h"
#include "connector.h"
#include "renderer.h"
#define REDRAW_REQUEST 5
class Application
{
public:
@@ -19,28 +21,26 @@ public:
private:
struct State
{
bool connected = false;
bool dirty = false;
bool frameRendered = false;
int requestFrame = 0;
bool showVideo = true;
bool fullscreen = false;
bool mouseDown = false;
int8_t deviceStatus = PROTOCOL_STATUS_INITIALISING;
bool flushBuffers = false;
int8_t previousdeviceStatus = PROTOCOL_STATUS_INITIALISING;
atomic<int8_t> deviceStatus = PROTOCOL_STATUS_INITIALISING;
};
bool setAudioDriver();
int processKey(SDL_Keysym key);
bool processSystemEvent(const SDL_Event &e);
bool processFrameEvents(Protocol &protocol, Renderer &renderer);
bool processFrameEvents(AtomicQueue<Message> &queue, Renderer &renderer);
void loop();
SDL_Window *_window;
SDL_Renderer *_renderer;
bool _active;
Uint32 _evtBase;
SDL_DisplayMode _displayMode;
State _state;
int _width;