mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-13 06:52:33 +00:00
Tweaked ui a bit, updated Credits, stubbed load menu, fixed crash when stopping helicopter, Stop order is now only emitted if player has entities selected.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
data/settings.json
|
data/settings.json
|
||||||
|
data/replays/*.replay
|
||||||
|
data/saves/*.save
|
||||||
doc/
|
doc/
|
||||||
.yardoc/
|
.yardoc/
|
||||||
0
data/replays/.gitkeep
Normal file
0
data/replays/.gitkeep
Normal file
0
data/saves/.gitkeep
Normal file
0
data/saves/.gitkeep
Normal file
@@ -19,6 +19,7 @@ require_relative "lib/window"
|
|||||||
require_relative "lib/camera"
|
require_relative "lib/camera"
|
||||||
require_relative "lib/setting"
|
require_relative "lib/setting"
|
||||||
require_relative "lib/team_colors"
|
require_relative "lib/team_colors"
|
||||||
|
require_relative "lib/constants"
|
||||||
|
|
||||||
require_relative "lib/states/boot"
|
require_relative "lib/states/boot"
|
||||||
require_relative "lib/states/game"
|
require_relative "lib/states/game"
|
||||||
@@ -27,7 +28,7 @@ require_relative "lib/states/menus/main_menu"
|
|||||||
require_relative "lib/states/menus/credits_menu"
|
require_relative "lib/states/menus/credits_menu"
|
||||||
require_relative "lib/states/menus/settings_menu"
|
require_relative "lib/states/menus/settings_menu"
|
||||||
require_relative "lib/states/menus/pause_menu"
|
require_relative "lib/states/menus/pause_menu"
|
||||||
require_relative "lib/states/menus/solo_play_menu"
|
require_relative "lib/states/menus/load_menu"
|
||||||
require_relative "lib/states/menus/multiplayer_menu"
|
require_relative "lib/states/menus/multiplayer_menu"
|
||||||
require_relative "lib/states/menus/solo_lobby_menu"
|
require_relative "lib/states/menus/solo_lobby_menu"
|
||||||
require_relative "lib/states/menus/multiplayer_lobby_menu"
|
require_relative "lib/states/menus/multiplayer_lobby_menu"
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ class IMICRTS
|
|||||||
|
|
||||||
follow_path
|
follow_path
|
||||||
else
|
else
|
||||||
|
return unless @parent.target
|
||||||
|
|
||||||
rotate_towards(@parent.target)
|
rotate_towards(@parent.target)
|
||||||
@parent.position -= (@parent.position.xy - @parent.target.xy).normalized * @parent.speed
|
@parent.position -= (@parent.position.xy - @parent.target.xy).normalized * @parent.speed
|
||||||
end
|
end
|
||||||
|
|||||||
4
lib/constants.rb
Normal file
4
lib/constants.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class IMICRTS
|
||||||
|
MENU_WIDTH = 350
|
||||||
|
MENU_PADDING = 8
|
||||||
|
end
|
||||||
@@ -99,7 +99,7 @@ class IMICRTS
|
|||||||
|
|
||||||
def target=(entity)
|
def target=(entity)
|
||||||
@target = entity
|
@target = entity
|
||||||
component(:movement).pathfinder = @director.find_path(player: @player, entity: self, goal: @target) if component(:movement) && @movement == :ground
|
component(:movement).pathfinder = @director.find_path(player: @player, entity: self, goal: @target) if @target && component(:movement) && @movement == :ground
|
||||||
end
|
end
|
||||||
|
|
||||||
def hit?(x_or_vector, y = nil)
|
def hit?(x_or_vector, y = nil)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class IMICRTS
|
|||||||
|
|
||||||
@debug_info = CyberarmEngine::Text.new("", y: 10, z: Float::INFINITY, shadow_color: Gosu::Color.rgba(0, 0, 0, 200))
|
@debug_info = CyberarmEngine::Text.new("", y: 10, z: Float::INFINITY, shadow_color: Gosu::Color.rgba(0, 0, 0, 200))
|
||||||
|
|
||||||
@sidebar = stack(width: 350, height: 1.0) do
|
@sidebar = stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
background [0x55555555, 0x55666666]
|
background [0x55555555, 0x55666666]
|
||||||
|
|
||||||
label "SIDEBAR", text_size: 78, margin_bottom: 20
|
label "SIDEBAR", text_size: 78, margin_bottom: 20
|
||||||
|
|||||||
@@ -3,14 +3,29 @@ class IMICRTS
|
|||||||
def setup
|
def setup
|
||||||
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
stack(width: 600, height: 1.0) do
|
flow(width: 1.0, height: 1.0) do
|
||||||
background [0xff555555, Gosu::Color::GRAY]
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
|
||||||
label "About I-MIC-RTS", text_size: 78, margin: 20
|
label "Credits", text_size: 78, margin: 20
|
||||||
label "Words go here. More words also go here. Thank you and have a nice day.", text_wrap: :word_wrap
|
|
||||||
|
|
||||||
button("Back", width: 1.0, margin_top: 20) do
|
licenses = Gosu::LICENSES.lines
|
||||||
push_state(MainMenu)
|
preamble = licenses.shift
|
||||||
|
licenses.shift # remove blank line
|
||||||
|
|
||||||
|
label preamble, text_wrap: :word_wrap
|
||||||
|
|
||||||
|
licenses.each do |l|
|
||||||
|
name, website, license, license_website = l.strip.split(",")
|
||||||
|
flow(width: 1.0) do
|
||||||
|
label name.strip, width: 0.49
|
||||||
|
label license.strip, width: 0.49
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
button("Back", width: 1.0, margin_top: 20) do
|
||||||
|
push_state(MainMenu)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
32
lib/states/menus/load_menu.rb
Normal file
32
lib/states/menus/load_menu.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
class IMICRTS
|
||||||
|
class LoadMenu < CyberarmEngine::GuiState
|
||||||
|
def setup
|
||||||
|
self.show_cursor = true
|
||||||
|
|
||||||
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
label "Load", text_size: 78, margin: 20
|
||||||
|
|
||||||
|
label "Replays"
|
||||||
|
stack(width: 1.0, height: 0.30) do
|
||||||
|
["2020-01-31_16-31-45.replay"].each do |item|
|
||||||
|
button item, width: 1.0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
label "Saves"
|
||||||
|
stack(width: 1.0, height: 0.30) do
|
||||||
|
["2020-01-31_16-31-45.save"].each do |item|
|
||||||
|
button item, width: 1.0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
button("Back", width: 1.0, margin_top: 20) do
|
||||||
|
pop_state
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -5,10 +5,11 @@ class IMICRTS
|
|||||||
|
|
||||||
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
stack(width: 350, height: 1.0) do
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
background [0xff555555, Gosu::Color::GRAY]
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
label "I-MIC-RTS", text_size: 78, margin: 20
|
label IMICRTS::NAME, text_size: 78, margin: 20
|
||||||
button("Campaign", width: 1.0) do
|
button("Campaign", width: 1.0, enabled: false) do
|
||||||
|
push_state(CampaignMenu)
|
||||||
end
|
end
|
||||||
|
|
||||||
button("Skirmish", width: 1.0) do
|
button("Skirmish", width: 1.0) do
|
||||||
@@ -20,7 +21,11 @@ class IMICRTS
|
|||||||
push_state(MultiplayerMenu)
|
push_state(MultiplayerMenu)
|
||||||
end
|
end
|
||||||
|
|
||||||
button("Settings", width: 1.0, margin_top: 20) do
|
button("Load", width: 1.0, margin_top: 20) do
|
||||||
|
push_state(LoadMenu)
|
||||||
|
end
|
||||||
|
|
||||||
|
button("Settings", width: 1.0) do
|
||||||
push_state(SettingsMenu)
|
push_state(SettingsMenu)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class IMICRTS
|
|||||||
def setup
|
def setup
|
||||||
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
stack(height: 1.0) do
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
background [0xff555555, Gosu::Color::GRAY]
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
|
||||||
label "Multiplayer", text_size: 78, margin: 20
|
label "Multiplayer", text_size: 78, margin: 20
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
class IMICRTS
|
class IMICRTS
|
||||||
class PauseMenu < CyberarmEngine::GuiState
|
class PauseMenu < CyberarmEngine::GuiState
|
||||||
def setup
|
def setup
|
||||||
stack(width: 350) do
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
label "Paused", text_size: 78, margin: 20
|
||||||
|
|
||||||
button "Resume", width: 1.0 do
|
button "Resume", width: 1.0 do
|
||||||
pop_state
|
pop_state
|
||||||
end
|
end
|
||||||
|
|
||||||
button "Settings", width: 1.0 do
|
button "Settings", width: 1.0 do
|
||||||
push_state(SettingsMenu)
|
push_state(SettingsMenu)
|
||||||
end
|
end
|
||||||
button "Quit", width: 1.0 do
|
|
||||||
|
button "Quit", width: 1.0, margin_top: 20 do
|
||||||
# TODO: Confirm
|
# TODO: Confirm
|
||||||
|
|
||||||
previous_state.director.finalize
|
previous_state.director.finalize
|
||||||
@@ -25,7 +30,7 @@ class IMICRTS
|
|||||||
def draw
|
def draw
|
||||||
previous_state&.draw
|
previous_state&.draw
|
||||||
|
|
||||||
# Gosu.flush
|
Gosu.flush
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,22 +3,18 @@ class IMICRTS
|
|||||||
def setup
|
def setup
|
||||||
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
stack(width: 350, height: 1.0) do
|
stack(width: IMICRTS::MENU_WIDTH, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
background [0xff555555, Gosu::Color::GRAY]
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
|
||||||
label "Settings", text_size: 78, margin: 20
|
label "Settings", text_size: 78, margin: 20
|
||||||
|
|
||||||
@skip_intro = check_box "Skip Intro", checked: Setting.enabled?(:skip_intro)
|
@skip_intro = check_box "Skip Intro", checked: Setting.enabled?(:skip_intro)
|
||||||
|
|
||||||
stack(width: 1.0) do
|
label "Debug Settings", background: 0xff030303, width: 1.0, margin_top: 20
|
||||||
background 0xff030303
|
@debug_mode = check_box "Debug Mode", checked: Setting.enabled?(:debug_mode)
|
||||||
|
@debug_info_bar = check_box "Show Debug Info Bar", checked: Setting.enabled?(:debug_info_bar)
|
||||||
label "Debug Settings"
|
@debug_pathfinding = check_box "Debug Pathfinding", checked: Setting.enabled?(:debug_pathfinding)
|
||||||
@debug_mode = check_box "Debug Mode", checked: Setting.enabled?(:debug_mode)
|
@debug_pathfinding_allow_diagonal = check_box "Allow Diagonal Paths", checked: Setting.enabled?(:debug_pathfinding_allow_diagonal)
|
||||||
@debug_info_bar = check_box "Show Debug Info Bar", checked: Setting.enabled?(:debug_info_bar)
|
|
||||||
@debug_pathfinding = check_box "Debug Pathfinding", checked: Setting.enabled?(:debug_pathfinding)
|
|
||||||
@debug_pathfinding_allow_diagonal = check_box "Allow Diagonal Paths", checked: Setting.enabled?(:debug_pathfinding_allow_diagonal)
|
|
||||||
end
|
|
||||||
|
|
||||||
button("Save and Close", width: 1.0, margin_top: 20) do
|
button("Save and Close", width: 1.0, margin_top: 20) do
|
||||||
if valid_options?
|
if valid_options?
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class IMICRTS
|
|||||||
def setup
|
def setup
|
||||||
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
background [0xff7b6ead, 0xff7a0d71, 0xff7a0d71, 0xff7b6ead]
|
||||||
|
|
||||||
stack(width: 0.5, min_width: 720, height: 1.0) do
|
stack(width: 0.5, min_width: 720, height: 1.0, padding: IMICRTS::MENU_PADDING) do
|
||||||
background [0xff555555, Gosu::Color::GRAY]
|
background [0xff555555, Gosu::Color::GRAY]
|
||||||
|
|
||||||
label "Lobby", text_size: 78, margin: 20
|
label "Lobby", text_size: 78, margin: 20
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -36,7 +36,7 @@ class IMICRTS
|
|||||||
)
|
)
|
||||||
|
|
||||||
when Gosu::KB_S
|
when Gosu::KB_S
|
||||||
@director.schedule_order(Order::STOP, @player.id)
|
@director.schedule_order(Order::STOP, @player.id) if @player.selected_entities.size.positive?
|
||||||
|
|
||||||
when Gosu::MS_LEFT
|
when Gosu::MS_LEFT
|
||||||
unless @game.sidebar.hit?(@game.window.mouse_x, @game.window.mouse_y)
|
unless @game.sidebar.hit?(@game.window.mouse_x, @game.window.mouse_y)
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ class IMICRTS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def draw
|
def draw
|
||||||
@cursor.draw(mouse_x, mouse_y, Float::INFINITY) if @show_cursor
|
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
|
@cursor.draw(mouse_x, mouse_y, Float::INFINITY) if @show_cursor
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
Reference in New Issue
Block a user