diff --git a/i-mic-rts.rb b/i-mic-rts.rb index ab6ff71..ed6ee98 100644 --- a/i-mic-rts.rb +++ b/i-mic-rts.rb @@ -11,8 +11,13 @@ require_relative "lib/camera" require_relative "lib/states/boot" require_relative "lib/states/game" require_relative "lib/states/closing" -require_relative "lib/states/about_menu" -require_relative "lib/states/main_menu" +require_relative "lib/states/menus/main_menu" +require_relative "lib/states/menus/credits_menu" +require_relative "lib/states/menus/settings_menu" +require_relative "lib/states/menus/solo_play_menu" +require_relative "lib/states/menus/multiplayer_menu" +require_relative "lib/states/menus/solo_lobby_menu" +require_relative "lib/states/menus/multiplayer_lobby_menu" require_relative "lib/zorder" require_relative "lib/entity" diff --git a/lib/states/game.rb b/lib/states/game.rb index 6c642d8..3fc3dd9 100644 --- a/lib/states/game.rb +++ b/lib/states/game.rb @@ -11,19 +11,27 @@ class IMICRTS label "SIDEBAR", text_size: 78, margin_bottom: 20 - @h = button("Harvester", width: 1.0) do - @units << Entity.new( - images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/harvester/images/harvester.png", retro: true), - position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE), - angle: rand(360) - ) - end - @c = button("Construction Worker", width: 1.0) do - @units << Entity.new( - images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/construction_worker/images/construction_worker.png", retro: true), - position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE), - angle: rand(360) - ) + flow do + @buttons = stack(width: 75) do + @h = button("Harvester", width: 1.0) do + @units << Entity.new( + images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/harvester/images/harvester.png", retro: true), + position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE), + angle: rand(360) + ) + end + @c = button("Construction Worker", width: 1.0) do + @units << Entity.new( + images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/construction_worker/images/construction_worker.png", retro: true), + position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE), + angle: rand(360) + ) + end + end + + stack(width: 0.25, height: 1.0) do + background Gosu::Color::GREEN + end end diff --git a/lib/states/main_menu.rb b/lib/states/main_menu.rb deleted file mode 100644 index 9b5f87d..0000000 --- a/lib/states/main_menu.rb +++ /dev/null @@ -1,25 +0,0 @@ -class IMICRTS - class MainMenu < CyberarmEngine::GuiState - def setup - self.show_cursor = true - - background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] - - stack(height: 1.0) do - background [0xff555555, Gosu::Color::GRAY] - label "I-MIC-RTS", text_size: 78, margin: 20 - button("Play", width: 1.0) do - push_state(Game) - end - - button("About", width: 1.0) do - push_state(AboutMenu) - end - - button("Exit", width: 1.0) do - push_state(Closing) - end - end - end - end -end \ No newline at end of file diff --git a/lib/states/about_menu.rb b/lib/states/menus/credits_menu.rb similarity index 79% rename from lib/states/about_menu.rb rename to lib/states/menus/credits_menu.rb index e1871ae..278bbb3 100644 --- a/lib/states/about_menu.rb +++ b/lib/states/menus/credits_menu.rb @@ -1,5 +1,5 @@ class IMICRTS - class AboutMenu < CyberarmEngine::GuiState + class CreditsMenu < CyberarmEngine::GuiState def setup background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] @@ -9,7 +9,7 @@ class IMICRTS label "About I-MIC-RTS", text_size: 78, margin: 20 label "Words go here.\nMore words also go here. Thank you and have a nice day." - button("Back", width: 1.0) do + button("Back", width: 1.0, margin_top: 20) do push_state(MainMenu) end end diff --git a/lib/states/menus/main_menu.rb b/lib/states/menus/main_menu.rb new file mode 100644 index 0000000..829e77c --- /dev/null +++ b/lib/states/menus/main_menu.rb @@ -0,0 +1,34 @@ +class IMICRTS + class MainMenu < CyberarmEngine::GuiState + def setup + self.show_cursor = true + + background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] + + stack(height: 1.0) do + background [0xff555555, Gosu::Color::GRAY] + label "I-MIC-RTS", text_size: 78, margin: 20 + button("Solo Play", width: 1.0) do + # push_state(SoloPlayMenu) + push_state(SoloLobbyMenu) + end + + button("Multiplayer", width: 1.0) do + push_state(MultiplayerMenu) + end + + button("Settings", width: 1.0, margin_top: 20) do + push_state(SettingsMenu) + end + + button("Credits", width: 1.0) do + push_state(CreditsMenu) + end + + button("Exit", width: 1.0, margin_top: 20) do + push_state(Closing) + end + end + end + end +end \ No newline at end of file diff --git a/lib/states/.gitkeep b/lib/states/menus/multiplayer_lobby_menu.rb similarity index 100% rename from lib/states/.gitkeep rename to lib/states/menus/multiplayer_lobby_menu.rb diff --git a/lib/states/menus/multiplayer_menu.rb b/lib/states/menus/multiplayer_menu.rb new file mode 100644 index 0000000..d668200 --- /dev/null +++ b/lib/states/menus/multiplayer_menu.rb @@ -0,0 +1,33 @@ +class IMICRTS + class MultiplayerMenu < CyberarmEngine::GuiState + def setup + background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] + + stack(height: 1.0) do + background [0xff555555, Gosu::Color::GRAY] + + label "Multiplayer", text_size: 78, margin: 20 + label "Games", text_size: 32 + @games_list = stack(border_color: Gosu::Color::WHITE, border_thickness: 2) do + end + flow do + button("Refresh") do + # refresh_games + end + button("Host Game") + button("Join Game") + end + + button("Back", width: 1.0, margin_top: 20) do + push_state(MainMenu) + end + end + end + + def refresh_games + @games_list.clear do + label "No games found..." + end + end + end +end \ No newline at end of file diff --git a/lib/states/menus/settings_menu.rb b/lib/states/menus/settings_menu.rb new file mode 100644 index 0000000..15c3f43 --- /dev/null +++ b/lib/states/menus/settings_menu.rb @@ -0,0 +1,18 @@ +class IMICRTS + class SettingsMenu < CyberarmEngine::GuiState + def setup + background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] + + stack(height: 1.0) do + background [0xff555555, Gosu::Color::GRAY] + + label "Settings", text_size: 78, margin: 20 + label "Nothing to see here, move along." + + button("Back", width: 1.0, margin_top: 20) do + push_state(MainMenu) + end + end + end + end +end \ No newline at end of file diff --git a/lib/states/menus/solo_lobby_menu.rb b/lib/states/menus/solo_lobby_menu.rb new file mode 100644 index 0000000..c9787fc --- /dev/null +++ b/lib/states/menus/solo_lobby_menu.rb @@ -0,0 +1,48 @@ +class IMICRTS + class SoloLobbyMenu < CyberarmEngine::GuiState + def setup + background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] + + stack(height: 1.0) do + background [0xff555555, Gosu::Color::GRAY] + + label "Lobby", text_size: 78, margin: 20 + stack do + flow do + + elements = [:edit_line, :button, :button, :toggle_button] + ["Players", "Color", "Team", "Map Preview"].each_with_index do |item, index| + stack do + label item, background: 0xff7a0d71 + + stack do + case elements[index] + when :edit_line + edit_line "Novice" + when :button + button item + when :toggle_button + toggle_button + end + end + end + end + end + + stack(height: 100) do + end + end + + flow do + button("Accept", width: 0.4) do + push_state(Game) + end + + button("Back", width: 0.4, margin_left: 20) do + push_state(MainMenu) + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/states/menus/solo_play_menu.rb b/lib/states/menus/solo_play_menu.rb new file mode 100644 index 0000000..fa5da9d --- /dev/null +++ b/lib/states/menus/solo_play_menu.rb @@ -0,0 +1,25 @@ +class IMICRTS + class SoloPlayMenu < CyberarmEngine::GuiState + def setup + background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead] + + stack(height: 1.0) do + background [0xff555555, Gosu::Color::GRAY] + + label "Solo Play", text_size: 78, margin: 20 + label "Words go here.\nMore words also go here. Thank you and have a nice day." + + button("Campaign", width: 1.0) do + end + + button("Skirmish", width: 1.0) do + push_state(SoloLobbyMenu) + end + + button("Back", width: 1.0, margin_top: 20) do + push_state(MainMenu) + end + end + end + end +end \ No newline at end of file