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

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

void BeginObject (const SceneViewContext &ctx)
 Sets the context for one object's gizmos, from ctx.
void ClaimMouse ()
 A gizmo calls this every frame the pointer is on one of its handles, or a handle is being dragged: a click then goes to the handle instead of selecting or moving an object.
void ClearMouseClaim ()
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 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 EndObject ()
Deki::Object * GetCurrentObject () const
float GetDisplayHeight () const
float GetDisplayWidth () const
 Display size for the current component.
float GetPixelsPerMeter () const
 Pixels per meter of the scene view: the project's art density.
Deki::ColorFormat GetPreviewFormat () const
 Pixel format of the previewed screen; play mode renders in it.
int GetPreviewHeight () const
 Height in pixels of the previewed screen (see GetPreviewWidth).
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.
float GetRotation () const
 Rotation in radians, engine convention.
float GetScaleX () const
 World scale.
float GetScaleY () const
float GetScreenX () const
 Screen position of the object's centre.
float GetScreenY () const
float GetWorldToScreenScale () const
 World meters to screen pixels (zoom * pixelsPerMeter).
float GetWorldX () const
float GetWorldY () const
float GetZoom () const
 View zoom: editor wheel zoom * dpi, without pixels-per-meter.
bool IsCurrentObjectSelected () const
bool IsMouseClaimed () const
bool IsPointerOnCanvas () const
 Whether the pointer is over the scene canvas and free to act on it.
void SetPointerOnCanvas (bool onCanvas)
void SetPreviewFormat (Deki::ColorFormat format)
void SetPreviewSize (int width, int height)
 Previews a screen of this size. The Play view calls it every frame.

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

◆ BeginObject()

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

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

◆ ClaimMouse()

void DekiEditor::SceneView::ClaimMouse ( )
inline

A gizmo calls this every frame the pointer is on one of its handles, or a handle is being dragged: a click then goes to the handle instead of selecting or moving an object.

◆ ClearMouseClaim()

void DekiEditor::SceneView::ClearMouseClaim ( )
inline

◆ 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 )

◆ 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 )

◆ EndObject()

void DekiEditor::SceneView::EndObject ( )

◆ Get()

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

◆ GetCurrentObject()

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

◆ GetDisplayHeight()

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

◆ GetDisplayWidth()

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

Display size for the current component.

◆ GetPixelsPerMeter()

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

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

◆ GetPreviewFormat()

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

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

◆ GetPreviewHeight()

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

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

◆ 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.

◆ GetRotation()

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

Rotation in radians, engine convention.

◆ GetScaleX()

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

World scale.

◆ GetScaleY()

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

◆ GetScreenX()

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

Screen position of the object's centre.

◆ GetScreenY()

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

◆ 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().

◆ GetWorldX()

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

◆ GetWorldY()

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

◆ GetZoom()

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

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

◆ IsCurrentObjectSelected()

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

◆ IsMouseClaimed()

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

◆ IsPointerOnCanvas()

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

Whether the pointer is over the scene canvas and free to act on it.

A gizmo checks this before reacting to the mouse.

◆ 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.

◆ SetPointerOnCanvas()

void DekiEditor::SceneView::SetPointerOnCanvas ( bool onCanvas)
inline

◆ 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.


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