9 SDL_Init(SDL_INIT_VIDEO);
10 this->
window_ = SDL_CreateWindow(
App.
get_name().c_str(), this->pos_x_, this->pos_y_, this->width_, this->height_,
11 this->window_options_);
12 this->
renderer_ = SDL_CreateRenderer(this->
window_, -1, SDL_RENDERER_SOFTWARE);
15 SDL_CreateTexture(this->
renderer_, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STATIC, this->
width_, this->
height_);
16 SDL_SetTextureBlendMode(this->
texture_, SDL_BLENDMODE_BLEND);
23 this->x_low_ = this->
width_;
37 SDL_Rect rect{x_start, y_start, w,
h};
39 Display::draw_pixels_at(x_start, y_start, w,
h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
41 auto stride = x_offset + w + x_pad;
42 auto data = ptr + (stride * y_offset + x_offset) * 2;
43 SDL_UpdateTexture(this->
texture_, &rect, data, stride * 2);
52 SDL_Rect rect{
x,
y, 1, 1};
54 SDL_UpdateTexture(this->
texture_, &rect, &data, 2);
68 callback->second(down);
73 if (SDL_PollEvent(&e)) {
78 case SDL_MOUSEBUTTONDOWN:
79 case SDL_MOUSEBUTTONUP:
80 if (e.button.button == 1) {
88 if (e.motion.state & 1) {
98 ESP_LOGD(TAG,
"keydown %d", e.key.keysym.sym);
103 ESP_LOGD(TAG,
"keyup %d", e.key.keysym.sym);
107 case SDL_WINDOWEVENT:
108 switch (e.window.event) {
109 case SDL_WINDOWEVENT_SIZE_CHANGED:
110 case SDL_WINDOWEVENT_EXPOSED:
111 case SDL_WINDOWEVENT_RESIZED: {
122 ESP_LOGV(TAG,
"Event %d", e.type);
const std::string & get_name() const
Get the name of this Application set by pre_setup().
static uint16_t color_to_565(Color color, ColorOrder color_order=ColorOrder::COLOR_ORDER_RGB)
Rect get_clipping() const
Get the current the clipping rectangle.
DisplayRotation rotation_
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
void process_key(uint32_t keycode, bool down)
void redraw_(SDL_Rect &rect)
void draw_pixel_at(int x, int y, Color color) override
std::map< int32_t, CallbackManager< void(bool)> > key_callbacks_
@ DISPLAY_ROTATION_0_DEGREES
Providing packet encoding functions for exchanging data with a remote host.
Application App
Global storage of Application pointer - only one Application can exist.