From: Brendan Hansen Date: Thu, 5 Jan 2023 02:46:41 +0000 (-0600) Subject: removed (almost) all mentions of glfw and opengles X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d1cbb485bcb6a9675dc6937a82b171e06a3a77c5;p=bar-game.git removed (almost) all mentions of glfw and opengles --- diff --git a/.vscode/launch.json b/.vscode/launch.json index 37150fb..29bdcb9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,7 +14,7 @@ "name": "Launch", "onyxFiles": ["../src/build"], "workingDir": "${workspaceFolder}/run_tree", - "stopOnEntry": false + "stopOnEntry": false, // "preLaunchTask": "Build debug game" } ] diff --git a/docs/gameplay.md b/docs/gameplay.md new file mode 100644 index 0000000..13686ed --- /dev/null +++ b/docs/gameplay.md @@ -0,0 +1,9 @@ +Gameplay Flow +============= + +Target play-time should be around 10-15 minutes. This is going to be an +arcade game in a bar, so the more people that can play in a fixed amount +of time, the better. + + + diff --git a/onyx-pkg.ini b/onyx-pkg.ini index 27fd7a2..22bddb8 100644 --- a/onyx-pkg.ini +++ b/onyx-pkg.ini @@ -18,7 +18,7 @@ library= [dependencies] git://onyxlang.io/repo/openal=0.0.2 -git://onyxlang.io/repo/ogre=0.0.10 +git://onyxlang.io/repo/ogre=0.0.11 [dependency_folders] git://onyxlang.io/repo/openal=openal diff --git a/run_tree/run.sh b/run_tree/run.sh index 83d0bb3..b947b0b 100755 --- a/run_tree/run.sh +++ b/run_tree/run.sh @@ -1,11 +1,9 @@ dest=game.wasm case "$1" in - build) shift; onyx -V --tag -I ../src build -o $dest $@ ;; + build) shift; onyx -V --tag -I ../src build -o $dest $@; mv tags .. ;; check) shift; onyx check -V -I ../src build $@ ;; run) onyx-run $dest ;; - debug) onyx-run --debug $dest ;; - *) onyx run -V --tag -I ../src build $@ ;; + debug) shift; onyx run -V -I ../src build --debug $@ ;; + *) onyx run -V --tag -I ../src build $@; mv tags .. ;; esac - -mv tags .. \ No newline at end of file diff --git a/run_tree/scenes/starter.scene b/run_tree/scenes/starter.scene new file mode 100644 index 0000000..0344e5a --- /dev/null +++ b/run_tree/scenes/starter.scene @@ -0,0 +1,257 @@ +[Background] +id = 1 +flags = 0 +nickname = "" +pos.x = 592.0000 +pos.y = 297.0000 +size.x = 1280.0000 +size.y = 722.0000 +:BackgroundComponent +texture_path = "./assets/images/background.png" +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 3 +flags = 2 +nickname = "" +pos.x = 397.0000 +pos.y = 576.0000 +size.x = 826.0000 +size.y = 64.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 4 +flags = 2 +nickname = "" +pos.x = 400.0000 +pos.y = 37.0000 +size.x = 816.0000 +size.y = 80.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 5 +flags = 2 +nickname = "" +pos.x = 768.0000 +pos.y = 304.0000 +size.x = 64.0000 +size.y = 512.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 6 +flags = 2 +nickname = "" +pos.x = 40.0000 +pos.y = 128.0000 +size.x = 80.0000 +size.y = 192.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 7 +flags = 2 +nickname = "" +pos.x = 40.0000 +pos.y = 480.0000 +size.x = 80.0000 +size.y = 256.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 8 +flags = 2 +nickname = "" +pos.x = 161.0000 +pos.y = -136.0000 +size.x = 16.0000 +size.y = 16.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Entryway] +id = 9 +flags = 0 +nickname = "" +pos.x = 40.0000 +pos.y = 288.0000 +size.x = 80.0000 +size.y = 128.0000 +:SpriteRenderComponent +sprite.sheet = "./assets/images/spritesheet.png" +sprite.pos.x = 80.0000 +sprite.pos.y = 32.0000 +sprite.size.x = 32.0000 +sprite.size.y = 16.0000 +sprite.color.r = 1.0000 +sprite.color.g = 1.0000 +sprite.color.b = 1.0000 +sprite.color.a = 1.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 +:EntrywayComponent +schematic = "Patron" +spawned_size.x = 32.0000 +spawned_size.y = 64.0000 +enabled = true +spawn_timeout_min = 5.0000 +spawn_timeout_max = 10.0000 +spawn_timeout = 10.0000 + +[Wall] +id = 10 +flags = 2 +nickname = "" +pos.x = 576.0000 +pos.y = 312.0000 +size.x = 64.0000 +size.y = 336.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Wall] +id = 11 +flags = 2 +nickname = "" +pos.x = 171.0000 +pos.y = -126.0000 +size.x = 16.0000 +size.y = 16.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 + +[Tap] +id = 12 +flags = 3 +nickname = "" +pos.x = 704.0000 +pos.y = 352.0000 +size.x = 64.0000 +size.y = 64.0000 +:SpriteRenderComponent +sprite.sheet = "./assets/images/spritesheet.png" +sprite.pos.x = 0.0000 +sprite.pos.y = 32.0000 +sprite.size.x = 32.0000 +sprite.size.y = 32.0000 +sprite.color.r = 1.0000 +sprite.color.g = 1.0000 +sprite.color.b = 1.0000 +sprite.color.a = 1.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 +:DispenserComponent +item = "beer" +max_timeout = 2.0000 +draw_item = true + +[Tap] +id = 14 +flags = 3 +nickname = "" +pos.x = 704.0000 +pos.y = 224.0000 +size.x = 64.0000 +size.y = 64.0000 +:SpriteRenderComponent +sprite.sheet = "./assets/images/spritesheet.png" +sprite.pos.x = 0.0000 +sprite.pos.y = 32.0000 +sprite.size.x = 32.0000 +sprite.size.y = 32.0000 +sprite.color.r = 1.0000 +sprite.color.g = 1.0000 +sprite.color.b = 1.0000 +sprite.color.a = 1.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 +:DispenserComponent +item = "beer" +max_timeout = 2.0000 +draw_item = true + +[Tap] +id = 15 +flags = 3 +nickname = "" +pos.x = 704.0000 +pos.y = 288.0000 +size.x = 64.0000 +size.y = 64.0000 +:SpriteRenderComponent +sprite.sheet = "./assets/images/spritesheet.png" +sprite.pos.x = 0.0000 +sprite.pos.y = 32.0000 +sprite.size.x = 32.0000 +sprite.size.y = 32.0000 +sprite.color.r = 1.0000 +sprite.color.g = 1.0000 +sprite.color.b = 1.0000 +sprite.color.a = 1.0000 +:RenderComponent +layer = 0 +color.r = 1.0000 +color.g = 1.0000 +color.b = 1.0000 +color.a = 1.0000 +:DispenserComponent +item = "beer" +max_timeout = 2.0000 +draw_item = true + diff --git a/src/build.onyx b/src/build.onyx index 5c2199d..cec2776 100644 --- a/src/build.onyx +++ b/src/build.onyx @@ -4,7 +4,7 @@ package runtime.vars MAJOR_VERSION :: 0 MINOR_VERSION :: 1 -DEBUG :: true +// DEBUG :: true #if runtime.arch == .X86_64 { #library_path "./lib" } @@ -22,4 +22,3 @@ DEBUG :: true #load "./../lib/openal/module" #load "./../lib/ogre/module" -// #load_all "./ogre" diff --git a/src/entity/components/movement.onyx b/src/entity/components/movement.onyx index 04b4bc2..6a0b0ea 100644 --- a/src/entity/components/movement.onyx +++ b/src/entity/components/movement.onyx @@ -1,6 +1,5 @@ use core -use glfw3 use ogre diff --git a/src/entity/components/player.onyx b/src/entity/components/player.onyx index 314a89d..88449ef 100644 --- a/src/entity/components/player.onyx +++ b/src/entity/components/player.onyx @@ -1,6 +1,5 @@ use core -use glfw3 use ogre PlayerComponent :: struct { diff --git a/src/entity/editor.onyx b/src/entity/editor.onyx index 71c1c0c..c36aa05 100644 --- a/src/entity/editor.onyx +++ b/src/entity/editor.onyx @@ -8,13 +8,17 @@ // use core -use opengles -use glfw3 use ogre use ogre.ui use runtime {type_info :: info} use core.misc {as_any} +// TODO: Remove needing glfw3 here. Everything should go through OGRE. +use glfw3 { + GLFW_MOUSE_BUTTON_LEFT, + GLFW_MOUSE_BUTTON_RIGHT +} + Editor_Range :: struct {min, max: f32;} Editor_Disabled :: struct {} Editor_Hidden :: struct {} @@ -44,11 +48,11 @@ editor_toggle :: () { editor_update :: (dt: f32) { move_towards(^editor_openness, editor_target_openness, dt * 6); - if is_key_just_up(GLFW_KEY_1) do clicked_tab = .File; - if is_key_just_up(GLFW_KEY_2) do clicked_tab = .Edit; - if is_key_just_up(GLFW_KEY_3) do clicked_tab = .Create; - if is_key_just_up(GLFW_KEY_4) do clicked_tab = .Actions; - if is_key_just_up(GLFW_KEY_G) do editor_grid_shown = !editor_grid_shown; + if is_key_just_up(.NUM_1) do clicked_tab = .File; + if is_key_just_up(.NUM_2) do clicked_tab = .Edit; + if is_key_just_up(.NUM_3) do clicked_tab = .Create; + if is_key_just_up(.NUM_4) do clicked_tab = .Actions; + if is_key_just_up(.G) do editor_grid_shown = !editor_grid_shown; handle_clicking_tab(dt); switch active_tab { @@ -141,10 +145,10 @@ editor_update :: (dt: f32) { } } else { - if is_key_down(GLFW_KEY_UP) do selected_entity.pos.y -= 32 * dt; - if is_key_down(GLFW_KEY_DOWN) do selected_entity.pos.y += 32 * dt; - if is_key_down(GLFW_KEY_LEFT) do selected_entity.pos.x -= 32 * dt; - if is_key_down(GLFW_KEY_RIGHT) do selected_entity.pos.x += 32 * dt; + if is_key_down(.UP) do selected_entity.pos.y -= 32 * dt; + if is_key_down(.DOWN) do selected_entity.pos.y += 32 * dt; + if is_key_down(.LEFT) do selected_entity.pos.x -= 32 * dt; + if is_key_down(.RIGHT) do selected_entity.pos.x += 32 * dt; } if resizing { @@ -162,7 +166,7 @@ editor_update :: (dt: f32) { } } - if is_key_just_down(GLFW_KEY_DELETE) { + if is_key_just_down(.DELETE) { scene->delete(selected_entity); selected_entity_id = Entity_Nothing; } diff --git a/src/entity/schematics/player.onyx b/src/entity/schematics/player.onyx index d293a2d..4703239 100644 --- a/src/entity/schematics/player.onyx +++ b/src/entity/schematics/player.onyx @@ -1,6 +1,5 @@ use core -use glfw3 use ogre Player_Controls :: struct { diff --git a/src/entity/schematics/tap.onyx b/src/entity/schematics/tap.onyx index ffcfe23..b0acb77 100644 --- a/src/entity/schematics/tap.onyx +++ b/src/entity/schematics/tap.onyx @@ -1,7 +1,7 @@ use ogre @Entity_Schematic.{ "Tap" } -(scene: ^Scene) -> ^Entity { +create :: (scene: ^Scene) -> ^Entity { this := scene->make(); this.pos = .{0, 0}; this.size = .{0, 0}; diff --git a/src/entity/store.onyx b/src/entity/store.onyx index c9af714..f863772 100644 --- a/src/entity/store.onyx +++ b/src/entity/store.onyx @@ -11,7 +11,10 @@ Entity_Store :: enum { scene_save_to_file :: (use this: ^Scene, filename: str) { err, output_file := os.open(filename, .Write); defer os.close(^output_file); + writer_ := io.writer_make(^output_file); + defer io.writer_free(^writer_); + writer := ^writer_; // writer := ^stdio.print_writer; diff --git a/src/game.onyx b/src/game.onyx index 6fe7412..9450b5b 100644 --- a/src/game.onyx +++ b/src/game.onyx @@ -1,7 +1,5 @@ use core -use glfw3 -use opengles use ogre // @@ -51,13 +49,13 @@ game_update :: (dt: f32) { game_time += dt; Audio_Manager.tick(); - if is_key_just_up(GLFW_KEY_F8) { - log(.Info, "Saving to '{}'.", quick_save_file); + if is_key_just_up(.F8) { + logf(.Info, "Saving to '{}'.", quick_save_file); scene->save_to_file(quick_save_file); } - if is_key_just_up(GLFW_KEY_F9) { - log(.Info, "Loading from '{}'.", quick_save_file); + if is_key_just_up(.F9) { + logf(.Info, "Loading from '{}'.", quick_save_file); scene->load_from_file(quick_save_file); } @@ -96,6 +94,8 @@ game_draw :: () { } scene_render_offset = Rect.top_left(view_rect); + 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); if distortion_enabled { diff --git a/src/main.onyx b/src/main.onyx index f03afb1..bd4f7e3 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -1,8 +1,6 @@ // #inject runtime.vars.Onyx_Enable_Operator_Methods :: true use core -use opengles -use glfw3 use ogre DEBUG :: #defined(runtime.vars.DEBUG) @@ -29,17 +27,18 @@ init :: () { deinit :: () { game_deinit(); + ogre_deinit(); } update :: (dt: f32) { input_update(); - if is_key_just_up(GLFW_KEY_ESCAPE) { + if is_key_just_up(.ESCAPE) { window->set_should_close(true); return; } - if is_key_just_up(GLFW_KEY_F7) { + if is_key_just_up(.F7) { editor_toggle(); }