diff --git a/lib/pages/games.rb b/lib/pages/games.rb index b796592..65dfff8 100644 --- a/lib/pages/games.rb +++ b/lib/pages/games.rb @@ -26,7 +26,9 @@ class W3DHub W3DHub::Game.games.each do |game| selected = game == @focused_game - game_button = stack(width: 1.0, border_thickness_left: 4, border_color_left: selected ? 0xff_00acff : 0x00_000000, hover: { background: 0xff_444444 }) do + game_button = stack(width: 1.0, border_thickness_left: 4, + border_color_left: selected ? 0xff_00acff : 0x00_000000, hover: { background: 0xff_444444 }, + padding_top: 4, padding_bottom: 4) do background game.background_color if selected flow(width: 1.0, height: 48) do @@ -134,7 +136,7 @@ class W3DHub flow(width: 0.5, height: 128, margin: 4) do # background 0x88_000000 - image game.icon, width: 0.4 + image game.icon, width: 0.4, padding: 4 stack(width: 0.6, height: 1.0) do stack(width: 1.0, height: 112) do diff --git a/lib/pages/login.rb b/lib/pages/login.rb index 410cee4..032d509 100644 --- a/lib/pages/login.rb +++ b/lib/pages/login.rb @@ -35,12 +35,48 @@ class W3DHub # Todo lock whole UI until response or timeout # Do network stuff + + Thread.new do + sleep 0.2 + + main_thread_queue << proc { populate_account_info; page(W3DHub::Pages::Games) } + end end end end end end end + + def populate_account_info + @host.instance_variable_get(:"@account_container").clear do + stack(width: 0.7, height: 1.0) do + # background 0xff_222222 + tagline "#{@username.value}" + + flow(width: 1.0) do + link("Logout", text_size: 16) { depopulate_account_info } + link "Profile", text_size: 16 + end + end + + image "#{GAME_ROOT_PATH}/media/ui_icons/singleplayer.png", height: 1.0 + end + end + + def depopulate_account_info + @host.instance_variable_get(:"@account_container").clear do + stack(width: 0.7, height: 1.0) do + # background 0xff_222222 + tagline "Not Logged In", text_wrap: :none + + flow(width: 1.0) do + link("Log in", text_size: 16) { page(W3DHub::Pages::Login) } + link "Register", text_size: 16 + end + end + end + end end end end diff --git a/lib/states/interface.rb b/lib/states/interface.rb index 5654171..21bcd95 100644 --- a/lib/states/interface.rb +++ b/lib/states/interface.rb @@ -20,6 +20,7 @@ class W3DHub text_shadow: false, }, TextBlock: { + # font: "Inconsolata", text_border: false, text_shadow: true, text_shadow_size: 1, @@ -68,7 +69,7 @@ class W3DHub @app_info_container = flow(width: 1.0, height: 0.65) do # background 0xff_8855ff - stack(width: 0.75, height: 1.0) do + stack(width: 0.6749, height: 1.0) do title "W3D Hub Launcher", height: 0.5 flow(width: 1.0, height: 0.5) do button( @@ -102,19 +103,48 @@ class W3DHub end @account_container = flow(width: 0.25, height: 1.0) do - # background 0xff_22ff00 - stack(width: 0.7, height: 1.0) do # background 0xff_222222 - tagline "Cyberarm" + tagline "Not Logged In", text_wrap: :none flow(width: 1.0) do - link("Logout", text_size: 14) { page(W3DHub::Pages::Login) } - link "Profile", text_size: 14 + link("Log in", text_size: 16) { page(W3DHub::Pages::Login) } + link "Register", text_size: 16 end end + end - image BLACK_IMAGE, height: 1.0 + flow(width: 0.075, height: 1.0) do + button( + get_image("#{GAME_ROOT_PATH}/media/ui_icons/minus.png"), + image_width: 16, + padding_left: 4, + padding_top: 4, + padding_right: 4, + padding_bottom: 4, + margin_left: 4 + ) do + # window.minimize + end + + button( + get_image("#{GAME_ROOT_PATH}/media/ui_icons/cross.png"), + image_width: 16, + padding_left: 4, + padding_top: 4, + padding_right: 4, + padding_bottom: 4, + margin_left: 4, + background: 0xff_800000, + hover: { + background: 0xff_a00000 + }, + active: { + background: 0xff_600000 + } + ) do + window.close + end end end diff --git a/lib/window.rb b/lib/window.rb index b53ea54..becb5d0 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -5,5 +5,11 @@ class W3DHub push_state(W3DHub::States::Boot) end + + def button_down(id) + super + + self.borderless = !self.borderless? if id == Gosu::KB_F7 + end end end diff --git a/media/ui_icons/cross.png b/media/ui_icons/cross.png new file mode 100644 index 0000000..e21d5ac Binary files /dev/null and b/media/ui_icons/cross.png differ diff --git a/media/ui_icons/minus.png b/media/ui_icons/minus.png new file mode 100644 index 0000000..bf53d03 Binary files /dev/null and b/media/ui_icons/minus.png differ