DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches

The scene view's current render context, for gizmo code to read: More...

#include <C:/Users/kirby/Documents/Github/deki/deki-editor/deki-editor/include/deki-editor/SceneView.h>

Public Member Functions

float GetScreenX () const
 Screen position of the object's centre.
float GetScreenY () const
float GetWorldX () const
float GetWorldY () const
float GetScaleX () const
 World scale.
float GetScaleY () const
float GetRotation () const
 Rotation in radians, engine convention.
float GetZoom () const
 View zoom: editor wheel zoom * dpi, without pixels-per-meter.
float GetPixelsPerMeter () const
 Pixels per meter of the scene view: the project's art density.
float GetWorldToScreenScale () const
 World meters to screen pixels (zoom * pixelsPerMeter).
float GetDisplayWidth () const
 Display size for the current component.
float GetDisplayHeight () const
bool IsCurrentObjectSelected () const
Deki::Object * GetCurrentObject () const
int GetPreviewWidth () const
 Width in pixels of the screen the Play view previews: the resolution picked in its toolbar, or for an aspect ratio, the panel's size at that ratio.
int GetPreviewHeight () const
 Height in pixels of the previewed screen (see GetPreviewWidth).
Deki::ColorFormat GetPreviewFormat () const
 Pixel format of the previewed screen; play mode renders in it.
void SetPreviewFormat (Deki::ColorFormat format)
void SetPreviewSize (int width, int height)
 Previews a screen of this size. The Play view calls it every frame.
void DrawLine (float x0, float y0, float x1, float y1, uint32_t rgba, float thickness=1.0f)
void DrawRect (float x0, float y0, float x1, float y1, uint32_t rgba, float thickness=1.0f, float rounding=0.0f)
void DrawRectFilled (float x0, float y0, float x1, float y1, uint32_t rgba, float rounding=0.0f)
void DrawCircle (float cx, float cy, float radius, uint32_t rgba, float thickness=1.0f)
void DrawCircleFilled (float cx, float cy, float radius, uint32_t rgba)
void BeginObject (const SceneViewContext &ctx)
 Sets the context for one object's gizmos, from ctx.
void EndObject ()

Static Public Member Functions

static SceneView & Get ()
static uint32_t Rgba (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Packs an RGBA colour (components 0-255) for the Draw* methods.

Detailed Description

The scene view's current render context, for gizmo code to read:

auto& view = SceneView::Get(); float halfW = sprite->width * view.GetScaleX() * view.GetZoom() * 0.5f;

SceneViewPanel calls BeginObject/EndObject around each object's gizmos. The scene itself is drawn by DekiRenderSystem.

Member Function Documentation

◆ Get()

SceneView & DekiEditor::SceneView::Get ( )
static

◆ GetScreenX()

float DekiEditor::SceneView::GetScreenX ( ) const
inline

Screen position of the object's centre.

◆ GetScreenY()

float DekiEditor::SceneView::GetScreenY ( ) const
inline

◆ GetWorldX()

float DekiEditor::SceneView::GetWorldX ( ) const
inline

◆ GetWorldY()

float DekiEditor::SceneView::GetWorldY ( ) const
inline

◆ GetScaleX()

float DekiEditor::SceneView::GetScaleX ( ) const
inline

World scale.

◆ GetScaleY()

float DekiEditor::SceneView::GetScaleY ( ) const
inline

◆ GetRotation()

float DekiEditor::SceneView::GetRotation ( ) const
inline

Rotation in radians, engine convention.

◆ GetZoom()

float DekiEditor::SceneView::GetZoom ( ) const
inline

View zoom: editor wheel zoom * dpi, without pixels-per-meter.

◆ GetPixelsPerMeter()

float DekiEditor::SceneView::GetPixelsPerMeter ( ) const
inline

Pixels per meter of the scene view: the project's art density.

◆ GetWorldToScreenScale()

float DekiEditor::SceneView::GetWorldToScreenScale ( ) const
inline

World meters to screen pixels (zoom * pixelsPerMeter).

Use it for any gizmo size given in world units (the camera's visible area, an emission shape's radius). For accents of fixed screen size (crosshairs, handle dots) use GetZoom().

◆ GetDisplayWidth()

float DekiEditor::SceneView::GetDisplayWidth ( ) const
inline

Display size for the current component.

◆ GetDisplayHeight()

float DekiEditor::SceneView::GetDisplayHeight ( ) const
inline

◆ IsCurrentObjectSelected()

bool DekiEditor::SceneView::IsCurrentObjectSelected ( ) const
inline

◆ GetCurrentObject()

Deki::Object * DekiEditor::SceneView::GetCurrentObject ( ) const
inline

◆ GetPreviewWidth()

int DekiEditor::SceneView::GetPreviewWidth ( ) const
inline

Width in pixels of the screen the Play view previews: the resolution picked in its toolbar, or for an aspect ratio, the panel's size at that ratio.

Play mode runs at it, and gizmos use it to show what that screen sees. 320 until the Play view has set it.

◆ GetPreviewHeight()

int DekiEditor::SceneView::GetPreviewHeight ( ) const
inline

Height in pixels of the previewed screen (see GetPreviewWidth).

◆ GetPreviewFormat()

Deki::ColorFormat DekiEditor::SceneView::GetPreviewFormat ( ) const
inline

Pixel format of the previewed screen; play mode renders in it.

◆ SetPreviewFormat()

void DekiEditor::SceneView::SetPreviewFormat ( Deki::ColorFormat format)
inline

◆ SetPreviewSize()

void DekiEditor::SceneView::SetPreviewSize ( int width,
int height )
inline

Previews a screen of this size. The Play view calls it every frame.

◆ Rgba()

uint32_t DekiEditor::SceneView::Rgba ( uint8_t r,
uint8_t g,
uint8_t b,
uint8_t a = 255 )
inlinestatic

Packs an RGBA colour (components 0-255) for the Draw* methods.

◆ DrawLine()

void DekiEditor::SceneView::DrawLine ( float x0,
float y0,
float x1,
float y1,
uint32_t rgba,
float thickness = 1.0f )

◆ DrawRect()

void DekiEditor::SceneView::DrawRect ( float x0,
float y0,
float x1,
float y1,
uint32_t rgba,
float thickness = 1.0f,
float rounding = 0.0f )

◆ DrawRectFilled()

void DekiEditor::SceneView::DrawRectFilled ( float x0,
float y0,
float x1,
float y1,
uint32_t rgba,
float rounding = 0.0f )

◆ DrawCircle()

void DekiEditor::SceneView::DrawCircle ( float cx,
float cy,
float radius,
uint32_t rgba,
float thickness = 1.0f )

◆ DrawCircleFilled()

void DekiEditor::SceneView::DrawCircleFilled ( float cx,
float cy,
float radius,
uint32_t rgba )

◆ BeginObject()

void DekiEditor::SceneView::BeginObject ( const SceneViewContext & ctx)

Sets the context for one object's gizmos, from ctx.

◆ EndObject()

void DekiEditor::SceneView::EndObject ( )

The documentation for this class was generated from the following file: