Files
kryon/examples/22_physics.kry
T
waozi 2423b97a0c scene/property/signal/transform: drop the Kry/Kryon prefix from the public API
KryScene->Scene, KryNode->Node, KryonProperty*->Property*,
KrySignal*->Signal*, KryTransform2D->Transform2D, and the
KRY_NODE_/KRY_SCENE_/KRYON_PROPERTY_/KRY_SIGNAL_ enum and macro
families to NODE_/SCENE_/PROPERTY_/SIGNAL_. Header guards keep their
original names (internal). The lowercase kry_ module namespaces
(kry_json, kry_term, ...) and the raymath-shadowing helpers
(KryVector2*, KryClamp, KryLerp) stay prefixed: their unprefixed names
collide with the raylib API surface kryon tracks.
2026-08-16 20:35:15 -03:00

35 lines
1.0 KiB
Plaintext

#module "example_physics"
#import "kryon.h"
#import "kryon_example_font.h"
app "Kryon Physics" {
size 640 420
fps 60
font examples
theme THEME_SKY 0
scene main
}
#enum {
GROUND_X = 320
GROUND_Y = 380
BOX_X = 320
BOX_Y = 60
}
scene main {
ScenePhysicsCreate(scene, 0.0, 980.0)
ground := NodeCreate(scene, 0, NODE_BODY2D, "ground")
NodeSetProps(scene, ground, KryBody2DPropsAlloc(KRY_BODY2D_STATIC))
NodeSetPosition(scene, ground, GROUND_X, GROUND_Y)
ground_shape := NodeCreate(scene, ground, NODE_COLLISION_SHAPE2D, "ground_shape")
NodeSetProps(scene, ground_shape, KryCollisionShape2DPropsAlloc(KRY_SHAPE2D_BOX, 400.0, 32.0))
box := NodeCreate(scene, 0, NODE_BODY2D, "box")
NodeSetProps(scene, box, KryBody2DPropsAlloc(KRY_BODY2D_DYNAMIC))
NodeSetPosition(scene, box, BOX_X, BOX_Y)
box_shape := NodeCreate(scene, box, NODE_COLLISION_SHAPE2D, "box_shape")
NodeSetProps(scene, box_shape, KryCollisionShape2DPropsAlloc(KRY_SHAPE2D_BOX, 48.0, 48.0))
}