Standardise and make ECS more robust
This commit is contained in:
parent
b9aaeb62c9
commit
2ba1022f79
13 changed files with 245 additions and 232 deletions
|
|
@ -3,12 +3,12 @@ package ecs
|
|||
import sa "../sokol/app"
|
||||
|
||||
InputSystem :: struct {
|
||||
using base: SystemBase,
|
||||
using _: SystemBase,
|
||||
}
|
||||
|
||||
input_system_update :: proc(input_system: ^InputSystem, coordinator: ^Coordinator, event: ^sa.Event) {
|
||||
for entity in input_system.entities {
|
||||
input := coordinator_get_component(InputComponent, coordinator, entity)
|
||||
for entity_id in input_system.entities {
|
||||
input := coordinator_get_component(coordinator, InputComponent, entity_id)
|
||||
|
||||
#partial switch event.type {
|
||||
case .MOUSE_MOVE:
|
||||
|
|
@ -24,9 +24,9 @@ input_system_update :: proc(input_system: ^InputSystem, coordinator: ^Coordinato
|
|||
}
|
||||
|
||||
input_system_mouse_reset :: proc(input_system: ^InputSystem, coordinator: ^Coordinator) {
|
||||
for entity in input_system.entities {
|
||||
input := coordinator_get_component(InputComponent, coordinator, entity)
|
||||
for entity_id in input_system.entities {
|
||||
input_id := coordinator_get_component(coordinator, InputComponent, entity_id)
|
||||
|
||||
input.mouse_movement = { 0, 0 }
|
||||
input_id.mouse_movement = { 0, 0 }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue