From 30776857a227495f8e545ac508a69918bd6babf1 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sat, 18 Apr 2026 21:58:58 -0500 Subject: [PATCH] Bunch of stuff --- LICENSE.md | 14 +++- lib/attribution.rb | 17 ++++- lib/dialog.rb | 9 +++ lib/dialogs/about.rb | 25 ++++--- lib/pages/boot/initial_setup.rb | 65 ++++++++++++++++++ lib/pages/boot/start_up.rb | 82 +++++++++++++++++++++++ lib/pages/boot/terms.rb | 38 +++++++++++ lib/pages/games.rb | 10 +-- lib/pages/server_browser.rb | 6 +- lib/state.rb | 9 +++ lib/states/boot.rb | 35 ++++++++++ lib/states/interface.rb | 112 +++++++++++++++++++++++++++++++ lib/theme.rb | 27 +++++++- lib/window.rb | 114 ++------------------------------ media/ui/rounded_tiny.png | Bin 0 -> 173 bytes w3d_hub_linux_launcher.rb | 7 ++ 16 files changed, 432 insertions(+), 138 deletions(-) create mode 100644 lib/dialog.rb create mode 100644 lib/pages/boot/initial_setup.rb create mode 100644 lib/pages/boot/start_up.rb create mode 100644 lib/pages/boot/terms.rb create mode 100644 lib/state.rb create mode 100644 media/ui/rounded_tiny.png diff --git a/LICENSE.md b/LICENSE.md index 0a4296e..f065e1f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,15 @@ -Copyright (c) 2021 cyberarm +Copyright (c) 2021-2026 cyberarm -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to +the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/attribution.rb b/lib/attribution.rb index d765f8c..d22ce28 100644 --- a/lib/attribution.rb +++ b/lib/attribution.rb @@ -3,15 +3,28 @@ module W3DHubLauncher Item = Data.define(:name, :description, :url, :license, :license_url) SPECIAL_THANKS = [ + Item.new("W3D Hub", "Creating awesome games and mods for free", "https://w3dhub.com", "", ""), Item.new("Yukihiro \"matz\" Matsumoto", "Creating the Ruby language", "https://matz.rubyist.net", "", ""), - Item.new("Kenney", "Creating awesome game assets and releasing them completely for free.\nThe launcher uses their UI Icon pack.", "https://kenney.nl", "CC0", "https://creativecommons.org/publicdomain/zero/1.0/") + Item.new("Samuel \"ioquatix\" Williams", "Creating and maintaining the async libraries for Ruby", "https://www.codeotaku.com", "", ""), + Item.new("Kenney", "Creating awesome game assets and releasing them completely for free\nThe launcher uses their UI Icon pack", "https://kenney.nl", "CC0", "https://creativecommons.org/publicdomain/zero/1.0/"), ] LIBRARIES = [ - Item.new("Ruby", "Programming language. A Programmer's Best Friend", "https://ruby-lang.org", "2-clause BSDL", "https://www.ruby-lang.org/en/about/license.txt"), + Item.new("Ruby", "Programming language. A Programmer's Best Friend", "https://ruby-lang.org", "BSD 2-Clause", "https://www.ruby-lang.org/en/about/license.txt"), Item.new("gosu", "Light-weight game library", "https://libgosu.org", "MIT", "https://github.com/gosu/gosu/blob/master/COPYING"), Item.new("SDL2", "Simple DirectMedia Layer", "https://libsdl.org", "MIT", "https://github.com/libsdl-org/SDL/blob/SDL2/LICENSE.txt"), Item.new("MojoAL", "OpenAL sound library implementation in a single C file", "https://icculus.org/mojoAL/", "MIT", "https://github.com/icculus/mojoAL/blob/main/LICENSE.txt"), + + Item.new("async", "Asynchronous event-driven reactor for Ruby", "https://github.com/socketry/async", "MIT", "https://github.com/socketry/async/blob/main/license.md"), + Item.new("async-http", "Asynchronous http(s) client/server for Ruby", "https://github.com/socketry/async-http", "MIT", "https://github.com/socketry/async-http/blob/main/license.md"), + Item.new("async-websocket", "Asynchronous websockets for Ruby", "https://github.com/socketry/async-websocket", "MIT", "https://github.com/socketry/async-websocket/blob/main/license.md"), + Item.new("rubyzip", "Ruby library for reading and writing zip files", "https://github.com/rubyzip/rubyzip", "BSD 2-Clause", "https://github.com/rubyzip/rubyzip/blob/main/LICENSE.md"), + Item.new("digest-crc", "Ruby library for reading and writing zip files", "https://github.com/postmodern/digest-crc", "MIT", "https://github.com/postmodern/digest-crc/blob/main/LICENSE.txt"), + Item.new("ircparser", "Ruby parser for the IRCv3 message format", "https://codeberg.org/sadiepowell/ircparser-ruby", "MIT", "https://codeberg.org/sadiepowell/ircparser-ruby#license"), + + Item.new("base64", "Ruby library for encoding and decoding base64", "https://github.com/ruby/base64", "BSD 2-Clause", "https://github.com/ruby/base64/blob/master/COPYING"), + Item.new("rexml", "Ruby library for parsing XML", "https://github.com/ruby/rexml", "BSD 2-Clause", "https://github.com/ruby/rexml/blob/master/LICENSE.txt"), + Item.new("logger", "Ruby logging library", "https://github.com/ruby/logger", "BSD 2-Clause", "https://github.com/ruby/logger/blob/master/COPYING"), ] end end diff --git a/lib/dialog.rb b/lib/dialog.rb new file mode 100644 index 0000000..4d31d63 --- /dev/null +++ b/lib/dialog.rb @@ -0,0 +1,9 @@ +module W3DHubLauncher + class Dialog < CyberarmEngine::Dialog + def setup + theme(THEME) + + background 0xee_222222 + end + end +end diff --git a/lib/dialogs/about.rb b/lib/dialogs/about.rb index 18a6f55..8cea50b 100644 --- a/lib/dialogs/about.rb +++ b/lib/dialogs/about.rb @@ -1,23 +1,18 @@ module W3DHubLauncher - module Dialog - class About < CyberarmEngine::Dialog + class Dialog + class About < W3DHubLauncher::Dialog def setup - # application name and version - # authorship - # special thanks - # used gems and libraries - # useful links - theme(THEME) - background 0xee_222222 + super - stack(width: 1.0, max_width: 600, height: 1.0, max_height: 600, h_align: :center, v_align: :center, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0x88_000000) do - flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0xaa_000000) do + stack(width: 1.0, max_width: 600, height: 1.0, max_height: 600, h_align: :center, v_align: :center, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK) do + flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do banner "About", width: 1.0, text_align: :center end stack(width: 1.0, fill: true, scroll: true, padding_left: PADDING, padding_right: PADDING) do title NAME - para "© 2026 cyberarm", margin_left: PADDING + tagline format("v%s (%s)", VERSION, VERSION_NAME), margin_left: PADDING + para "© 2021 - #{Time.now.year} cyberarm", margin_left: PADDING link "MIT licence", margin_left: PADDING title "Special Thanks", margin_top: LARGE_PADDING @@ -31,10 +26,14 @@ module W3DHubLauncher end end - flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0xaa_000000) do + flow(width: 1.0, padding: PADDING, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do + flow(fill: true) + button "Close" do pop_state end + + flow(fill: true) end end end diff --git a/lib/pages/boot/initial_setup.rb b/lib/pages/boot/initial_setup.rb new file mode 100644 index 0000000..3d51f55 --- /dev/null +++ b/lib/pages/boot/initial_setup.rb @@ -0,0 +1,65 @@ +module W3DHubLauncher + module Page + module Boot + class InitialSetup < CyberarmEngine::Page + include GuiExt + + def setup + stack(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: 8, background_nine_slice_color: 0x11_ffffff, padding: HALF_PADDING) do + banner "Welcome to #{NAME}", width: 1.0, text_align: :center + tagline "Your gateway to the world of W3D Hub games.", width: 1.0, text_align: :center + end + + stack(width: 1.0, fill: true, padding: PADDING) do + stack(width: 1.0, fill: true, scroll: true) do + title "Initial Setup" + caption "Please confirm launcher's default settings and make any desired tweaks.", font: FONT_REGULAR + + flow(width: 1.0, height: 40, margin_top: PADDING) do + tagline "Launcher data directory", height: 1.0, text_v_align: :center + edit_line format("%s/.local/share/W3D Hub", Dir.home), fill: true + button "Browse..." + end + inscription "Location where the launcher stores it's configuration files and cache interface data." + + flow(width: 1.0, height: 40, margin_top: HALF_PADDING) do + tagline "Launcher package cache directory", height: 1.0, text_v_align: :center + edit_line format("%s/.local/share/W3D Hub/package-cache", Dir.home), fill: true + button "Browse..." + end + inscription "Location where the launcher will download application packages." + + flow(width: 1.0, height: 40, margin_top: HALF_PADDING) do + tagline "Application installation directory", height: 1.0, text_v_align: :center + edit_line format("%s/.local/share/W3D Hub/applications", Dir.home), fill: true + button "Browse..." + end + inscription "Location where the launcher will install new applications." + + flow(width: 1.0, height: 40, margin_top: HALF_PADDING) do + tagline "Wine context", height: 1.0, text_v_align: :center + edit_line "", fill: true + button "Browse..." + end + inscription "Location of wine context to use. Leave blank to use default." + + flow(width: 1.0, height: 40, margin_top: HALF_PADDING) do + tagline "Wine command", height: 1.0, text_v_align: :center + edit_line "wine", fill: true + button "Browse..." + end + inscription "Path to wine executable. Use `wine` for system installed wine." + end + + flow(width: 1.0, padding_top: PADDING) do + flow(fill: true) + button "Accept" do + page(Page::Boot::StartUp) + end + end + end + end + end + end + end +end diff --git a/lib/pages/boot/start_up.rb b/lib/pages/boot/start_up.rb new file mode 100644 index 0000000..18a5b31 --- /dev/null +++ b/lib/pages/boot/start_up.rb @@ -0,0 +1,82 @@ +module W3DHubLauncher + module Page + module Boot + class StartUp < CyberarmEngine::Page + include GuiExt + + def setup + stack(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: 8, background_nine_slice_color: 0x11_ffffff, padding: HALF_PADDING) do + banner "Establishing Battlefield Control", width: 1.0, text_align: :center + tagline "Please stand by...", width: 1.0, text_align: :center + end + + stack(width: 1.0, fill: true, padding: PADDING) do + stack(width: 1.0, fill: true, scroll: true) do + a = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/checkmark.png"), height: 1.0, v_align: :center + tagline "DNS resolution", height: 1.0, text_v_align: :center + end + after(500) do + a.show + end + b = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/information.png"), height: 1.0, v_align: :center, color: 0xff_ff8800 + tagline "Upstream backend", height: 1.0, text_v_align: :center + caption "Notice: Unreachable. Accounts will be unavailable.", height: 1.0, text_v_align: :center, color: 0xff_ff8800 + end + after(1000) do + b.show + end + c = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/checkmark.png"), height: 1.0, v_align: :center + tagline "Alternate backend", height: 1.0, text_v_align: :center + end + after(1500) do + c.show + end + d = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/information.png"), height: 1.0, v_align: :center, color: 0xff_ff8800 + tagline "Refresh account session", height: 1.0, text_v_align: :center + caption "Notice: Upstream backend unavailable, session not refreshed.", height: 1.0, text_v_align: :center, color: 0xff_ff8800 + end + after(2000) do + d.show + end + e = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/checkmark.png"), height: 1.0, v_align: :center + tagline "Fetch game servers", height: 1.0, text_v_align: :center + end + after(2500) do + e.show + end + f = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do + image safe_get_image("./media/icons/cross.png"), height: 1.0, v_align: :center, color: 0xff_ff0000 + tagline "Fetch applications", height: 1.0, text_v_align: :center + caption "Fatal: Failed to retrieve applications list and no local cache exists. Cannot continue.", height: 1.0, text_v_align: :center, color: 0xff_ff0000 + end + after(3000) do + f.show + @progress_bar.type = :linear + @progress_bar.value = 0.0 + end + + after(3500) do + parent.page_host.clear do + banner "Battlefield control established".upcase, width: 1.0, height: 1.0, text_v_align: :center, text_align: :center + end + end + after(3600) do + pop_state + push_state(States::Interface) + end + end + + flow(width: 1.0, padding_top: PADDING) do + @progress_bar = progress width: 1.0, type: :marquee + end + end + end + end + end + end +end diff --git a/lib/pages/boot/terms.rb b/lib/pages/boot/terms.rb new file mode 100644 index 0000000..2308892 --- /dev/null +++ b/lib/pages/boot/terms.rb @@ -0,0 +1,38 @@ +module W3DHubLauncher + module Page + module Boot + class Terms < CyberarmEngine::Page + include GuiExt + + TERMS_AND_CONDITIONS = <<~TERMS + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + TERMS + + def setup + flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: 8, background_nine_slice_color: 0x11_ffffff, padding: HALF_PADDING) do + banner "Terms and Conditions", width: 1.0, text_align: :center + end + + stack(width: 1.0, fill: true, padding: PADDING) do + stack(width: 1.0, fill: true, scroll: true, padding_bottom: PADDING) do + tagline TERMS_AND_CONDITIONS, font: FONT_REGULAR + end + + flow(width: 1.0) do + flow(fill: true) + button "Decline", margin_right: PADDING do + window.close + end + + button "Accept" do + page(Page::Boot::InitialSetup) + end + end + end + end + end + end + end +end diff --git a/lib/pages/games.rb b/lib/pages/games.rb index bd7ec81..2d93184 100644 --- a/lib/pages/games.rb +++ b/lib/pages/games.rb @@ -6,14 +6,14 @@ module W3DHubLauncher def setup # game bar container flow(width: 1.0, height: 60) do - flow(width: 220, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK) do + flow(width: 220, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do flow(width: 1.0, height: 40, margin_left: PADDING, v_align: :center, h_align: :center) do image safe_get_image("./media/icons/menuGrid.png"), height: 40, color: 0xff_bbbbbb link "ALL GAMES", text_size: 24, font: FONT_BLACK, height: 1.0, text_v_align: :center end end - flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK, margin_left: PADDING) do + flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do image safe_get_image("./data/cache/apb.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0x88_5e5c64, border_thickness_bottom: 3, border_color_bottom: 0xff_3584e4, tip: "Red Alert: A Path Beyond" image safe_get_image("./data/cache/ren.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, tip: "Command & Conquer: Renegade" image safe_get_image("./data/cache/tsr.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, tip: "Tiberian Sun: Reborn" @@ -48,7 +48,7 @@ module W3DHubLauncher # game events and news container stack(fill: true, height: 1.0, margin_left: LARGE_PADDING, scroll: true) do - flow(width: 1.0, height: 1.0, max_height: 380, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK) do + flow(width: 1.0, height: 1.0, max_height: 380, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do image safe_get_image("./media/background.png"), fill: true, aspect_ratio: 16.0 / 9.0 stack(fill: true, height: 1.0, margin_left: PADDING) do @@ -65,9 +65,9 @@ module W3DHubLauncher # news container flow(width: 1.0, margin_top: PADDING) do 9.times do - stack(width: 1.0 / 3, height: 345, aspect_ratio: 1, margin_left: HALF_PADDING, margin_right: HALF_PADDING, margin_bottom: PADDING) do + stack(width: 1.0 / 3, min_width: 345, height: 345, aspect_ratio: 1, margin_left: HALF_PADDING, margin_right: HALF_PADDING, margin_bottom: PADDING) do stack(width: 1.0, fill: true, background_image: safe_get_image("./media/background.png"), background_image_mode: :fill) - stack(width: 1.0, height: 1.0 / 3, padding: PADDING, v_align: :bottom, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK, border_thickness_top: 1, border_color_top: Gosu::Color::BLACK) do + stack(width: 1.0, height: 1.0 / 3, padding: PADDING, v_align: :bottom, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, border_thickness_top: 1, border_color_top: Gosu::Color::BLACK) do caption "NEWS", color: 0x88_ffffff tagline "A News Item Post A News Item Post" end diff --git a/lib/pages/server_browser.rb b/lib/pages/server_browser.rb index 9aa1694..9d4107a 100644 --- a/lib/pages/server_browser.rb +++ b/lib/pages/server_browser.rb @@ -6,14 +6,14 @@ module W3DHubLauncher def setup # game bar container flow(width: 1.0, height: 60) do - flow(width: 220, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK) do + flow(width: 220, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY) do flow(width: 1.0, height: 40, margin_left: PADDING, v_align: :center, h_align: :center) do image safe_get_image("./media/icons/menuGrid.png"), height: 40, color: 0xff_bbbbbb link "ALL SERVERS", text_size: 24, font: FONT_BLACK, height: 1.0, text_v_align: :center end end - flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_BLACK, margin_left: PADDING) do + flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do image safe_get_image("./data/cache/apb.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0x88_5e5c64, border_thickness_bottom: 3, border_color_bottom: 0xff_3584e4, tip: "Red Alert: A Path Beyond" image safe_get_image("./data/cache/ren.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, tip: "Command & Conquer: Renegade" image safe_get_image("./data/cache/tsr.png"), height: 1.0, padding: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, tip: "Tiberian Sun: Reborn" @@ -24,7 +24,7 @@ module W3DHubLauncher # game content container stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do 10.times do - flow(width: 1.0, height: 48, padding_top: HALF_PADDING, padding_bottom: HALF_PADDING, margin_bottom: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0x44_000000, hover: { background_nine_slice_color: 0x88_000000 }) do + flow(width: 1.0, height: 48, padding_top: HALF_PADDING, padding_bottom: HALF_PADDING, margin_bottom: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, hover: { background_nine_slice_color: 0xff_5e5c64 } , active: { background_nine_slice_color: 0xaa_5e5c64 }) do # app icon container image(safe_get_image("./data/cache/apb.png"), tip: "Red Alert: A Path Beyond", width: 48, height: 1.0, margin_left: HALF_PADDING) # friend name and status container diff --git a/lib/state.rb b/lib/state.rb new file mode 100644 index 0000000..2026024 --- /dev/null +++ b/lib/state.rb @@ -0,0 +1,9 @@ +module W3DHubLauncher + class State < CyberarmEngine::GuiState + include W3DHubLauncher::GuiExt + + def setup + theme(THEME) + end + end +end diff --git a/lib/states/boot.rb b/lib/states/boot.rb index e69de29..9784c3f 100644 --- a/lib/states/boot.rb +++ b/lib/states/boot.rb @@ -0,0 +1,35 @@ +module W3DHubLauncher + class States + class Boot < W3DHubLauncher::State + def setup + super + + # root container - background image + stack(width: 1.0, height: 1.0, background_image: safe_get_image("/run/media/cyberarm/Storage/W3DHub/Launcher/package-cache/games/apb/background.png.package"), background_image_mode: :fill) do + # root container - background image tint + flow(width: 1.0, height: 1.0, background: 0xaa_000000) do + # content container + stack(fill: true, height: 1.0, margin: PADDING, margin_right: PADDING) do + # header bar container + flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c| + # logo image + image(safe_get_image("./media/logo.png"), height: 1.0) + + stack(fill: true, height: 1.0) do + stack(fill: true) + title NAME + stack(fill: true) + end + end + + @page_host = stack(width: 1.0, fill: true, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: 8, background_nine_slice_color: ALPHA_GRAY) do + end + end + end + end + + page(Page::Boot::Terms) + end + end + end +end diff --git a/lib/states/interface.rb b/lib/states/interface.rb index e69de29..ee7ae05 100644 --- a/lib/states/interface.rb +++ b/lib/states/interface.rb @@ -0,0 +1,112 @@ +module W3DHubLauncher + class States + class Interface < W3DHubLauncher::State + def setup + super + + # root container - background image + stack(width: 1.0, height: 1.0, background_image: safe_get_image("/run/media/cyberarm/Storage/W3DHub/Launcher/package-cache/games/apb/background.png.package"), background_image_mode: :fill) do + # root container - background image tint + flow(width: 1.0, height: 1.0, background: ALPHA_BLACK) do + # content container + stack(fill: true, height: 1.0, margin: PADDING, margin_right: LARGE_PADDING) do + # header bar container + flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c| + # logo + menu button + button(safe_get_image("./media/logo.png"), image_height: 1.0, background: 0, border_color: 0, hover: { background: 0 }, active: { background: 0, color: 0xff_ffffff }) do |btn| + menu(parent: btn) do + menu_item("Settings") + menu_item("About") do + dialog(Dialog::About) + end + menu_item("Exit") do + window.close + end + end.show + end + + stack(fill: true, height: 1.0) do + stack(fill: true) + flow(width: 1.0) do + link("GAMES", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::Games) } + link("SERVERS", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::ServerBrowser) } + stack(fill: true) + image safe_get_image("./media/icons/import.png"), height: 40, color: 0xff_bbbbbb, tip: "Downloads" + image safe_get_image("./media/icons/information.png"), height: 40, color: 0xff_bbbbbb, tip: "Notifications" + end + stack(fill: true) + end + end + + # page content container + @page_host = stack(width: 1.0, fill: true) do + end + end + + # battleview/friends container + stack(width: 300, height: 1.0, margin: PADDING, margin_left: 0) do + # self account container + flow(width: 1.0, height: 80) do + # self avatar container + stack(width: 80, height: 1.0, background_image: rounded_avatar(safe_get_image("./media/default.png"))) do + # self online state container + stack(width: 20, height: 20, v_align: :bottom, h_align: :right, background_image: safe_get_image("./media/ui/circle_small.png"), background_image_color: 0xff_26a269) + end + + stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do + flow(fill: true) + # self name + caption "cyberarm", font: FONT_BLACK, text_wrap: :none + # self set online state + link "Online ▼", text_size: 18 do |l| + menu(parent: l) do + menu_item("Online") + menu_item("Do Not Disturb") + menu_item("Away") + menu_item("Invisible") + menu_item("Sign Out") + end.show + end + flow(fill: true) + end + end + + # friend management container + flow(width: 1.0, height: 60, margin_top: PADDING) do + flow(width: 1.0, v_align: :center) do + button safe_get_image("./media/icons/singleplayer.png"), image_height: 1.0 + button safe_get_image("./media/icons/gear.png"), image_height: 1.0, margin_left: HALF_PADDING + edit_line "", margin_left: HALF_PADDING, fill: true, height: 1.0 + end + end + + # friends/clanmates list container + stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do + 50.times do |i| + # friend container + flow(width: 1.0, height: 48, padding_top: HALF_PADDING, padding_bottom: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, hover: { background_nine_slice_color: ALPHA_GRAY }) do + # friend avatar container + stack(width: 48, height: 1.0, margin_left: HALF_PADDING, background_image: rounded_avatar(safe_get_image("./media/default.png"))) do + stack(width: 12, height: 12, v_align: :bottom, h_align: :right, background_image: safe_get_image("./media/ui/circle_small.png"), background_image_color: 0xff_26a269) + end + # friend name and status container + stack(fill: true, height: 1.0, margin_left: HALF_PADDING, margin_right: HALF_PADDING) do + stack(v_align: :center) do + caption ["Silverlight", "PXD2000", "Alstar", "SteelGhost", "FRAYDO"].sample, text_wrap: :none + inscription "RA_Under • 13:52", text_wrap: :none, margin_top: -HALF_PADDING + end + end + # friend active application container + stack(width: 48, height: 1.0, margin_right: HALF_PADDING, background_image: safe_get_image("./media/logo.png")) + end + end + end + end + end + end + + page(Page::Games) + end + end + end +end diff --git a/lib/theme.rb b/lib/theme.rb index 85e2565..48e627f 100644 --- a/lib/theme.rb +++ b/lib/theme.rb @@ -3,6 +3,7 @@ module W3DHubLauncher PADDING = 20 HALF_PADDING = 10 ALPHA_BLACK = 0x88_000000 + ALPHA_GRAY = 0x88_5e5c64 FONT_LIGHT = "./media/fonts/NotoSans-Light.ttf" FONT_REGULAR = "./media/fonts/NotoSans-Regular.ttf" @@ -13,8 +14,10 @@ module W3DHubLauncher NINE_SLICE_EDGE = 8 NINE_SLICE_EDGE_SMALL = 4 + NINE_SLICE_EDGE_TINY = 2 NINE_SLICE_ROUNDED = "./media/ui/rounded.png" NINE_SLICE_ROUNDED_SMALL = "./media/ui/rounded_small.png" + NINE_SLICE_ROUNDED_TINY = "./media/ui/rounded_small.png" NINE_SLICE_ROUNDED_LEFT = "./media/ui/rounded_left.png" NINE_SLICE_ROUNDED_RIGHT = "./media/ui/rounded_right.png" NINE_SLICE_ROUNDED_TOP = "./media/ui/rounded_top.png" @@ -22,7 +25,16 @@ module W3DHubLauncher NINE_SLICE_SQUARE = "./media/ui/square.png" CTA_BUTTON_THEME = { - background_nine_slice_color: 0xff_1a5fb4 + color: 0xff_ffffff, + background_nine_slice_color: 0xff_1c71d8, + hover: { + color: 0xff_ffffff, + background_nine_slice_color: 0xff_3584e4 + }, + active: { + color: 0xff_ffffff, + background_nine_slice_color: 0xff_1a5fb4 + } } THEME = { @@ -116,13 +128,24 @@ module W3DHubLauncher background: 0xee_444444 } }, + Progress: { + height: NINE_SLICE_EDGE_TINY * 2, + background: 0, + background_nine_slice: NINE_SLICE_ROUNDED_TINY, + background_nine_slice_from_edge: NINE_SLICE_EDGE_TINY, + background_nine_slice_mode: :stretched, + background_nine_slice_color: 0x88_5e5c64, + fraction_background: 0xff_1a5fb4, + border_thickness: 0, + }, ToolTip: { + delay: 500, text_size: 24, background: 0,#x88_5e5c64, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_mode: :stretched, - background_nine_slice_color: 0xdd_5e5c64, + background_nine_slice_color: 0xcc_000000, border_thickness: 0 } } diff --git a/lib/window.rb b/lib/window.rb index f114456..440a29e 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -4,118 +4,12 @@ module W3DHubLauncher self.show_cursor = true self.caption = format("%s | v%s (%s)", NAME, VERSION, VERSION_NAME) # "Cyberarm's W3D Hub Linux Launcher | v2.0.0 alpha" - push_state(Interface) + push_state(States::Boot) + # push_state(States::Interface) end - end - class Interface < CyberarmEngine::GuiState - include W3DHubLauncher::GuiExt - - def setup - theme(THEME) - - # root container - background image - stack(width: 1.0, height: 1.0, background_image: safe_get_image("/run/media/cyberarm/Storage/W3DHub/Launcher/package-cache/games/apb/background.png.package"), background_image_mode: :fill) do - # root container - background image tint - flow(width: 1.0, height: 1.0, background: 0xaa_000000) do - # content container - stack(fill: true, height: 1.0, margin: PADDING, margin_right: LARGE_PADDING) do - # header bar container - flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c| - # logo + menu button - button(safe_get_image("./media/logo.png"), image_height: 1.0, background: 0, border_color: 0, hover: { background: 0 }, active: { background: 0, color: 0xff_ffffff }) do |btn| - menu(parent: btn) do - menu_item("Settings") - menu_item("About") do - dialog(Dialog::About) - end - menu_item("Exit") do - window.close - end - end.show - end - - stack(fill: true, height: 1.0) do - stack(fill: true) - flow(width: 1.0) do - link("GAMES", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::Games) } - link("SERVERS", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::ServerBrowser) } - stack(fill: true) - image safe_get_image("./media/icons/import.png"), height: 40, color: 0xff_bbbbbb - image safe_get_image("./media/icons/information.png"), height: 40, color: 0xff_bbbbbb - end - stack(fill: true) - end - end - - # page content container - @page_host = stack(width: 1.0, fill: true) do - end - end - - # battleview/friends container - stack(width: 300, height: 1.0, margin: PADDING, margin_left: 0) do - # self account container - flow(width: 1.0, height: 80) do - # self avatar container - stack(width: 80, height: 1.0, background_image: rounded_avatar(safe_get_image("./media/default.png"))) do - # self online state container - stack(width: 20, height: 20, v_align: :bottom, h_align: :right, background_image: safe_get_image("./media/ui/circle_small.png"), background_image_color: 0xff_26a269) - end - - stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do - flow(fill: true) - # self name - caption "cyberarm", font: FONT_BLACK, text_wrap: :none - # self set online state - link "Online ▼", text_size: 18 do |l| - menu(parent: l) do - menu_item("Online") - menu_item("Do Not Disturb") - menu_item("Away") - menu_item("Invisible") - menu_item("Sign Out") - end.show - end - flow(fill: true) - end - end - - # friend management container - flow(width: 1.0, height: 60, margin_top: PADDING) do - flow(width: 1.0, v_align: :center) do - button safe_get_image("./media/icons/singleplayer.png"), image_height: 1.0 - button safe_get_image("./media/icons/gear.png"), image_height: 1.0, margin_left: HALF_PADDING - edit_line "", margin_left: HALF_PADDING, fill: true, height: 1.0 - end - end - - # friends/clanmates list container - stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do - 50.times do |i| - # friend container - flow(width: 1.0, height: 48, padding_top: HALF_PADDING, padding_bottom: HALF_PADDING, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0, hover: { background_nine_slice_color: 0x44_000000 }) do - # friend avatar container - stack(width: 48, height: 1.0, margin_left: HALF_PADDING, background_image: rounded_avatar(safe_get_image("./media/default.png"))) do - stack(width: 12, height: 12, v_align: :bottom, h_align: :right, background_image: safe_get_image("./media/ui/circle_small.png"), background_image_color: 0xff_26a269) - end - # friend name and status container - stack(fill: true, height: 1.0, margin_left: HALF_PADDING, margin_right: HALF_PADDING) do - stack(v_align: :center) do - caption ["Silverlight", "PXD2000", "Alstar", "SteelGhost", "FRAYDO"].sample, text_wrap: :none - inscription "RA_Under • 13:52", text_wrap: :none, margin_top: -HALF_PADDING - end - end - # friend active application container - stack(width: 48, height: 1.0, margin_right: HALF_PADDING, background_image: safe_get_image("./media/logo.png")) - end - end - end - end - end - end - - page(Page::Games) + def needs_redraw? + states.any?(&:needs_repaint?) end end end diff --git a/media/ui/rounded_tiny.png b/media/ui/rounded_tiny.png new file mode 100644 index 0000000000000000000000000000000000000000..a7fd543b4e4ca236151e8defd00f66ebdb12a7b5 GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqoCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt)!bE{-7*Qv=x4iu294`2|$0&Y=1!@k9U9&MiPw O7(8A5T-G@yGywpju|InN literal 0 HcmV?d00001 diff --git a/w3d_hub_linux_launcher.rb b/w3d_hub_linux_launcher.rb index 1b6a9cb..9879ec0 100644 --- a/w3d_hub_linux_launcher.rb +++ b/w3d_hub_linux_launcher.rb @@ -7,10 +7,17 @@ end require_relative "lib/version" require_relative "lib/attribution" require_relative "lib/gui_ext" +require_relative "lib/state" +require_relative "lib/dialog" require_relative "lib/theme" require_relative "lib/pages/games" require_relative "lib/pages/server_browser" +require_relative "lib/pages/boot/terms" +require_relative "lib/pages/boot/initial_setup" +require_relative "lib/pages/boot/start_up" require_relative "lib/dialogs/about" +require_relative "lib/states/boot" +require_relative "lib/states/interface" require_relative "lib/window" require_relative "lib/worker"