Tweaked loading screen to pause for a split second to show 100%, tweaked menu hover color and effect, fixed indention.

This commit is contained in:
2018-09-09 19:19:26 -05:00
parent e57cf8500b
commit 54c480ecb8
3 changed files with 19 additions and 6 deletions

View File

@@ -3,8 +3,8 @@ class IMICFPS
def setup def setup
@header = Text.new("I-MIC FPS", y: 10, size: 100, alignment: :center) @header = Text.new("I-MIC FPS", y: 10, size: 100, alignment: :center)
@subheading = Text.new("Loading Assets", y: 100, size: 50, 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) @state = Text.new("Preparing...", y: $window.height/2-40, size: 40, alignment: :center)
@percentage = Text.new("0%", y: $window.height-50-15, size: 30, alignment: :center) @percentage = Text.new("0%", y: $window.height-50-25, size: 50, alignment: :center)
@dummy_game_object = nil @dummy_game_object = nil
@assets = [] @assets = []
@@ -16,6 +16,9 @@ class IMICFPS
@act = false @act = false
@cycled = false @cycled = false
@completed_for_ms = 0
@lock = false
end end
def draw def draw
@@ -28,10 +31,11 @@ class IMICFPS
end end
def update def update
puts (@asset_index.to_f/@assets.count)
@percentage.text = "#{((@asset_index.to_f/@assets.count)*100.0).round}%" @percentage.text = "#{((@asset_index.to_f/@assets.count)*100.0).round}%"
@act = true if @cycled @act = true if @cycled
if @act if @act && (@asset_index+1 <= @assets.count)
@act = false @act = false
@cycled = false @cycled = false
@@ -42,9 +46,16 @@ class IMICFPS
end end
unless @asset_index < @assets.count unless @asset_index < @assets.count
if @act && Gosu.milliseconds-@completed_for_ms > 250
push_game_state(@options[:forward]) push_game_state(@options[:forward])
else
@act = true
@completed_for_ms = Gosu.milliseconds unless @lock
@lock = true
end
else else
@state.text = "Loading #{@assets[@asset_index][:path].split('/').last}..." @state.text = "Loading #{@assets[@asset_index][:path].split('/').last}..."
@state.x = ($window.width/2)-(@state.width/2)
@cycled = true @cycled = true
end end
end end

View File

@@ -104,14 +104,16 @@ class IMICFPS
def initialize(text, host, block) def initialize(text, host, block)
@text, @host, @block = text, host, block @text, @host, @block = text, host, block
@color = @text.color @color = @text.color
@hover_color = Gosu::Color.rgb(255, 127, 0) @hover_color = Gosu::Color.rgb(64, 127, 255)
end end
def update def update
if @host.mouse_over?(self) if @host.mouse_over?(self)
@text.color = @hover_color @text.color = @hover_color
@text.shadow_size = 2
else else
@text.color = @color @text.color = @color
@text.shadow_size = 1
end end
end end