ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
sdl_touchscreen.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_HOST
4#include "../sdl_esphome.h"
6
7namespace esphome::sdl {
8
9class SdlTouchscreen : public touchscreen::Touchscreen, public Parented<Sdl> {
10 public:
11 void setup() override {
12 this->x_raw_max_ = this->display_->get_width();
13 this->y_raw_max_ = this->display_->get_height();
14 }
15
16 void update_touches() override {
17 if (this->parent_->mouse_down) {
18 add_raw_touch_position_(0, this->parent_->mouse_x, this->parent_->mouse_y);
19 }
20 }
21};
22
23} // namespace esphome::sdl
24#endif
Helper class to easily give an object a parent of type T.
Definition helpers.h:1861
virtual int get_height()
Get the calculated height of the display in pixels with rotation applied.
Definition display.h:327
virtual int get_width()
Get the calculated width of the display in pixels with rotation applied.
Definition display.h:325
void add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw=0)