Define ROOT_PATH to fix using absolute paths for assets

This commit is contained in:
2026-04-20 12:25:19 -05:00
parent 30776857a2
commit dc9e737587
10 changed files with 61 additions and 52 deletions

3
lib/constants.rb Normal file
View File

@@ -0,0 +1,3 @@
module W3DHubLauncher
ROOT_PATH = Dir.pwd
end

View File

@@ -6,14 +6,14 @@ module W3DHubLauncher
def safe_get_image(path, retro: false) def safe_get_image(path, retro: false)
return get_image(path, retro: retro) if File.exist?(path) return get_image(path, retro: retro) if File.exist?(path)
path = "./media/default.png" path = "#{ROOT_PATH}/media/default.png"
return get_image(path, retro: retro) if File.exist?(path) return get_image(path, retro: retro) if File.exist?(path)
WHITE_IMAGE WHITE_IMAGE
end end
def rounded_avatar(image) def rounded_avatar(image)
circle = get_image("./media/ui/circle.png") circle = get_image("#{ROOT_PATH}/media/ui/circle.png")
scale = [(circle.width.to_f / image.width).abs, (circle.width.to_f / image.height).abs].min scale = [(circle.width.to_f / image.width).abs, (circle.width.to_f / image.height).abs].min
Gosu.render(circle.width, circle.height) do Gosu.render(circle.width, circle.height) do

View File

@@ -13,14 +13,14 @@ module W3DHubLauncher
stack(width: 1.0, fill: true, padding: PADDING) do stack(width: 1.0, fill: true, padding: PADDING) do
stack(width: 1.0, fill: true, scroll: true) do stack(width: 1.0, fill: true, scroll: true) do
a = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) 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 image safe_get_image("#{ROOT_PATH}/media/icons/checkmark.png"), height: 1.0, v_align: :center
tagline "DNS resolution", height: 1.0, text_v_align: :center tagline "DNS resolution", height: 1.0, text_v_align: :center
end end
after(500) do after(500) do
a.show a.show
end end
b = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do 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 image safe_get_image("#{ROOT_PATH}/media/icons/information.png"), height: 1.0, v_align: :center, color: 0xff_ff8800
tagline "Upstream backend", height: 1.0, text_v_align: :center 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 caption "Notice: Unreachable. Accounts will be unavailable.", height: 1.0, text_v_align: :center, color: 0xff_ff8800
end end
@@ -28,14 +28,14 @@ module W3DHubLauncher
b.show b.show
end end
c = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do 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 image safe_get_image("#{ROOT_PATH}/media/icons/checkmark.png"), height: 1.0, v_align: :center
tagline "Alternate backend", height: 1.0, text_v_align: :center tagline "Alternate backend", height: 1.0, text_v_align: :center
end end
after(1500) do after(1500) do
c.show c.show
end end
d = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do 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 image safe_get_image("#{ROOT_PATH}/media/icons/information.png"), height: 1.0, v_align: :center, color: 0xff_ff8800
tagline "Refresh account session", height: 1.0, text_v_align: :center 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 caption "Notice: Upstream backend unavailable, session not refreshed.", height: 1.0, text_v_align: :center, color: 0xff_ff8800
end end
@@ -43,14 +43,14 @@ module W3DHubLauncher
d.show d.show
end end
e = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do 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 image safe_get_image("#{ROOT_PATH}/media/icons/checkmark.png"), height: 1.0, v_align: :center
tagline "Fetch game servers", height: 1.0, text_v_align: :center tagline "Fetch game servers", height: 1.0, text_v_align: :center
end end
after(2500) do after(2500) do
e.show e.show
end end
f = flow(width: 1.0, height: HALF_PADDING + PADDING, visible: false) do 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 image safe_get_image("#{ROOT_PATH}/media/icons/cross.png"), height: 1.0, v_align: :center, color: 0xff_ff0000
tagline "Fetch applications", height: 1.0, text_v_align: :center 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 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 end

View File

@@ -6,18 +6,18 @@ module W3DHubLauncher
def setup def setup
# game bar container # game bar container
flow(width: 1.0, height: 60) do 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_GRAY) do widget(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, hover: { background_nine_slice_color: ALPHA_BLACK }, active: { background_nine_slice_color: ALPHA_GRAY }) do
flow(width: 1.0, height: 40, margin_left: PADDING, v_align: :center, h_align: :center) 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 image safe_get_image("#{ROOT_PATH}/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 link "ALL GAMES", text_size: 24, font: FONT_BLACK, height: 1.0, text_v_align: :center
end end
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_GRAY, 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("#{ROOT_PATH}/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("#{ROOT_PATH}/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" image safe_get_image("#{ROOT_PATH}/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"
image safe_get_image("./data/cache/woa.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: "Battle for Dune: War of Assassins" image safe_get_image("#{ROOT_PATH}/data/cache/woa.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: "Battle for Dune: War of Assassins"
end end
end end
@@ -40,8 +40,8 @@ module W3DHubLauncher
list_box items: [ "Release", "Open Testing" ], width: 1.0, margin_bottom: PADDING list_box items: [ "Release", "Open Testing" ], width: 1.0, margin_bottom: PADDING
flow(width: 1.0, height: 60) do flow(width: 1.0, height: 60) do
button "PLAY", fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_LEFT, **CTA_BUTTON_THEME button "PLAY", fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_LEFT, **CTA_BUTTON_THEME
button safe_get_image("./media/icons/singleplayer.png"), image_height: 1.0, background_nine_slice: NINE_SLICE_SQUARE, **CTA_BUTTON_THEME button safe_get_image("#{ROOT_PATH}/media/icons/singleplayer.png"), image_height: 1.0, background_nine_slice: NINE_SLICE_SQUARE, **CTA_BUTTON_THEME
button safe_get_image("./media/icons/gear.png"), image_height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_RIGHT, **CTA_BUTTON_THEME button safe_get_image("#{ROOT_PATH}/media/icons/gear.png"), image_height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_RIGHT, **CTA_BUTTON_THEME
end end
inscription "Version: 3.9.2.15", margin_top: PADDING inscription "Version: 3.9.2.15", margin_top: PADDING
end end
@@ -49,7 +49,7 @@ module W3DHubLauncher
# game events and news container # game events and news container
stack(fill: true, height: 1.0, margin_left: LARGE_PADDING, scroll: true) do 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_GRAY) 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 image safe_get_image("#{ROOT_PATH}/media/background.png"), fill: true, aspect_ratio: 16.0 / 9.0
stack(fill: true, height: 1.0, margin_left: PADDING) do stack(fill: true, height: 1.0, margin_left: PADDING) do
caption "Upcoming Event".upcase, color: 0xff_22aa11 caption "Upcoming Event".upcase, color: 0xff_22aa11
@@ -66,7 +66,7 @@ module W3DHubLauncher
flow(width: 1.0, margin_top: PADDING) do flow(width: 1.0, margin_top: PADDING) do
9.times do 9.times 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 / 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, fill: true, background_image: safe_get_image("#{ROOT_PATH}/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_GRAY, 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 caption "NEWS", color: 0x88_ffffff
tagline "A News Item Post A News Item Post" tagline "A News Item Post A News Item Post"

View File

@@ -8,25 +8,25 @@ module W3DHubLauncher
flow(width: 1.0, height: 60) do 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_GRAY) 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 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 image safe_get_image("#{ROOT_PATH}/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 link "ALL SERVERS", text_size: 24, font: FONT_BLACK, height: 1.0, text_v_align: :center
end end
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_GRAY, 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("#{ROOT_PATH}/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("#{ROOT_PATH}/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" image safe_get_image("#{ROOT_PATH}/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"
image safe_get_image("./data/cache/woa.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: "Battle for Dune: War of Assassins" image safe_get_image("#{ROOT_PATH}/data/cache/woa.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: "Battle for Dune: War of Assassins"
end end
end end
# game content container # game content container
stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do
10.times 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: ALPHA_GRAY, hover: { background_nine_slice_color: 0xff_5e5c64 } , active: { background_nine_slice_color: 0xaa_5e5c64 }) do widget(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 # 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) image(safe_get_image("#{ROOT_PATH}/data/cache/apb.png"), tip: "Red Alert: A Path Beyond", width: 48, height: 1.0, margin_left: HALF_PADDING)
# friend name and status container # friend name and status container
stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do
stack(v_align: :center) do stack(v_align: :center) do

View File

@@ -13,7 +13,7 @@ module W3DHubLauncher
# header bar container # header bar container
flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c| flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c|
# logo image # logo image
image(safe_get_image("./media/logo.png"), height: 1.0) image(safe_get_image("#{ROOT_PATH}/media/logo.png"), height: 1.0)
stack(fill: true, height: 1.0) do stack(fill: true, height: 1.0) do
stack(fill: true) stack(fill: true)

View File

@@ -13,7 +13,7 @@ module W3DHubLauncher
# header bar container # header bar container
flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c| flow(width: 1.0, height: 80, margin_bottom: PADDING) do |c|
# logo + menu button # 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| button(safe_get_image("#{ROOT_PATH}/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(parent: btn) do
menu_item("Settings") menu_item("Settings")
menu_item("About") do menu_item("About") do
@@ -31,8 +31,8 @@ module W3DHubLauncher
link("GAMES", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::Games) } 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) } link("SERVERS", text_v_align: :center, font: FONT_BLACK, margin_left: PADDING) { page(Page::ServerBrowser) }
stack(fill: true) stack(fill: true)
image safe_get_image("./media/icons/import.png"), height: 40, color: 0xff_bbbbbb, tip: "Downloads" image safe_get_image("#{ROOT_PATH}/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" image safe_get_image("#{ROOT_PATH}/media/icons/information.png"), height: 40, color: 0xff_bbbbbb, tip: "Notifications"
end end
stack(fill: true) stack(fill: true)
end end
@@ -48,9 +48,9 @@ module W3DHubLauncher
# self account container # self account container
flow(width: 1.0, height: 80) do flow(width: 1.0, height: 80) do
# self avatar container # self avatar container
stack(width: 80, height: 1.0, background_image: rounded_avatar(safe_get_image("./media/default.png"))) do stack(width: 80, height: 1.0, background_image: rounded_avatar(safe_get_image("#{ROOT_PATH}/media/default.png"))) do
# self online state container # 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) stack(width: 20, height: 20, v_align: :bottom, h_align: :right, background_image: safe_get_image("#{ROOT_PATH}/media/ui/circle_small.png"), background_image_color: 0xff_26a269)
end end
stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do stack(fill: true, height: 1.0, margin_left: HALF_PADDING) do
@@ -74,8 +74,8 @@ module W3DHubLauncher
# friend management container # friend management container
flow(width: 1.0, height: 60, margin_top: PADDING) do flow(width: 1.0, height: 60, margin_top: PADDING) do
flow(width: 1.0, v_align: :center) 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("#{ROOT_PATH}/media/icons/singleplayer.png"), image_height: 1.0
button safe_get_image("./media/icons/gear.png"), image_height: 1.0, margin_left: HALF_PADDING button safe_get_image("#{ROOT_PATH}/media/icons/gear.png"), image_height: 1.0, margin_left: HALF_PADDING
edit_line "", margin_left: HALF_PADDING, fill: true, height: 1.0 edit_line "", margin_left: HALF_PADDING, fill: true, height: 1.0
end end
end end
@@ -84,10 +84,15 @@ module W3DHubLauncher
stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do stack(width: 1.0, fill: true, margin_top: LARGE_PADDING, scroll: true) do
50.times do |i| 50.times do |i|
# friend container # 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 widget(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 }, active: { background_nine_slice_color: ALPHA_BLACK }) do |w|
w.subscribe(:clicked_left_mouse_button) do
puts "HELLO THERE"
end
# friend avatar container # 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: 48, height: 1.0, margin_left: HALF_PADDING, background_image: rounded_avatar(safe_get_image("#{ROOT_PATH}/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) stack(width: 12, height: 12, v_align: :bottom, h_align: :right, background_image: safe_get_image("#{ROOT_PATH}/media/ui/circle_small.png"), background_image_color: 0xff_26a269)
end end
# friend name and status container # friend name and status container
stack(fill: true, height: 1.0, margin_left: HALF_PADDING, margin_right: HALF_PADDING) do stack(fill: true, height: 1.0, margin_left: HALF_PADDING, margin_right: HALF_PADDING) do
@@ -97,7 +102,7 @@ module W3DHubLauncher
end end
end end
# friend active application container # friend active application container
stack(width: 48, height: 1.0, margin_right: HALF_PADDING, background_image: safe_get_image("./media/logo.png")) stack(width: 48, height: 1.0, margin_right: HALF_PADDING, background_image: safe_get_image("#{ROOT_PATH}/media/logo.png"))
end end
end end
end end

View File

@@ -5,24 +5,24 @@ module W3DHubLauncher
ALPHA_BLACK = 0x88_000000 ALPHA_BLACK = 0x88_000000
ALPHA_GRAY = 0x88_5e5c64 ALPHA_GRAY = 0x88_5e5c64
FONT_LIGHT = "./media/fonts/NotoSans-Light.ttf" FONT_LIGHT = "#{ROOT_PATH}/media/fonts/NotoSans-Light.ttf"
FONT_REGULAR = "./media/fonts/NotoSans-Regular.ttf" FONT_REGULAR = "#{ROOT_PATH}/media/fonts/NotoSans-Regular.ttf"
FONT_BOLD = "./media/fonts/NotoSans-Bold.ttf" FONT_BOLD = "#{ROOT_PATH}/media/fonts/NotoSans-Bold.ttf"
FONT_BLACK = "./media/fonts/NotoSans-Black.ttf" FONT_BLACK = "#{ROOT_PATH}/media/fonts/NotoSans-Black.ttf"
FONT_MONO = "./media/fonts/NotoSansMono-Regular.ttf" FONT_MONO = "#{ROOT_PATH}/media/fonts/NotoSansMono-Regular.ttf"
NINE_SLICE_EDGE = 8 NINE_SLICE_EDGE = 8
NINE_SLICE_EDGE_SMALL = 4 NINE_SLICE_EDGE_SMALL = 4
NINE_SLICE_EDGE_TINY = 2 NINE_SLICE_EDGE_TINY = 2
NINE_SLICE_ROUNDED = "./media/ui/rounded.png" NINE_SLICE_ROUNDED = "#{ROOT_PATH}/media/ui/rounded.png"
NINE_SLICE_ROUNDED_SMALL = "./media/ui/rounded_small.png" NINE_SLICE_ROUNDED_SMALL = "#{ROOT_PATH}/media/ui/rounded_small.png"
NINE_SLICE_ROUNDED_TINY = "./media/ui/rounded_small.png" NINE_SLICE_ROUNDED_TINY = "#{ROOT_PATH}/media/ui/rounded_small.png"
NINE_SLICE_ROUNDED_LEFT = "./media/ui/rounded_left.png" NINE_SLICE_ROUNDED_LEFT = "#{ROOT_PATH}/media/ui/rounded_left.png"
NINE_SLICE_ROUNDED_RIGHT = "./media/ui/rounded_right.png" NINE_SLICE_ROUNDED_RIGHT = "#{ROOT_PATH}/media/ui/rounded_right.png"
NINE_SLICE_ROUNDED_TOP = "./media/ui/rounded_top.png" NINE_SLICE_ROUNDED_TOP = "#{ROOT_PATH}/media/ui/rounded_top.png"
NINE_SLICE_ROUNDED_BOTTOM = "./media/ui/rounded_bottom.png" NINE_SLICE_ROUNDED_BOTTOM = "#{ROOT_PATH}/media/ui/rounded_bottom.png"
NINE_SLICE_SQUARE = "./media/ui/square.png" NINE_SLICE_SQUARE = "#{ROOT_PATH}/media/ui/square.png"
CTA_BUTTON_THEME = { CTA_BUTTON_THEME = {
color: 0xff_ffffff, color: 0xff_ffffff,

View File

@@ -4,8 +4,8 @@ module W3DHubLauncher
self.show_cursor = true 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" self.caption = format("%s | v%s (%s)", NAME, VERSION, VERSION_NAME) # "Cyberarm's W3D Hub Linux Launcher | v2.0.0 alpha"
push_state(States::Boot) # push_state(States::Boot)
# push_state(States::Interface) push_state(States::Interface)
end end
def needs_redraw? def needs_redraw?

View File

@@ -5,6 +5,7 @@ rescue LoadError
end end
require_relative "lib/version" require_relative "lib/version"
require_relative "lib/constants"
require_relative "lib/attribution" require_relative "lib/attribution"
require_relative "lib/gui_ext" require_relative "lib/gui_ext"
require_relative "lib/state" require_relative "lib/state"