aboutsummaryrefslogtreecommitdiff
path: root/examples/game
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-15 17:34:34 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-15 17:34:34 -0400
commit8ee23054bf771e56802ce21d70229b7f8f2e9654 (patch)
tree58b7ac43f523ed1de1e8b5f49b6465d376c88843 /examples/game
parent3cbc62ee43737e3afae0dd2e6597ff703689634e (diff)
Update Inline C syntax and documentation/tests
Diffstat (limited to 'examples/game')
-rw-r--r--examples/game/player.tm8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/game/player.tm b/examples/game/player.tm
index dff95b9d..5909ae63 100644
--- a/examples/game/player.tm
+++ b/examples/game/player.tm
@@ -13,12 +13,12 @@ struct Player(pos,prev_pos:Vec2):
SIZE := Vec2(30, 30)
func update(p:&Player):
- target_x := inline C (
+ target_x := inline C:Num {
(Num_t)((IsKeyDown(KEY_A) ? -1 : 0) + (IsKeyDown(KEY_D) ? 1 : 0))
- ) : Num
- target_y := inline C (
+ }
+ target_y := inline C:Num {
(Num_t)((IsKeyDown(KEY_W) ? -1 : 0) + (IsKeyDown(KEY_S) ? 1 : 0))
- ) : Num
+ }
target_vel := Vec2(target_x, target_y):norm() * WALK_SPEED
vel := (p.pos - p.prev_pos)/World.DT