DEKI/ENGINE docs
manual api reference
Deki 0.40.1
Modular C++ engine with a visual editor, for 2D and 3D
Loading...
Searching...
No Matches
DekiEditor::EditorTexture Namespace Reference

Pictures the editor UI draws: the Scene and Play views, asset previews, font atlases. More...

Classes

struct  Backend
 What the editor draws textures with. More...

Enumerations

enum class  Format : uint8_t { Rgba8 , Rgb565 }
 How the pixels handed to Update are laid out. More...

Functions

void AddImageNearest (ImDrawList *drawList, uint32_t texture, const ImVec2 &min, const ImVec2 &max, const ImVec2 &uvMin=ImVec2(0, 0), const ImVec2 &uvMax=ImVec2(1, 1))
 Adds it to drawList sampled nearest, so each texel stays a sharp square when it is drawn bigger than it is (the game view, pixel art).
uint32_t Create (int width, int height)
 A width x height texture.
uint32_t CreateRgba (int width, int height, const void *rgba)
 A texture with these RGBA8 pixels, rows packed: Create, then Update.
void Destroy (uint32_t texture)
 Frees it. 0 is ignored.
void SetBackend (const Backend *backend)
 Called by the editor. Null takes it away again.
ImTextureID ToImGui (uint32_t texture)
 What ImGui takes for it.
void Update (uint32_t texture, int x, int y, int width, int height, Format format, const void *pixels, int rowPixels=0)
 Replaces the pixels in the rectangle at (x, y).

Detailed Description

Pictures the editor UI draws: the Scene and Play views, asset previews, font atlases.

Editor code and packages make them here: the editor draws with SDL's GPU API (Direct3D 12, Vulkan or Metal), which they never call.

A texture is a number, 0 for none. Its pixels are RGBA8 and start undefined; Update fills them from RGBA8 or RGB565. Draw one with ToImGui (ImGui::Image, ImDrawList::AddImage), or with AddImageNearest for sharp pixels when it is scaled up.

Enumeration Type Documentation

◆ Format

enum class DekiEditor::EditorTexture::Format : uint8_t
strong

How the pixels handed to Update are laid out.

Enumerator
Rgba8 
Rgb565 

Function Documentation

◆ AddImageNearest()

void DekiEditor::EditorTexture::AddImageNearest ( ImDrawList * drawList,
uint32_t texture,
const ImVec2 & min,
const ImVec2 & max,
const ImVec2 & uvMin = ImVec2(0, 0),
const ImVec2 & uvMax = ImVec2(1, 1) )

Adds it to drawList sampled nearest, so each texel stays a sharp square when it is drawn bigger than it is (the game view, pixel art).

◆ Create()

uint32_t DekiEditor::EditorTexture::Create ( int width,
int height )

A width x height texture.

Returns 0 when there is nothing to draw it with (a headless editor) or it could not be made.

◆ CreateRgba()

uint32_t DekiEditor::EditorTexture::CreateRgba ( int width,
int height,
const void * rgba )

A texture with these RGBA8 pixels, rows packed: Create, then Update.

◆ Destroy()

void DekiEditor::EditorTexture::Destroy ( uint32_t texture)

Frees it. 0 is ignored.

◆ SetBackend()

void DekiEditor::EditorTexture::SetBackend ( const Backend * backend)

Called by the editor. Null takes it away again.

◆ ToImGui()

ImTextureID DekiEditor::EditorTexture::ToImGui ( uint32_t texture)

What ImGui takes for it.

◆ Update()

void DekiEditor::EditorTexture::Update ( uint32_t texture,
int x,
int y,
int width,
int height,
Format format,
const void * pixels,
int rowPixels = 0 )

Replaces the pixels in the rectangle at (x, y).

pixels points at its top-left pixel; its rows are rowPixels pixels apart (0: width).