From: Brendan Hansen Date: Fri, 20 May 2022 16:53:47 +0000 (-0500) Subject: updating to newer version of onyx X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=ea505370c2656a425bfd1962beeda2de9fb107db;p=bar-game.git updating to newer version of onyx --- diff --git a/.gitignore b/.gitignore index 54f6f03..f0c0553 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.sublime-project *.sublime-workspace src/config.onyx -*.wasm \ No newline at end of file +*.wasm +lib/ \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a000fc2..cd529eb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,11 +7,14 @@ "label": "Build game", "type": "shell", "options": { - "cwd": "${workspaceFolder}/run_tree" + "cwd": "${workspaceFolder}/run_tree", + "shell": { + "executable": "/bin/sh" + } }, "problemMatcher": "$onyx", "command": "./run.sh", - "args": ["build"], + // "args": ["build"], "presentation": { "echo": true, "reveal": "silent", @@ -29,7 +32,10 @@ "label": "run", "type": "shell", "options": { - "cwd": "${workspaceFolder}/run_tree" + "cwd": "${workspaceFolder}/run_tree", + "shell": { + "executable": "/bin/sh" + } }, "problemMatcher": "$onyx", "command": "./run.sh", diff --git a/onyx-pkg.ini b/onyx-pkg.ini new file mode 100644 index 0000000..b6da73c --- /dev/null +++ b/onyx-pkg.ini @@ -0,0 +1,29 @@ +[metadata] +name=bar-game +description=Bar simulation for MadLads Brewing +url= +author=Brendan Hansen +version=0.0.1 + +[config] +lib_source_directory=./lib +lib_bin_directory=./run_tree/lib + +[native_library] +build_cmd= +library= + +[dependencies] +git://onyxlang.io/repo/glfw3=0.0.2 +git://onyxlang.io/repo/opengles=0.0.2 +git://onyxlang.io/repo/openal=0.0.2 +git://onyxlang.io/repo/stb_truetype=0.0.2 +git://onyxlang.io/repo/stb_image=0.0.2 + +[dependency_folders] +git://onyxlang.io/repo/glfw3=glfw3 +git://onyxlang.io/repo/opengles=opengles +git://onyxlang.io/repo/openal=openal +git://onyxlang.io/repo/stb_truetype=stb_truetype +git://onyxlang.io/repo/stb_image=stb_image + diff --git a/run_tree/lib/onyx_glfw3.so b/run_tree/lib/onyx_glfw3.so index dd2da0c..168d722 100755 Binary files a/run_tree/lib/onyx_glfw3.so and b/run_tree/lib/onyx_glfw3.so differ diff --git a/run_tree/lib/onyx_openal.so b/run_tree/lib/onyx_openal.so index d853604..d2a61d7 100755 Binary files a/run_tree/lib/onyx_openal.so and b/run_tree/lib/onyx_openal.so differ diff --git a/run_tree/lib/onyx_opengles.so b/run_tree/lib/onyx_opengles.so index 6015b67..333ecb0 100755 Binary files a/run_tree/lib/onyx_opengles.so and b/run_tree/lib/onyx_opengles.so differ diff --git a/run_tree/lib/stb_image.so b/run_tree/lib/stb_image.so index e8d39d6..56fda28 100755 Binary files a/run_tree/lib/stb_image.so and b/run_tree/lib/stb_image.so differ diff --git a/run_tree/lib/stb_truetype.so b/run_tree/lib/stb_truetype.so index 355297f..6d81294 100755 Binary files a/run_tree/lib/stb_truetype.so and b/run_tree/lib/stb_truetype.so differ diff --git a/run_tree/run.sh b/run_tree/run.sh index 4cdba56..90450ef 100755 --- a/run_tree/run.sh +++ b/run_tree/run.sh @@ -2,6 +2,6 @@ dest=game.wasm case "$1" in build) shift; onyx -V -I ../src build -o $dest $@ ;; - run) onyxrun $dest ;; + run) onyx-run $dest ;; *) onyx run -V -I ../src build $@ ;; esac \ No newline at end of file diff --git a/src/build.onyx b/src/build.onyx index 199acc6..b5fc9a5 100644 --- a/src/build.onyx +++ b/src/build.onyx @@ -7,8 +7,6 @@ MINOR_VERSION :: 1 // DEBUG :: true -#load_path ONYX_PATH - #if (package runtime).arch == .X86_64 { #library_path "./lib" } #if (package runtime).arch == .AARCH64 { #library_path "./lib/aarch64" } @@ -23,8 +21,8 @@ MINOR_VERSION :: 1 #load_all "./sfx" #load_all "./utils" -#load "modules/opengles/module" -#load "modules/glfw3/module" -#load "modules/openal/module" -#load "modules/stb_truetype/module" -#load "modules/stb_image/module" +#load "./../lib/opengles/module" +#load "./../lib/glfw3/module" +#load "./../lib/openal/module" +#load "./../lib/stb_truetype/module" +#load "./../lib/stb_image/module" diff --git a/src/config.onyx.template b/src/config.onyx.template deleted file mode 100644 index a396fa5..0000000 --- a/src/config.onyx.template +++ /dev/null @@ -1,4 +0,0 @@ -package runtime.vars - - -ONYX_PATH :: "" \ No newline at end of file diff --git a/src/entity/entities.onyx b/src/entity/entities.onyx index 8e91e0b..e8cd663 100644 --- a/src/entity/entities.onyx +++ b/src/entity/entities.onyx @@ -2,16 +2,14 @@ use package core use package glfw3 - +#tag Entity_Schematic.{ + (scene) => wall_create(scene, .{0,0}, .{0,0}) +} #local Wall :: struct { render :: (use this: ^Entity) { r := Entity.get_rect(this); immediate_rectangle(r.x, r.y, r.w, r.h); } - - #struct_tag Entity_Schematic.{ - (scene) => wall_create(scene, .{0,0}, .{0,0}) - } } wall_create :: (scene: ^Scene, pos, size: Vector2) -> ^Entity { @@ -27,6 +25,7 @@ wall_create :: (scene: ^Scene, pos, size: Vector2) -> ^Entity { return this; } +#tag Entity_Schematic.{create} #local Door :: struct { create :: (scene) => door_create(scene, .Zero, .Zero); @@ -50,8 +49,6 @@ wall_create :: (scene: ^Scene, pos, size: Vector2) -> ^Entity { door->toggle_open(); } } - - #struct_tag Entity_Schematic.{create} } DoorComponent :: struct { diff --git a/src/entity/items.onyx b/src/entity/items.onyx index de76aaf..3e35743 100644 --- a/src/entity/items.onyx +++ b/src/entity/items.onyx @@ -87,8 +87,8 @@ item_store_get_item :: (use this: ^Item_Store, id: str) -> ^Item { return items[id]; } +#tag Entity_Schematic.{create} #local Item_Entity :: struct { - #struct_tag Entity_Schematic.{create} create :: (scene) => { this := scene->make(); diff --git a/src/entity/scene.onyx b/src/entity/scene.onyx index cfcfad0..c9c7acc 100644 --- a/src/entity/scene.onyx +++ b/src/entity/scene.onyx @@ -82,18 +82,16 @@ SpriteRenderComponent :: struct { } } +#tag Entity_Store.Skip SizeComponent :: struct { use base: Component; func : (e: ^Entity) -> Rect; - - #struct_tag Entity_Store.Skip } +#tag Entity_Store.Skip InteractableComponent :: struct { use base: Component; interact: (e: ^Entity, interactor: ^Entity) -> void; - - #struct_tag Entity_Store.Skip } Entity :: struct { diff --git a/src/entity/schematics/background.onyx b/src/entity/schematics/background.onyx index 095abf4..5c6014e 100644 --- a/src/entity/schematics/background.onyx +++ b/src/entity/schematics/background.onyx @@ -3,18 +3,17 @@ use package core // #local background_texture: Texture; +#tag Entity_Schematic.{ Background.create } Background :: struct { - #struct_tag Entity_Schematic.{ - (scene) => { - this := scene->make(); - this.pos = .{0, 0}; - this.size = .{0, 0}; + create :: (scene) => { + this := scene->make(); + this.pos = .{0, 0}; + this.size = .{0, 0}; - scene->modify_component(this, BackgroundComponent) { - comp.texture_path = "./assets/images/background.png"; - } - - return this; + scene->modify_component(this, BackgroundComponent) { + comp.texture_path = "./assets/images/background.png"; } + + return this; } } diff --git a/src/entity/schematics/entryway.onyx b/src/entity/schematics/entryway.onyx index 825762c..8ceac16 100644 --- a/src/entity/schematics/entryway.onyx +++ b/src/entity/schematics/entryway.onyx @@ -1,25 +1,24 @@ use package core +#tag Entity_Schematic.{ Entryway.create } Entryway :: struct { - #struct_tag Entity_Schematic.{ - (scene) => { - this := scene->make(); - this.size = .{16, 16}; + create :: (scene) => { + this := scene->make(); + this.size = .{16, 16}; - scene->modify_component(this, SpriteRenderComponent) { - comp.sprite.sheet = "./assets/images/spritesheet.png"; - comp.sprite.pos = .{0, 0}; - comp.sprite.size = .{16, 16}; - comp.sprite.color = .{1, 1, 1}; - } - - scene->modify_component(this, EntrywayComponent) { - comp.schematic = "Patron"; - comp.spawned_size = .{16, 32}; - } + scene->modify_component(this, SpriteRenderComponent) { + comp.sprite.sheet = "./assets/images/spritesheet.png"; + comp.sprite.pos = .{0, 0}; + comp.sprite.size = .{16, 16}; + comp.sprite.color = .{1, 1, 1}; + } - return this; + scene->modify_component(this, EntrywayComponent) { + comp.schematic = "Patron"; + comp.spawned_size = .{16, 32}; } + + return this; } } diff --git a/src/entity/schematics/furniture.onyx b/src/entity/schematics/furniture.onyx index 06375a1..5ff56ab 100644 --- a/src/entity/schematics/furniture.onyx +++ b/src/entity/schematics/furniture.onyx @@ -1,11 +1,10 @@ use package core +#tag Entity_Schematic.{ + (scene) => Furniture.create(scene, .{0, 0}) +} Furniture :: struct { - #struct_tag Entity_Schematic.{ - (scene) => Furniture.create(scene, .{0, 0}) - } - create :: (scene: ^Scene, pos: Vector2) -> ^Entity { this := scene->make(); this.pos = pos; diff --git a/src/entity/schematics/patron.onyx b/src/entity/schematics/patron.onyx index 3a91d6a..197d1e7 100644 --- a/src/entity/schematics/patron.onyx +++ b/src/entity/schematics/patron.onyx @@ -1,11 +1,10 @@ use package core +#tag Entity_Schematic.{ + (scene) => Patron.create(scene, .{0,0}) +} Patron :: struct { - #struct_tag Entity_Schematic.{ - (scene) => Patron.create(scene, .{0,0}) - } - create :: (scene: ^Scene, pos: Vector2) -> ^Entity { this := scene->make(); this.pos = pos; diff --git a/src/entity/schematics/player.onyx b/src/entity/schematics/player.onyx index 2e17526..200a760 100644 --- a/src/entity/schematics/player.onyx +++ b/src/entity/schematics/player.onyx @@ -30,11 +30,10 @@ player_2_controls :: Player_Controls.{ } +#tag Entity_Schematic.{ + (scene: ^Scene) => Player.create(scene, .{0,0}) +} Player :: struct { - #struct_tag Entity_Schematic.{ - (scene: ^Scene) => Player.create(scene, .{0,0}) - } - create :: (scene: ^Scene, pos: Vector2, controls := player_1_controls) -> ^Entity { this := scene->make(); this.pos = pos; diff --git a/src/entity/schematics/tap.onyx b/src/entity/schematics/tap.onyx index ca956e6..60baef6 100644 --- a/src/entity/schematics/tap.onyx +++ b/src/entity/schematics/tap.onyx @@ -1,9 +1,8 @@ +#tag Entity_Schematic.{ + (scene) => Tap.create(scene, .{0,0}, .{0,0}) +} Tap :: struct { - #struct_tag Entity_Schematic.{ - (scene) => Tap.create(scene, .{0,0}, .{0,0}) - } - create :: (scene: ^Scene, pos: Vector2, size: Vector2) -> ^Entity { this := scene->make(); this.pos = pos; diff --git a/src/utils/vecmath.onyx b/src/utils/vecmath.onyx index c3e02e3..a2f38c6 100644 --- a/src/utils/vecmath.onyx +++ b/src/utils/vecmath.onyx @@ -1,12 +1,14 @@ #local hash :: package core.hash +#tag conv.Custom_Format.{format_vector2i} +#tag conv.Custom_Parse.{parse_vector2i} Vector2i :: struct { x, y: i32; - #struct_tag conv.Custom_Format.{format_vector2i} - #struct_tag conv.Custom_Parse.{parse_vector2i} } +#tag conv.Custom_Format.{format_vector2} +#tag conv.Custom_Parse.{parse_vector2} Vector2 :: struct { x, y: f32; @@ -21,16 +23,14 @@ Vector2 :: struct { Zero :: Vector2.{0, 0} - - #struct_tag conv.Custom_Format.{format_vector2} - #struct_tag conv.Custom_Parse.{parse_vector2} } +#tag conv.Custom_Format.{format_vector3i} Vector3i :: struct { x, y, z: i32; - #struct_tag conv.Custom_Format.{format_vector3i} } +#tag conv.Custom_Format.{format_vector3} Vector3 :: struct { x, y, z: f32; @@ -62,8 +62,6 @@ Vector3 :: struct { math.clamp(v.z, min.z, max.z), }; } - - #struct_tag conv.Custom_Format.{format_vector3} } #operator + macro (v1, v2: Vector2i) => (typeof v1).{ v1.x + v2.x, v1.y + v2.y };