aboutsummaryrefslogtreecommitdiff
path: root/src/platform.odin
blob: 306df3b351a3ac01d4b3f727d7b289144cf27e79 (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
25
26
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)
  draw.renderer.tint = {1, 0, 0, 0.25}
  for p in entity_list_iter(&iter) {
    body := phys.get_body(p.body)
    draw.rect(cast(draw.Rect)body.rect)
  }
  draw.renderer.tint = {1, 1, 1, 1}
}