From 54c480ecb8b9b6d25556c310e87b69f7d978efaf Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 9 Sep 2018 19:19:26 -0500 Subject: [PATCH] Tweaked loading screen to pause for a split second to show 100%, tweaked menu hover color and effect, fixed indention. --- lib/states/game_states/game.rb | 2 +- lib/states/game_states/loading_state.rb | 19 +++++++++++++++---- lib/states/menu.rb | 4 +++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/states/game_states/game.rb b/lib/states/game_states/game.rb index 60ff31c..3161fe1 100644 --- a/lib/states/game_states/game.rb +++ b/lib/states/game_states/game.rb @@ -139,7 +139,7 @@ eos def needs_cursor? @needs_cursor - end + end def lose_focus puts 'Bye' diff --git a/lib/states/game_states/loading_state.rb b/lib/states/game_states/loading_state.rb index 28b70bf..b65f80a 100644 --- a/lib/states/game_states/loading_state.rb +++ b/lib/states/game_states/loading_state.rb @@ -3,8 +3,8 @@ class IMICFPS def setup @header = Text.new("I-MIC FPS", y: 10, size: 100, alignment: :center) @subheading = Text.new("Loading Assets", y: 100, size: 50, alignment: :center) - @state = Text.new("Preparing...", y: $window.height/2-30, size: 30, alignment: :center) - @percentage = Text.new("0%", y: $window.height-50-15, size: 30, alignment: :center) + @state = Text.new("Preparing...", y: $window.height/2-40, size: 40, alignment: :center) + @percentage = Text.new("0%", y: $window.height-50-25, size: 50, alignment: :center) @dummy_game_object = nil @assets = [] @@ -16,6 +16,9 @@ class IMICFPS @act = false @cycled = false + + @completed_for_ms = 0 + @lock = false end def draw @@ -28,10 +31,11 @@ class IMICFPS end def update + puts (@asset_index.to_f/@assets.count) @percentage.text = "#{((@asset_index.to_f/@assets.count)*100.0).round}%" @act = true if @cycled - if @act + if @act && (@asset_index+1 <= @assets.count) @act = false @cycled = false @@ -42,9 +46,16 @@ class IMICFPS end unless @asset_index < @assets.count - push_game_state(@options[:forward]) + if @act && Gosu.milliseconds-@completed_for_ms > 250 + push_game_state(@options[:forward]) + else + @act = true + @completed_for_ms = Gosu.milliseconds unless @lock + @lock = true + end else @state.text = "Loading #{@assets[@asset_index][:path].split('/').last}..." + @state.x = ($window.width/2)-(@state.width/2) @cycled = true end end diff --git a/lib/states/menu.rb b/lib/states/menu.rb index 6297d9f..be06dfe 100644 --- a/lib/states/menu.rb +++ b/lib/states/menu.rb @@ -104,14 +104,16 @@ class IMICFPS def initialize(text, host, block) @text, @host, @block = text, host, block @color = @text.color - @hover_color = Gosu::Color.rgb(255, 127, 0) + @hover_color = Gosu::Color.rgb(64, 127, 255) end def update if @host.mouse_over?(self) @text.color = @hover_color + @text.shadow_size = 2 else @text.color = @color + @text.shadow_size = 1 end end