mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-13 06:52:33 +00:00
56 lines
1.2 KiB
Ruby
56 lines
1.2 KiB
Ruby
class IMICRTS
|
|
class Window < CyberarmEngine::Window
|
|
attr_reader :mouse
|
|
def setup
|
|
@last_update_time = Gosu.milliseconds
|
|
@mouse = CyberarmEngine::Vector.new
|
|
@cursor = Gosu::Image.new("#{IMICRTS::ASSETS_PATH}/cursors/pointer.png")
|
|
|
|
self.caption = "#{IMICRTS::NAME} (#{IMICRTS::VERSION} #{IMICRTS::VERSION_NAME})"
|
|
if ARGV.join.include?("--debug-game")
|
|
push_state(Game)
|
|
elsif Setting.enabled?(:skip_intro)
|
|
push_state(MainMenu)
|
|
else
|
|
push_state(Boot)
|
|
end
|
|
end
|
|
|
|
def draw
|
|
@cursor.draw(mouse_x, mouse_y, Float::INFINITY) if @show_cursor
|
|
|
|
super
|
|
end
|
|
|
|
def update
|
|
@mouse.x, @mouse.y = self.mouse_x, self.mouse_y
|
|
super
|
|
|
|
@last_update_time = Gosu.milliseconds
|
|
end
|
|
|
|
def needs_cursor?
|
|
return false
|
|
end
|
|
|
|
def close
|
|
push_state(Closing) unless current_state.is_a?(Closing)
|
|
end
|
|
|
|
def delta_time
|
|
Gosu.milliseconds - @last_update_time
|
|
end
|
|
|
|
def dt
|
|
delta_time / 1000.0
|
|
end
|
|
|
|
# Override CyberarmEngine::Window#push_state to only ever have 1 state
|
|
def push_state(*args)
|
|
@states.clear
|
|
|
|
super(*args)
|
|
end
|
|
end
|
|
end
|