From da54bf5c5319066fdfd5484c5d73b9ce0575c4fc Mon Sep 17 00:00:00 2001 From: cyberarm Date: Sat, 29 May 2021 00:36:47 +0000 Subject: [PATCH] Replaced usages of Text shadow with properly named border, use new correct Text shadow for menu titles, use text border for a few more elements --- lib/hud/widgets/ammo.rb | 2 +- lib/hud/widgets/chat_history.rb | 2 +- lib/hud/widgets/health.rb | 2 +- lib/hud/widgets/radar.rb | 2 +- lib/hud/widgets/score_board.rb | 4 ++-- lib/hud/widgets/squad.rb | 4 ++-- lib/overlay.rb | 2 +- lib/states/game_states/boot.rb | 7 +++++-- lib/states/game_states/loading_state.rb | 4 ++-- lib/tools/asset_viewer/lib/main_menu.rb | 2 +- lib/tools/asset_viewer/lib/turn_table.rb | 8 ++++---- lib/tools/map_editor/lib/main_menu.rb | 4 ++-- lib/ui/console.rb | 4 +++- lib/ui/menu.rb | 16 ++++++++++------ lib/ui/menus/extras_menu.rb | 3 +-- lib/ui/menus/game_pause_menu.rb | 3 +-- lib/ui/menus/level_select_menu.rb | 2 +- lib/ui/menus/multiplayer_menu.rb | 3 +-- lib/ui/menus/multiplayer_profile_menu.rb | 2 +- lib/ui/menus/multiplayer_server_browser_menu.rb | 2 +- lib/ui/menus/settings_menu.rb | 2 +- 21 files changed, 43 insertions(+), 37 deletions(-) diff --git a/lib/hud/widgets/ammo.rb b/lib/hud/widgets/ammo.rb index 645f55b..19a5d07 100644 --- a/lib/hud/widgets/ammo.rb +++ b/lib/hud/widgets/ammo.rb @@ -4,7 +4,7 @@ class IMICFPS class HUD class AmmoWidget < HUD::Widget def setup - @text = Text.new("", size: 64, font: MONOSPACE_FONT, shadow: true, shadow_color: Gosu::Color::BLACK) + @text = Text.new("", size: 64, font: MONOSPACE_FONT, border: true, border_color: Gosu::Color::BLACK) @background = Gosu::Color.new(0x88c64600) end diff --git a/lib/hud/widgets/chat_history.rb b/lib/hud/widgets/chat_history.rb index 54fd23b..32b5c03 100644 --- a/lib/hud/widgets/chat_history.rb +++ b/lib/hud/widgets/chat_history.rb @@ -10,7 +10,7 @@ class IMICFPS "", size: 16, x: Widget.margin, y: Widget.margin, z: 45, - shadow_color: Gosu::Color::BLACK, + border_color: Gosu::Color::BLACK, font: BOLD_SANS_FONT ) diff --git a/lib/hud/widgets/health.rb b/lib/hud/widgets/health.rb index 14b4344..b506fdf 100644 --- a/lib/hud/widgets/health.rb +++ b/lib/hud/widgets/health.rb @@ -5,7 +5,7 @@ class IMICFPS class HealthWidget < HUD::Widget def setup @spacer = 0 - @text = Text.new("", font: MONOSPACE_FONT, shadow: true, shadow_color: Gosu::Color::BLACK) + @text = Text.new("", font: MONOSPACE_FONT, border: true, border_color: Gosu::Color::BLACK) @width = 512 @height = 24 @slant = 32 diff --git a/lib/hud/widgets/radar.rb b/lib/hud/widgets/radar.rb index e83f521..b762af1 100644 --- a/lib/hud/widgets/radar.rb +++ b/lib/hud/widgets/radar.rb @@ -12,7 +12,7 @@ class IMICFPS @border_color = Gosu::Color.new(0x88c64600) @radar_color = Gosu::Color.new(0x88212121) - @text = Text.new("RADAR", size: 18, font: MONOSPACE_FONT, shadow: true, shadow_color: Gosu::Color::BLACK) + @text = Text.new("RADAR", size: 18, font: MONOSPACE_FONT, border: true, border_color: Gosu::Color::BLACK) @image = Gosu::Image.new("#{CYBERARM_ENGINE_ROOT_PATH}/assets/textures/default.png", retro: true) @scale = (@size - Widget.padding * 2.0) / @image.width end diff --git a/lib/hud/widgets/score_board.rb b/lib/hud/widgets/score_board.rb index 95f7174..e9ba7e9 100644 --- a/lib/hud/widgets/score_board.rb +++ b/lib/hud/widgets/score_board.rb @@ -10,8 +10,8 @@ class IMICFPS "", size: 16, x: Widget.margin, y: Widget.margin, z: 45, - shadow: true, - shadow_color: Gosu::Color::BLACK, + border: true, + border_color: Gosu::Color::BLACK, font: BOLD_SANS_FONT ) diff --git a/lib/hud/widgets/squad.rb b/lib/hud/widgets/squad.rb index 51597af..bf78f14 100644 --- a/lib/hud/widgets/squad.rb +++ b/lib/hud/widgets/squad.rb @@ -16,8 +16,8 @@ class IMICFPS size: 18, font: SANS_FONT, color: @color, - shadow: true, - shadow_color: Gosu::Color::BLACK, + border: true, + border_color: Gosu::Color::BLACK, ) end diff --git a/lib/overlay.rb b/lib/overlay.rb index aa8f172..f60ddcf 100644 --- a/lib/overlay.rb +++ b/lib/overlay.rb @@ -7,7 +7,7 @@ class IMICFPS Slot = Struct.new(:value, :width) def initialize - @text = CyberarmEngine::Text.new("", x: 3, y: 3, shadow_color: Gosu::Color::BLACK) + @text = CyberarmEngine::Text.new("", x: 3, y: 3, border_color: Gosu::Color::BLACK) @slots = [] @space_width = @text.textobject.text_width(" ") end diff --git a/lib/states/game_states/boot.rb b/lib/states/game_states/boot.rb index d04774a..7e35314 100644 --- a/lib/states/game_states/boot.rb +++ b/lib/states/game_states/boot.rb @@ -3,7 +3,7 @@ class IMICFPS class Boot < GameState def setup - @title = Text.new(IMICFPS::NAME, size: 100, z: 0, color: Gosu::Color.new(0xff000000), shadow: false, font: IMICFPS::BOLD_SANS_FONT) + @title = Text.new(IMICFPS::NAME, size: 100, z: 0, color: Gosu::Color.new(0xff000000), border: false, font: IMICFPS::BOLD_SANS_FONT) @logo = get_image("#{IMICFPS::GAME_ROOT_PATH}/static/logo.png") @start_time = Gosu.milliseconds @@ -76,8 +76,11 @@ class IMICFPS def update @animators.each(&:update) + y = window.height / 2 - (@logo.height / 2 + @title.height + 8) + y = 0 if y < @title.height + @title.x = window.width / 2 - @title.width / 2 - @title.y = (0 - @title.height) + (@title.height * @title_animator.transition) + @title.y = (0 - (@title.height * (1 - @title_animator.transition))) + (y * @title_animator.transition) push_state(MainMenu) if Gosu.milliseconds - @start_time >= @time_to_live end diff --git a/lib/states/game_states/loading_state.rb b/lib/states/game_states/loading_state.rb index a435e08..5bcccbb 100644 --- a/lib/states/game_states/loading_state.rb +++ b/lib/states/game_states/loading_state.rb @@ -22,8 +22,8 @@ class IMICFPS @assets = [] @asset_index = 0 - add_asset(:model, @map_parser.terrain.package, @map_parser.terrain.name) - add_asset(:model, @map_parser.skydome.package, @map_parser.skydome.name) + add_asset(:model, @map_parser.terrain.package, @map_parser.terrain.name) if @map_parser.terrain.package + add_asset(:model, @map_parser.skydome.package, @map_parser.skydome.name) if @map_parser.skydome.package @map_parser.entities.each do |entity| add_asset(:model, entity.package, entity.name) end diff --git a/lib/tools/asset_viewer/lib/main_menu.rb b/lib/tools/asset_viewer/lib/main_menu.rb index 28f6db7..c2dd83c 100644 --- a/lib/tools/asset_viewer/lib/main_menu.rb +++ b/lib/tools/asset_viewer/lib/main_menu.rb @@ -24,7 +24,7 @@ class IMICFPS end stack(width: 0.5, height: 1.0) do - label "Asset Viewer", text_size: 100, font: BOLD_SANS_FONT, width: 1.0, text_align: :center + title "Asset Viewer" link I18n.t("menus.back"), width: 1.0 do pop_state diff --git a/lib/tools/asset_viewer/lib/turn_table.rb b/lib/tools/asset_viewer/lib/turn_table.rb index e00eb57..350cc40 100644 --- a/lib/tools/asset_viewer/lib/turn_table.rb +++ b/lib/tools/asset_viewer/lib/turn_table.rb @@ -23,10 +23,10 @@ class IMICFPS @camera = PerspectiveCamera.new(aspect_ratio: window.aspect_ratio, position: Vector.new(0, 1.5, 5), orientation: Vector.forward) @camera_controller = CameraController.new(camera: @camera, entity: nil, mode: :fpv) - label @manifest.name, text_size: 50, text_shadow: true, text_shadow_color: Gosu::Color::BLACK - label @manifest.model, text_shadow: true, text_shadow_color: Gosu::Color::BLACK - @camera_position = label "", text_shadow: true, text_shadow_color: Gosu::Color::BLACK - @camera_orientation = label "", text_shadow: true, text_shadow_color: Gosu::Color::BLACK + label @manifest.name, text_size: 50, text_border: true, text_border_color: Gosu::Color::BLACK + label @manifest.model, text_border: true, text_border_color: Gosu::Color::BLACK + @camera_position = label "", text_border: true, text_border_color: Gosu::Color::BLACK + @camera_orientation = label "", text_border: true, text_border_color: Gosu::Color::BLACK button "Back" do pop_state diff --git a/lib/tools/map_editor/lib/main_menu.rb b/lib/tools/map_editor/lib/main_menu.rb index 55817cd..45a69e5 100644 --- a/lib/tools/map_editor/lib/main_menu.rb +++ b/lib/tools/map_editor/lib/main_menu.rb @@ -22,14 +22,14 @@ class IMICFPS end stack(width: 0.5, height: 1.0) do - label "Map Editor", text_size: 100, font: BOLD_SANS_FONT, width: 1.0, text_align: :center + title "Map Editor" flow width: 1.0 do link I18n.t("menus.back"), width: 0.32 do pop_state end - button "New Map", width: 1.0, width: 0.64 + button "New Map", width: 0.64 end label "Edit Map", width: 1.0, text_align: :center, text_size: 50 diff --git a/lib/ui/console.rb b/lib/ui/console.rb index 7821274..0edc7fa 100644 --- a/lib/ui/console.rb +++ b/lib/ui/console.rb @@ -16,7 +16,9 @@ class IMICFPS @input = Text.new("", x: 4, y: @height - (PADDING * 2), z: Console::Z + 1, font: MONOSPACE_FONT) @input.y -= @input.height - @history = Text.new("=== #{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME}) ===\n\n", x: 4, z: Console::Z + 1, font: MONOSPACE_FONT) + @history = Text.new( + "=== #{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME}) ===\n\n", + x: 4, z: Console::Z + 1, font: MONOSPACE_FONT, border: true, border_color: Gosu::Color::BLACK) update_history_y @command_history = [] diff --git a/lib/ui/menu.rb b/lib/ui/menu.rb index 04d8faa..756b6ee 100644 --- a/lib/ui/menu.rb +++ b/lib/ui/menu.rb @@ -22,7 +22,9 @@ class IMICFPS @accent_color = ACCENT_COLOR window.needs_cursor = true - @__version_text = CyberarmEngine::Text.new("#{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})", font: BOLD_SANS_FONT) + @__version_text = CyberarmEngine::Text.new( + "#{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})", + font: BOLD_SANS_FONT, border: true, border_color: Gosu::Color::BLACK) @__version_text.x = window.width - (@__version_text.width + 10) @__version_text.y = window.height - (@__version_text.height + 10) @@ -39,7 +41,9 @@ class IMICFPS text_size: 100, color: Gosu::Color::BLACK, text_align: :center, - width: 1.0 + text_shadow: true, + text_shadow_size: 4, + width: 1.0, }, Subtitle: { text_size: 50, @@ -51,10 +55,10 @@ class IMICFPS font: BOLD_SANS_FONT, text_size: 50, text_align: :center, - text_shadow: true, - text_shadow_size: 2, - text_shadow_color: Gosu::Color::BLACK, - text_shadow_alpha: 100, + text_border: true, + text_border_size: 2, + text_border_color: Gosu::Color::BLACK, + text_border_alpha: 100, color: Gosu::Color.rgb(0, 127, 127), width: 1.0, hover: { diff --git a/lib/ui/menus/extras_menu.rb b/lib/ui/menus/extras_menu.rb index 15da8e6..6697cc5 100644 --- a/lib/ui/menus/extras_menu.rb +++ b/lib/ui/menus/extras_menu.rb @@ -3,8 +3,7 @@ class IMICFPS class ExtrasMenu < Menu def setup - title IMICFPS::NAME - subtitle "Extras" + title I18n.t("menus.extras") link "Asset Viewer" do push_state(IMICFPS::AssetViewerTool::MainMenu) diff --git a/lib/ui/menus/game_pause_menu.rb b/lib/ui/menus/game_pause_menu.rb index e9673b5..ac1748b 100644 --- a/lib/ui/menus/game_pause_menu.rb +++ b/lib/ui/menus/game_pause_menu.rb @@ -4,8 +4,7 @@ class IMICFPS class GamePauseMenu < Menu def setup @bar_alpha = 50 - title IMICFPS::NAME - subtitle "Paused" + title "Paused" link "Resume" do pop_state diff --git a/lib/ui/menus/level_select_menu.rb b/lib/ui/menus/level_select_menu.rb index 61527b8..61f816f 100644 --- a/lib/ui/menus/level_select_menu.rb +++ b/lib/ui/menus/level_select_menu.rb @@ -3,7 +3,7 @@ class IMICFPS class LevelSelectMenu < Menu def setup - title IMICFPS::NAME + title I18n.t("menus.singleplayer") subtitle "Choose a Map" Dir.glob("#{GAME_ROOT_PATH}/maps/*.json").map { |file| [file, MapParser.new(map_file: file)] }.each do |file, map| diff --git a/lib/ui/menus/multiplayer_menu.rb b/lib/ui/menus/multiplayer_menu.rb index 4e30ce0..51400c2 100644 --- a/lib/ui/menus/multiplayer_menu.rb +++ b/lib/ui/menus/multiplayer_menu.rb @@ -3,8 +3,7 @@ class IMICFPS class MultiplayerMenu < Menu def setup - title IMICFPS::NAME - subtitle "Multiplayer" + title I18n.t("menus.multiplayer") link "Quick Join" link "Server Browser" do diff --git a/lib/ui/menus/multiplayer_profile_menu.rb b/lib/ui/menus/multiplayer_profile_menu.rb index 4f8c32f..52e0563 100644 --- a/lib/ui/menus/multiplayer_profile_menu.rb +++ b/lib/ui/menus/multiplayer_profile_menu.rb @@ -8,7 +8,7 @@ class IMICFPS end stack(width: 0.5, height: 1.0) do - label "Profile", text_size: 100, color: Gosu::Color::BLACK, width: 1.0, text_align: :center + title "Profile" flow width: 1.0 do link I18n.t("menus.back"), width: 0.32 do diff --git a/lib/ui/menus/multiplayer_server_browser_menu.rb b/lib/ui/menus/multiplayer_server_browser_menu.rb index e6d70ce..57d00ef 100644 --- a/lib/ui/menus/multiplayer_server_browser_menu.rb +++ b/lib/ui/menus/multiplayer_server_browser_menu.rb @@ -36,7 +36,7 @@ class IMICFPS stack width: 0.5, height: 1.0 do stack width: 1.0, height: 0.25 do - label "Server Browser", text_size: 100, text_align: :center, width: 1.0 + title "Server Browser" flow(width: 1.0) do link I18n.t("menus.back"), width: 0.32 do diff --git a/lib/ui/menus/settings_menu.rb b/lib/ui/menus/settings_menu.rb index 13e33e3..96c4452 100644 --- a/lib/ui/menus/settings_menu.rb +++ b/lib/ui/menus/settings_menu.rb @@ -26,7 +26,7 @@ class IMICFPS stack(width: 0.5, height: 1.0) do stack(width: 1.0, height: 0.25) do - label "Settings", color: Gosu::Color::BLACK, text_size: 100, text_align: :center, width: 1.0 + title "Settings" flow(width: 1.0) do link I18n.t("menus.back"), width: nil do