aboutsummaryrefslogtreecommitdiff
path: root/src/platform.odin
blob: 150d96c2d1d3d49284263de0c5a0ee7f12829996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package demonchime

import "draw"
import "phys"

Platform :: struct {
  handle: Entity_Handle,
  body: phys.Body_Handle,
}

make_platform :: proc(rect: Rect) -> (Entity_Handle, ^Platform) {
  handle, body := phys.make_body(&state.physics_world, transmute(phys.Rect)rect)
  return make_entity(&state.platform_list, Platform {
    body = handle,
  })
}

draw_platforms :: proc() {
  iter := iter_entity_list(state.platform_list)
  for p in entity_list_iter(&iter) {
    body := phys.get_body(state.physics_world, p.body)
    draw.rect(&state.renderer, cast(draw.Rect)body.rect)
  }
}