query start
This commit is contained in:
@@ -11,7 +11,8 @@ App :: struct {
|
||||
update_systems: [dynamic]proc(),
|
||||
draw_systems: [dynamic]proc(),
|
||||
plugins: [dynamic]proc(app: ^App),
|
||||
entities: map[int][dynamic]struct{},
|
||||
entities: map[u32][dynamic]struct{},
|
||||
storages: map[typeid]rawptr,
|
||||
}
|
||||
|
||||
add_system :: proc(app: ^App, schedule: int, system: proc()) {
|
||||
@@ -29,13 +30,6 @@ add_plugin :: proc(app: ^App, plugin: proc(app: ^App)) {
|
||||
append(&app.plugins, plugin)
|
||||
}
|
||||
|
||||
spawn_entity :: proc(app: ^App, components: [dynamic]struct{}) {
|
||||
entity_len := len(&app.entities)
|
||||
|
||||
app.entities[entity_len] = components
|
||||
|
||||
}
|
||||
|
||||
run :: proc(app: ^App) {
|
||||
rl.InitWindow(800, 600, "shoal window")
|
||||
defer rl.CloseWindow()
|
||||
|
||||
+11
-8
@@ -1,18 +1,21 @@
|
||||
package shoal
|
||||
|
||||
Entity :: struct {
|
||||
id: int,
|
||||
components: [dynamic]struct{},
|
||||
Entity :: distinct u32
|
||||
|
||||
Storage :: struct($T: typeid) {
|
||||
data: map[Entity]T,
|
||||
}
|
||||
|
||||
spawn_entity :: proc(app: ^App) -> Entity {
|
||||
spawn_entity :: proc(app: ^App, $T: typeid) -> Entity {
|
||||
entity: Entity
|
||||
entity_len := len(&app.entities)
|
||||
entity.id = entity_len
|
||||
|
||||
return entity
|
||||
}
|
||||
|
||||
add_collection :: proc(app: ^App, component: $T) {
|
||||
add_collection :: proc(app: ^App, $T: typeid) {
|
||||
storage: ^Storage(T)
|
||||
app.storages[T] = storage
|
||||
}
|
||||
|
||||
query :: proc(app: ^App, $T: typeid) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user