33 SDL_Init(SDL_INIT_VIDEO);
34 this->
window_ = SDL_CreateWindow(
App.
get_name().
c_str(), this->pos_x_, this->pos_y_, this->width_, this->height_,
35 this->window_options_);
36 this->
renderer_ = SDL_CreateRenderer(this->
window_, -1, SDL_RENDERER_SOFTWARE);
39 SDL_CreateTexture(this->
renderer_, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STATIC, this->
width_, this->
height_);
40 SDL_SetTextureBlendMode(this->
texture_, SDL_BLENDMODE_BLEND);
47 this->x_low_ = this->
width_;
61 SDL_Rect rect{x_start, y_start, w,
h};
63 Display::draw_pixels_at(x_start, y_start, w,
h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
65 auto stride = x_offset + w + x_pad;
66 auto data = ptr + (stride * y_offset + x_offset) * 2;
67 SDL_UpdateTexture(this->
texture_, &rect, data, stride * 2);
89 SDL_Rect rect{
x,
y, 1, 1};
91 SDL_UpdateTexture(this->
texture_, &rect, &data, 2);
105 callback->second(down);
110 if (SDL_PollEvent(&e)) {
115 case SDL_MOUSEBUTTONDOWN:
116 case SDL_MOUSEBUTTONUP:
117 if (e.button.button == 1) {
124 case SDL_MOUSEMOTION:
125 if (e.motion.state & 1) {
135 ESP_LOGD(TAG,
"keydown %d", e.key.keysym.sym);
140 ESP_LOGD(TAG,
"keyup %d", e.key.keysym.sym);
144 case SDL_WINDOWEVENT:
145 switch (e.window.event) {
146 case SDL_WINDOWEVENT_SIZE_CHANGED:
147 case SDL_WINDOWEVENT_EXPOSED:
148 case SDL_WINDOWEVENT_RESIZED: {
159 ESP_LOGV(TAG,
"Event %d", e.type);
const StringRef & get_name() const
Get the name of this Application set by pre_setup().
constexpr const char * c_str() const
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_
int get_height() override
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
int get_height_internal() 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
int get_width_internal() override
std::map< int32_t, CallbackManager< void(bool)> > key_callbacks_
@ DISPLAY_ROTATION_0_DEGREES
@ DISPLAY_ROTATION_270_DEGREES
@ DISPLAY_ROTATION_180_DEGREES
@ DISPLAY_ROTATION_90_DEGREES
Providing packet encoding functions for exchanging data with a remote host.
Application App
Global storage of Application pointer - only one Application can exist.