Class: Amaterasu::GameBoy::Ppu::Modes::VBlank
- Inherits:
-
Object
- Object
- Amaterasu::GameBoy::Ppu::Modes::VBlank
- Defined in:
- lib/amaterasu/game_boy/ppu/modes/v_blank.rb
Overview
Defines the behavior of the Ppu during VBlank mode.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(ppu) ⇒ VBlank
constructor
A new instance of VBlank.
- #inspect ⇒ Object
- #tick ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(ppu) ⇒ VBlank
Returns a new instance of VBlank.
11 12 13 14 15 16 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 11 def initialize(ppu) @ppu = ppu @name = 'VBLANK' @number = 1 end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 9 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 9 def number @number end |
Instance Method Details
#inspect ⇒ Object
30 31 32 33 34 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 30 def inspect '#<Amaterasu::GameBoy::Ppu::Modes::VBlank ' \ "@name='#{@name}' " \ "@number=#{@number} " end |
#tick ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 18 def tick return unless @ppu.dots == DOTS_PER_SCANLINE @ppu.reset_for_scanline @ppu.increment_ly return unless @ppu.registers.ly == TOTAL_SCANLINES @ppu.draw_frame @ppu.reset_states @ppu.set_mode(:oam_scan) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/amaterasu/game_boy/ppu/modes/v_blank.rb', line 36 def to_s "#{@name} (##{@number}) | WAITING UNTIL THE FRAME IS COMPLETED" end |