Better documented `Window#on_key`
[nfoiled.git] / examples / multiple_windows.rb
blob1acec1e78b0919420486c02655595b780227064a
1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), '..', 'lib' ))).uniq!
2 require 'nfoiled'
4 ##
5 # This example shows you how to utilize a single Nfoiled window
7 # Creating our first `Window` should take care of initializing the Nfoiled
8 # system for us. However, the `Ncurses.LINES` and `Ncurses.COLS` methods won't
9 # be defined until the system is initialized, so we have to prime it.
10 Nfoiled::initialize
11 left  = Nfoiled::Window.new :width => ::Ncurses.COLS / 2
12 right = Nfoiled::Window.new :left  => ::Ncurses.COLS / 2,
13                             :width => ::Ncurses.COLS / 2
15 # As per usual, the screen doesn't update until we actually tell it to.
16 Nfoiled::update!
18 # Let's print some stuff, just to see
19 left.print  "left-brain"
20 right.print "right-brain"
22 # ... aaaaand update again!
23 Nfoiled::update!
25 sleep 5