Compare commits

...
2 Commits
Author SHA1 Message Date
harper de088f69e6 single returns nil when empty 2026-10-10 12:07:33 -07:00
harper 294ffb70cc default window background 2026-10-10 12:07:20 -07:00
3 changed files with 3 additions and 8 deletions
+1 -1
View File
@@ -39,9 +39,9 @@ run :: proc(app: ^App) {
rl.SetTargetFPS(60) rl.SetTargetFPS(60)
for !rl.WindowShouldClose() { for !rl.WindowShouldClose() {
rl.ClearBackground(window.background)
for i in app.systems[UPDATE] {i()} for i in app.systems[UPDATE] {i()}
rl.BeginDrawing() rl.BeginDrawing()
rl.ClearBackground(window.background)
for i in app.systems[DRAW] {i()} for i in app.systems[DRAW] {i()}
rl.EndDrawing() rl.EndDrawing()
} }
+1 -6
View File
@@ -44,7 +44,7 @@ single :: proc(storage: ^Storage($T)) -> (Entity, ^T) {
for i, &v in slice(storage) { for i, &v in slice(storage) {
return i, &v return i, &v
} }
return Entity{}, new(T) return 0, nil
} }
// get component of type from entity // get component of type from entity
@@ -54,8 +54,3 @@ get_component :: proc(entity: Entity, storage: ^Storage($T)) -> ^T {
} }
return new(T) return new(T)
} }
// alias for direct mutation access
get_component_with_ref :: proc(entity: Entity, storage: ^Storage($T)) -> ^T {
return get_component(entity, storage)
}
+1 -1
View File
@@ -9,7 +9,7 @@ DefaultPlugin :: proc(app: ^App) {
add_component( add_component(
display, display,
&Window, &Window,
WindowComponent{width = 800, height = 600, title = "shoal window"}, WindowComponent{width = 800, height = 600, title = "shoal window", background = rl.BLACK},
) )
} }