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

Namespaces

namespace  ComponentInterfaceAdapters
namespace  Detail
 A class entry for a component the codegen never saw (a test double, a type defined in a .cpp).
namespace  Internal
namespace  Math
namespace  ProjectSettings
namespace  SceneFormat
namespace  Storage

Classes

struct  AllocContext
 Who asked for an allocation, filled in by the compiler. More...
class  AssetLookupTable
class  AssetManager
class  AssetPackReader
struct  AssetRef
 Typed asset reference: use it like a T*. More...
struct  AssetRefBase
 The untyped part of AssetRef, so the asset system can reach guid and ptr without knowing T. More...
struct  AutoSetupRegistrar
class  Buffer
 Owning array of T, freed when it goes out of scope. More...
class  Color
 An RGBA colour, 8 bits per channel, with conversions to and from packed formats (RGB565, RGB888, ARGB8888, RGBA8888), floats and HSV. More...
class  Component
 The base class of every component. More...
class  ComponentFactory
 Creates components by type id and tells which class an id belongs to. More...
struct  ComponentMeta
 Component metadata for runtime reflection. More...
class  ComponentRegistry
struct  ComponentsMigrationRegistrar
struct  ComponentTypeInfo
 Everything the engine knows about one component class. More...
class  CoreProjectSettings
struct  DPackEntry
struct  DPackHeader
class  Engine
 Engine singleton: owns the scene system, lifecycle and frame loop. More...
struct  EngineHost
struct  EngineSettings
struct  FieldRef
 Compact field descriptor, the one piece of reflection on every platform. More...
class  FileSystem
 Holds the process-wide filesystems. More...
class  FPSCounter
class  HostMemoryProvider
 Memory provider over the C heap (malloc/free), for any host with a normal C library heap: the editor, desktop and simulator builds, tests. More...
class  ICamera
 Camera interface for coordinate conversion. More...
class  IClipProvider
class  IDisplay
 What a display package implements: setup, presenting frames, events and UI overlays. More...
class  IFileSystem
 What a filesystem package implements: file operations, path conversion and USB storage mode. More...
class  IInputSystem
 The input system as the engine sees it, so it need not link to the implementation in the input package DLL. More...
class  IMemoryProvider
 The platform's memory, as the engine sees it, so the engine has no platform-specific allocation code: a microcontroller with external RAM uses its SDK's capability allocator, a part without it or a desktop uses malloc. More...
class  IPackage
 What a hardware peripheral package (SD card, GPS, WiFi, ...) implements. More...
class  IPower
 Device power management (sleep and wake). More...
class  IRenderSystem
 The render system as the engine sees it, so it need not link to the implementation in the rendering package DLL. More...
class  ISortableProvider
class  ITimeProvider
 The platform's millisecond clock, such as SDL_GetTicks() on SDL3 or esp_timer_get_time() / 1000 on ESP32. More...
struct  LoadedPack
class  LogSystem
struct  Mat4
 4x4 matrix in the layout OpenGL/GLSL expect: column-major, m[col][row]. More...
class  Memory
 The engine's memory, in named regions. More...
struct  MemoryStats
struct  NodeRef
class  Object
struct  ObjectRef
 An object reference the user assigns in the editor. More...
struct  ObjectRefBase
struct  PackageConfig
 Runtime configuration of one hardware package on a board: pin assignments (GPIO numbers) and string settings, loaded from the platform JSON. More...
struct  PackIndexEntry
class  PlatformSetupComponent
 Runs the boot scene's SetupComponents (such as SDCardComponent) one at a time, in order, waiting for each to finish, then loads the startup scene. More...
class  Power
struct  PropertyBinding
 A resolved PropertyRef: where the field lives and what it is. More...
struct  PropertyInfo
 Property metadata, one per component type and field. More...
struct  PropertyRef
 A picked field of a component on an object. More...
struct  Rect
class  Scene
 A scene: objects with components, and Deki's basic unit of content. More...
class  SceneSystem
 Loads and owns the root scene, the scene that is running, and keeps the persistent objects that outlive scene changes. More...
class  ScreenAnchor
 Keeps its object at a point on the screen, such as the top-left corner, on every screen size and while the camera moves. More...
class  SettingsRegistry
 Registry of project-settings types, which packages can add to. More...
struct  SettingsTypeInfo
class  SetupComponent
 Base class for components that need asynchronous setup at boot. More...
class  Texture2D
class  Time
 The engine's clock, independent of the platform. More...
class  UnitProjectSettings
class  Vector
 Growable array of T whose growth can fail. More...
struct  Vector2
 2D vector for positions, directions and scales. More...
struct  Vector3
 3D vector for positions, directions, scales and rotations. More...

Typedefs

using InterfaceAdapter = void* (*)(Component*)
using UpdateCallback = std::function<void(uint32_t deltaTime)>
using GameUpdateCallback = std::function<void()>
using LogCallback = std::function<void(LogLevel level, const std::string& message, const char* file, int line)>
using ComponentsMigration = void (*)(nlohmann::json& components)
using ComponentType = uint32_t

Enumerations

enum class  ColorFormat { RGB565 = 0 , RGB888 = 1 , ARGB8888 = 2 , RGB565A8 = 3 }
enum class  ProjectionMode : uint8_t { Orthographic = 0 , Perspective = 1 }
 How a camera projects the world. More...
enum class  UnitMode : uint8_t { Pixels = 0 , Meters = 1 }
 Units the inspector shows. More...
enum class  TemperatureUnit : uint8_t { Celsius = 0 , Fahrenheit = 1 }
 Temperature scale the inspector shows. More...
enum class  LogLevel {
  Editor , Internal , Debug , Info ,
  Warning , Error
}
enum class  PackageState {
  Uninitialized , Initialized , Running , Error ,
  Disabled
}
enum class  PhysicalUnit : uint8_t {
  None = 0 , Distance , Velocity , Acceleration ,
  Angle , AngularVelocity , Temperature , Frequency ,
  Time
}
 Physical unit of a Float or Vector2 property. More...
enum class  PropertyType : uint8_t {
  Int8 , Int16 , Int32 , Int64 ,
  UInt8 , UInt16 , UInt32 , UInt64 ,
  Float , Double , Bool , String ,
  Color , Vector2 , Vector3 , Enum ,
  ObjectRef , Array , AssetRef , NodeRef ,
  PropertyRef
}
 Property types for runtime reflection. More...
enum class  TransformField : uint8_t {
  None = 0 , X , Y , Position ,
  Rotation , ScaleX , ScaleY , Scale ,
  Active , Z , RotationX , RotationY ,
  ScaleZ
}
 A field of the object's own transform, addressable like a component field. More...
enum class  ScreenPoint : uint8_t {
  TopLeft , Top , TopRight , Left ,
  Center , Right , BottomLeft , Bottom ,
  BottomRight
}
 A point on the screen: a corner, the middle of an edge, or the centre. More...
enum class  AnchorUpdate : uint8_t { Always , Once }
 When a Screen Anchor places its object. More...

Functions

void ColorToHex (const Color &c, char out[10])
 Writes c as "#RRGGBBAA", the form saved files use.
bool ColorFromHex (const char *text, Color &out)
 Parses "#RRGGBBAA", and "#RRGGBB" as fully opaque.
constexpr size_t FrameBufferBytes (ColorFormat format, int width, int height)
 Bytes a width x height framebuffer of format occupies.
std::string GenerateDeterministicGuid (const std::string &seed)
 A GUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) hashed from seed with FNV-1a, so the same seed always gives the same GUID.
int Main ()
 Runs the engine: initialises it, loads the boot scene from flash storage, runs the main loop until it ends, and shuts down.
template<typename Fn>
void VisitSubtree (Object *root, Fn &&fn)
 Pre-order visit of root and every descendant. fn(Object*).
template<typename Fn>
void VisitActiveSubtree (Object *root, Fn &&fn)
 Like VisitSubtree, but does not enter inactive objects (nor visit them).
template<typename Pred>
Object * FindInSubtree (Object *root, Pred &&pred)
 First object in pre-order for which pred(Object*) is true, or null.
constexpr uint32_t HashName (const char *s)
 FNV-1a over a name, at compile time: the same hash as AssetLookupTable::HashString, so region names hash like every other name.
template<class T, class Base = void>
constexpr ComponentTypeInfo MakeHandWrittenTypeInfo (bool declaresUpdate, const ComponentMeta *meta=nullptr, ComponentType typeId=TypeId< T >(), const char *name=TypeName< T >())
 Base names the direct component base when it is not Deki::Component (a test renderer deriving from RendererComponent), so lookups by base type find the instance.
template<class T>
const ComponentTypeInfo * TypeInfoFor ()
 The class entry AddComponent<T> attaches to a new T: the codegen's registered entry, or a hand-written one for a class it never saw.
const char * EnumNameForValue (const PropertyInfo &prop, int32_t value)
 Name of the enumerator whose underlying value is value, or nullptr when the enum has no such value or the property has no enumInts.
bool SameNameIgnoringStyle (const char *a, const char *b)
 True when a and b are the same name once underscores are dropped and letter case is ignored: "Portrait_180" and "Portrait180", "READ_BINARY" and "ReadBinary".
bool EnumValueForName (const PropertyInfo &prop, const char *name, int32_t &out)
 Underlying value of the enumerator called name.
int EnumIndexForValue (const PropertyInfo &prop, int32_t value)
 Position of value in the enum tables, for a UI that works in list indices such as a combo box.
template<typename T>
T & GetPropertyRef (Component *comp, const PropertyInfo &prop)
template<typename T>
const T & GetPropertyRef (const Component *comp, const PropertyInfo &prop)
template<typename T>
T GetPropertyValue (const Component *comp, const PropertyInfo &prop)
template<typename T>
void SetPropertyValue (Component *comp, const PropertyInfo &prop, const T &value)
template<typename T>
T & GetNodePropertyRef (void *base, const PropertyInfo &prop)
template<typename T>
const T & GetNodePropertyRef (const void *base, const PropertyInfo &prop)
const FieldRef * DekiVariableFieldRef (PropertyType type)
 A field descriptor for a standalone value of type, at offset 0, or nullptr for a type with no literal form.
const FieldRef * TransformFields (int &outCount)
 The transform's field table, for pickers and binding.
const char *const * TransformFieldNames (int &outCount)
 Transform field names, in the same order as TransformFields.
bool BindPropertyRef (Object *object, const PropertyRef &ref, PropertyBinding &out, const char **outError=nullptr)
 Resolves ref on object, which the caller has already found by name.
bool ParsePropertyLiteral (const FieldRef &info, const char *text, double &out, double &out2)
 Parses a literal by the bound field's type.
bool ParsePropertyLiteral (const FieldRef &info, const char *text, double &out)
 For targets that are not Vector2.
double ReadBoundProperty (const PropertyBinding &binding)
 The bound target's current value (the first axis for Vector2).
double ReadBoundProperty2 (const PropertyBinding &binding)
 The bound target's second axis, or 0 when it is not a Vector2.
void WriteBoundNumbers (const PropertyBinding &binding, double v, double v2)
 Writes v and v2 to the bound target instead of the parsed literal.
void WriteBoundProperty (const PropertyBinding &binding, const std::string &text)
 Writes the parsed literal, or text for String fields, into the field.
int CompareBoundProperty (const PropertyBinding &binding, const std::string &text)
 Compares the field's current value with the parsed literal, or with text for String fields.
template<typename T>
nlohmann::json Serialize (const T &obj)
template<typename T>
T Deserialize (const nlohmann::json &j)
void RegisterComponentsMigration (ComponentsMigration migration)
void UnregisterComponentsMigration (ComponentsMigration migration)
void RunComponentsMigrations (nlohmann::json &components)
 Runs every registered migration on one object's components array.
int PixelPerfectMultiple (float scale)
 Whole art-pixel multiple for pixel-perfect scaling, at least 1.
float OrthoPixelsPerMeter (int screenHeight, float orthoHeight, bool pixelPerfect, float artPixelsPerMeter)
 Screen pixels per meter for a screen this tall showing orthoHeight meters.
constexpr uint32_t HashString (const char *str, uint32_t hash=2166136261u)
 FNV-1a of a C string; the hash behind every type and property id.
uint32_t HashStringLen (const char *str, uint16_t length)
 The same hash over a string with a length (msgpack keys are not null-terminated).
constexpr uint32_t HashStringView (std::string_view s)
 The same hash over a string_view, usable in constant expressions.
template<class T>
constexpr std::string_view TypeNameOf ()
 The fully qualified name of T, such as "Game::Health".
template<class T>
constexpr std::string_view TypeShortNameOf ()
 The identifier alone, such as "Health" for Game::Health.
template<class T>
constexpr ComponentType TypeId ()
 The component type id of T: HashString of its fully qualified name.
template<class T>
constexpr const char * TypeName ()
 The fully qualified name of T as a null-terminated string with static storage.
template<class T>
constexpr const char * TypeShortName ()
 The identifier of T as a null-terminated string with static storage.
Vector2 operator* (float s, const Vector2 &v)
Vector3 operator* (float s, const Vector3 &v)
void SetImGuiContext (void *context)
 Gives this DLL the host's ImGui context, so ImGui state is shared across the DLL boundary.
void SetImGuiAllocators (void *(*allocFunc)(size_t sz, void *userData), void(*freeFunc)(void *ptr, void *userData), void *userData)
 Gives this DLL the host's ImGui allocators.

Variables

static constexpr char kDpackMagic [4] = { 'D', 'P', 'A', 'K' }
static constexpr uint32_t kDpackVersion = 1
constexpr bool kRGB565BigEndian = false
constexpr const char * kTransformRefComponent = "Transform"
 The component name a reference stores to mean "the object's transform".
constexpr const char * kVariableRefComponent = "Variable"
 The component name a reference stores to mean "a variable of this graph".

Typedef Documentation

◆ InterfaceAdapter

using Deki::InterfaceAdapter = void* (*)(Component*)

◆ UpdateCallback

using Deki::UpdateCallback = std::function<void(uint32_t deltaTime)>

◆ GameUpdateCallback

using Deki::GameUpdateCallback = std::function<void()>

◆ LogCallback

using Deki::LogCallback = std::function<void(LogLevel level, const std::string& message, const char* file, int line)>

◆ ComponentsMigration

using Deki::ComponentsMigration = void (*)(nlohmann::json& components)

◆ ComponentType

using Deki::ComponentType = uint32_t

Enumeration Type Documentation

◆ ColorFormat

enum class Deki::ColorFormat
strong
Enumerator
RGB565 
RGB888 
ARGB8888 
RGB565A8 

◆ ProjectionMode

enum class Deki::ProjectionMode : uint8_t
strong

How a camera projects the world.

Orthographic shows a fixed height of world (the camera's ortho height); the width follows the screen's shape. Perspective shows a vertical field of view, which 3D passes (deki-3d) draw through. Sprites draw flat through the orthographic mapping in both modes.

Enumerator
Orthographic 
Perspective 

◆ UnitMode

enum class Deki::UnitMode : uint8_t
strong

Units the inspector shows.

Display only: storage, serialization, runtime math and physics are always in meters. In Pixels mode the inspector multiplies physical-unit fields (DEKI_UNIT(Distance|Velocity|Acceleration)) by the project's pixelsPerMeter.

Enumerator
Pixels 
Meters 

◆ TemperatureUnit

enum class Deki::TemperatureUnit : uint8_t
strong

Temperature scale the inspector shows.

Storage is Celsius. Separate from UnitMode because the two preferences are independent.

Enumerator
Celsius 
Fahrenheit 

◆ LogLevel

enum class Deki::LogLevel
strong
Enumerator
Editor 
Internal 
Debug 
Info 
Warning 
Error 

◆ PackageState

enum class Deki::PackageState
strong
Enumerator
Uninitialized 
Initialized 
Running 
Error 
Disabled 

◆ PhysicalUnit

enum class Deki::PhysicalUnit : uint8_t
strong

Physical unit of a Float or Vector2 property.

Values are stored in the unit noted on each enumerator (meters for lengths). The inspector converts for display by the project's inspectorUnit setting:

  • Meters: shows the stored value (suffix m / m/s / m/s²).
  • Pixels: shows stored * pixelsPerMeter (suffix px / px/s / px/s²).
Enumerator
None 
Distance 
Velocity 
Acceleration 
Angle 
AngularVelocity 
Temperature 
Frequency 
Time 

◆ PropertyType

enum class Deki::PropertyType : uint8_t
strong

Property types for runtime reflection.

Enumerator
Int8 
Int16 
Int32 
Int64 
UInt8 
UInt16 
UInt32 
UInt64 
Float 
Double 
Bool 
String 
Color 
Vector2 
Vector3 
Enum 
ObjectRef 
Array 
AssetRef 
NodeRef 
PropertyRef 

◆ TransformField

enum class Deki::TransformField : uint8_t
strong

A field of the object's own transform, addressable like a component field.

The transform is not a component: it lives on Object, with private fields and setters that invalidate the cached world transform of the object and its descendants. So a reference to it is dispatched by this id, not written through an offset, and every write goes through the setter.

Position and Scale cover both axes at once (a Vector2 target), so "move this object to (x, y)" is one action, not two.

Enumerator
None 
X 
Y 
Position 
Rotation 
ScaleX 
ScaleY 
Scale 
Active 
Z 
RotationX 
RotationY 
ScaleZ 

◆ ScreenPoint

enum class Deki::ScreenPoint : uint8_t
strong

A point on the screen: a corner, the middle of an edge, or the centre.

Enumerator
TopLeft 
Top 
TopRight 
Left 
Center 
Right 
BottomLeft 
Bottom 
BottomRight 

◆ AnchorUpdate

enum class Deki::AnchorUpdate : uint8_t
strong

When a Screen Anchor places its object.

Enumerator
Always 
Once 

Function Documentation

◆ ColorToHex()

void Deki::ColorToHex ( const Color & c,
char out[10] )
inline

Writes c as "#RRGGBBAA", the form saved files use.

Saved files must not store a packed number: it is unreadable in a diff and ties every file to how Color packs its channels.

◆ ColorFromHex()

bool Deki::ColorFromHex ( const char * text,
Color & out )
inline

Parses "#RRGGBBAA", and "#RRGGBB" as fully opaque.

False on anything else, leaving out untouched, so a malformed value keeps the field's default rather than turning into black.

◆ FrameBufferBytes()

size_t Deki::FrameBufferBytes ( ColorFormat format,
int width,
int height )
constexpr

Bytes a width x height framebuffer of format occupies.

Use this rather than counting bytes per pixel yourself: it decides how much of a PSRAM framebuffer is flushed from CPU cache before DMA reads it, and an undercount leaves the bottom of the screen showing stale pixels.

It answers for the whole framebuffer, not per pixel, because 1-bit monochrome panels and e-paper use less than a byte per pixel. A MONO1 format would be one more case returning (w * h + 7) / 8.

◆ GenerateDeterministicGuid()

std::string Deki::GenerateDeterministicGuid ( const std::string & seed)

A GUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) hashed from seed with FNV-1a, so the same seed always gives the same GUID.

Used for cache GUIDs built from a source asset and its parameters (such as "fontGuid:fontSize").

◆ Main()

int Deki::Main ( )

Runs the engine: initialises it, loads the boot scene from flash storage, runs the main loop until it ends, and shuts down.

Returns the process exit code.

The platform package's entry point (main() on desktop, app_main() on ESP-IDF) sets up its providers and then calls this.

◆ VisitSubtree()

template<typename Fn>
void Deki::VisitSubtree ( Object * root,
Fn && fn )
inline

Pre-order visit of root and every descendant. fn(Object*).

◆ VisitActiveSubtree()

template<typename Fn>
void Deki::VisitActiveSubtree ( Object * root,
Fn && fn )
inline

Like VisitSubtree, but does not enter inactive objects (nor visit them).

◆ FindInSubtree()

template<typename Pred>
Object * Deki::FindInSubtree ( Object * root,
Pred && pred )
inline

First object in pre-order for which pred(Object*) is true, or null.

◆ HashName()

uint32_t Deki::HashName ( const char * s)
constexpr

FNV-1a over a name, at compile time: the same hash as AssetLookupTable::HashString, so region names hash like every other name.

◆ MakeHandWrittenTypeInfo()

template<class T, class Base = void>
ComponentTypeInfo Deki::MakeHandWrittenTypeInfo ( bool declaresUpdate,
const ComponentMeta * meta = nullptr,
ComponentType typeId = TypeId<T>(),
const char * name = TypeName<T>() )
constexpr

Base names the direct component base when it is not Deki::Component (a test renderer deriving from RendererComponent), so lookups by base type find the instance.

A class that builds its own entry attaches it with SetTypeInfo() in its constructor, and AddComponent<T> keeps it.

◆ TypeInfoFor()

template<class T>
const ComponentTypeInfo * Deki::TypeInfoFor ( )

The class entry AddComponent<T> attaches to a new T: the codegen's registered entry, or a hand-written one for a class it never saw.

◆ EnumNameForValue()

const char * Deki::EnumNameForValue ( const PropertyInfo & prop,
int32_t value )
inline

Name of the enumerator whose underlying value is value, or nullptr when the enum has no such value or the property has no enumInts.

◆ SameNameIgnoringStyle()

bool Deki::SameNameIgnoringStyle ( const char * a,
const char * b )
inline

True when a and b are the same name once underscores are dropped and letter case is ignored: "Portrait_180" and "Portrait180", "READ_BINARY" and "ReadBinary".

◆ EnumValueForName()

bool Deki::EnumValueForName ( const PropertyInfo & prop,
const char * name,
int32_t & out )
inline

Underlying value of the enumerator called name.

False when the enum has no enumerator by that name, leaving out untouched.

When no name matches exactly, a single enumerator that differs only in underscores and letter case is used, so a name saved in another style (Portrait_180 for Portrait180) still loads.

◆ EnumIndexForValue()

int Deki::EnumIndexForValue ( const PropertyInfo & prop,
int32_t value )
inline

Position of value in the enum tables, for a UI that works in list indices such as a combo box.

-1 when the enum declares no such value.

◆ GetPropertyRef() [1/2]

template<typename T>
T & Deki::GetPropertyRef ( Component * comp,
const PropertyInfo & prop )
inline

◆ GetPropertyRef() [2/2]

template<typename T>
const T & Deki::GetPropertyRef ( const Component * comp,
const PropertyInfo & prop )
inline

◆ GetPropertyValue()

template<typename T>
T Deki::GetPropertyValue ( const Component * comp,
const PropertyInfo & prop )
inline

◆ SetPropertyValue()

template<typename T>
void Deki::SetPropertyValue ( Component * comp,
const PropertyInfo & prop,
const T & value )
inline

◆ GetNodePropertyRef() [1/2]

template<typename T>
T & Deki::GetNodePropertyRef ( void * base,
const PropertyInfo & prop )
inline

◆ GetNodePropertyRef() [2/2]

template<typename T>
const T & Deki::GetNodePropertyRef ( const void * base,
const PropertyInfo & prop )
inline

◆ DekiVariableFieldRef()

const FieldRef * Deki::DekiVariableFieldRef ( PropertyType type)

A field descriptor for a standalone value of type, at offset 0, or nullptr for a type with no literal form.

For runners binding their own storage (graph variables): point PropertyBinding::field at the value and its info at this, and the Read/Write/Compare helpers below work on it.

◆ TransformFields()

const FieldRef * Deki::TransformFields ( int & outCount)

The transform's field table, for pickers and binding.

In this table only, FieldRef::offset holds a TransformField id, not a byte offset, because the fields are private and dispatched (see above). Only BindPropertyRef reads it.

◆ TransformFieldNames()

const char *const * Deki::TransformFieldNames ( int & outCount)

Transform field names, in the same order as TransformFields.

FieldRef stores only a name hash, so the names for pickers and error messages live here.

◆ BindPropertyRef()

bool Deki::BindPropertyRef ( Object * object,
const PropertyRef & ref,
PropertyBinding & out,
const char ** outError = nullptr )

Resolves ref on object, which the caller has already found by name.

Fills out.field and out.info, and leaves out.number as it is.

Returns false when the object has no such component or the component no such field. outError, when not null, then gets a short reason to log.

◆ ParsePropertyLiteral() [1/2]

bool Deki::ParsePropertyLiteral ( const FieldRef & info,
const char * text,
double & out,
double & out2 )

Parses a literal by the bound field's type.

Numbers, bools ("true"/"1") and enums go into out. Enums are stored as their index, so the device needs no name table. Vector2 targets read "x, y" and also fill out2. String fields return true and leave both alone. Returns false when a numeric field's text is not a number.

◆ ParsePropertyLiteral() [2/2]

bool Deki::ParsePropertyLiteral ( const FieldRef & info,
const char * text,
double & out )

For targets that are not Vector2.

◆ ReadBoundProperty()

double Deki::ReadBoundProperty ( const PropertyBinding & binding)

The bound target's current value (the first axis for Vector2).

◆ ReadBoundProperty2()

double Deki::ReadBoundProperty2 ( const PropertyBinding & binding)

The bound target's second axis, or 0 when it is not a Vector2.

◆ WriteBoundNumbers()

void Deki::WriteBoundNumbers ( const PropertyBinding & binding,
double v,
double v2 )

Writes v and v2 to the bound target instead of the parsed literal.

◆ WriteBoundProperty()

void Deki::WriteBoundProperty ( const PropertyBinding & binding,
const std::string & text )

Writes the parsed literal, or text for String fields, into the field.

◆ CompareBoundProperty()

int Deki::CompareBoundProperty ( const PropertyBinding & binding,
const std::string & text )

Compares the field's current value with the parsed literal, or with text for String fields.

Returns <0, 0 or >0 like strcmp.

◆ Serialize()

template<typename T>
nlohmann::json Deki::Serialize ( const T & obj)

◆ Deserialize()

template<typename T>
T Deki::Deserialize ( const nlohmann::json & j)

◆ RegisterComponentsMigration()

void Deki::RegisterComponentsMigration ( ComponentsMigration migration)

◆ UnregisterComponentsMigration()

void Deki::UnregisterComponentsMigration ( ComponentsMigration migration)

◆ RunComponentsMigrations()

void Deki::RunComponentsMigrations ( nlohmann::json & components)

Runs every registered migration on one object's components array.

◆ PixelPerfectMultiple()

int Deki::PixelPerfectMultiple ( float scale)
inline

Whole art-pixel multiple for pixel-perfect scaling, at least 1.

The small bias keeps an exact fit that float division puts just under (3.9999) at 4.

◆ OrthoPixelsPerMeter()

float Deki::OrthoPixelsPerMeter ( int screenHeight,
float orthoHeight,
bool pixelPerfect,
float artPixelsPerMeter )
inline

Screen pixels per meter for a screen this tall showing orthoHeight meters.

Returns 0 for an empty screen or a non-positive height; callers draw nothing then.

◆ HashString()

uint32_t Deki::HashString ( const char * str,
uint32_t hash = 2166136261u )
constexpr

FNV-1a of a C string; the hash behind every type and property id.

◆ HashStringLen()

uint32_t Deki::HashStringLen ( const char * str,
uint16_t length )
inline

The same hash over a string with a length (msgpack keys are not null-terminated).

◆ HashStringView()

uint32_t Deki::HashStringView ( std::string_view s)
constexpr

The same hash over a string_view, usable in constant expressions.

◆ TypeNameOf()

template<class T>
std::string_view Deki::TypeNameOf ( )
constexpr

The fully qualified name of T, such as "Game::Health".

◆ TypeShortNameOf()

template<class T>
std::string_view Deki::TypeShortNameOf ( )
constexpr

The identifier alone, such as "Health" for Game::Health.

◆ TypeId()

template<class T>
ComponentType Deki::TypeId ( )
constexpr

The component type id of T: HashString of its fully qualified name.

Every lookup by type (GetComponent<T>, the factory, the field tables) uses it, and a scene file's "type" string hashes to it on load.

◆ TypeName()

template<class T>
const char * Deki::TypeName ( )
constexpr

The fully qualified name of T as a null-terminated string with static storage.

◆ TypeShortName()

template<class T>
const char * Deki::TypeShortName ( )
constexpr

The identifier of T as a null-terminated string with static storage.

◆ operator*() [1/2]

Vector2 Deki::operator* ( float s,
const Vector2 & v )
inline

◆ operator*() [2/2]

Vector3 Deki::operator* ( float s,
const Vector3 & v )
inline

◆ SetImGuiContext()

void Deki::SetImGuiContext ( void * context)

Gives this DLL the host's ImGui context, so ImGui state is shared across the DLL boundary.

Call it before using any window that uses ImGui.

◆ SetImGuiAllocators()

void Deki::SetImGuiAllocators ( void * allocFunc (*)(size_t sz, void *userData),
void(* freeFunc )(void *ptr, void *userData),
void * userData )

Gives this DLL the host's ImGui allocators.

The context alone is not enough: this DLL links its own copy of ImGui, whose GImAllocatorAllocFunc/FreeFunc default to its own CRT heap, so an ImGui object allocated on one side and freed on the other would cross heaps. Call this BEFORE SetImGuiContext and before any ImGui use.

The signatures match ImGuiMemAllocFunc / ImGuiMemFreeFunc, spelled out so this header does not need imgui.h.

Variable Documentation

◆ kDpackMagic

char Deki::kDpackMagic[4] = { 'D', 'P', 'A', 'K' }
staticconstexpr

◆ kDpackVersion

uint32_t Deki::kDpackVersion = 1
staticconstexpr

◆ kRGB565BigEndian

bool Deki::kRGB565BigEndian = false
inlineconstexpr

◆ kTransformRefComponent

const char* Deki::kTransformRefComponent = "Transform"
inlineconstexpr

The component name a reference stores to mean "the object's transform".

◆ kVariableRefComponent

const char* Deki::kVariableRefComponent = "Variable"
inlineconstexpr

The component name a reference stores to mean "a variable of this graph".

The field is the variable's name.

Variables are declared by a node with DEKI_NODE_VARIABLES and live in storage the graph's runner allocates per instance. BindPropertyRef skips them; the runner binds them itself with DekiVariableFieldRef.