Added fonts and tweaked hud, added chat history and score board hud widgets

This commit is contained in:
2020-07-18 13:00:22 -05:00
parent b4a0a7a8bc
commit f6e4a509fd
17 changed files with 404 additions and 25 deletions

View File

@@ -2,14 +2,14 @@ class IMICFPS
class HUD
class AmmoWidget < HUD::Widget
def setup
@text = Text.new("")
@background = Gosu::Color.new(0x88222222)
@text = Text.new("", size: 64, mode: :add, font: MONOSPACE_FONT)
@background = Gosu::Color.new(0x88c64600)
end
def draw
Gosu.draw_rect(
@text.x - @margin, @text.y - @margin,
@text.width + @margin * 2, @text.height + @margin * 2,
@text.x - @padding, @text.y - @padding,
@text.width + @padding * 2, @text.height + @padding * 2,
@background
)
@text.draw
@@ -17,12 +17,12 @@ class IMICFPS
def update
if (Gosu.milliseconds / 1000.0) % 1.0 >= 0.9
random = "#{rand(0..999)}".rjust(3, "0")
@text.text = "Pistol\nAMMO: #{random}"
random = "#{rand(0..199)}".rjust(3, "0")
@text.text = "#{random}/999"
end
@text.x = window.width - (@margin * 2 + @text.width)
@text.y = window.height - (@margin * 2 + @text.height)
@text.x = window.width - (@margin + @text.width + @padding)
@text.y = window.height - (@margin + @text.height + @padding)
end
end
end