From ed254dc45573d725ae35a7eb515e8f97594212d5 Mon Sep 17 00:00:00 2001 From: elliottcable Date: Thu, 5 Mar 2009 14:42:58 -0900 Subject: [PATCH] Added a basic window initialization example --- examples/initialization.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/initialization.rb diff --git a/examples/initialization.rb b/examples/initialization.rb new file mode 100644 index 0000000..dd9bf5c --- /dev/null +++ b/examples/initialization.rb @@ -0,0 +1,23 @@ +($:.unshift File.expand_path(File.join( File.dirname(__FILE__), '..', 'lib' ))).uniq! +require 'nfoiled' + +## +# This example provides a simple example of setting up an Ncurses interface, +# and then tearing it down. + +# First, we need to ensure that Ncurses will exit cleanly (that is, we don't +# want an interrupt or fatal error to screw up the terminal output after the +# program exists). +at_exit { ::Ncurses.endwin } + +# Second, the actual initialization of Ncurses. This allocates the necessary +# memory and initializes all variables. +::Ncurses.initscr + +# Finally, we have to update the display. +::Ncurses.doupdate + +# Let's print something and exit! +puts "woot!" + +sleep 10 -- 2.11.4.GIT