2003-08-07 20:42:00 +04:00
|
|
|
.\" $NetBSD: appen.A,v 1.7 2003/08/07 16:44:26 agc Exp $
|
1998-01-09 07:11:49 +03:00
|
|
|
.\"
|
1993-11-09 06:36:33 +03:00
|
|
|
.\" Copyright (c) 1980, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2003-08-07 20:42:00 +04:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1993-11-09 06:36:33 +03:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1994-08-18 01:51:41 +04:00
|
|
|
.\" @(#)appen.A 8.1 (Berkeley) 6/8/93
|
1993-11-09 06:36:33 +03:00
|
|
|
.\"
|
|
|
|
.ie t .oh '\*(Ln Appendix A''PS1:19-%'
|
|
|
|
.eh 'PS1:19-%''\*(Ln Appendix A'
|
|
|
|
.el .he ''\fIAppendix A\fR''
|
|
|
|
.bp
|
|
|
|
.(x
|
|
|
|
.ti 0
|
|
|
|
.b "Appendix A"
|
|
|
|
.)x
|
|
|
|
.sh 1 "Examples" 1
|
|
|
|
.pp
|
|
|
|
Here we present a few examples
|
|
|
|
of how to use the package.
|
|
|
|
They attempt to be representative,
|
2002-10-01 23:03:15 +04:00
|
|
|
though not comprehensive.
|
|
|
|
Further examples can be found in the games section
|
1999-07-02 19:58:35 +04:00
|
|
|
of the source tree and in various utilities that use the screen such as
|
1993-11-09 06:36:33 +03:00
|
|
|
.i systat(1) .
|
|
|
|
.pp
|
|
|
|
The following examples are intended to demonstrate
|
|
|
|
the basic structure of a program
|
2002-10-01 23:03:15 +04:00
|
|
|
using the package.
|
|
|
|
An additional, more comprehensive, program can be found in
|
1999-07-02 19:58:35 +04:00
|
|
|
the source code in the
|
1993-11-09 06:36:33 +03:00
|
|
|
\fIexamples\fP subdirectory.
|
|
|
|
.sh 2 "Simple Character Output"
|
|
|
|
.pp
|
|
|
|
This program demonstrates how to set up a window and output characters to it.
|
2002-10-01 23:03:15 +04:00
|
|
|
Also, it demonstrates how one might control the output to the window.
|
|
|
|
If you run this program, you will get a demonstration of the character output
|
1993-11-09 06:36:33 +03:00
|
|
|
chracteristics discussed in the above Character Output section.
|
|
|
|
.(l I
|
|
|
|
.so ex1.gr
|
|
|
|
.)l
|
|
|
|
.sh 2 "Twinkle"
|
|
|
|
.pp
|
|
|
|
This is a moderately simple program which prints
|
|
|
|
patterns on the screen.
|
|
|
|
It switches between patterns of asterisks,
|
|
|
|
putting them on one by one in random order,
|
|
|
|
and then taking them off in the same fashion.
|
|
|
|
It is more efficient to write this
|
|
|
|
using only the motion optimization,
|
|
|
|
as is demonstrated below.
|
|
|
|
.(l I
|
|
|
|
.so twinkle1.gr
|
|
|
|
.)l
|