From: Brendan Hansen Date: Tue, 28 Mar 2023 02:28:12 +0000 (-0500) Subject: keeping things up to date X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=fd226803fdcc5374ecdc61697b5cd6dd64302eec;p=bar-game.git keeping things up to date --- diff --git a/onyx-pkg.ini b/onyx-pkg.ini index 7dce445..fc9cc13 100644 --- a/onyx-pkg.ini +++ b/onyx-pkg.ini @@ -17,8 +17,8 @@ build_cmd= library= [dependencies] -git://onyxlang.io/repo/openal=0.0.2 -git://onyxlang.io/repo/ogre=0.0.15 +git://onyxlang.io/repo/openal=0.0.3 +git://onyxlang.io/repo/ogre=0.0.19 [dependency_folders] git://onyxlang.io/repo/openal=openal diff --git a/run_tree/lib/glfw3.dll b/run_tree/lib/glfw3.dll deleted file mode 100644 index 1d9f9a2..0000000 Binary files a/run_tree/lib/glfw3.dll and /dev/null differ diff --git a/run_tree/lib/onyx_glfw3.dll b/run_tree/lib/onyx_glfw3.dll deleted file mode 100644 index abd19ac..0000000 Binary files a/run_tree/lib/onyx_glfw3.dll and /dev/null differ diff --git a/run_tree/lib/onyx_opengles.dll b/run_tree/lib/onyx_opengles.dll deleted file mode 100644 index d015f35..0000000 Binary files a/run_tree/lib/onyx_opengles.dll and /dev/null differ diff --git a/run_tree/lib/onyx_runtime.dll b/run_tree/lib/onyx_runtime.dll deleted file mode 100644 index 53571c2..0000000 Binary files a/run_tree/lib/onyx_runtime.dll and /dev/null differ diff --git a/run_tree/lib/stb_truetype.dll b/run_tree/lib/stb_truetype.dll deleted file mode 100644 index 37e6b45..0000000 Binary files a/run_tree/lib/stb_truetype.dll and /dev/null differ diff --git a/run_tree/run.sh b/run_tree/run.sh index 2932a5b..465d817 100755 --- a/run_tree/run.sh +++ b/run_tree/run.sh @@ -1,9 +1,9 @@ dest=game.wasm case "$1" in - build) shift; onyx -V -I ../src build -o $dest $@ ;; + build) shift; onyx build -V -I ../src build -o $dest $@ ;; check) shift; onyx check -V -I ../src build $@ ;; - run) onyx-run $dest ;; + run) onyx run $dest ;; debug) shift; onyx run -V -I ../src build --debug $@ ;; *) onyx run -V -I ../src build $@ ;; esac diff --git a/src/build.onyx b/src/build.onyx index da15fdb..f2b99ce 100644 --- a/src/build.onyx +++ b/src/build.onyx @@ -1,5 +1,7 @@ package runtime.vars +use runtime + MAJOR_VERSION :: 0 MINOR_VERSION :: 1 diff --git a/src/entity/components/background.onyx b/src/entity/components/background.onyx index 241071c..3dfbae2 100644 --- a/src/entity/components/background.onyx +++ b/src/entity/components/background.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} BackgroundComponent :: struct { use component: Component; diff --git a/src/entity/components/collision_mask.onyx b/src/entity/components/collision_mask.onyx index acbefb8..190c4e4 100644 --- a/src/entity/components/collision_mask.onyx +++ b/src/entity/components/collision_mask.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} CollisionMaskComponent :: struct { use component: Component; diff --git a/src/entity/components/dispenser.onyx b/src/entity/components/dispenser.onyx index 98a8329..b6e60b6 100644 --- a/src/entity/components/dispenser.onyx +++ b/src/entity/components/dispenser.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} // // Currently, DispenserComponents only dispense Item_Entity's, and no diff --git a/src/entity/components/entryway.onyx b/src/entity/components/entryway.onyx index d313e78..f0f0311 100644 --- a/src/entity/components/entryway.onyx +++ b/src/entity/components/entryway.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} EntrywayComponent :: struct { use component: Component; diff --git a/src/entity/components/money.onyx b/src/entity/components/money.onyx index 78a2921..956ad55 100644 --- a/src/entity/components/money.onyx +++ b/src/entity/components/money.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} #local Transaction :: struct { amount: i32; diff --git a/src/entity/components/movement.onyx b/src/entity/components/movement.onyx index 6a0b0ea..af1749c 100644 --- a/src/entity/components/movement.onyx +++ b/src/entity/components/movement.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} Facing :: enum { diff --git a/src/entity/components/patron.onyx b/src/entity/components/patron.onyx index a68e1d4..3c44570 100644 --- a/src/entity/components/patron.onyx +++ b/src/entity/components/patron.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} #local Patron_State :: enum { Walking_To_Seat; diff --git a/src/entity/components/player.onyx b/src/entity/components/player.onyx index 88449ef..54a61ad 100644 --- a/src/entity/components/player.onyx +++ b/src/entity/components/player.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} PlayerComponent :: struct { use base: Component; diff --git a/src/entity/editor.onyx b/src/entity/editor.onyx index c045d93..e3865b4 100644 --- a/src/entity/editor.onyx +++ b/src/entity/editor.onyx @@ -7,9 +7,9 @@ // - [x] Serialize / Deserialize a scene // -use core -use ogre -use ogre.ui +use core {*} +use ogre {*} +use ogre.ui {*} use runtime {type_info :: info} use core.misc {as_any} @@ -449,7 +449,7 @@ editor_draw :: () { i += 1; y += Field_Height; - member_any := any.{cast(^u8) v.data + it.offset, it.type}; + member_any := any.{cast([&] u8) v.data + it.offset, it.type}; if is_button_just_down(GLFW_MOUSE_BUTTON_LEFT) { is_disabled := false; diff --git a/src/entity/entities.onyx b/src/entity/entities.onyx index f191b82..ff65d6c 100644 --- a/src/entity/entities.onyx +++ b/src/entity/entities.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} @Entity_Schematic.{ "Wall" } (scene: ^Scene) => wall_create(scene, .{0,0}, .{0,0}) diff --git a/src/entity/items.onyx b/src/entity/items.onyx index c69715b..69db529 100644 --- a/src/entity/items.onyx +++ b/src/entity/items.onyx @@ -1,7 +1,7 @@ -use core -use ogre -use ogre.ui +use core {*} +use ogre {*} +use ogre.ui {*} use core.misc {as_any, any_nested_selector} @@ -34,15 +34,17 @@ item_store_make :: () -> Item_Store { item_store_load_items_from_file :: (use this: ^Item_Store, path: str) { // @CopyNPaste // from entity/store.onyx - err, input_file := os.open(path, .Read); - if err != .None { + input_file_res := os.open(path, .Read); + if !input_file_res { logf(.Error, "Failed to open file: {}", path); return; } + input_file := input_file_res->unwrap(); + defer os.close(^input_file); reader := io.reader_make(^input_file); - use type_info; + use runtime.info {*}; current_item: ^Item; diff --git a/src/entity/scene.onyx b/src/entity/scene.onyx index f7a8cb3..5361788 100644 --- a/src/entity/scene.onyx +++ b/src/entity/scene.onyx @@ -1,6 +1,7 @@ -use core -use ogre +use core {*} +use ogre {*} +use runtime Entity_Nothing :: cast(Entity_ID) 0 Entity_ID :: #distinct u32 @@ -211,7 +212,7 @@ scene_create :: (width, height: f32) -> Scene { } #local scene_load_schematics :: (use this: ^Scene) { - use runtime.info; + use runtime.info { * }; index := 0; for type_table { diff --git a/src/entity/schematics/patron.onyx b/src/entity/schematics/patron.onyx index 7a4225e..0fdc230 100644 --- a/src/entity/schematics/patron.onyx +++ b/src/entity/schematics/patron.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} @Entity_Schematic.{ "Patron" } (scene: ^Scene) -> ^Entity { diff --git a/src/entity/schematics/player.onyx b/src/entity/schematics/player.onyx index 4703239..c56cf55 100644 --- a/src/entity/schematics/player.onyx +++ b/src/entity/schematics/player.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} Player_Controls :: struct { up : Keys; diff --git a/src/entity/store.onyx b/src/entity/store.onyx index f863772..2c3a27f 100644 --- a/src/entity/store.onyx +++ b/src/entity/store.onyx @@ -1,5 +1,5 @@ -use core +use core {*} use core.misc {any_nested_selector} // Flags to control how a field of a structure is being stored @@ -9,7 +9,12 @@ Entity_Store :: enum { } scene_save_to_file :: (use this: ^Scene, filename: str) { - err, output_file := os.open(filename, .Write); + output_file_res := os.open(filename, .Write); + if !output_file_res { + logf(.Error, "Failed to open file: {}", filename); + return; + } + output_file := output_file_res->unwrap(); defer os.close(^output_file); writer_ := io.writer_make(^output_file); @@ -19,7 +24,7 @@ scene_save_to_file :: (use this: ^Scene, filename: str) { // writer := ^stdio.print_writer; - use runtime.info; + use runtime.info {*}; for entities { name := it.schematic; @@ -42,7 +47,7 @@ scene_save_to_file :: (use this: ^Scene, filename: str) { } emit_struct_fields :: (v: any, dest: ^io.Writer, parent_name: str) { - use runtime.info; + use runtime.info {*}; info := cast(^Type_Info_Struct) get_type_info(v.type); assert(info.kind == .Struct, "Expected type to be a structure."); @@ -56,7 +61,7 @@ scene_save_to_file :: (use this: ^Scene, filename: str) { } member_info := get_type_info(it.type); - member_any := any.{cast(^u8) v.data + it.offset, it.type}; + member_any := any.{cast([&] u8) v.data + it.offset, it.type}; name := conv.format(name_buffer, "{}{}{}", parent_name, @@ -90,11 +95,13 @@ scene_save_to_file :: (use this: ^Scene, filename: str) { } scene_load_from_file :: (use this: ^Scene, filename: str, reset_scene := true) { - err, input_file := os.open(filename, .Read); - if err != .None { + input_file_res := os.open(filename, .Read); + if !input_file_res { logf(.Error, "Failed to open file: {}", filename); return; } + input_file := input_file_res->unwrap(); + defer os.close(^input_file); reader := io.reader_make(^input_file); @@ -105,7 +112,7 @@ scene_load_from_file :: (use this: ^Scene, filename: str, reset_scene := true) { next_entity_id = 0; } - use runtime.info; + use runtime.info {*}; current_entity: ^Entity; current_component: ^Component; diff --git a/src/game.onyx b/src/game.onyx index d692f97..de0ef70 100644 --- a/src/game.onyx +++ b/src/game.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} // // Game Global Variables @@ -30,7 +30,7 @@ game_init :: () { // This process of queueing the asset bucket should // be made automatic somehow... - Spritesheet', _ := texture_lookup(#cstr "./assets/images/spritesheet.png"); + Spritesheet~, _ := texture_lookup(#cstr "./assets/images/spritesheet.png"); load_assets(); @@ -70,7 +70,7 @@ game_update :: (dt: f32) { } game_draw :: () { - canvas_use(^scene_canvas); + canvas_use(&scene_canvas); immediate_clear(.{0.15, 0.15, 0.2}); scene->draw(); immediate_flush(); @@ -79,8 +79,8 @@ game_draw :: () { immediate_clear(.{0.04, 0.04, 0.06}); immediate_set_color(.{1, 1, 1}); - texture := canvas_to_texture(^scene_canvas); - texture_wrap(^texture, .Clamp); + texture := canvas_to_texture(&scene_canvas); + texture_wrap(&texture, .Clamp); view_rect: Rect; if !editor_shown() { view_rect = Rect.{0, 0, ~~window.width, ~~window.height}; @@ -96,7 +96,7 @@ game_draw :: () { use opengles { glDisable, glEnable, GL_CULL_FACE } glDisable(GL_CULL_FACE); - immediate_image(^texture, view_rect.x, ~~window.height - view_rect.y, view_rect.w, -view_rect.h); + immediate_image(&texture, view_rect.x, ~~window.height - view_rect.y, view_rect.w, -view_rect.h); if distortion_enabled { shader_use(distortion_shader); shader_set_uniform(distortion_shader, #cstr "u_texture", 0); diff --git a/src/main.onyx b/src/main.onyx index 28b9757..e235f19 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -1,7 +1,7 @@ // #inject runtime.vars.Onyx_Enable_Operator_Methods :: true -use core -use ogre +use core {*} +use ogre {*} DEBUG :: #defined(runtime.vars.DEBUG) diff --git a/src/sfx/audio_manager.onyx b/src/sfx/audio_manager.onyx index 56f2ee0..8307870 100644 --- a/src/sfx/audio_manager.onyx +++ b/src/sfx/audio_manager.onyx @@ -1,6 +1,6 @@ -use core -use openal +use core {*} +use openal {*} Sound :: struct { buffer: u32; diff --git a/src/sfx/wav_file.onyx b/src/sfx/wav_file.onyx index c5c9ee7..0f215be 100644 --- a/src/sfx/wav_file.onyx +++ b/src/sfx/wav_file.onyx @@ -1,5 +1,5 @@ -use core +use core {*} WAV_File :: struct { Format :: enum { @@ -64,4 +64,4 @@ load_wav_file :: (path: str) -> WAV_File { defer pos += n; return data[pos .. pos+n]; } -} \ No newline at end of file +} diff --git a/src/utils/asset_loader.onyx b/src/utils/asset_loader.onyx index ad92c90..6e1b40e 100644 --- a/src/utils/asset_loader.onyx +++ b/src/utils/asset_loader.onyx @@ -1,6 +1,6 @@ -use core -use ogre +use core {*} +use ogre {*} queue_assets :: (store: ^$T, callsite := #callsite) { assets_to_load << .{ T, store, callsite }; @@ -26,13 +26,13 @@ load_assets :: () { } load_asset_bucket :: (bucket: ^Asset_Bucket_To_Load) { - use package runtime.info + use package runtime.info {*} struct_info := cast(^Type_Info_Struct) get_type_info(bucket.type); if struct_info.kind != .Struct do return; for struct_info.members { - load_asset(cast(^u8) bucket.dest + it.offset, it.type, bucket.location, it.tags); + load_asset(cast([&] u8) bucket.dest + it.offset, it.type, bucket.location, it.tags); } } diff --git a/src/utils/logger.onyx b/src/utils/logger.onyx index 6c9b44c..be18493 100644 --- a/src/utils/logger.onyx +++ b/src/utils/logger.onyx @@ -3,6 +3,8 @@ // but for now this is just for logging to the command line. // +use core + logf :: (level: Log_Level, format: str, args: ..any) { buf: [2048] u8; log(level, core.conv.format_va(buf, format, args));