diff options
| author | iamcheeseman <[hidden email]> | 2026-01-16 14:08:51 -0500 |
|---|---|---|
| committer | iamcheeseman <[hidden email]> | 2026-01-16 14:08:51 -0500 |
| commit | 30a49954e4cb434a1c47503c839feb20558a202b (patch) | |
| tree | d18228602676dbc7cd9790e18444b15a8a2157d3 /src/phys | |
| parent | 64e3dc9c109f4f76d5d1f65a9082340213985361 (diff) | |
Rename enums to use Ada_Case
Diffstat (limited to 'src/phys')
| -rw-r--r-- | src/phys/body.odin | 30 | ||||
| -rw-r--r-- | src/phys/world.odin | 16 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/phys/body.odin b/src/phys/body.odin index 09dc95a..6734b2b 100644 --- a/src/phys/body.odin +++ b/src/phys/body.odin @@ -8,22 +8,22 @@ Rect :: struct { } Layer :: enum (u16) { - DEFAULT, - HARD, // hard collisions; don't let bodies intersect at all - SOFT, // soft collisions; push away other bodies with a force - ENEMY, // enemy hitboxes - PLAYER, // player hitboxes - ENEMY_PROJECTILE, - PLAYER_PROJECTILE, + Default, + Hard, // hard collisions; don't let bodies intersect at all + Soft, // soft collisions; push away other bodies with a force + Enemy, // enemy hitboxes + Player, // player hitboxes + Enemy_Projectile, + Player_Projectile, } Collision_Type :: enum (u8) { - UP, - DOWN, - RIGHT, - LEFT, - HORIZONTAL, - VERTICAL, + Up, + Down, + Right, + Left, + Horizontal, + Vertical, } Body :: struct { @@ -40,8 +40,8 @@ Body :: struct { make_body :: proc( rect: Rect, - layers := bit_set[Layer;u16]{.DEFAULT}, - mask := bit_set[Layer;u16]{.DEFAULT}, + layers := bit_set[Layer;u16]{.Default}, + mask := bit_set[Layer;u16]{.Default}, ) -> Body_Handle { b := Body { rect = rect, diff --git a/src/phys/world.odin b/src/phys/world.odin index aacc8bc..3dbd052 100644 --- a/src/phys/world.odin +++ b/src/phys/world.odin @@ -236,30 +236,30 @@ update_body :: proc(h: Body_Handle) { if aabb_hori(rect, c_rect) { if b.vel.y > 0 { res_pos.y = c_rect.start.y - b.rect.size.y - b.rect.start.y - b.collisions += {.DOWN} + b.collisions += {.Down} } else { res_pos.y = c_rect.start.y + c_rect.size.y - b.rect.start.y - b.collisions += {.UP} + b.collisions += {.Up} } - b.collisions += {.VERTICAL} + b.collisions += {.Vertical} } else if aabb_vert(rect, c.rect) { if b.vel.x > 0 { res_pos.x = c_rect.start.x - b.rect.size.x - b.rect.start.x - b.collisions += {.LEFT} + b.collisions += {.Left} } else { res_pos.x = c_rect.start.x + c_rect.size.x - b.rect.start.x - b.collisions += {.RIGHT} + b.collisions += {.Right} } - b.collisions += {.HORIZONTAL} + b.collisions += {.Horizontal} } } } } - if .HORIZONTAL in b.collisions { + if .Horizontal in b.collisions { b.vel.x = 0 } - if .VERTICAL in b.collisions { + if .Vertical in b.collisions { b.vel.y = 0 } |
