From 5152eb3f313d5140f7b7bd317fa921838718a311 Mon Sep 17 00:00:00 2001 From: harper Date: Wed, 30 Sep 2026 16:13:20 -0700 Subject: [PATCH] initial commit --- componenets.odin | 0 ecs.odin | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ entities.odin | 6 ++++++ plugins.odin | 4 ++++ query.odin | 10 ++++++++++ 5 files changed, 69 insertions(+) create mode 100644 componenets.odin create mode 100644 ecs.odin create mode 100644 entities.odin create mode 100644 plugins.odin create mode 100644 query.odin diff --git a/componenets.odin b/componenets.odin new file mode 100644 index 0000000..e69de29 diff --git a/ecs.odin b/ecs.odin new file mode 100644 index 0000000..7249dca --- /dev/null +++ b/ecs.odin @@ -0,0 +1,49 @@ +package shoal + +import "core:text/table" +import rl "vendor:raylib" + +STARTUP := 0 +UPDATE := 1 +DRAW := 2 + +App :: struct { + startup_systems: [dynamic]proc(), + update_systems: [dynamic]proc(), + draw_systems: [dynamic]proc(), + plugins: [dynamic]proc(app: ^App), + entities: [dynamic]Entity, +} + +add_system :: proc(app: ^App, schedule: int, system: proc()) { + switch schedule { + case STARTUP: + append(&app.startup_systems, system) + case UPDATE: + append(&app.update_systems, system) + case DRAW: + append(&app.draw_systems, system) + } +} + +add_plugin :: proc(app: ^App, plugin: proc(app: ^App)) { + append(&app.plugins, plugin) +} + + +run :: proc(app: ^App) { + rl.InitWindow(800, 600, "shoal window") + defer rl.CloseWindow() + + for p in app.plugins { + p(app) + } + + for i in app.startup_systems {i()} + for !rl.WindowShouldClose() { + for i in app.update_systems {i()} + rl.BeginDrawing() + for i in app.draw_systems {i()} + rl.EndDrawing() + } +} diff --git a/entities.odin b/entities.odin new file mode 100644 index 0000000..df31850 --- /dev/null +++ b/entities.odin @@ -0,0 +1,6 @@ +package shoal + +Entity :: struct { + id: i32, + components: [dynamic]struct{}, +} diff --git a/plugins.odin b/plugins.odin new file mode 100644 index 0000000..a447a54 --- /dev/null +++ b/plugins.odin @@ -0,0 +1,4 @@ +#+private +package shoal + +plugins: [dynamic]proc() diff --git a/query.odin b/query.odin new file mode 100644 index 0000000..94e2988 --- /dev/null +++ b/query.odin @@ -0,0 +1,10 @@ +package shoal + +Query :: struct { + with: [dynamic]struct{}, +} + +query :: proc(app: ^App, query: Query) { + for e in app.entities { + } +}