Added HUD widgets, make Boot and Close use button_up instead of button_down

This commit is contained in:
2020-05-04 08:57:58 -05:00
parent 1629cf4605
commit 85dd90b2f4
9 changed files with 164 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ class IMICFPS
push_state(MainMenu) if Gosu.milliseconds - @start_time >= @time_to_live
end
def button_down(id)
def button_up(id)
if id == Gosu::KbEscape or
(id >= Gosu::GP_LEFT and id >= Gosu::GP_BUTTON_15) or
id == Gosu::MsLeft

View File

@@ -51,7 +51,7 @@ class IMICFPS
@slope -= 25 * window.dt
end
def button_down(id)
def button_up(id)
if id == Gosu::KbEscape or
(id >= Gosu::GP_LEFT and id >= Gosu::GP_BUTTON_15) or
id == Gosu::MsLeft

View File

@@ -12,6 +12,7 @@ class IMICFPS
@director = Networking::Director.new(mode: :memory, hostname: "i-mic.rubyclan.org", port: 56789, interface: { server: Networking::MemoryServer, connection: Networking::MemoryConnection }, state: self)
@crosshair = Crosshair.new
@hud = HUD.new(@player)
@text = Text.new("Pending...", x: 10, y: 22, z: 1, size: 18, font: "DejaVu Sans", shadow_color: Gosu::Color::BLACK)
@@ -27,6 +28,7 @@ class IMICFPS
@map.render(@camera)
@crosshair.draw
@hud.draw
@text.draw
end
@@ -38,6 +40,7 @@ class IMICFPS
@map.update
control_player
@hud.update
@camera.update
@director.tick(window.dt)