Fixed some typos and some funny language (my own) in the documentation of the test applications. ADded a hidden [+] key support for 'Blocks' so that I can increase the level to my prefered one (6) and not have to play through 1-5 ;-)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5976 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2007-11-19 14:14:13 +00:00
parent 7455482458
commit b92ee9f21c
2 changed files with 56 additions and 45 deletions

View File

@ -9,7 +9,7 @@
<P ALIGN="RIGHT">March 19, 2005</P>
<P>The FLTK distribution contains over 60 sample applications written
in or ported to FLTK. If the FLTK archive you received does not
in, or ported to, FLTK. If the FLTK archive you received does not
contain a 'test' directory, you can download the complete FLTK
distribution from
<a href="http://fltk.org/software.php">http://fltk.org/software.php</a>.</P>
@ -118,8 +118,9 @@ generate some custom drawings. The sample drawings use the matrix
based arc drawing for some fun effects.
<h3><a name="ask">ask</h3>
<tt>ask</tt> shows some of FLTK's standard dialog boxes, but you
may end up in a loop, but you may end up in a loop, but... .
<tt>ask</tt> shows some of FLTK's standard dialog boxes. Click
the correct answers or you may end up in a loop, or you may end
up in a loop, or you... .
<h3><a name="bitmap">bitmap</h3>
This simple test shows the use of a single color bitmap as a
@ -134,8 +135,9 @@ bundle format.
<h3><a name="boxtype">boxtype</h3>
<tt>boxtype</tt> gives an overview of readily available boxes and
frames in FLTK. More types can be added by the user. When using
themes, FLTK shuffles boxtypes around to give an app a new look.
frames in FLTK. More types can be added by the application programmer.
When using themes, FLTK shuffles boxtypes around to give your program
a new look.
<h3><a name="browser">browser</h3>
<tt>browser</tt> shows the capabilities of the <tt>Fl_Browser</tt> widget.
@ -143,28 +145,28 @@ Important features tested are loading of files, line formatting, and
correct positioning of the browser data window.
<h3><a name="button">button</h3>
The <tt>button</tt> test is a very simple demo of buttons and callbacks.
The <tt>button</tt> test is a simple demo of push-buttons and callbacks.
<h3><a name="buttons">buttons</h3>
<tt>buttons</tt> shows a sample of FLTK button types.
<h3><a name="checkers">checkers</h3>
Written by Steve Poulsen in early 1979, <tt>checkers</tt> shows
how to polish a VT100 text terminal based program into a neat
program with a graphical UI. Check out the code that drags the
how to convert a VT100 text-terminal based program into a neat
application with a graphical UI. Check out the code that drags the
pieces, and how the pieces are drawn by layering. Then tell me
how to beat this program.
how to beat the computer at Checkers.
<h3><a name="clock">clock</h3>
The <tt>clock</tt> demo shows two analog clocks. The innards of
teh <tt>Fl_Clock</tt> widget are pretty interesting as they explain
the <tt>Fl_Clock</tt> widget are pretty interesting, explaining
the use of timeouts and matrix based drawing.
<h3><a name="colbrowser">colbrowser</h3>
<tt>colbrowser</tt> runs only on X11 systems. It reads
<i>/usr/lib/X11/rgb.txt</i> to show the color representation
of every text entry in the file. This is beautiful, but
only mederatly useful unless your UI is written in <i>Motif</i>.
only moderatly useful unless your UI is written in <i>Motif</i>.
<h3><a name="color_chooser">color_chooser</h3>
The <tt>color_chooser</tt> gives a short demo of FLTK's palette based
@ -176,12 +178,12 @@ the ability to render two OpenGL buffers into a single window,
and shows OpenGL text.
<h3><a name="CubeView">CubeView</h3>
<tt>CubeView</tt> shows how to create a UI containing OpenGL with fluid.
<tt>CubeView</tt> shows how to create a UI containing OpenGL with Fluid.
<h3><a name="cursor">cursor</h3>
The <tt>cursor</tt> demo show all mouse cursor shapes that come standard
with FLTK. The <i>fgcolor</i> and <i>bgcolor</i> sliders work only
on few systems like Irix.
on few systems (some version of Irix for example).
<h3><a name="curve">curve</h3>
<tt>curve</tt> draws a nice Bezier curve into a custom widget. The
@ -189,8 +191,8 @@ on few systems like Irix.
<h3><a name="demo">demo</h3>
This tool allows quick access to all programs in the <tt>test</tt> directory.
<tt>demo</tt> is viaully based on the IrixGL demo program and cna be
extended by editing <tt>test/demo.menu</tt>.
<tt>demo</tt> is based on the visuals of the IrixGL demo program. The menu
tree can be changed by editing <tt>test/demo.menu</tt>.
<h3><a name="doublebuffer">doublebuffer</h3>
The <tt>doublebuffer</tt> demo show the difference between a single
@ -203,7 +205,7 @@ to not tripple buffer a window in that case.
<h3><a name="editor">editor</h3>
FLTK has two very different text input widgets. <tt>Fl_Input</tt>
and derived classes are rather leight weight, however
<tt>Fl_Text_Editor</tt> is a complete port of nedit (with permission).
<tt>Fl_Text_Editor</tt> is a complete port of <i>nedit</i> (with permission).
The <tt>editor</tt> test is almost a full application, showing custom
syntax highlighting and dialog creation.
@ -235,18 +237,18 @@ application compile just fine.
<h3><a name="fullscreen">fullscreen</h3>
This demo shows how to do many of the window manipulations that
are popular on SGI programs, even though X does not really like
them. You can toggle the border on/off, change the visual to
switch between single/double buffer, and make the window take
over the screen. More information in the source code.
are popular for games.
You can toggle the border on/off, switch between single-
and double-buffered rendering, and take over the entire
screen. More information in the source code.
<h3><a name="gl_overlay">gl_overlay</h3>
<tt>gl_overlay</tt> shows OpenGL overlay plane rendering. If no
hardware overly plane is available, FLTK will simulate it
automatically.
for you.
<h3><a name="glpuzzle">glpuzzle</h3>
The <tt>glpuzzle</tt> test dhows how most Glut source code compiles
The <tt>glpuzzle</tt> test shows how most Glut source code compiles
easily under FLTK.
<h3><a name="hello">hello</h3>
@ -257,12 +259,12 @@ running with FLTK. Quite impressive, I'd say.
<h3><a name="help">help</h3>
<tt>help</tt> displays the built-in FLTK help browser. The
<tt>Fl_Help_Dialog</tt> understands a subset of html and renders
various image formats. It is a great help to provide help
various image formats. This widget makes it easy to provide help
pages to the user without depending on the operating system's
html browser.
<h3><a name="iconize">iconize</h3>
<tt>iconize</tt> demonstrates the efeect of the window functions
<tt>iconize</tt> demonstrates the effect of the window functions
<tt>hide()</tt>, <tt>iconize()</tt>, and <tt>show()</tt>.
<h3><a name="image">image</h3>
@ -273,11 +275,11 @@ transparency or by using screen door transparency (pixelation).
<h3><a name="inactive">inactive</h3>
<tt>inactive</tt> tests the correct rendering of inactive widgets.
To see the inactive version of images, you can check the pixmap
To see the inactive version of images, you can check out the pixmap
or image test.
<h3><a name="input">input</h3>
This tool shows and tests differnet types of text input fields based on
This tool shows and tests different types of text input fields based on
<tt>Fl_Input_</tt>. The <tt>input</tt> program also tests various
settings of <tt>Fl_Input::when()</tt>.
@ -327,12 +329,12 @@ arbitrary sub menu depth, and global shortcuts.
<h3><a name="minimum">minimum</h3>
The <tt>minimum</tt> test program verifies that the update regions
are set correctly. In a real life application, the trail would
be avoided by choosing a smaller label or by setting label clipping.
correctly.
be avoided by choosing a smaller label or by setting label clipping
differently.
<h3><a name="navigation">navigation</h3>
<tt>navigation</tt> demonstrates how the text cursor moves from
text field to text field by using the arrow keys, tab and shift-tab..
text field to text field when using the arrow keys, tab, and shift-tab.
<h3><a name="output">output</h3>
<tt>output</tt> shows the difference between the single line and
@ -349,11 +351,11 @@ provides a new function to draw custom overlays.
The <tt>pack</tt> test program demonstrates the resizing
and repositioning of children of the <tt>Fl_Pack</tt> group.
Putting an <tt>Fl_Pack</tt> into an <tt>Fl_Scroll</tt> is
a useful way to create a kind of browser.
a useful way to create a browser for large sets of data.
<h3><a name="pixmap_browser">pixmap_browser</h3>
<tt>pixmap_browser</tt> tests the shared image interface. When using
the same image multiple times <tt>Fl_Shared_Image</tt> will keep it
<tt>pixmap_browser</tt> tests the shared-image interface. When using
the same image multiple times, <tt>Fl_Shared_Image</tt> will keep it
only once in memory.
<h3><a name="pixmap">pixmap</h3>
@ -365,11 +367,11 @@ one transparent color.
<h3><a name="preferences">preferences</h3>
I do have my <tt>preferences</tt> in the morning, but sometimes I
just can't remember a thing. This is where the <tt>Fl_Preferences</tt>
come in handy. The remember any kind of data between program launches.
come in handy. They remember any kind of data between program launches.
<h3><a name="radio">radio</h3>
The <tt>radio</tt> tool was created entirely with <i>fluid</i>. It
shows some of the available btton types and tests radio
shows some of the available button types and tests radio
button behavior.
<h3><a name="resizebox">resizebox</h3>
@ -384,7 +386,7 @@ the given window manager.
<tt>scroll</tt> shows how to scroll an area of widgets, one of
them beeing a slow custom drawing. <tt>Fl_Scroll</tt> uses
clipping and smart window area copying to improve redraw speed.
The buttons at the bottom of the window test decoration rendering
The buttons at the bottom of the window control decoration rendering
and updates.
<h3><a name="shape">shape</h3>
@ -394,7 +396,7 @@ and write that flight simulator you always dreamt of.
<h3><a name="subwindow">subwindow</h3>
The <tt>subwindow</tt> demo tests messaging and drawing between
the main window and 'true' sub windows. A sub window is differnt
the main window and 'true' sub windows. A sub window is different
to a group by resetting the FLTK coordinate stystem to 0, 0 in the
top left corner. On Win32 and X11, subwindows have their own
operating system specific handle.
@ -402,7 +404,7 @@ operating system specific handle.
<h3><a name="sudoku">sudoku</h3>
Another highly addictive game - don't play it, I warned you.
The implementation shows how to create application icons,
how to deal with OS specific, and how to generate sound.
how to deal with OS specifics, and how to generate sound.
<h3><a name="symbols">symbols</h3>
<tt>symbols</tt> are a speciality of FLTK. These little vector

View File

@ -476,6 +476,7 @@ class BlockWindow : public Fl_Double_Window
int handle(int event);
void new_game();
int score() { return (score_); }
void up_level();
};
@ -734,6 +735,12 @@ BlockWindow::handle(int event) {
else if (interval_ < 0.0 || paused_) return (0);
switch (event) {
case FL_KEYBOARD:
if (Fl::event_text()) {
if (strcmp(Fl::event_text(), "+") == 0)
up_level();
}
break;
case FL_PUSH :
mx = w() - Fl::event_x() + BLOCK_SIZE;
my = h() - Fl::event_y();
@ -841,6 +848,15 @@ BlockWindow::play_cb(Fl_Widget *wi, BlockWindow *bw) {
}
}
void BlockWindow::up_level() {
interval_ *= 0.95;
opened_columns_ = 0;
if (num_colors_ < 7) num_colors_ ++;
level_ ++;
sprintf(title_, "Level: %d", level_);
title_y_ = h();
Fl::repeat_timeout(interval_, (Fl_Timeout_Handler)timeout_cb, (void *)this);
}
// Animate the game...
void
@ -940,14 +956,7 @@ BlockWindow::timeout_cb(BlockWindow *bw) {
bw->opened_columns_ ++;
if (bw->opened_columns_ > (2 * BLOCK_COLS)) {
bw->interval_ *= 0.95;
bw->opened_columns_ = 0;
if (bw->num_colors_ < 7) bw->num_colors_ ++;
bw->level_ ++;
sprintf(bw->title_, "Level: %d", bw->level_);
bw->title_y_ = bw->h();
bw->up_level();
}
c = bw->columns_;