Storm Sync

This commit is contained in:
2020-07-18 18:20:24 -05:00
parent 1d7cd19b41
commit ce90284001
10 changed files with 157 additions and 45 deletions

View File

@@ -8,31 +8,31 @@ class IMICFPS
@text = Text.new("RADAR", size: 18, mode: :add, font: MONOSPACE_FONT)
@image = Gosu::Image.new("#{CYBERARM_ENGINE_ROOT_PATH}/assets/textures/default.png", retro: true)
@scale = (@size - @padding * 2.0) / @image.width
@scale = (@size - Widget.padding * 2.0) / @image.width
end
def draw
Gosu.draw_rect(
@margin, window.height - (@size + @margin),
Widget.margin, window.height - (@size + Widget.margin),
@size, @size,
@border_color
)
Gosu.draw_rect(
@margin + @padding, window.height - (@size + @margin) + @padding,
@size - @padding * 2, @size - @padding * 2,
Widget.margin + Widget.padding, window.height - (@size + Widget.margin) + Widget.padding,
@size - Widget.padding * 2, @size - Widget.padding * 2,
@radar_color
)
@image.draw(@margin + @padding, window.height - (@size + @margin) + @padding, 46, @scale, @scale, 0x88ffffff)
@image.draw(Widget.margin + Widget.padding, window.height - (@size + Widget.margin) + Widget.padding, 46, @scale, @scale, 0x88ffffff)
@text.draw
end
def update
@text.text = "RADAR: X #{@player.position.x.round(1)} Y #{@player.position.y.round(1)} Z #{@player.position.z.round(1)}"
@text.x = @margin + @size / 2 - @text.width / 2
@text.y = window.height - (@margin + @size + @text.height)
@text.x = Widget.margin + @size / 2 - @text.width / 2
@text.y = window.height - (Widget.margin + @size + @text.height)
end
end
end