From d8afa73368cdff38125fa1f7d17ad5ce54c84def Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 6 Apr 2025 21:43:19 -0400 Subject: Improved inline C code: now uses `C_code` keyword and supports interpolation with @ --- examples/game/player.tm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/game') diff --git a/examples/game/player.tm b/examples/game/player.tm index 9f166d9e..2e5e54f6 100644 --- a/examples/game/player.tm +++ b/examples/game/player.tm @@ -10,12 +10,12 @@ struct Player(pos,prev_pos:Vector2) COLOR := Color(0x60, 0x60, 0xbF) func update(p:@Player) - target_x := inline C:Num32 { + target_x := C_code:Num32( (Num32_t)((IsKeyDown(KEY_A) ? -1 : 0) + (IsKeyDown(KEY_D) ? 1 : 0)) - } - target_y := inline C:Num32 { + ) + target_y := C_code:Num32( (Num32_t)((IsKeyDown(KEY_W) ? -1 : 0) + (IsKeyDown(KEY_S) ? 1 : 0)) - } + ) target_vel := Vector2(target_x, target_y).norm() * Player.WALK_SPEED vel := (p.pos - p.prev_pos)/World.DT -- cgit v1.2.3