Class: Badline::VIC::Sprites
- Inherits:
-
Object
- Object
- Badline::VIC::Sprites
- Defined in:
- lib/badline/vic/sprites.rb
Constant Summary collapse
- SPRITE_COLLISION_IRQ =
$D019 latch bits raised by the collision registers.
0x04- DATA_COLLISION_IRQ =
IMMC, mirrors $D01E
0x02
Instance Method Summary collapse
- #[](index) ⇒ Object
- #active? ⇒ Boolean
-
#composite(colors, mask) ⇒ Object
Merge each displaying sprite’s line into the scratch buffers, then apply the winners over the background in a single pass over the touched span.
-
#initialize(registers, bank, width) ⇒ Sprites
constructor
IMBC, mirrors $D01F.
- #start_line(line) ⇒ Object
Constructor Details
#initialize(registers, bank, width) ⇒ Sprites
IMBC, mirrors $D01F
12 13 14 15 16 17 18 19 20 |
# File 'lib/badline/vic/sprites.rb', line 12 def initialize(registers, bank, width) @registers = registers @bank = bank @width = width @sprites = Array.new(8) { |i| Sprite.new(i, registers, bank, width) } @hits = Array.new(width, 0) @win_color = Array.new(width, 0) @win_priority = Array.new(width, false) end |
Instance Method Details
#[](index) ⇒ Object
22 |
# File 'lib/badline/vic/sprites.rb', line 22 def [](index) = @sprites[index] |
#active? ⇒ Boolean
28 |
# File 'lib/badline/vic/sprites.rb', line 28 def active? = @sprites.any?(&:displaying?) |
#composite(colors, mask) ⇒ Object
Merge each displaying sprite’s line into the scratch buffers, then apply the winners over the background in a single pass over the touched span.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/badline/vic/sprites.rb', line 33 def composite(colors, mask) @sprite_clash = 0 @data_clash = 0 lo = @width hi = 0 @sprites.each do |sprite| next unless sprite. seg_lo, seg_hi = merge(sprite, mask) lo = seg_lo if seg_lo < lo hi = seg_hi if seg_hi > hi end apply(colors, mask, lo, hi) register_collisions end |
#start_line(line) ⇒ Object
24 25 26 |
# File 'lib/badline/vic/sprites.rb', line 24 def start_line(line) @sprites.each { |sprite| sprite.start_line(line) } end |