43 lines
954 B
C++
43 lines
954 B
C++
#pragma once
|
||
|
||
#include <Arduino.h>
|
||
#include "ScreenState.h"
|
||
#include "IDisplayDriver.h"
|
||
|
||
struct TouchEvent {
|
||
bool pressed = false;
|
||
int x = 0;
|
||
int y = 0;
|
||
};
|
||
|
||
struct HoldState {
|
||
bool active = false;
|
||
bool completed = false;
|
||
float progress = 0.0f; // 0.0 – 1.0
|
||
};
|
||
|
||
class DisplayDriverGFX : public IDisplayDriver {
|
||
public:
|
||
// ── IDisplayDriver ──
|
||
void begin() override;
|
||
void setBacklight(bool on) override;
|
||
void render(const ScreenState& state) override;
|
||
|
||
TouchEvent readTouch() override;
|
||
int dashboardTouch(int x, int y) override;
|
||
HoldState updateHold(unsigned long holdMs) override;
|
||
void updateHint() override;
|
||
|
||
int width() override;
|
||
int height() override;
|
||
|
||
// ── Internal ──
|
||
static DisplayDriverGFX& instance();
|
||
|
||
private:
|
||
// Touch handling
|
||
TouchEvent _lastTouch = {false, 0, 0};
|
||
unsigned long _pressStartMs = 0;
|
||
bool _isHolding = false;
|
||
};
|