Class: Doom::Wad::HudSprite

Inherits:
Object
  • Object
show all
Defined in:
lib/doom/wad/hud_graphics.rb

Overview

Simple sprite container for HUD graphics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, width, height, left_offset, top_offset, columns) ⇒ HudSprite

Returns a new instance of HudSprite.



243
244
245
246
247
248
249
250
# File 'lib/doom/wad/hud_graphics.rb', line 243

def initialize(name, width, height, left_offset, top_offset, columns)
  @name = name
  @width = width
  @height = height
  @left_offset = left_offset
  @top_offset = top_offset
  @columns = columns
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def columns
  @columns
end

#heightObject (readonly)

Returns the value of attribute height.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def height
  @height
end

#left_offsetObject (readonly)

Returns the value of attribute left_offset.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def left_offset
  @left_offset
end

#nameObject (readonly)

Returns the value of attribute name.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def name
  @name
end

#top_offsetObject (readonly)

Returns the value of attribute top_offset.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def top_offset
  @top_offset
end

#widthObject (readonly)

Returns the value of attribute width.



241
242
243
# File 'lib/doom/wad/hud_graphics.rb', line 241

def width
  @width
end

Instance Method Details

#column_pixels(x) ⇒ Object



252
253
254
# File 'lib/doom/wad/hud_graphics.rb', line 252

def column_pixels(x)
  @columns[x % @width]
end