mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-14 07:12:34 +00:00
Redid menus, stubbed Entity
This commit is contained in:
28
lib/states/closing.rb
Normal file
28
lib/states/closing.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class IMICRTS
|
||||
class Closing < CyberarmEngine::GuiState
|
||||
def setup
|
||||
@logo = Gosu::Image.new("assets/logo.png")
|
||||
@color = Gosu::Color.new(0xffffffff)
|
||||
|
||||
@started_at = Gosu.milliseconds
|
||||
@close_time = 3_000
|
||||
end
|
||||
|
||||
def draw
|
||||
Gosu.draw_rect(0, 0, window.width, window.height, @color)
|
||||
@logo.draw(window.width / 2 - @logo.width / 2, window.height / 2 - @logo.height / 2, 2, 1.0, 1.0, @color)
|
||||
end
|
||||
|
||||
def update
|
||||
super
|
||||
factor = (1.0 - ((Gosu.milliseconds - @started_at) / @close_time.to_f)).clamp(0.0, 1.0)
|
||||
@color.alpha = 255 * (factor - 0.1)
|
||||
|
||||
window.close if Gosu.milliseconds - @started_at >= @close_time
|
||||
end
|
||||
|
||||
def button_up(id)
|
||||
window.close if id == Gosu::KB_ESCAPE
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user