Skip to content

SDL2_Drawer

Class

Source: SDL2_Drawer.h

Inherits from: BaseDrawSurface

Description

SDL2-backed draw surface for native desktop builds.

Inheritance

BaseDrawSurfaceSDL2_Drawer

Methods

void init()

void setRotation(uint16_t rotation)

Description:

Sets the screen rotation.

Parameters:

  • rotation: 0-3 corresponding to 0, 90, 180, 270 degrees.

void clearBuffer()

void sendBuffer()

void drawFilledCircle(int x, int y, int radius, uint16_t color)

void drawCircle(int x, int y, int radius, uint16_t color)

void drawRectangle(int x, int y, int width, int height, uint16_t color)

void drawFilledRectangle(int x, int y, int width, int height, uint16_t color)

void drawLine(int x1, int y1, int x2, int y2, uint16_t color)

void drawBitmap(int x, int y, int width, int height, const uint8_t *bitmap, uint16_t color)

void drawPixel(int x, int y, uint16_t color)

void drawTileDirect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data)

Description:

Direct tile write (not optimized for SDL2 - uses fallback).

uint8_t* getSpriteBuffer()

Description:

Get pointer to sprite buffer (not supported in SDL2).

uint16_t* getPixelBuffer()

Description:

Get pointer to the RGB565 pixel buffer for transition effects.

bool processEvents()

void setTouchDispatcher(pixelroot32::input::TouchEventDispatcher* touchDispatcher)

Description:

Set the TouchEventDispatcher to receive mouse events.

Parameters:

  • touchDispatcher: Pointer to the Engine's TouchEventDispatcher.

This is the preferred method when PIXELROOT32_ENABLE_TOUCH is enabled. Mouse events are mapped directly to touch events.

void setInputManager(pixelroot32::input::InputManager* inputManager)

Description:

Set the InputManager for backwards compatibility.

Parameters:

  • inputManager: Pointer to the InputManager instance.

Deprecated: Use setTouchDispatcher() instead.

Released under the MIT License.