mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 05:42:35 +00:00
Updates to support latest version of CyberarmEngine
This commit is contained in:
@@ -8,7 +8,7 @@ module TAC
|
||||
|
||||
def initialize
|
||||
@title = CyberarmEngine::Text.new("FIRST TECH CHALLENGE", size: TITLE_SIZE, text_shadow: true, y: 10, color: Gosu::Color::GRAY)
|
||||
@title.x = $window.width / 2 - @title.width / 2
|
||||
@title.x = CyberarmEngine::Window.instance.width / 2 - @title.width / 2
|
||||
|
||||
@text = CyberarmEngine::Text.new(":1234567890", size: CLOCK_SIZE, text_border: true, border_size: 2, border_color: Gosu::Color::GRAY)
|
||||
@text.width # trigger font-eager loading
|
||||
@@ -28,7 +28,7 @@ module TAC
|
||||
end
|
||||
|
||||
def update
|
||||
@title.x = $window.width / 2 - @title.width / 2
|
||||
@title.x = CyberarmEngine::Window.instance.width / 2 - @title.width / 2
|
||||
|
||||
if @controller
|
||||
@text.color = @controller.display_color
|
||||
@@ -38,8 +38,8 @@ module TAC
|
||||
@text.text = "0:00"
|
||||
end
|
||||
|
||||
@text.x = $window.width / 2 - @text.textobject.text_width("0:00") / 2
|
||||
@text.y = $window.height / 2 - @text.height / 2
|
||||
@text.x = CyberarmEngine::Window.instance.width / 2 - @text.textobject.text_width("0:00") / 2
|
||||
@text.y = CyberarmEngine::Window.instance.height / 2 - @text.height / 2
|
||||
|
||||
@controller&.update
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ module TAC
|
||||
end
|
||||
|
||||
def start_clock(mode)
|
||||
return if @clock.active? || $window.current_state.is_a?(Randomizer)
|
||||
return if @clock.active? || CyberarmEngine::Window.instance.current_state.is_a?(Randomizer)
|
||||
|
||||
@clock.controller = case mode
|
||||
when :full_match
|
||||
@@ -45,7 +45,7 @@ module TAC
|
||||
|
||||
def set_clock_title(string)
|
||||
@clock.title.text = string.to_s
|
||||
@clock.title.x = $window.width / 2 - @clock.title.width / 2
|
||||
@clock.title.x = CyberarmEngine::Window.instance.width / 2 - @clock.title.width / 2
|
||||
end
|
||||
|
||||
def get_clock_title(string)
|
||||
|
||||
@@ -225,7 +225,7 @@ module TAC
|
||||
def handle_shutdown(packet)
|
||||
unless @host_is_a_connection
|
||||
# RemoteControl.server.close
|
||||
# $window.close
|
||||
# CyberarmEngine::Window.instance.close
|
||||
Gosu::Song.current_song&.stop
|
||||
exit
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ module TAC
|
||||
end
|
||||
|
||||
def update
|
||||
@particles.each { |part| part.update($window.dt) }
|
||||
@particles.each { |part| part.update(CyberarmEngine::Window.instance.dt) }
|
||||
@particles.delete_if { |part| part.die? }
|
||||
|
||||
spawn_particles
|
||||
@@ -27,28 +27,28 @@ module TAC
|
||||
def spawn_particles
|
||||
# !clock_active? &&
|
||||
if @particles.count < @max_particles && Gosu.milliseconds - @last_spawned >= @interval
|
||||
screen_midpoint = CyberarmEngine::Vector.new($window.width / 2, $window.height / 2)
|
||||
screen_midpoint = CyberarmEngine::Vector.new(CyberarmEngine::Window.instance.width / 2, CyberarmEngine::Window.instance.height / 2)
|
||||
scale = rand(0.25..1.0)
|
||||
image_name = @image_options.sample
|
||||
|
||||
return unless image_name
|
||||
|
||||
image = $window.current_state.get_image(image_name)
|
||||
image = CyberarmEngine::Window.instance.current_state.get_image(image_name)
|
||||
position = CyberarmEngine::Vector.new(0, 0)
|
||||
|
||||
r = rand
|
||||
if r < 0.25 # LEFT
|
||||
position.x = -image.width * scale
|
||||
position.y = rand(0..($window.height - image.height * scale))
|
||||
position.y = rand(0..(CyberarmEngine::Window.instance.height - image.height * scale))
|
||||
elsif r < 0.5 # RIGHT
|
||||
position.x = $window.width + (image.width * scale)
|
||||
position.y = rand(0..($window.height - image.height * scale))
|
||||
position.x = CyberarmEngine::Window.instance.width + (image.width * scale)
|
||||
position.y = rand(0..(CyberarmEngine::Window.instance.height - image.height * scale))
|
||||
elsif r < 0.75 # TOP
|
||||
position.x = rand(0..($window.width - image.width * scale))
|
||||
position.x = rand(0..(CyberarmEngine::Window.instance.width - image.width * scale))
|
||||
position.y = -image.height * scale
|
||||
else #BOTTOM
|
||||
position.x = rand(0..($window.width - image.width * scale))
|
||||
position.y = $window.height + image.height * scale
|
||||
position.x = rand(0..(CyberarmEngine::Window.instance.width - image.width * scale))
|
||||
position.y = CyberarmEngine::Window.instance.height + image.height * scale
|
||||
end
|
||||
|
||||
position.x ||= 0
|
||||
|
||||
@@ -35,7 +35,7 @@ module TAC
|
||||
end
|
||||
|
||||
def draw
|
||||
window.previous_state.draw
|
||||
previous_state.draw
|
||||
|
||||
Gosu.flush
|
||||
|
||||
@@ -56,7 +56,7 @@ module TAC
|
||||
end
|
||||
|
||||
def update
|
||||
window.previous_state&.update_non_gui
|
||||
previous_state&.update_non_gui
|
||||
|
||||
@ducks.each { |o| o.update(@size) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user