Class: Quake::Renderer::GLHud
- Inherits:
-
Object
- Object
- Quake::Renderer::GLHud
- Defined in:
- lib/quake/renderer/gl_hud.rb
Overview
Renders Quake’s status bar HUD using graphics from gfx.wad. Uses orthographic projection for 2D rendering on top of the 3D scene.
Layout matches original Quake sbar.c (320x200 virtual resolution):
Bottom bar (sbar): [armor_icon][armor] [face] [health] [ammo_icon][ammo]
Above that (ibar): weapon slots and ammo counts
Constant Summary collapse
- VIRTUAL_WIDTH =
320- VIRTUAL_HEIGHT =
200- SBAR_HEIGHT =
status bar height
24- DIGIT_WIDTH =
big number digit width
24
Instance Method Summary collapse
-
#initialize(wad, palette, screen_width, screen_height) ⇒ GLHud
constructor
A new instance of GLHud.
- #render(player_state) ⇒ Object
Constructor Details
#initialize(wad, palette, screen_width, screen_height) ⇒ GLHud
Returns a new instance of GLHud.
19 20 21 22 23 24 25 26 27 |
# File 'lib/quake/renderer/gl_hud.rb', line 19 def initialize(wad, palette, screen_width, screen_height) @wad = wad @palette = palette @screen_width = screen_width @screen_height = screen_height @textures = {} # name -> { id:, width:, height: } upload_hud_graphics end |
Instance Method Details
#render(player_state) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/quake/renderer/gl_hud.rb', line 29 def render(player_state) setup_ortho GL.Enable(GL::TEXTURE_2D) GL.Enable(GL::BLEND) GL.BlendFunc(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA) GL.Disable(GL::DEPTH_TEST) GL.Color4f(1.0, 1.0, 1.0, 1.0) (player_state) GL.Enable(GL::DEPTH_TEST) GL.Disable(GL::BLEND) restore_projection end |