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

This commit is contained in:
2021-05-29 00:36:47 +00:00
parent 3570a80d67
commit da54bf5c53
21 changed files with 43 additions and 37 deletions

View File

@@ -4,7 +4,7 @@ class IMICFPS
class HUD class HUD
class AmmoWidget < HUD::Widget class AmmoWidget < HUD::Widget
def setup 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) @background = Gosu::Color.new(0x88c64600)
end end

View File

@@ -10,7 +10,7 @@ class IMICFPS
"", "",
size: 16, size: 16,
x: Widget.margin, y: Widget.margin, z: 45, x: Widget.margin, y: Widget.margin, z: 45,
shadow_color: Gosu::Color::BLACK, border_color: Gosu::Color::BLACK,
font: BOLD_SANS_FONT font: BOLD_SANS_FONT
) )

View File

@@ -5,7 +5,7 @@ class IMICFPS
class HealthWidget < HUD::Widget class HealthWidget < HUD::Widget
def setup def setup
@spacer = 0 @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 @width = 512
@height = 24 @height = 24
@slant = 32 @slant = 32

View File

@@ -12,7 +12,7 @@ class IMICFPS
@border_color = Gosu::Color.new(0x88c64600) @border_color = Gosu::Color.new(0x88c64600)
@radar_color = Gosu::Color.new(0x88212121) @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) @image = Gosu::Image.new("#{CYBERARM_ENGINE_ROOT_PATH}/assets/textures/default.png", retro: true)
@scale = (@size - Widget.padding * 2.0) / @image.width @scale = (@size - Widget.padding * 2.0) / @image.width
end end

View File

@@ -10,8 +10,8 @@ class IMICFPS
"", "",
size: 16, size: 16,
x: Widget.margin, y: Widget.margin, z: 45, x: Widget.margin, y: Widget.margin, z: 45,
shadow: true, border: true,
shadow_color: Gosu::Color::BLACK, border_color: Gosu::Color::BLACK,
font: BOLD_SANS_FONT font: BOLD_SANS_FONT
) )

View File

@@ -16,8 +16,8 @@ class IMICFPS
size: 18, size: 18,
font: SANS_FONT, font: SANS_FONT,
color: @color, color: @color,
shadow: true, border: true,
shadow_color: Gosu::Color::BLACK, border_color: Gosu::Color::BLACK,
) )
end end

View File

@@ -7,7 +7,7 @@ class IMICFPS
Slot = Struct.new(:value, :width) Slot = Struct.new(:value, :width)
def initialize 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 = [] @slots = []
@space_width = @text.textobject.text_width(" ") @space_width = @text.textobject.text_width(" ")
end end

View File

@@ -3,7 +3,7 @@
class IMICFPS class IMICFPS
class Boot < GameState class Boot < GameState
def setup 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") @logo = get_image("#{IMICFPS::GAME_ROOT_PATH}/static/logo.png")
@start_time = Gosu.milliseconds @start_time = Gosu.milliseconds
@@ -76,8 +76,11 @@ class IMICFPS
def update def update
@animators.each(&: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.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 push_state(MainMenu) if Gosu.milliseconds - @start_time >= @time_to_live
end end

View File

@@ -22,8 +22,8 @@ class IMICFPS
@assets = [] @assets = []
@asset_index = 0 @asset_index = 0
add_asset(:model, @map_parser.terrain.package, @map_parser.terrain.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) add_asset(:model, @map_parser.skydome.package, @map_parser.skydome.name) if @map_parser.skydome.package
@map_parser.entities.each do |entity| @map_parser.entities.each do |entity|
add_asset(:model, entity.package, entity.name) add_asset(:model, entity.package, entity.name)
end end

View File

@@ -24,7 +24,7 @@ class IMICFPS
end end
stack(width: 0.5, height: 1.0) do 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 link I18n.t("menus.back"), width: 1.0 do
pop_state pop_state

View File

@@ -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 = 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) @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.name, text_size: 50, text_border: true, text_border_color: Gosu::Color::BLACK
label @manifest.model, text_shadow: true, text_shadow_color: Gosu::Color::BLACK label @manifest.model, text_border: true, text_border_color: Gosu::Color::BLACK
@camera_position = label "", text_shadow: true, text_shadow_color: Gosu::Color::BLACK @camera_position = label "", text_border: true, text_border_color: Gosu::Color::BLACK
@camera_orientation = label "", text_shadow: true, text_shadow_color: Gosu::Color::BLACK @camera_orientation = label "", text_border: true, text_border_color: Gosu::Color::BLACK
button "Back" do button "Back" do
pop_state pop_state

View File

@@ -22,14 +22,14 @@ class IMICFPS
end end
stack(width: 0.5, height: 1.0) do 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 flow width: 1.0 do
link I18n.t("menus.back"), width: 0.32 do link I18n.t("menus.back"), width: 0.32 do
pop_state pop_state
end end
button "New Map", width: 1.0, width: 0.64 button "New Map", width: 0.64
end end
label "Edit Map", width: 1.0, text_align: :center, text_size: 50 label "Edit Map", width: 1.0, text_align: :center, text_size: 50

View File

@@ -16,7 +16,9 @@ class IMICFPS
@input = Text.new("", x: 4, y: @height - (PADDING * 2), z: Console::Z + 1, font: MONOSPACE_FONT) @input = Text.new("", x: 4, y: @height - (PADDING * 2), z: Console::Z + 1, font: MONOSPACE_FONT)
@input.y -= @input.height @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 update_history_y
@command_history = [] @command_history = []

View File

@@ -22,7 +22,9 @@ class IMICFPS
@accent_color = ACCENT_COLOR @accent_color = ACCENT_COLOR
window.needs_cursor = true window.needs_cursor = true
@__version_text = CyberarmEngine::Text.new("<b>#{IMICFPS::NAME}</b> v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})", font: BOLD_SANS_FONT) @__version_text = CyberarmEngine::Text.new(
"<b>#{IMICFPS::NAME}</b> 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.x = window.width - (@__version_text.width + 10)
@__version_text.y = window.height - (@__version_text.height + 10) @__version_text.y = window.height - (@__version_text.height + 10)
@@ -39,7 +41,9 @@ class IMICFPS
text_size: 100, text_size: 100,
color: Gosu::Color::BLACK, color: Gosu::Color::BLACK,
text_align: :center, text_align: :center,
width: 1.0 text_shadow: true,
text_shadow_size: 4,
width: 1.0,
}, },
Subtitle: { Subtitle: {
text_size: 50, text_size: 50,
@@ -51,10 +55,10 @@ class IMICFPS
font: BOLD_SANS_FONT, font: BOLD_SANS_FONT,
text_size: 50, text_size: 50,
text_align: :center, text_align: :center,
text_shadow: true, text_border: true,
text_shadow_size: 2, text_border_size: 2,
text_shadow_color: Gosu::Color::BLACK, text_border_color: Gosu::Color::BLACK,
text_shadow_alpha: 100, text_border_alpha: 100,
color: Gosu::Color.rgb(0, 127, 127), color: Gosu::Color.rgb(0, 127, 127),
width: 1.0, width: 1.0,
hover: { hover: {

View File

@@ -3,8 +3,7 @@
class IMICFPS class IMICFPS
class ExtrasMenu < Menu class ExtrasMenu < Menu
def setup def setup
title IMICFPS::NAME title I18n.t("menus.extras")
subtitle "Extras"
link "Asset Viewer" do link "Asset Viewer" do
push_state(IMICFPS::AssetViewerTool::MainMenu) push_state(IMICFPS::AssetViewerTool::MainMenu)

View File

@@ -4,8 +4,7 @@ class IMICFPS
class GamePauseMenu < Menu class GamePauseMenu < Menu
def setup def setup
@bar_alpha = 50 @bar_alpha = 50
title IMICFPS::NAME title "Paused"
subtitle "Paused"
link "Resume" do link "Resume" do
pop_state pop_state

View File

@@ -3,7 +3,7 @@
class IMICFPS class IMICFPS
class LevelSelectMenu < Menu class LevelSelectMenu < Menu
def setup def setup
title IMICFPS::NAME title I18n.t("menus.singleplayer")
subtitle "Choose a Map" subtitle "Choose a Map"
Dir.glob("#{GAME_ROOT_PATH}/maps/*.json").map { |file| [file, MapParser.new(map_file: file)] }.each do |file, map| Dir.glob("#{GAME_ROOT_PATH}/maps/*.json").map { |file| [file, MapParser.new(map_file: file)] }.each do |file, map|

View File

@@ -3,8 +3,7 @@
class IMICFPS class IMICFPS
class MultiplayerMenu < Menu class MultiplayerMenu < Menu
def setup def setup
title IMICFPS::NAME title I18n.t("menus.multiplayer")
subtitle "Multiplayer"
link "Quick Join" link "Quick Join"
link "Server Browser" do link "Server Browser" do

View File

@@ -8,7 +8,7 @@ class IMICFPS
end end
stack(width: 0.5, height: 1.0) do 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 flow width: 1.0 do
link I18n.t("menus.back"), width: 0.32 do link I18n.t("menus.back"), width: 0.32 do

View File

@@ -36,7 +36,7 @@ class IMICFPS
stack width: 0.5, height: 1.0 do stack width: 0.5, height: 1.0 do
stack width: 1.0, height: 0.25 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 flow(width: 1.0) do
link I18n.t("menus.back"), width: 0.32 do link I18n.t("menus.back"), width: 0.32 do

View File

@@ -26,7 +26,7 @@ class IMICFPS
stack(width: 0.5, height: 1.0) do stack(width: 0.5, height: 1.0) do
stack(width: 1.0, height: 0.25) 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 flow(width: 1.0) do
link I18n.t("menus.back"), width: nil do link I18n.t("menus.back"), width: nil do