Added custom cursors

This commit is contained in:
2019-10-27 11:43:15 -05:00
parent a95849d5c7
commit cd7b71894d
12 changed files with 475 additions and 3 deletions

View File

@@ -33,12 +33,12 @@ class IMICRTS
end
end
flow do
button("Accept", width: 0.4) do
flow(width: 1.0) do
button("Accept", width: 0.5) do
push_state(Game)
end
button("Back", width: 0.4, margin_left: 20) do
button("Back", align: :right) do
push_state(MainMenu)
end
end

View File

@@ -4,6 +4,7 @@ class IMICRTS
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")
@@ -15,6 +16,12 @@ class IMICRTS
end
end
def draw
@cursor.draw(mouse_x, mouse_y, Float::INFINITY)
super
end
def update
@mouse.x, @mouse.y = self.mouse_x, self.mouse_y
super
@@ -22,6 +29,10 @@ class IMICRTS
@last_update_time = Gosu.milliseconds
end
def needs_cursor?
return false
end
def close
push_state(Closing) unless current_state.is_a?(Closing)
end