- include/kry_math.h: Vector2 math and KryTransform2D (compose/point/camera) - include/scene_tree.h + src/scene/scene_tree.c: KryScene/KryNode retained node tree with array arena, parent/child links, world-transform update, lifecycle vtable (ready/process/physics_process/draw), KrySceneTick/ PhysicsTick/Draw driver - include/node2d_props.h: Camera2DProps, Sprite2DProps - Rename UI Sprite widget to Picture (raylib owns Image as a struct): ui_sprite.h -> ui_picture.h, SpriteProps -> PictureProps, UISpriteFit -> UIPictureFit, UI_SPRITE_FIT_* -> UI_PICTURE_FIT_*, Sprite() -> Picture(); extract shared texture cache to src/ui/ui_picture_cache.c (KryLoadPictureTexture, KryPictureFitRect) shared by the Picture widget and the upcoming Sprite2D scene node - Migrate example, docs, node registry to the Picture name
29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
#ifndef NODE2D_PROPS_H
|
|
#define NODE2D_PROPS_H
|
|
|
|
/*
|
|
* Kind-specific props for built-in scene nodes. These are attached to a
|
|
* KryNode via its `props` pointer and read by the node's lifecycle hooks.
|
|
* Each concrete kind owns its props struct; the scene tree treats props as
|
|
* opaque (void *) and only the kind's registered ops/destroy touch it.
|
|
*/
|
|
|
|
#include "kryon_compat.generated.h"
|
|
#include "ui_picture.h" /* PictureProps / UIPictureFit, shared with the UI widget */
|
|
|
|
typedef struct Camera2DProps {
|
|
float zoom; /* 1.0 = default; >1 zooms in */
|
|
float rotation; /* extra camera rotation in radians, added to the node transform */
|
|
int active; /* nonzero = this camera drives BeginMode2D during KrySceneDraw */
|
|
} Camera2DProps;
|
|
|
|
typedef struct Sprite2DProps {
|
|
const char *asset_path; /* texture path or embedded asset name */
|
|
Rectangle source; /* sub-rectangle of the texture; {0,0,0,0} = full texture */
|
|
Vector2 size; /* world-space size of the sprite (width/height) */
|
|
Color tint; /* .a == 0 -> WHITE */
|
|
UIPictureFit fit; /* STRETCH/CONTAIN/COVER within `size` */
|
|
} Sprite2DProps;
|
|
|
|
#endif
|