Class: WindowBlessing::BufferedScreen

Inherits:
XtermScreen show all
Defined in:
lib/window_blessing/buffered_screen.rb

Instance Attribute Summary collapse

Attributes inherited from XtermScreen

#event_manager, #event_queue, #input, #output, #state

Instance Method Summary collapse

Methods inherited from XtermScreen

#event_loop, #in_xterm_state, #initialize_screen, #inspect, #process_events, #process_queued_events, #queue_event, #queue_pending_xterm_events, #queued_events?, #quit, #running?, #start, #wait_for_events

Constructor Details

#initializeBufferedScreen

Returns a new instance of BufferedScreen.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/window_blessing/buffered_screen.rb', line 6

def initialize
  super
  @screen_buffer = Buffer.new point(20,20)

  event_manager.on :tick do
    update_from_screen_buffer
  end

  event_manager.on :resize do |event|
    @screen_buffer = Buffer.new event[:size]
    @screen_buffer.dirty
  end
end

Instance Attribute Details

#screen_bufferObject

Returns the value of attribute screen_buffer.



4
5
6
# File 'lib/window_blessing/buffered_screen.rb', line 4

def screen_buffer
  @screen_buffer
end

Instance Method Details

#update_from_screen_bufferObject



20
21
22
23
24
25
26
# File 'lib/window_blessing/buffered_screen.rb', line 20

def update_from_screen_buffer
  if dirty_buffer = screen_buffer.dirty_subbuffer
#      XtermLog.log "#{self.class}#update_from_screen_buffer() diry_area: #{screen_buffer.dirty_area}"
    output.draw_buffer screen_buffer.dirty_area.loc, dirty_buffer
    screen_buffer.clean
  end
end