aboutsummaryrefslogtreecommitdiff
path: root/src/platform.odin
blob: 674e1a37580fb63c0c8d6732f95f45990460e6eb (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(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(p.body)
    draw.rect(cast(draw.Rect)body.rect)
  }
}