ESPHome
2024.10.2
esphome
esphome
components
sdl
sdl_esphome.h
Go to the documentation of this file.
1
#pragma once
2
3
#ifdef USE_HOST
4
#include "
esphome/core/component.h
"
5
#include "
esphome/core/log.h
"
6
#include "
esphome/core/application.h
"
7
#include "
esphome/components/display/display.h
"
8
#define SDL_MAIN_HANDLED
9
#include "SDL.h"
10
11
namespace
esphome
{
12
namespace
sdl {
13
14
constexpr
static
const
char
*
const
TAG =
"sdl"
;
15
16
class
Sdl
:
public
display::Display
{
17
public
:
18
display::DisplayType
get_display_type
()
override
{
return
display::DISPLAY_TYPE_COLOR
; }
19
void
update
()
override
;
20
void
loop
()
override
;
21
void
setup
()
override
;
22
void
draw_pixels_at
(
int
x_start,
int
y_start,
int
w,
int
h
,
const
uint8_t *ptr,
display::ColorOrder
order,
23
display::ColorBitness
bitness,
bool
big_endian,
int
x_offset,
int
y_offset,
int
x_pad)
override
;
24
void
draw_pixel_at
(
int
x
,
int
y
,
Color
color)
override
;
25
void
set_dimensions
(uint16_t width, uint16_t height) {
26
this->
width_
= width;
27
this->
height_
= height;
28
}
29
int
get_width
()
override
{
return
this->
width_
; }
30
int
get_height
()
override
{
return
this->
height_
; }
31
float
get_setup_priority
()
const override
{
return
setup_priority::HARDWARE
; }
32
void
dump_config
()
override
{ LOG_DISPLAY(
""
,
"SDL"
,
this
); }
33
34
int
mouse_x
{};
35
int
mouse_y
{};
36
bool
mouse_down
{};
37
38
protected
:
39
int
get_width_internal
()
override
{
return
this->
width_
; }
40
int
get_height_internal
()
override
{
return
this->
height_
; }
41
int
width_
{};
42
int
height_
{};
43
SDL_Renderer *
renderer_
{};
44
SDL_Window *
window_
{};
45
SDL_Texture *
texture_
{};
46
uint16_t
x_low_
{0};
47
uint16_t
y_low_
{0};
48
uint16_t
x_high_
{0};
49
uint16_t
y_high_
{0};
50
};
51
}
// namespace sdl
52
}
// namespace esphome
53
54
#endif
esphome::sdl::Sdl::setup
void setup() override
Definition:
sdl_esphome.cpp:8
esphome::sdl::Sdl::height_
int height_
Definition:
sdl_esphome.h:42
esphome::display::ColorOrder
ColorOrder
Definition:
display_color_utils.h:6
esphome::sdl::Sdl::get_display_type
display::DisplayType get_display_type() override
Definition:
sdl_esphome.h:18
application.h
esphome::sdl::Sdl::x_high_
uint16_t x_high_
Definition:
sdl_esphome.h:48
x
uint16_t x
Definition:
tt21100.cpp:17
esphome::sdl::Sdl::window_
SDL_Window * window_
Definition:
sdl_esphome.h:44
esphome::sdl::Sdl::get_width
int get_width() override
Definition:
sdl_esphome.h:29
esphome::sdl::Sdl::draw_pixels_at
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order, display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override
Definition:
sdl_esphome.cpp:32
esphome::sdl::Sdl::get_height_internal
int get_height_internal() override
Definition:
sdl_esphome.h:40
esphome::sdl::Sdl::width_
int width_
Definition:
sdl_esphome.h:41
h
uint8_t h
Definition:
bl0906.h:209
esphome::sdl::Sdl::set_dimensions
void set_dimensions(uint16_t width, uint16_t height)
Definition:
sdl_esphome.h:25
y
uint16_t y
Definition:
tt21100.cpp:18
esphome::sdl::Sdl::y_low_
uint16_t y_low_
Definition:
sdl_esphome.h:47
esphome::display::DISPLAY_TYPE_COLOR
Definition:
display.h:131
esphome::sdl::Sdl::mouse_down
bool mouse_down
Definition:
sdl_esphome.h:36
esphome::display::ColorBitness
ColorBitness
Definition:
display_color_utils.h:7
esphome::sdl::Sdl::renderer_
SDL_Renderer * renderer_
Definition:
sdl_esphome.h:43
esphome::sdl::Sdl::x_low_
uint16_t x_low_
Definition:
sdl_esphome.h:46
esphome::sdl::Sdl::dump_config
void dump_config() override
Definition:
sdl_esphome.h:32
esphome::Color
Definition:
color.h:10
esphome::sdl::Sdl::get_setup_priority
float get_setup_priority() const override
Definition:
sdl_esphome.h:31
esphome::display::Display
Definition:
display.h:208
esphome::sdl::Sdl::mouse_y
int mouse_y
Definition:
sdl_esphome.h:35
esphome::sdl::Sdl::update
void update() override
Definition:
sdl_esphome.cpp:19
esphome::sdl::Sdl::draw_pixel_at
void draw_pixel_at(int x, int y, Color color) override
Definition:
sdl_esphome.cpp:47
esphome::setup_priority::HARDWARE
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition:
component.cpp:18
esphome::sdl::Sdl::get_width_internal
int get_width_internal() override
Definition:
sdl_esphome.h:39
esphome::sdl::Sdl
Definition:
sdl_esphome.h:16
display.h
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::sdl::Sdl::mouse_x
int mouse_x
Definition:
sdl_esphome.h:34
log.h
esphome::sdl::Sdl::texture_
SDL_Texture * texture_
Definition:
sdl_esphome.h:45
esphome::sdl::Sdl::y_high_
uint16_t y_high_
Definition:
sdl_esphome.h:49
esphome::sdl::Sdl::get_height
int get_height() override
Definition:
sdl_esphome.h:30
esphome::display::DisplayType
DisplayType
Definition:
display.h:128
esphome::sdl::Sdl::loop
void loop() override
Definition:
sdl_esphome.cpp:61
Generated by
1.8.13