This commit is contained in:
Alexander Deynichenko
2013-02-25 07:23:44 +04:00
parent 35ff18a6a1
commit 03b62f3315
809 changed files with 211135 additions and 0 deletions

62
examples/AUTHORS Normal file
View File

@@ -0,0 +1,62 @@
PLIB was originally written by Steve Baker as a solo project - but
has subsequently been greatly enhanced and expanded by a 'cast of
thousands'.
Most important of all - the 'official' PLIB developers:
Alex Perry
Curtis Olson
Ben Woodhead
Dave McClurg
Gerard Decatrel
Gil Carter
Giancarlo Niccolai
James Jones
John Fay ("Mr. PUI")
Juergen Marquardt
Mark Vallevand
Marten Stromberg
Nathan Matias
Norman Vine
Per Liedman
Sam Stickland
Sebastian Ude
Steve Baker <--- Hmmm - must sort this list by SECOND name!
Will Lachance
Wolfram Kuss
Apologies to anyone I've left out - please let me know
who you are and I'll add you in.
Christopher St.John
Christian Mayer
Darrell Walisser
Dave Heil
Erik Hofman
Kevin Thompson
Karl Kremer
Negative0 <---- Who? Some kind of 1's complement arithmetic fanatic?
Mark Danks
Michael Kurth
Sean Palmer
Simon Britnell
Themie Gouthas
Tony Knienieder
Trent Gamblin
Special mention must go to:
Daryll Strauss (GLIDE port to Linux)
David Bucciarelli (Mesa -> GLIDE interface)
Brian Paul (Mesa)
Curtis Olson (FlightGear guru and all-round "Mr Nice Guy",
who nagged me into writing most of this stuff!)
Vasily Lewis (Tireless maintainer and sysadmin at Woodsoup
where PLIB was first hosted)
Toru Egashira (Who wrote a program called 'NSPmod' which was
the original basis of the SL 'MOD' player -
although the original code has been almost
entirely rewritten in the process of merging
it with SL.
Everyone at OPENGL-GAMEDEV-L

340
examples/COPYING Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

5
examples/COPYING.DATA Normal file
View File

@@ -0,0 +1,5 @@
All fonts, textures, models and other data is licensed under the same
license as the code unless otherwise stated.
Please see COPYING for more details.

34
examples/ChangeLog Normal file
View File

@@ -0,0 +1,34 @@
PLIB_Examples Change Log.
=========================
PLIB_Examples v1.8.0 (March 19th 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added examples for PW, PSL, ssgAux and puAux.
PLIB_Examples v1.6.1 (Sept 4th 2002)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added missing files from the 'water/data' directory.
PLIB_Examples v1.4.1 (June 25th 2001)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Changes are now reported in main 'PLIB' CHANGES
file.
PLIB_Examples v1.1.8 (Jan 23rd 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Updated examples and documents to
match latest PLIB main code.
PLIB_Examples v1.1.2 (Nov 8th 1999)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Example programs split from main
PLIB distribution.
* Example programs are now under GPL
rather than LGPL. Previous releases
of these programs that were released
under LGPL may still be used under
those terms.

203
examples/INSTALL Normal file
View File

@@ -0,0 +1,203 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Configure Options
=================
On some occations opengl are not found on systems. Additional
commandline parameters have been added to resolve this issue.
--with-gl GL prefix
Examples
./configure --with-gl=/usr/local
This should help with locating GL when configure is unable to find
the files.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Compiling for Windows with MSVC
===============================
You can easily compile plib with MSVC 6. First compile plib
itself. Then open the included workspace in MSVC, choose what you
want to compile (build/set active configuration) and then compile (F7).
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

16
examples/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
SUBDIRS = src
EXTRA_DIST = README COPYING.DATA plib_examples.dsp plib_examples.dsw install-sh missing autogen.sh
dist-hook:
tar cf - doc \
src/ssg/tux/data \
src/ssg/water/data \
src/ssg/sky/data \
src/ssg/majik/data \
src/ssg/shrubs/data \
src/psl/data \
src/fnt/data \
data \
| ( cd $(distdir) ; tar xf - )

0
examples/NEWS Normal file
View File

23
examples/README Normal file
View File

@@ -0,0 +1,23 @@
PLIB Examples and Documents
===========================
by Steve Baker.
LICENSING:
These example programs are offered as OpenSource freeware
under the provisions of the GNU Public
License (GPL). Those terms and conditions are
detailed in the file 'COPYING' in this directory.
REQUIREMENTS:
In addition to the PLIB libraries that I provide, you
will also need OpenGL (OpenGL 1.1 or later -
Mesa 3.0 or later) and GLUT (The OpenGL utilities
toolkit - version 3.7 or later) and a hardware 3D
graphics accellerator that supports OpenGL.
by Steve Baker.
<sjbaker1@airmail.net>
http://www.sjbaker.org

19
examples/autogen.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
OSTYPE=`uname -s`
AMFLAGS="--add-missing"
if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then
AMFLAGS=$AMFLAGS" --include-deps";
fi
echo "Running aclocal"
aclocal
echo "Running automake"
automake $AMFLAGS
echo "Running autoconf"
autoconf
echo "======================================"
echo "Now you are ready to run './configure'"
echo "======================================"

313
examples/configure.in Normal file
View File

@@ -0,0 +1,313 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/js/js_demo.cxx)
AM_INIT_AUTOMAKE(plib_examples, 1.8.5)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_LANG_CPLUSPLUS
dnl Command line arguments.
dnl Don't use AC_HELP_STRING here as old versions of autoconf do not
dnl understand it.
AC_ARG_WITH(GL,
[ --with-GL=DIR set the prefix directory where GL resides],
GL_PREFIX=$withval, GL_PREFIX=auto)
AC_ARG_ENABLE(fnt,
[ --enable-fnt build FNT examples default: yes],,
enable_fnt=yes)
AC_ARG_ENABLE(js,
[ --enable-js build JS examples default: yes],,
enable_js=yes)
AC_ARG_ENABLE(pw,
[ --enable-pw build PW examples default: yes],,
enable_pw=yes)
AC_ARG_ENABLE(net,
[ --enable-net build NET examples default: yes],,
enable_net=yes)
AC_ARG_ENABLE(pui,
[ --enable-pui build PUI examples default: yes],,
enable_pui=yes)
AC_ARG_ENABLE(sg,
[ --enable-sg build SG examples default: yes],,
enable_sg=yes)
AC_ARG_ENABLE(psl,
[ --enable-psl build PSL examples default: yes],,
enable_psl=yes)
AC_ARG_ENABLE(sl,
[ --enable-sl build SL examples default: yes],,
enable_sl=yes)
AC_ARG_ENABLE(ssg,
[ --enable-ssg build SSG/ssgAux examples default: yes],,
enable_ssg=yes)
AC_ARG_ENABLE(ul,
[ --enable-ul build UTIL examples default: yes],,
enable_ul=yes)
if test "x$enable_fnt" = "xyes"; then need_opengl=yes; fi
if test "x$enable_pui" = "xyes"; then need_opengl=yes; fi
if test "x$enable_sg" = "xyes"; then need_opengl=yes; fi
if test "x$enable_ssg" = "xyes"; then need_opengl=yes; fi
if test "x$enable_ssgaux" = "xyes"; then need_opengl=yes; fi
AM_CONDITIONAL(BUILD_FNT, test "x$enable_fnt" = "xyes")
AM_CONDITIONAL(BUILD_JS, test "x$enable_js" = "xyes")
AM_CONDITIONAL(BUILD_PW, test "x$enable_pw" = "xyes")
AM_CONDITIONAL(BUILD_NET, test "x$enable_net" = "xyes")
AM_CONDITIONAL(BUILD_PUI, test "x$enable_pui" = "xyes")
AM_CONDITIONAL(BUILD_SG, test "x$enable_sg" = "xyes")
AM_CONDITIONAL(BUILD_PSL, test "x$enable_psl" = "xyes")
AM_CONDITIONAL(BUILD_SL, test "x$enable_sl" = "xyes")
AM_CONDITIONAL(BUILD_SSG, test "x$enable_ssg" = "xyes")
AM_CONDITIONAL(BUILD_UL, test "x$enable_ul" = "xyes")
if test "x$need_opengl" = "xyes" && test "x$GL_PREFIX" != "xauto"; then
LDFLAGS="$LDFLAGS -L$GL_PREFIX/lib"
CPPFLAGS="$CPPFLAGS -I$GL_PREFIX/include"
fi
dnl Checks for library functions.
dnl check for OpenGL related libraries
AC_CANONICAL_HOST
case "${host}" in
*-*-cygwin*)
dnl CygWin under Windoze.
dnl Sound / joystick stuff, mmtimer (ulClock !)
LIBS="$LIBS -lwinmm"
dnl OpenGL libraries
OGL_LIBS="-lglu32 -lopengl32 -lgdi32"
GLUT_LIBS="-lglut32"
;;
*-*-mingw32*)
dnl Mingw under Windoze.
dnl Sound / joystick stuff, mmtimer (ulClock !)
LIBS="$LIBS -lwinmm -lwsock32"
dnl OpenGL libraries
OGL_LIBS="-lglu32 -lopengl32 -lgdi32"
GLUT_LIBS="-lglut32"
;;
*-apple-darwin*)
dnl Mac OS X
dnl OpenGL libraries
OGL_LIBS="-framework OpenGL"
GLUT_LIBS="-framework GLUT -lobjc"
dnl Sound libraries
SND_LIBS="-framework Carbon"
;;
*)
if test "x$need_opengl" = "xyes"; then
dnl Check for X11
AC_PATH_XTRA
LDFLAGS="$LDFLAGS $X_LIBS"
OGL_LIBS="$X_PRE_LIBS -lXi -lXmu -lXext -lX11 $X_EXTRA_LIBS -lm"
dnl =========================================================
dnl if test "x$x_includes" != "x"; then
dnl CPPFLAGS="$CPPFLAGS -I$x_includes"
dnl fi
dnl =========================================================
dnl Reasonable stuff non-windoze variants ... :-)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(GL, glNewList, OGL_LIBS="-lGL $OGL_LIBS",,$OGL_LIBS)
if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
dnl if no GL, check for MesaGL
AC_CHECK_LIB(MesaGL, glNewList, OGL_LIBS="-lMesaGL $OGL_LIBS",
AC_MSG_ERROR([could not find working GL library]),
$OGL_LIBS)
fi
AC_CHECK_LIB(GLU, gluLookAt, OGL_LIBS="-lGLU $OGL_LIBS",,$OGL_LIBS)
if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
dnl if no GLU, check for MesaGLU
AC_CHECK_LIB(MesaGLU, gluLookAt,
OGL_LIBS="-lMesaGLU $OGL_LIBS",
AC_MSG_ERROR([could not find working GLU library]),
$OGL_LIBS)
fi
dnl check for glut...or freeglut
AC_CHECK_LIB(freeglut, glutGetModifiers, GLUT_LIBS="-lfreeglut",,
$OGL_LIBS)
if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xno" ; then
dnl if no freeglut, check for real GLUT
AC_CHECK_LIB(glut, glutGetModifiers, GLUT_LIBS="-lglut",
AC_MSG_ERROR([could not find working GLUT library]),
$OGL_LIBS)
fi
fi
AC_CHECK_LIB(dl, dlclose)
dnl Check SGI audio library
AC_CHECK_LIB(audio, ALopenport, SND_LIBS="-laudio")
;;
esac
dnl Check PLIB library
AC_CHECK_LIB(plibul, ulInit, true,
AC_MSG_ERROR([there seems to be a problem with the PLIB libraries]))
AC_SUBST(OGL_LIBS)
AC_SUBST(GLUT_LIBS)
AC_SUBST(SND_LIBS)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADER(windows.h, AC_DEFINE(WIN32))
if test "x$need_opengl" = "xyes"; then
dnl Check for OpenGl header files
case "${host}" in
*-*-cygwin* | *-*-mingw32*)
dnl CygWin under Windoze.
AC_CHECK_HEADERS(GL/gl.h GL/glu.h,,
AC_MSG_ERROR([OpenGL header files not found]))
AC_CHECK_HEADER(GL/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
AC_MSG_ERROR([GLUT header file not found]))
;;
*-apple-darwin*)
dnl Mac OS X
AC_CHECK_HEADERS(OpenGL/gl.h OpenGL/glu.h,,
AC_MSG_ERROR([OpenGL header files not found]))
AC_CHECK_HEADER(GLUT/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
AC_MSG_ERROR([GLUT header file not found]))
;;
*)
AC_CHECK_HEADERS(GL/gl.h GL/glu.h,,
AC_MSG_ERROR([OpenGL header files not found]))
if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xyes"; then
AC_CHECK_HEADER(GL/freeglut.h, AC_DEFINE(FREEGLUT_IS_PRESENT),
AC_MSG_ERROR([freeglut header file not found]))
else
AC_CHECK_HEADER(GL/glut.h, AC_DEFINE(GLUT_IS_PRESENT),
AC_MSG_ERROR([GLUT header file not found]))
fi
;;
esac
fi
AC_CHECK_HEADER(plib/ul.h,, AC_MSG_ERROR([PLIB header files not found]))
dnl Warning flags
WFLAG="-Wall"
case "$host" in
mips-sgi-irix*)
if test "x$CXX" = "xCC"; then
WFLAG="-fullwarn";
fi
;;
*)
if test "x$CXX" = "xicpc" || test "x$CXX" = "xicc"; then
WFLAG="-w1"
fi
;;
esac
CFLAGS="$CFLAGS $WFLAG"
CXXFLAGS="$CXXFLAGS $WFLAG"
AC_OUTPUT( \
Makefile \
src/Makefile \
src/js/Makefile \
src/pw/Makefile \
src/pui/Makefile \
src/sg/Makefile \
src/sl/Makefile \
src/ssg/Makefile \
src/ssg/tux/Makefile \
src/ssg/majik/Makefile \
src/ssg/load_save/Makefile \
src/ssg/state_test/Makefile \
src/ssg/tween_test/Makefile \
src/ssg/viewer/Makefile \
src/ssg/water/Makefile \
src/ssg/sky/Makefile \
src/ssg/dynamics/Makefile \
src/ssg/shrubs/Makefile \
src/ssg/shapes/Makefile \
src/fnt/Makefile \
src/net/Makefile \
src/net/client_server/Makefile \
src/net/http_get/Makefile \
src/net/net_echo/Makefile \
src/psl/Makefile \
src/util/Makefile )
if test "x$need_opengl" = "xyes"; then
if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xyes"; then
glut_msg="yes (found freeglut)"
else
glut_msg="yes (found GLUT)"
fi
else
glut_msg="no"
fi
AC_MSG_RESULT(
[PLIB configuration information:
Building FNT examples: $enable_fnt
Building JS examples: $enable_js
Building PW examples: $enable_pw
Building NET examples: $enable_net
Building PUI examples: $enable_pui
Building SG examples: $enable_sg
Building PSL examples: $enable_psl
Building SL examples: $enable_sl
Building SSG/ssgAux examples: $enable_ssg
Building UTIL examples: $enable_ul
Need GLUT: $glut_msg
])

View File

@@ -0,0 +1,61 @@
# Microsoft Developer Studio Project File - Name="plib_examples" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Generic Project" 0x010a
CFG=plib_examples - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "plib_examples.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "plib_examples.mak" CFG="plib_examples - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "plib_examples - Win32 Release" (based on "Win32 (x86) Generic Project")
!MESSAGE "plib_examples - Win32 Debug" (based on "Win32 (x86) Generic Project")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
MTL=midl.exe
!IF "$(CFG)" == "plib_examples - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
!ELSEIF "$(CFG)" == "plib_examples - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "plib_examples___Win32_Debug"
# PROP BASE Intermediate_Dir "plib_examples___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
!ENDIF
# Begin Target
# Name "plib_examples - Win32 Release"
# Name "plib_examples - Win32 Debug"
# End Target
# End Project

491
examples/plib_examples.dsw Normal file
View File

@@ -0,0 +1,491 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "PointPicker"=.\src\pui\PointPicker.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "WavingFlag"=.\src\ssg\tux\WavingFlag.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "complex"=.\src\pui\complex.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "dynamics"=.\src\ssg\dynamics\dynamics.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "example"=.\src\sl\example.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fnt_test"=.\src\fnt\fnt_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "http_get"=.\src\net\http_get\http_get.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "js_demo"=.\src\js\js_demo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "load"=.\src\ssg\load_save\load.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "majik_demo"=.\src\ssg\majik\majik_demo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "mod_demo"=.\src\sl\mod_demo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "net_echo"=.\src\net\net_echo\net_echo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "net_udp_client"=.\src\net\client_server\net_udp_client.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "net_udp_server"=.\src\net\client_server\net_udp_server.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "plib_examples"=.\plib_examples.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name complex
End Project Dependency
Begin Project Dependency
Project_Dep_Name example
End Project Dependency
Begin Project Dependency
Project_Dep_Name fnt_test
End Project Dependency
Begin Project Dependency
Project_Dep_Name http_get
End Project Dependency
Begin Project Dependency
Project_Dep_Name js_demo
End Project Dependency
Begin Project Dependency
Project_Dep_Name load
End Project Dependency
Begin Project Dependency
Project_Dep_Name majik_demo
End Project Dependency
Begin Project Dependency
Project_Dep_Name mod_demo
End Project Dependency
Begin Project Dependency
Project_Dep_Name net_echo
End Project Dependency
Begin Project Dependency
Project_Dep_Name net_udp_client
End Project Dependency
Begin Project Dependency
Project_Dep_Name net_udp_server
End Project Dependency
Begin Project Dependency
Project_Dep_Name save
End Project Dependency
Begin Project Dependency
Project_Dep_Name sg_quat_test
End Project Dependency
Begin Project Dependency
Project_Dep_Name simple
End Project Dependency
Begin Project Dependency
Project_Dep_Name slideshow
End Project Dependency
Begin Project Dependency
Project_Dep_Name tux_example
End Project Dependency
Begin Project Dependency
Project_Dep_Name viewer
End Project Dependency
Begin Project Dependency
Project_Dep_Name net_http_get
End Project Dependency
Begin Project Dependency
Project_Dep_Name PointPicker
End Project Dependency
Begin Project Dependency
Project_Dep_Name test_dir
End Project Dependency
Begin Project Dependency
Project_Dep_Name tween_test
End Project Dependency
Begin Project Dependency
Project_Dep_Name WavingFlag
End Project Dependency
Begin Project Dependency
Project_Dep_Name widget_list
End Project Dependency
Begin Project Dependency
Project_Dep_Name water
End Project Dependency
Begin Project Dependency
Project_Dep_Name dynamics
End Project Dependency
Begin Project Dependency
Project_Dep_Name psl_demo
End Project Dependency
Begin Project Dependency
Project_Dep_Name pw_demo
End Project Dependency
Begin Project Dependency
Project_Dep_Name pw_pui
End Project Dependency
Begin Project Dependency
Project_Dep_Name sky
End Project Dependency
Begin Project Dependency
Project_Dep_Name stest
End Project Dependency
}}}
###############################################################################
Project: "psl_demo"=.\src\psl\psl_demo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pview"=.\src\ssg\viewer\pview.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pw_demo"=.\src\pw\pw_demo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pw_pui"=.\src\pw\pw_pui.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "save"=.\src\ssg\load_save\save.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "sg_quat_test"=.\src\sg\sg_quat_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "simple"=.\src\pui\simple.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "sky"=.\src\ssg\sky\sky.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "slideshow"=.\src\fnt\slideshow.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "stest"=.\src\ssg\state_test\stest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "test_dir"=.\src\util\test_dir.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "tux_example"=.\src\ssg\tux\tux_example.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "tween_test"=.\src\ssg\tween_test\tween_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "viewer"=.\src\ssg\viewer\viewer.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "water"=.\src\ssg\water\water.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "widget_list"=.\src\pui\widget_list.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "widget_test"=.\src\pui\widget_test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

3
examples/src/Makefile.am Normal file
View File

@@ -0,0 +1,3 @@
SUBDIRS = js pui sl sg ssg fnt net util psl pw

View File

@@ -0,0 +1,18 @@
if BUILD_FNT
noinst_PROGRAMS = fnt_test slideshow hello_world
hello_world_SOURCES = hello_world.cxx
fnt_test_SOURCES = fnt_test.cxx
slideshow_SOURCES = slideshow.cxx
hello_world_LDADD = -lplibpw -lplibfnt -lplibsg -lplibul $(OGL_LIBS)
fnt_test_LDADD = -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
slideshow_LDADD = -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
endif
EXTRA_DIST = fnt_test.dsp slideshow.dsp

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,48 @@
These antialiased '.txf' fonts were generated by Andrew Ross from
Ghostscript fonts using his afm2txf script which can be found in the
'tools' area of PLIB. All Ghostscript fonts used were GPL and Copyright
(C) URW++ Design & Development Incorporated.
Things that make them better than existing fonts are (quoted from Andrew):
+ They are complete. Each one has glyphs rendered for every printable
ASCII character. No more property confusion from different strings
rendering identically due to missing glyphs. This alone is enough
to make them worth the price of admission. :)
+ They are rendered and antialiased from vector descriptions, instead
of being pixel-for-pixel copies of X11 screen fonts. So they look a
lot better under most conditions (at very small sizes the difference
is negligible as mipmapping does the antialiasing for you).
+ They have more space around the glyphs. Mark Kilgard's 'gentexfont'
program packed the glyphs too tightly togther; at small sizes, you could
see "bleeding" in the textures from nearby characters.
+ They make better use of space in general. The characters are drawn
as large as practical for simple layout code (i.e., I scale them up,
but don't do any gymnastics like recursive packing or non-rectangular
layout). So you get more font for your texture byte. Most of the
existing '.txf' fonts use only about half of the available texture
space.
+ They are professional fonts. I don't know where "typewriter.txf"
came from, but it is awfully ugly. I replaced it with the antialiased
Helvetica (in FlightGear), and things look *so* much nicer.
Stuff that isn't ideal:
+ They're stored as 8 bit gray scale images instead of bitmaps, which
means that the files are significantly larger. The texture memory
footprint is the same, however.
Note that you still find the inferior textured fonts that came with PLIB
before in the 'old' directory.
- Sebastian Ude, August 2002

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,34 @@
TXF Font Pack.
~~~~~~~~~~~~~~
Most of these fonts were created from the X-windows
fonts that are distributed with Xfree86. The
exceptions are Sorority, Curlfont, Default and
Haeberli which came from Mark Kilgards' "texfont"
distribution.
I used Mark's program called 'gentexfont' to convert
X fonts into '.txf' format - which can be read into
the PLIB FNT component.
Large bold-faced fonts seem to work best. There
is little point in converting the italic versions
of these fonts since FNT can do a reasonable job
of italicising them on-the-fly.
Using large fonts gives them the best chance of
scaling them without undue aliasing either in
pixel or texel space. These fonts all fit pretty
well into 256x256 maps - using smaller maps would
require you to go for smaller font sizes - larger
maps would not fit into 3Dfx and similar hardware.
Medium and fine fonts look pretty terrible when scaled,
I have omitted all the fine fonts and some of the
worst medium fonts from the set that come with Xfree86.
You can preview these using the fnt_test program,
or use them from within other programs that use
Mark's TXF format.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,36 @@
1
2
3 Hello to the first page.
4 Advance by pressing "enter"
5
*
6 This is the second page.
7 Go back with backspace.
8
9
*
10 It seems you pressed enter again instead of backspace ;)
11
12
13
14
15
16
17 This time some more lines
18
19
20
*
The fourth page
*
The fifth page
*
The sixth page
*
The seventh page
************************************************|
*
*
*
*

View File

@@ -0,0 +1,282 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: fnt_test.cxx 2032 2005-07-05 15:43:18Z bram $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/fnt.h>
static fntRenderer *text ;
static const char *font_names [] =
{
"Helvetica.txf", /* This is the default */
"Helvetica-Bold.txf",
"Helvetica-Oblique.txf",
"Helvetica-BoldOblique.txf",
"AvantGarde-Book.txf",
"AvantGarde-BookOblique.txf",
"AvantGarde-Demi.txf",
"AvantGarde-DemiOblique.txf",
"Bookman-Light.txf",
"Bookman-LightItalic.txf",
"Bookman-Demi.txf",
"Bookman-DemiItalic.txf",
"Courier.txf",
"Courier-Bold.txf",
"Courier-Oblique.txf",
"Courier-BoldOblique.txf",
"NewCenturySchlbk-Roman.txf",
"NewCenturySchlbk-Italic.txf",
"NewCenturySchlbk-Bold.txf",
"NewCenturySchlbk-BoldItalic.txf",
"Palatino-Roman.txf",
"Palatino-Italic.txf",
"Palatino-Bold.txf",
"Palatino-BoldItalic.txf",
"Times-Roman.txf",
"Times-Italic.txf",
"Times-Bold.txf",
"Times-BoldItalic.txf",
"ZapfChancery-MediumItalic.txf",
"old/sorority.txf",
"old/charter.txf",
/* "old/courier-bold.txf",
"old/courier_medium.txf", */
"old/curlfont.txf",
"old/default.txf",
"old/derniere.txf",
"old/haeberli.txf",
/* "old/helvetica_bold.txf",
"old/helvetica_medium.txf", */
"old/junius.txf",
"old/ledfixed.txf",
"old/lucida.txf",
"old/lucidabright_bold.txf",
/* "old/schoolbook_bold.txf",
"old/schoolbook_medium.txf", */
"old/symbol.txf",
/* "old/times_bold.txf",
"old/times_medium.txf",
"old/typewriter.txf", */
NULL
} ;
static fntTexFont **font_list ;
static int cur_font = 0 ;
static int max_font = 0 ;
static void motionfn ( int, int )
{
glutPostRedisplay () ;
}
static void keyfn ( unsigned char key, int, int )
{
cur_font++ ;
if ( cur_font >= max_font )
cur_font = 0 ;
}
static void mousefn ( int /*button*/, int /*updown*/, int /*x*/, int /*y*/ )
{
exit ( 0 ) ;
}
static int getWindowHeight () { return glutGet ( (GLenum) GLUT_WINDOW_HEIGHT ) ; }
static int getWindowWidth () { return glutGet ( (GLenum) GLUT_WINDOW_WIDTH ) ; }
static void setOpenGLState ( void )
{
int w = getWindowWidth () ;
int h = getWindowHeight () ;
glPushAttrib ( GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_TRANSFORM_BIT | GL_LIGHTING_BIT ) ;
glDisable ( GL_LIGHTING ) ;
glDisable ( GL_FOG ) ;
glDisable ( GL_TEXTURE_2D ) ;
glDisable ( GL_DEPTH_TEST ) ;
glDisable ( GL_CULL_FACE ) ;
glEnable ( GL_ALPHA_TEST ) ;
glEnable ( GL_BLEND ) ;
glAlphaFunc ( GL_GREATER, 0.1f ) ;
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
glViewport ( 0, 0, w, h ) ;
glMatrixMode ( GL_PROJECTION ) ;
glPushMatrix () ;
glLoadIdentity () ;
gluOrtho2D ( 0, w, 0, h ) ;
glMatrixMode ( GL_MODELVIEW ) ;
glPushMatrix () ;
glLoadIdentity () ;
}
static void restoreOpenGLState ( void )
{
glMatrixMode ( GL_PROJECTION ) ;
glPopMatrix () ;
glMatrixMode ( GL_MODELVIEW ) ;
glPopMatrix () ;
glPopAttrib () ;
}
static void displayfn (void)
{
setOpenGLState () ;
glClearColor ( 0.1f, 0.4f, 0.1f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT ) ;
text -> setFont ( font_list [ 0 ] ) ;
text -> setPointSize ( 25.0f ) ;
text -> begin () ;
glColor3f ( 1.0f, 1.0f, 0.0f ) ;
text -> start2f ( 50.0f, 400.0f ) ;
text -> puts ( "This is the PLIB Font Demo." ) ;
text -> end () ;
text -> setFont ( font_list [ 0 ] ) ;
text -> setPointSize ( 12.0f ) ;
text -> begin () ;
glColor3f ( 0.0f, 0.0f, 0.0f ) ;
text -> start2f ( 270.0f, 168.0f ) ;
text -> puts ( "The current font is:" ) ;
text -> start2f ( 300.0f, 148.0f ) ;
text -> puts ( font_names [ cur_font ] ) ;
text -> start2f ( 270.0f, 128.0f ) ;
text -> puts ( "Press any key to change the font.\nClick the mouse to exit." ) ;
text -> end () ;
text -> setFont ( font_list [ cur_font ] ) ;
text -> setPointSize ( 25.0f ) ;
text -> begin () ;
glColor3f ( 0.0f, 1.0f, 1.0f ) ;
text -> start2f ( 50.0f, 360.0f ) ;
text -> puts ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ;
glColor3f ( 1.0f, 0.0f, 1.0f ) ;
text -> start2f ( 50.0f, 320.0f ) ;
text -> puts ( "abcdefghijklmnopqrstuvwxyz" ) ;
glColor3f ( 1.0f, 0.0f, 0.0f ) ;
text -> start2f ( 50.0f, 280.0f ) ;
text -> puts ( "0123456789!@#$%^&*()+-={}[]:\"'<>?,./`~_" ) ;
text -> end () ;
text -> setPointSize ( 9.0f ) ;
text -> begin () ;
glColor3f ( 0, 0, 0 ) ;
text -> start2f ( -50.0f, 265.0f ) ;
text -> puts ( "This is a very long line, in fact, this line is so long, that it starts left of viewport. We are curious to see wether this line is still visible in plib." ) ;
text -> end () ;
glDisable ( GL_TEXTURE_2D ) ;
glBegin ( GL_LINE_LOOP ) ;
glColor3f ( 1.0f, 0.0f, 1.0f ) ;
glVertex2f ( 0.0f, 0.0f ) ;
glVertex2f ( 256.0f, 0.0f ) ;
glVertex2f ( 256.0f, 256.0f ) ;
glVertex2f ( 0.0f, 256.0f ) ;
glEnd () ;
glEnable ( GL_TEXTURE_2D ) ;
glBegin ( GL_TRIANGLE_STRIP ) ;
glColor3f ( 1.0f, 1.0f, 1.0f ) ;
glTexCoord2f( 0.0f, 0.0f ) ; glVertex2f ( 0.0f, 0.0f ) ;
glTexCoord2f( 1.0f, 0.0f ) ; glVertex2f ( 256.0f, 0.0f ) ;
glTexCoord2f( 0.0f, 1.0f ) ; glVertex2f ( 0.0f, 256.0f ) ;
glTexCoord2f( 1.0f, 1.0f ) ; glVertex2f ( 256.0f, 256.0f ) ;
glEnd () ;
restoreOpenGLState () ;
glutSwapBuffers () ;
glutPostRedisplay () ;
}
int main ( int argc, char **argv )
{
font_list = new fntTexFont* [ sizeof(font_names) / sizeof(font_names[0]) ] ;
glutInitWindowPosition ( 0, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( "FNT Application" ) ;
glutDisplayFunc ( displayfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutKeyboardFunc ( keyfn ) ;
text = new fntRenderer () ;
for ( max_font = 0 ; font_names [ max_font ] != NULL ; max_font++ )
{
char fname [ 256 ] ;
#ifdef macintosh
sprintf ( fname, ":data:%s", font_names [ max_font ] ) ;
#else
sprintf ( fname, "data/%s", font_names [ max_font ] ) ;
#endif
font_list [ max_font ] = new fntTexFont ( fname ) ;
}
cur_font = 0 ;
glutMainLoop () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="fnt_test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=fnt_test - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "fnt_test.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fnt_test.mak" CFG="fnt_test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "fnt_test - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "fnt_test - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "fnt_test - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fnt.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"fnt_test.exe" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "fnt_test - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fnt_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"fnt_test.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "fnt_test - Win32 Release"
# Name "fnt_test - Win32 Debug"
# Begin Source File
SOURCE=.\fnt_test.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,65 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: hello_world.cxx 1996 2004-12-29 07:19:40Z sjbaker $
*/
#include <plib/pw.h>
#include <plib/fnt.h>
int main ( int argc, char **argv )
{
int w, h ;
pwInit ( 100, 100, 230, 50, false, "FNT Hello World Demo", true, 0 ) ;
pwSetCallbacks ( NULL, NULL, NULL, NULL, NULL ) ;
pwGetSize ( &w, &h ) ;
fntRenderer *text = new fntRenderer () ;
text -> setFont ( new fntTexFont ( "data/Helvetica.txf" ) ) ;
text -> setPointSize ( 30.0f ) ;
glEnable ( GL_ALPHA_TEST ) ;
glEnable ( GL_BLEND ) ;
glAlphaFunc ( GL_GREATER, 0.1f ) ;
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
glMatrixMode ( GL_PROJECTION ) ;
glLoadIdentity () ;
glOrtho ( 0, w, 0, h, -1, 1 ) ;
while ( 1 )
{
glClearColor ( 0.1f, 0.4f, 0.1f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT ) ;
text -> begin () ;
glColor3f ( 1.0f, 1.0f, 0.0f ) ;
text -> start2f ( 10.0f, 10.0f ) ;
text -> puts ( "Hello World." ) ;
text -> end () ;
pwSwapBuffers () ;
}
return 0 ;
}

View File

@@ -0,0 +1,235 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: slideshow.cxx 2099 2006-11-03 20:04:40Z fayjf $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <windows.h>
# ifdef __CYGWIN32__
# include <sys/stat.h>
# include <unistd.h>
# else
# include <sys/stat.h>
# endif
#else
# include <sys/stat.h>
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/fnt.h>
static fntRenderer *text ;
static fntTexFont *font ;
static char *file ;
static char **line ;
static int *page ;
static int num_lines = 0 ;
static int num_pages = 0 ;
static int curr_page = 0 ;
static void motionfn ( int, int )
{
glutPostRedisplay () ;
}
static void keyfn ( unsigned char key, int, int )
{
switch ( key )
{
case 'H' : case 'R' : curr_page = 0 ; break ;
case '<' : case '{' : curr_page-=5 ; break ;
case 0x08 : /* Backspace */
case '[' : case ',' : curr_page-- ; break ;
case '>' : case '}' : curr_page+=5 ; break ;
case ' ' :
case '\n' :
case '\r' :
case ']' : case '.' : curr_page++ ; break ;
case 0x03 : /* Ctrl-C */
case 'x' :
case 'X' : exit ( 0 ) ;
}
if ( curr_page < 0 ) curr_page = 0 ;
if ( curr_page >= num_pages ) curr_page = num_pages-1 ;
}
static void mousefn ( int /*button*/, int /*updown*/, int /*x*/, int /*y*/ )
{
exit ( 0 ) ;
}
static int getWindowHeight () { return glutGet ( (GLenum) GLUT_WINDOW_HEIGHT ) ; }
static int getWindowWidth () { return glutGet ( (GLenum) GLUT_WINDOW_WIDTH ) ; }
static void setOpenGLState ( void )
{
int w = getWindowWidth () ;
int h = getWindowHeight () ;
glutWarpPointer ( 320, 240 ) ;
glPushAttrib ( GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_TRANSFORM_BIT | GL_LIGHTING_BIT ) ;
glDisable ( GL_LIGHTING ) ;
glDisable ( GL_FOG ) ;
glDisable ( GL_TEXTURE_2D ) ;
glDisable ( GL_DEPTH_TEST ) ;
glDisable ( GL_CULL_FACE ) ;
glEnable ( GL_ALPHA_TEST ) ;
glEnable ( GL_BLEND ) ;
glAlphaFunc ( GL_GREATER, 0.1f ) ;
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
glViewport ( 0, 0, w, h ) ;
glMatrixMode ( GL_PROJECTION ) ;
glPushMatrix () ;
glLoadIdentity () ;
gluOrtho2D ( 0, w, 0, h ) ;
glMatrixMode ( GL_MODELVIEW ) ;
glPushMatrix () ;
glLoadIdentity () ;
}
static void restoreOpenGLState ( void )
{
glMatrixMode ( GL_PROJECTION ) ;
glPopMatrix () ;
glMatrixMode ( GL_MODELVIEW ) ;
glPopMatrix () ;
glPopAttrib () ;
}
static void displayfn (void)
{
setOpenGLState () ;
glClearColor ( 0.1f, 0.4f, 0.1f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT ) ;
text -> setFont ( font ) ;
text -> setPointSize ( 25.0f ) ;
int row = 460 ;
text -> begin () ;
glColor3f ( 1.0f, 1.0f, 1.0f ) ;
for ( int i = page [ curr_page ] ;
i < page [ curr_page+1 ]-1 && i < num_lines && row > 0 ; i++ )
{
text -> start2f ( 10.0f, (float)row ) ;
text -> puts ( line[i] ) ;
row -= 30 ;
}
text -> end () ;
restoreOpenGLState () ;
glutSwapBuffers () ;
glutPostRedisplay () ;
}
int main ( int argc, char **argv )
{
struct stat buf ;
const char* fname = NULL ;
if ( argc > 1 )
fname = argv[1] ;
else
fname = "data/test_slideshow.txt" ;
FILE *fd = fopen ( fname, "r" ) ;
if ( fd == NULL )
exit ( 1 ) ;
fstat ( fileno(fd), & buf ) ;
off_t len = buf.st_size ;
file = new char [ len+1 ] ;
line = new char* [ len+1 ] ;
page = new int [ len+1 ] ;
fread ( file, 1, len, fd ) ;
fclose ( fd ) ;
file [ len ] = '\0' ;
num_lines = 0 ;
num_pages = 0 ;
line [ num_lines ] = file ;
page [ num_pages ] = 0 ;
for ( int i = 0 ; i < len ; i++ )
{
if ( file [ i ] == '\n' )
{
file [ i ] = '\0' ;
line [ ++num_lines ] = & file [ i+1 ] ;
if ( line [ num_lines ][ 0 ] == '*' )
page [ ++num_pages ] = num_lines+1 ;
}
}
glutInitWindowPosition ( 0, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( "FNT Application" ) ;
glutDisplayFunc ( displayfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutKeyboardFunc ( keyfn ) ;
text = new fntRenderer () ;
font = new fntTexFont ( "data/old/lucida.txf" ) ;
glutMainLoop () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="slideshow" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=slideshow - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "slideshow.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "slideshow.mak" CFG="slideshow - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "slideshow - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "slideshow - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "slideshow - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fnt.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libcd.lib" /out:"slideshow.exe" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "slideshow - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fnt_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"slideshow.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "slideshow - Win32 Release"
# Name "slideshow - Win32 Debug"
# Begin Source File
SOURCE=.\slideshow.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,12 @@
if BUILD_JS
noinst_PROGRAMS = js_demo
js_demo_SOURCES = js_demo.cxx
js_demo_LDADD = -lplibjs -lplibul
endif
EXTRA_DIST = js_demo.dsp

124
examples/src/js/js_demo.cxx Normal file
View File

@@ -0,0 +1,124 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: js_demo.cxx 1551 2002-09-01 12:04:53Z ude $
*/
#include <plib/js.h>
int main ( int, char ** )
{
jsJoystick *js[2] ;
float *ax[2] ;
jsInit () ;
js[0] = new jsJoystick ( 0 ) ;
js[1] = new jsJoystick ( 1 ) ;
printf ( "Joystick test program.\n" ) ;
printf ( "~~~~~~~~~~~~~~~~~~~~~~\n" ) ;
if ( js[0]->notWorking () )
printf ( "Joystick 0 not detected\n" ) ;
else
printf ( "Joystick 0 is \"%s\"\n", js[0]->getName() ) ;
if ( js[1]->notWorking () )
printf ( "Joystick 1 not detected\n" ) ;
else
printf ( "Joystick 1 is \"%s\"\n", js[1]->getName() ) ;
if ( js[0]->notWorking () && js[1]->notWorking () ) exit ( 1 ) ;
ax[0] = new float [ js[0]->getNumAxes () ] ;
ax[1] = new float [ js[1]->getNumAxes () ] ;
int i, j ;
for ( i = 0 ; i < 2 ; i++ )
printf ( "+---------------JS.%d-----------------", i ) ;
printf ( "+\n" ) ;
for ( i = 0 ; i < 2 ; i++ )
{
if ( js[i]->notWorking () )
printf ( "| ~~~ Not Detected ~~~ " ) ;
else
{
printf ( "| Btns " ) ;
for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
printf ( "Ax:%d ", j ) ;
for ( ; j < 6 ; j++ )
printf ( " " ) ;
}
}
printf ( "|\n" ) ;
for ( i = 0 ; i < 2 ; i++ )
printf ( "+------------------------------------" ) ;
printf ( "+\n" ) ;
while (1)
{
for ( i = 0 ; i < 2 ; i++ )
{
if ( js[i]->notWorking () )
printf ( "| . . . . . . . . . " ) ;
else
{
int b ;
js[i]->read ( &b, ax[i] ) ;
printf ( "| %04x ", b ) ;
for ( j = 0 ; j < js[i]->getNumAxes () ; j++ )
printf ( "%+.1f ", ax[i][j] ) ;
for ( ; j < 6 ; j++ )
printf ( " . " ) ;
}
}
printf ( "|\r" ) ;
fflush ( stdout ) ;
/* give other processes a chance */
#ifdef WIN32
Sleep ( 1 ) ;
#elif defined(sgi)
sginap ( 1 ) ;
#else
usleep ( 1000 ) ;
#endif
}
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="js_demo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=js_demo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "js_demo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "js_demo.mak" CFG="js_demo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "js_demo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "js_demo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "js_demo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ul.lib js.lib winmm.lib /nologo /subsystem:console /machine:I386 /out:"js_demo.exe" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "js_demo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ul_d.lib js_d.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /out:"js_demo.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "js_demo - Win32 Release"
# Name "js_demo - Win32 Debug"
# Begin Source File
SOURCE=.\js_demo.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,3 @@
SUBDIRS = client_server http_get net_echo

View File

@@ -0,0 +1,14 @@
if BUILD_NET
noinst_PROGRAMS = net_udp_client net_udp_server
net_udp_client_SOURCES = net_udp_client.cxx
net_udp_client_LDADD = -lplibnet -lplibul
net_udp_server_SOURCES = net_udp_server.cxx
net_udp_server_LDADD = -lplibnet -lplibul
endif
EXTRA_DIST = net_udp_client.dsp net_udp_server.dsp

View File

@@ -0,0 +1,25 @@
This example demonstrates a simple one-way communication path
between a client and a server.
It uses UDP protocol - which is unreliable but fast - don't
use it for messages that utterly must get there!
The client program can be told to send to the server on any port number of
any host computer - by default it uses 'localhost'.
The server program can be told to listen out on any port number
and to either listen to just one specific client - or to accept
messages from any client.
Usage:
net_udp_client [-p port] [servername]
net_udp_server [-p port] [clientname]
The default for the client is to use port 5501 on 'localhost'.
The default to the server is to listen on port 5501 and to allow anyone
to send to it. The name "<broadcast>" refers to the broadcast address.
(To enter it on the command line, you'll need to escape the < and >
symbols like this: \<broadcast\> )

View File

@@ -0,0 +1,105 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: net_udp_client.cxx 1898 2004-03-21 17:13:00Z sjbaker $
*/
// This is an example of a UDP client that blasts messages at a
// server.
//
// UDP is a "fire and forget" protocal so the client and server can be
// started up in any order. The client doesn't care if the server
// receives the messages and the server doesn't care if the client is
// sending messages, so either side can be killed and restarted at any
// time.
#include <stdio.h>
#include <plib/net.h>
#include <plib/ul.h>
void help ()
{
fprintf ( stderr, "net_udp_client: Usage -\n" ) ;
fprintf ( stderr, "\n" ) ;
fprintf ( stderr, " net_udp_client [-h] [-p port] [hostname]\n" ) ;
fprintf ( stderr, "\n" ) ;
fprintf ( stderr, "Where:\n" ) ;
fprintf ( stderr, " -h -- Help (displays this message).\n" ) ;
fprintf ( stderr, " -p port -- Set the port number (def=5501).\n" ) ;
fprintf ( stderr, " hostname -- Set the host name (def=localhost).\n" ) ;
fprintf ( stderr, "\n" ) ;
exit ( 0 ) ;
}
int main ( int argc, char **argv )
{
int port = 5501 ;
char host[256] = "localhost" ;
for ( int i = 1 ; i < argc ; i++ )
{
if ( argv [ i ][ 0 ] == '-' || argv [ i ][ 0 ] == '+' )
switch ( argv [ i ][ 1 ] )
{
case 'p' : port = atoi ( argv [ ++i ] ) ; break ;
case 'h' :
default : help () ; break ;
}
else
strcpy ( host, argv [ i ] ) ;
}
fprintf ( stderr, "Talking to host '%s' on port %d\n", host, port ) ;
// Must call this before any other net stuff
netInit() ;
netSocket *sock = new netSocket () ;
if ( ! sock -> open ( false ) ) // open a UDP socket
{
printf ( "error opening socket\n" ) ;
return -1 ;
}
sock -> setBlocking ( false ) ;
if ( sock -> connect( host, port ) == -1 )
{
printf ( "error connecting to %s:%d\n", host, port ) ;
return -1 ;
}
char msg[256] = "Hello world!" ;
int len = strlen ( msg ) ;
while ( true )
{
ulSleep ( 1 ) ;
sock -> send( msg, len, 0 );
printf("msg sent = %s\n", msg);
}
return 0;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="net_udp_client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=net_udp_client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "net_udp_client.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "net_udp_client.mak" CFG="net_udp_client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "net_udp_client - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "net_udp_client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "net_udp_client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net.lib ul.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"net_udp_client.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "net_udp_client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"net_udp_client.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "net_udp_client - Win32 Release"
# Name "net_udp_client - Win32 Debug"
# Begin Source File
SOURCE=.\net_udp_client.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,87 @@
// This is an example of a UDP server that accepts messages coming from a
// client.
//
// UDP is a "fire and forget" protocal so the client and server can be
// started up in any order. The client doesn't care if the server
// receives the messages and the server doesn't care if the client is
// sending messages, so either side can be killed and restarted at any
// time.
#include <stdio.h>
#include <plib/net.h>
void help ()
{
fprintf ( stderr, "net_udp_server: Usage -\n" ) ;
fprintf ( stderr, "\n" ) ;
fprintf ( stderr, " net_udp_server [-h] [-p port] [hostname]\n" ) ;
fprintf ( stderr, "\n" ) ;
fprintf ( stderr, "Where:\n" ) ;
fprintf ( stderr, " -h -- Help (displays this message).\n" ) ;
fprintf ( stderr, " -p port -- Set the port number (def=5501).\n" ) ;
fprintf ( stderr, " hostname -- Set the client host name (def=any host).\n");
fprintf ( stderr, "\n" ) ;
exit ( 0 ) ;
}
int main( int argc, char **argv )
{
int port = 5501 ;
char host [ 256 ] = "" ;
for ( int i = 1 ; i < argc ; i++ )
{
if ( argv [ i ][ 0 ] == '-' || argv [ i ][ 0 ] == '+' )
switch ( argv [ i ][ 1 ] )
{
case 'p' : port = atoi ( argv [ ++i ] ) ; break ;
case 'h' :
default : help () ; break ;
}
else
strcpy ( host, argv [ i ] ) ;
}
if ( host [ 0 ] == '\0' )
fprintf ( stderr, "Listening to any host on port %d\n", port ) ;
else
fprintf ( stderr, "Listening to host '%s' on port %d\n", host, port ) ;
// Must call this before any other net stuff
netInit () ;
netSocket *sock = new netSocket () ;
if ( ! sock -> open( false ) ) // open a UDP socket
{
printf ( "error opening socket\n" ) ;
return -1 ;
}
sock -> setBlocking ( false ) ;
if ( sock -> bind( host, port ) == -1 )
{
printf ( "error binding to port %s:%d\n", host, port ) ;
return -1 ;
}
char msg [ 256 ] ;
int maxlen = 256 ;
int len ;
while ( true )
{
if ( (len = sock -> recv(msg, maxlen, 0)) >= 0 )
{
msg[len] = '\0' ;
printf ( "msg received = %s\n", msg ) ;
}
}
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="net_udp_server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=net_udp_server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "net_udp_server.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "net_udp_server.mak" CFG="net_udp_server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "net_udp_server - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "net_udp_server - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "net_udp_server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net.lib ul.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"net_udp_server.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "net_udp_server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"net_udp_server.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "net_udp_server - Win32 Release"
# Name "net_udp_server - Win32 Debug"
# Begin Source File
SOURCE=.\net_udp_server.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,12 @@
if BUILD_NET
noinst_PROGRAMS = http_get
http_get_SOURCES = http_get.cxx
http_get_LDADD = -lplibnet -lplibul
endif
EXTRA_DIST = http_get.dsp

View File

@@ -0,0 +1,6 @@
This demonstrates the fetching of a HTTP web page using the network
library.
It's hardwired to fetch the PLIB home-page.

View File

@@ -0,0 +1,75 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: http_get.cxx 1906 2004-03-22 19:44:50Z sjbaker $
*/
#include <plib/net.h>
class HTTPClient : public netBufferChannel
{
FILE *fpout ;
public:
HTTPClient ( const char* host, const char* path )
{
open () ;
connect ( host, 80 ) ;
const char* s = netFormat ( "GET %s HTTP/1.1\r\n", path ) ;
bufferSend ( s, strlen(s) ) ;
const char* h = netFormat ( "host: %s\r\n", host ) ;
bufferSend ( h, strlen(h) ) ;
const char *c = netFormat ( "Connection: close\r\n\r\n" ) ;
bufferSend ( c, strlen(c) ) ;
}
~HTTPClient ()
{
if( fpout )
fclose( fpout );
}
virtual void handleBufferRead (netBuffer& buffer)
{
const char* s = buffer.getData();
while (*s)
fputc(*s++,stdout);
buffer.remove();
}
} ;
int main ( int argc, char * argv[] )
{
netInit ( &argc, argv ) ;
new HTTPClient ( "plib.sourceforge.net", "/index.html" ) ;
netChannel::loop ( 0 ) ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="http_get" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=http_get - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "http_get.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "http_get.mak" CFG="http_get - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "http_get - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "http_get - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "http_get - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net.lib ul.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"http_get.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "http_get - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"http_get.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "http_get - Win32 Release"
# Name "http_get - Win32 Debug"
# Begin Source File
SOURCE=.\http_get.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,12 @@
if BUILD_NET
noinst_PROGRAMS = net_echo
net_echo_SOURCES = net_echo.cxx
net_echo_LDADD = -lplibnet -lplibul
endif
EXTRA_DIST = net_echo.dsp

View File

@@ -0,0 +1,16 @@
This is a simple example server that reads lines of text from the client
and echoes them back. An echo server is usually running on TCP
port 7 of Unix machines.
Start it running someplace on your network, then use 'telnet' to
connect to it on port 8000:
telnet localhost 8000
...notice that you can open multiple telnet sessions - and the
server echoes the right data back to the right client.
You can choose a port number other than 8000 by putting it on the
command line of the echo server.

View File

@@ -0,0 +1,97 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: net_echo.cxx 1898 2004-03-21 17:13:00Z sjbaker $
*/
#include <plib/net.h>
/*
** simple example server that reads lines of text from the client
** and echoes them back. An echo server is usually running on TCP
** port 7 of Unix machines.
*/
class EchoChannel : public netChat
{
netBuffer buffer ;
public:
EchoChannel() : buffer(512) { setTerminator("\r\n"); }
virtual void collectIncomingData (const char* s, int n)
{
buffer.append(s,n);
}
virtual void foundTerminator (void)
{
const char* s = buffer.getData();
printf("echo: %s\n",s);
push(s);
push(getTerminator());
buffer.remove();
}
} ;
class EchoServer : private netChannel
{
virtual bool writable (void) { return false ; }
virtual void handleAccept (void)
{
netAddress addr ;
int handle = accept ( &addr ) ;
printf("Client %s:%d connected\n",addr.getHost(),addr.getPort());
EchoChannel * ec = new EchoChannel;
ec->setHandle ( handle ) ;
}
public:
EchoServer ( int port )
{
open () ;
bind ("", port) ;
listen (5) ;
printf ( "Echo Server started on port %d\n", port ) ;
}
} ;
int
main (int argc, char * argv[])
{
int port = 8000 ;
if (argc > 1)
port = atoi (argv[1]);
netInit(&argc,argv);
new EchoServer ( port ) ;
netChannel::loop(0);
return 0;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="net_echo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=net_echo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "net_echo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "net_echo.mak" CFG="net_echo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "net_echo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "net_echo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "net_echo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net.lib ul.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"net_echo.exe" /libpath:"..\..\..\..\..\plib"
!ELSEIF "$(CFG)" == "net_echo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"net_echo.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "net_echo - Win32 Release"
# Name "net_echo - Win32 Debug"
# Begin Source File
SOURCE=.\net_echo.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,13 @@
if BUILD_PSL
noinst_PROGRAMS = psl_demo
psl_demo_SOURCES = psl_demo.cxx
psl_demo_LDADD = -lplibpsl -lplibul -lm
endif
EXTRA_DIST = psl_demo.dsp

View File

@@ -0,0 +1,4 @@
void newline () { printf ( "\n" ) ; }
void tab () { printf ( "\t" ) ; }

View File

@@ -0,0 +1,9 @@
void main ()
{
int diff ;
if ( diff == 1 ) { diff = 2 ; } else { diff = 3 ; }
}

View File

@@ -0,0 +1,129 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: psl_demo.cxx 1912 2004-03-24 10:54:56Z nmcevoy $
*/
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <plib/psl.h>
pslValue my_printf ( int argc, pslValue *argv, pslProgram *p )
{
if ( argv[0].getType() != PSL_STRING )
printf ( "printf: ERROR - First param must be a string!\n" ) ;
else
{
printf ( "%s", argv[0].getString() ) ;
for ( int i = 1 ; i < argc ; i++ )
{
switch ( argv[i].getType () )
{
case PSL_INT : printf ( "%d ", argv[i].getInt () ) ; break ;
case PSL_FLOAT : printf ( "%f ", argv[i].getFloat () ) ; break ;
case PSL_STRING : printf ( "%s ", argv[i].getString () ) ; break ;
case PSL_VOID : printf ( "(void) " ) ; break ;
}
}
}
pslValue ret ;
return ret ;
}
pslValue identify ( int argc, pslValue *argv, pslProgram *p )
{
printf ( "I am %s.\n", (char *)( p->getUserData ()) ) ;
pslValue ret ;
return ret ;
}
pslExtension extensions [] =
{
{ "identify", 0, identify },
{ "printf", -1, my_printf },
{ NULL, 0, NULL }
} ;
int main ()
{
pslInit () ;
/* Create program 1 and compile it. */
pslProgram *prog_1 = new pslProgram ( extensions, "code1" ) ;
ulClock ck ;
ck.setMaxDelta ( 100000.0 ) ;
ck.update () ;
prog_1 -> compile ( "data/test.psl" ) ;
ck.update () ;
fprintf(stderr, "%fs compiletime elapsed\n", ck.getDeltaTime () ) ;
prog_1 -> dump () ;
/* Clone program 2 from program 1 */
pslProgram *prog_2 = new pslProgram ( prog_1, "code2" ) ;
/* Make program 3 from inline strings. */
pslProgram *prog_3 = new pslProgram ( extensions, "inline" ) ;
prog_3 -> compile ( "int main () { printf ( \"Hello World.\\n\" ) ; }\n",
"HelloProgram" ) ;
/* Make them unique by assigning user data to them */
prog_1 -> setUserData ( (void *) "Program 1" ) ;
prog_2 -> setUserData ( (void *) "Program 2" ) ;
prog_3 -> setUserData ( (void *) "Program 3" ) ;
ck.update () ;
while ( 1 )
{
if ( prog_1 -> step () == PSL_PROGRAM_END &&
prog_2 -> step () == PSL_PROGRAM_END &&
prog_3 -> step () == PSL_PROGRAM_END )
break ;
}
ck.update () ;
fprintf(stderr, "%fs runtime elapsed\n", ck.getDeltaTime () ) ;
exit ( 0 ) ;
return 0 ;
}

View File

@@ -0,0 +1,90 @@
# Microsoft Developer Studio Project File - Name="psl_demo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=psl_demo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "psl_demo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "psl_demo.mak" CFG="psl_demo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "psl_demo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "psl_demo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "psl_demo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib psl.lib ul.lib /nologo /subsystem:console /machine:I386 /out:"psl_demo.exe" /libpath:"..\..\..\..\plib"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "psl_demo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib psl_d.lib ul_d.lib /nologo /subsystem:console /debug /machine:I386 /out:"psl_demo.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "psl_demo - Win32 Release"
# Name "psl_demo - Win32 Debug"
# Begin Source File
SOURCE=.\psl_demo.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,31 @@
if BUILD_PUI
noinst_PROGRAMS = simple complex widget_list PointPicker widget_test
simple_SOURCES = simple.cxx
complex_SOURCES = complex.cxx
widget_test_SOURCES = widget_test.cxx
widget_list_SOURCES = widget_list.cxx
PointPicker_SOURCES = PointPicker.cxx
simple_LDADD = -lplibpu -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
complex_LDADD = -lplibpuaux -lplibpu -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS)
widget_test_LDADD = -lplibpuaux -lplibpu -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) \
$(OGL_LIBS)
widget_list_LDADD = -lplibpuaux -lplibpu -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) \
$(OGL_LIBS)
PointPicker_LDADD = -lplibpuaux -lplibpu -lplibfnt -lplibsg -lplibul $(GLUT_LIBS) \
$(OGL_LIBS)
endif
EXTRA_DIST = complex.dsp simple.dsp PointPicker.dsp widget_list.dsp widget_test.dsp

View File

@@ -0,0 +1,446 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: PointPicker.cxx 2143 2009-01-21 17:18:45Z fayjf $
*/
// Point Picker Program by John Fay, October 2000.
// This is a demonstration program for PUI. It displays a set of points in
// a window and allows the user to pick them with the right mouse button.
// It demonstrates the following PUI capabilities:
// - puInput widget
// - puOneShot widget
// - active widget functionality, with up, active, and down callbacks
// - valuators
//
// To use it, the user does the following:
// First Method: Click in the input widget and type the number of the
// point
// Second Method: Click in the input widget and right-click on a point to
// select it.
//
// For both methods, clicking the left (one-shot) button moves the point
// to the right. When it gets far enough to the right, it wraps around to
// the left and moves slightly upwards.
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/pu.h>
#include <plib/puAux.h>
//#define VOODOO 1
/***********************************\
* *
* These are the PUI widget pointers *
* *
\***********************************/
static int main_window ;
static puText *instruction ;
static puInput *point_no ;
static puOneShot *move_point ;
static puButton *exit_button ;
static puaLargeInput *input ;
static int picked_point ;
static int mouse_x, mouse_y ; // Mouse coordinates
//static fntTexFont *tim ;
/**********************************\
* *
* Here are the point coordinates *
* *
\**********************************/
typedef struct {
float x, y, z ;
} node ;
#define NUMBER_POINTS 30
static node point[NUMBER_POINTS] ;
static int firsttime;
static void drawSinglePickableObject ( int i, float x, float y, float z )
{
// I realize that putting the point size, normal, and begin/end inside the for-loop
// is less efficient, but for the purposes of the demo I want everything required
// to draw a single pickable object in this routine.
glPointSize ( 10.0f ) ;
glBegin ( GL_POINTS ) ;
glNormal3f ( 1.0f, 0.0f, 0.0f ) ; // Needed so the points show color
if ( i == picked_point )
glColor4f ( 1.0f, 0.0f, 0.0f, 1.0f ) ;
else
glColor4f ( 0.0f, 1.0f, 0.0f, 1.0f ) ;
glVertex3f ( x, y, z ) ;
glEnd () ;
}
static void drawPoints (void)
{
if ( firsttime )
{
/*
Deliberately do this only once - it's a better test of
PUI's attempts to leave the OpenGL state undisturbed
*/
glEnable ( GL_BLEND ) ;
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER,0.1f);
firsttime = FALSE ;
glMatrixMode ( GL_PROJECTION ) ;
gluPerspective ( 40.0, 1.0, 1.0, 10.0 ) ;
glMatrixMode ( GL_MODELVIEW ) ;
gluLookAt ( 0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ) ;
// Assign point coordinates (random values between zero and one)
for ( int i = 0; i < NUMBER_POINTS; i++ )
{
point[i].x = ( (float) i / (float)NUMBER_POINTS * 2 ) - 1 ;
point[i].y = ( (float)( ( i * i * i ) % NUMBER_POINTS) / (float)NUMBER_POINTS * 2 ) - 1 ;
point[i].z = ( (float)( ( i * i ) % NUMBER_POINTS) / (float)NUMBER_POINTS * 2 ) - 1 ;
}
}
GLfloat matrix[16] ;
glGetFloatv ( GL_MODELVIEW_MATRIX, matrix ) ;
glGetFloatv ( GL_PROJECTION_MATRIX, matrix ) ;
for ( int i = 0 ; i < NUMBER_POINTS ; i++ )
{
drawSinglePickableObject ( i, point[i].x, point[i].y, point[i].z ) ;
}
}
/**************************************\
* *
* These three functions capture mouse *
* and keystrokes (special and mundane) *
* from GLUT and pass them on to PUI. *
* *
\**************************************/
static void specialfn ( int key, int, int )
{
puKeyboard ( key + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN ) ;
glutPostRedisplay () ;
}
static void keyfn ( unsigned char key, int, int )
{
puKeyboard ( key, PU_DOWN ) ;
glutPostRedisplay () ;
}
static void motionfn ( int x, int y )
{
puMouse ( x, y ) ;
glutPostRedisplay () ;
}
static puObject *active_widget = (puObject *)NULL ;
static void mousefn ( int button, int updown, int x, int y )
{
if ( updown == PU_UP ) active_widget = puActiveWidget () ;
if ( !puMouse ( button, updown, x, y ) )
{
// PUI didn't take the mouseclick, try the main window
mouse_x = x ;
mouse_y = puGetWindowHeight () - y ;
// Check for an active widget. If there is one, call its active callback
if ( active_widget )
{
active_widget -> invokeActiveCallback () ;
// Make sure PUI keeps the active widget active
puSetActiveWidget ( active_widget, 0, 0 ) ;
}
}
glutPostRedisplay () ;
}
/**************************************\
* *
* This function redisplays the PUI and *
* the points, flips the double buffer *
* and then asks GLUT to post a *
* redisplay command - so we re-render *
* at maximum rate. *
* *
\**************************************/
static void displayfn (void)
{
/* Clear the screen */
glClearColor ( 0.4f, 0.1f, 0.1f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
/* Draw the points */
drawPoints () ;
/* Make PUI redraw */
puDisplay () ;
/* Off we go again... */
glutSwapBuffers () ;
glutPostRedisplay () ;
}
/***********************************\
* *
* Here are the PUI widget callback *
* functions. *
* *
\***********************************/
// Point Number Input Widget Up Callback
static void point_no_up_cb ( puObject *ob )
{
printf ( "Calling the up-callback with partial data: %d\n", picked_point ) ;
if ( input->inputDisabled () )
input->enableInput () ;
else
input->disableInput () ;
}
// Point Number Input Widget Active Callback
static void point_no_active_cb ( puObject *ob )
{
GLint viewport[4] ; // Viewport
glGetIntegerv ( GL_VIEWPORT, viewport ) ;
GLuint buffer[512];
glSelectBuffer ( 512L, buffer ); // Set up the buffer to put hits into
glRenderMode ( GL_SELECT ) ; // Go into Select mode
glInitNames (); // Empty the name stack
glMatrixMode ( GL_PROJECTION ) ; // Set the Projection matrix for picking
glPushMatrix () ; // Save the current matrix
glLoadIdentity();
// Many thanks to Dave McClurg for getting the transformation matrices to work correctly
/* create 10x10 pixel picking region near cursor location */
gluPickMatrix ( (double)mouse_x, (double)mouse_y,
10.0f, 10.0f, viewport ) ;
gluPerspective ( 40.0, 1.0, 1.0, 10.0 ) ;
for ( int i = 0 ; i < NUMBER_POINTS ; i++ )
{
glPushName ( i ) ;
drawSinglePickableObject ( i, point[i].x, point[i].y, point[i].z ) ;
glPopName () ;
}
glPopMatrix();
glFlush();
long hits = glRenderMode ( GL_RENDER ) ; // Back to Rendering mode, get number of hits
if ( hits )
point_no->setValue ( (int)buffer[3] ) ;
printf ( "Active point %d %d %ld\n", mouse_x, mouse_y, hits ) ;
glMatrixMode ( GL_MODELVIEW ); // got set to GL_PROJECTION earlier
}
// Point Number Input Widget Down Callback
static void point_no_down_cb ( puObject *ob )
{
printf ( "Calling the down callback with full data: %d\n", picked_point ) ;
if ( picked_point < 0 )
{
printf ( "Value too small, setting it to zero\n" ) ;
picked_point = 0 ;
}
if ( picked_point > NUMBER_POINTS - 1 )
{
printf ( "Value too big, setting it to %d\n", NUMBER_POINTS - 1 ) ;
picked_point = NUMBER_POINTS - 1 ;
}
point_no->setValue ( picked_point ) ;
}
// Move Point Button Callback
static void move_point_cb ( puObject *ob )
{
point[picked_point].x += 0.1f ;
if ( point[picked_point].x > 1.0 )
{
point[picked_point].x = -1.0 ;
point[picked_point].y += 0.1f ;
}
}
static void exit_cb ( puObject * )
{
fprintf ( stderr, "Exiting PUI demo program.\n" ) ;
exit ( 1 ) ;
}
int main ( int argc, char **argv )
{
firsttime = TRUE;
picked_point = 0 ;
// Set up the window
glutInitWindowPosition( 100, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
main_window = glutCreateWindow ( "Point Picker PUI Application" ) ;
glutDisplayFunc ( displayfn ) ;
glutKeyboardFunc ( keyfn ) ;
glutSpecialFunc ( specialfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutPassiveMotionFunc ( motionfn ) ;
glutIdleFunc ( displayfn ) ;
puInit () ;
#ifdef VOODOO
puShowCursor () ;
#endif
// Set up the font
//tim = new fntTexFont ;
//tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
//puFont times_medium ( tim, 15, 0.3f ) ;
//puSetDefaultFonts ( times_medium, times_medium ) ;
puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ) ;
puSetDefaultColourScheme ( 0.1f, 0.8f, 0.1f, 1.0f) ;
// Set up the widgets in the window
instruction = new puText ( 10, 450 ) ;
instruction -> setColour ( PUCOL_LABEL, 1.0, 1.0, 1.0 ) ;
instruction -> setLabel ( "Enter a point number in the input box, or\n"
"left-click in the input box and right-click on a point." ) ;
point_no = new puInput ( 150, 60, 240, 80 ) ;
point_no->setValuator ( &picked_point ) ;
point_no->setLabel ( "Point Number" ) ;
point_no->setLabelPlace ( PUPLACE_LEFT_CENTER ) ;
point_no->setCallback ( point_no_up_cb ) ;
point_no->setActiveCallback ( point_no_active_cb ) ;
point_no->setDownCallback ( point_no_down_cb ) ;
move_point = new puOneShot ( 10, 10, 250, 50 ) ;
move_point->setLegend ( "Move Selected Point" ) ;
move_point->setCallback ( move_point_cb ) ;
move_point->makeReturnDefault ( TRUE ) ;
exit_button = new puButton ( 260, 10, 360, 50 ) ;
exit_button->setLegend ( "Exit" ) ;
exit_button->setCallback ( exit_cb ) ;
exit_button->setStyle ( PUSTYLE_BOXED ) ;
exit_button->setLegendPlace ( PUPLACE_CENTERED_LEFT ) ;
input = new puaLargeInput ( 440, 0, 200, 300, 1, 20, TRUE ) ;
//input->setChildStyle ( PUCLASS_ARROW, PUSTYLE_BOXED ) ;
//input->setChildBorderThickness ( PUCLASS_ARROW, 15 ) ;
input->setValue( "This is a large input box\n"
"This is line two of a large input box\n"
"Line 3\n"
"Line 4\n"
"This is an extremely long line in the large input box, so long it passes the box width\n"
"Line 6\n"
"Line 7\n"
"Line 8\n"
"Line 9\n"
"Line 10\n"
"Line 11\n"
"Line 12\n"
"Line 13\n"
"Line 14\n"
"Line 15\n"
"Line 16\n"
"Line 17\n"
"Line 18\n"
"Line 19\n"
"Line 20\n"
"Line 21\n"
"Line 22\n"
"Line 23\n"
"Line 24\n"
"Line 25\n"
"Line 26\n"
"Line 27\n"
"Line 28\n"
"Line 29\n"
"Line 30\n" ) ;
glutMainLoop () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="PointPicker" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=PointPicker - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "PointPicker.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "PointPicker.mak" CFG="PointPicker - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "PointPicker - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "PointPicker - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "PointPicker - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pui.lib puAux.lib fnt.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"PointPicker.exe" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "PointPicker - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pui_d.lib puAux_d.lib fnt_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"PointPicker.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "PointPicker - Win32 Release"
# Name "PointPicker - Win32 Debug"
# Begin Source File
SOURCE=.\PointPicker.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,636 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 2001 Steve Baker
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id: complex.cxx 2099 2006-11-03 20:04:40Z fayjf $
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32
# include <windows.h>
#else
# include <unistd.h>
#endif
#include <math.h>
#ifdef FREEGLUT_IS_PRESENT
# include <GL/freeglut.h>
#else
# ifdef __APPLE__
# include <GLUT/glut.h>
# else
# include <GL/glut.h>
# endif
#endif
#include <plib/pu.h>
#include <plib/puAux.h>
//#define VOODOO 1
/***********************************\
* *
* These are the PUI widget pointers *
* *
\***********************************/
static int main_window ;
static puMenuBar *main_menu_bar ;
static puButton *hide_menu_button ;
static puDialogBox *dialog_box ;
static puText *dialog_box_message ;
static puOneShot *dialog_box_ok_button ;
static puText *timer_text ;
static puGroup *mygroup ;
static puInput *input1 ;
static puInput *input2 ;
static int slider_window ;
static puSlider *rspeedSlider ;
static puSlider *directSlider ;
static int save_window ;
static puaFileSelector *file_selector ;
static int coordinate_window ;
static puaBiSlider *x_coordinate ;
static puaTriSlider *y_coordinate ;
//static fntTexFont *hel ;
//static fntTexFont *tim ;
/***********************************\
* *
* This is a generic tumbling cube *
* *
\***********************************/
static const GLfloat light_diffuse [] = {0.0, 1.0, 0.0, 1.0} ; /* Red diffuse light. */
static const GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0} ; /* Infinite light location. */
static const GLfloat cube_n[6][3] = /* Normals */
{
{-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0},
{ 0.0,-1.0, 0.0}, {0.0, 0.0,-1.0}, {0.0, 0.0, 1.0}
} ;
static const GLint cube_i[6][4] = /* Vertex indices */
{
{0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4},
{4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3}
} ;
static const GLfloat cube_v[8][3] = /* Vertices */
{
{-1.0,-1.0, 1.0}, {-1.0,-1.0,-1.0}, {-1.0, 1.0,-1.0}, {-1.0, 1.0, 1.0},
{ 1.0,-1.0, 1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, { 1.0, 1.0, 1.0}
} ;
static int firsttime;
static void drawCube (void)
{
if ( firsttime )
{
/*
Deliberately do this only once - it's a better test of
PUI's attempts to leave the OpenGL state undisturbed
*/
glEnable ( GL_BLEND ) ;
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER,0.1f);
firsttime = FALSE ;
glLightfv ( GL_LIGHT0, GL_DIFFUSE , light_diffuse ) ;
glLightfv ( GL_LIGHT0, GL_POSITION, light_position ) ;
glEnable ( GL_LIGHT0 ) ;
glEnable ( GL_LIGHTING ) ;
glEnable ( GL_DEPTH_TEST ) ;
glMatrixMode ( GL_PROJECTION ) ;
gluPerspective ( 40.0, 1.0, 1.0, 10.0 ) ;
glMatrixMode ( GL_MODELVIEW ) ;
gluLookAt ( 0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ) ;
glTranslatef ( 0.0, 0.0, -1.0 ) ;
glRotatef ( 60.0, 1.0, 0.0, 0.0 ) ;
}
glCullFace ( GL_FRONT ) ;
glEnable ( GL_CULL_FACE ) ;
// glRotatef ( 1.0f, 0.0, 0.0, 1.0 ) ; /* Tumble that cube! */
glBegin ( GL_QUADS ) ;
for ( int i = 0 ; i < 6 ; i++ )
{
glNormal3fv ( &cube_n[i][0] ) ;
for ( int j = 0; j < 4; j++ )
{
float xmult =(float)(x_coordinate->getCurrentMax () - x_coordinate->getCurrentMin ()) /
(float)(x_coordinate->getMaxValue () - x_coordinate->getMinValue ()) ;
float ymult =(float)(y_coordinate->getCurrentMax () - y_coordinate->getCurrentMin ()) /
(float)(y_coordinate->getMaxValue () - y_coordinate->getMinValue ()) ;
float x = cube_v[cube_i[i][j]][0] * xmult ;
float y = cube_v[cube_i[i][j]][1] * ymult ;
float z = cube_v[cube_i[i][j]][2] ;
glVertex3f ( x, y, z ) ;
}
}
glEnd () ;
}
/********************************\
* *
* End of cube renderer in OpenGL *
* *
\********************************/
/**************************************\
* *
* These three functions capture mouse *
* and keystrokes (special and mundane) *
* from GLUT and pass them on to PUI. *
* *
\**************************************/
static void specialfn ( int key, int, int )
{
puKeyboard ( key + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN ) ;
glutPostRedisplay () ;
}
static void keyfn ( unsigned char key, int, int )
{
puKeyboard ( key, PU_DOWN ) ;
glutPostRedisplay () ;
}
static void motionfn ( int x, int y )
{
puMouse ( x, y ) ;
glutPostRedisplay () ;
}
static void mousefn ( int button, int updown, int x, int y )
{
puMouse ( button, updown, x, y ) ;
glutPostRedisplay () ;
}
/**************************************\
* *
* This function redisplays the PUI and *
* the tumbling cube, flips the double *
* buffer and then asks GLUT to post a *
* redisplay command - so we re-render *
* at maximum rate. *
* *
\**************************************/
static void displayfn (void)
{
/* Clear the screen */
glClearColor ( 0.1f, 0.3f, 0.5f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
/* Draw the tumbling cube */
float val ; rspeedSlider->getValue ( &val ) ;
float dir ; directSlider->getValue ( &dir ) ;
glRotatef( 4*val, 3.0f * ( 2.0f * dir - 1.0f ) , 2.0f * ( 1.0f - 2.0f * dir ) , 1.0f );
drawCube () ;
/* Update the 'timer' */
time_t t = time ( NULL ) ;
timer_text -> setLabel ( ctime ( & t ) ) ;
/* Make PUI redraw */
puDisplay () ;
/* Off we go again... */
glutSwapBuffers () ;
glutPostRedisplay () ;
}
static void sliderdisplayfn (void)
{
/*
Function to display only the slider window
We must set the glut window first or we get an annoying flicker in the main window.
*/
glutSetWindow ( slider_window ) ;
/* Clear the screen */
glClearColor ( 0.1f, 0.3f, 0.5f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
/* Make PUI redraw the slider window */
puDisplay ( slider_window ) ;
/* Off we go again... */
glutSwapBuffers () ;
glutPostRedisplay () ;
}
static void savedisplayfn (void)
{
/*
Function to display only the save window
We must set the glut window first or we get an annoying flicker in the main window.
*/
glutSetWindow ( save_window ) ;
/* Clear the screen */
glClearColor ( 0.1f, 0.1f, 5.0f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
/* Make PUI redraw the save window */
puDisplay ( save_window ) ;
/* Off we go again... */
glutSwapBuffers () ;
glutPostRedisplay () ;
}
static void coorddisplayfn (void)
{
/*
Function to display only the slider window
We must set the glut window first or we get an annoying flicker in the main window.
*/
glutSetWindow ( coordinate_window ) ;
/* Clear the screen */
glClearColor ( 0.1f, 0.3f, 0.5f, 1.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
/* Make PUI redraw the slider window */
puDisplay ( coordinate_window ) ;
/* Off we go again... */
glutSwapBuffers () ;
glutPostRedisplay () ;
}
/***********************************\
* *
* Here are the PUI widget callback *
* functions. *
* *
\***********************************/
static void hide_menu_cb ( puObject *cb )
{
if ( cb -> getValue () )
{
main_menu_bar -> reveal () ;
hide_menu_button->setLegend ( "Hide Menu" ) ;
}
else
{
main_menu_bar -> hide () ;
hide_menu_button->setLegend ( "Show Menu" ) ;
}
}
static void go_away_cb ( puObject * )
{
// Delete the dialog box when its 'OK' button is pressed.
puDeleteObject( dialog_box ) ;
dialog_box = NULL ;
}
static void mk_dialog ( char *fmt, ... )
{
static char txt [ PUSTRING_MAX ] ;
va_list argptr ;
va_start(argptr, fmt) ;
vsprintf( txt, fmt, argptr ) ;
va_end(argptr) ;
dialog_box = new puDialogBox ( 150, 50 ) ;
{
new puFrame ( 0, 0, 400, 100 ) ;
dialog_box_message = new puText ( 10, 70 ) ;
dialog_box_message -> setLabel ( txt ) ;
dialog_box_ok_button = new puOneShot ( 180, 10, 240, 50 ) ;
dialog_box_ok_button -> setLegend ( "OK" ) ;
dialog_box_ok_button -> makeReturnDefault ( TRUE ) ;
dialog_box_ok_button -> setCallback ( go_away_cb ) ;
}
dialog_box -> close () ;
dialog_box -> reveal () ;
}
static void pick_cb ( puObject * )
{
char* filename ;
file_selector -> getValue ( &filename ) ;
//NOTE: interface creation/deletion must be nested
//the old interface must be deleted *before* a new one is created
//otherwise the interface stack will be messed up
puDeleteObject ( file_selector ) ;
file_selector = 0 ;
glutHideWindow () ;
glutSetWindow ( main_window ) ;
if ( filename[0] != 0 )
mk_dialog ( "Saving File:\n%s", filename ) ;
else
mk_dialog ( "Save canceled" ) ;
}
static void savereshapefn ( int w, int h )
{
if ( file_selector )
file_selector->setSize ( w, h ) ;
}
static void coordreshapefn ( int w, int h )
{
x_coordinate->setSize ( 20, h-40 ) ;
y_coordinate->setSize ( 20, h-40 ) ;
y_coordinate->setPosition ( w/2 - 5, 30 ) ;
}
static void save_cb ( puObject * )
{
static int save_count = 0 ; // Number of buttons in file picker
int w = 320, h = 270 ;
glutSetWindow ( save_window ) ;
glutShowWindow () ;
glutReshapeWindow ( w, h ) ;
glutPositionWindow ( ( 640 - w ) / 2, ( 480 - h ) / 2 ) ;
if ( ++save_count > 2 ) save_count = 0 ;
file_selector = new puaFileSelector ( 0, 0, w, h, save_count, ".", "Pick Place To Save" ) ;
file_selector -> setCallback ( pick_cb ) ;
file_selector->setChildStyle ( PUCLASS_ONESHOT, PUSTYLE_BOXED ) ;
file_selector->setChildBorderThickness ( PUCLASS_ONESHOT, 5 ) ;
file_selector->setChildColour ( PUCLASS_SLIDER, 0, 0.5, 0.5, 0.5 ) ;
}
static void ni_cb ( puObject * )
{
mk_dialog ( "Warning:\nSorry, that function isn't implemented" ) ;
}
static void about_cb ( puObject * )
{
mk_dialog ( "About:\nThis is the PUI 'complex' program" ) ;
}
static void help_cb ( puObject * )
{
mk_dialog ( "Help:\nSorry, no help is available for this demo" ) ;
}
static void edit_cb ( puObject * )
{
}
static void exit_cb ( puObject * )
{
fprintf ( stderr, "Exiting PUI demo program.\n" ) ;
exit ( 1 ) ;
}
/* Menu bar entries: */
static char *file_submenu [] = { "Exit", "Close", "------------", "Print - this is a long entry", "------------", "Save", "New", NULL } ;
static puCallback file_submenu_cb [] = { exit_cb, exit_cb, NULL, ni_cb, NULL, save_cb, ni_cb, NULL } ;
static char *edit_submenu [] = { "Do nothing", NULL } ;
static puCallback edit_submenu_cb [] = { edit_cb, NULL } ;
static char *help_submenu [] = { "About...", "Help", NULL } ;
static puCallback help_submenu_cb [] = { about_cb, help_cb, NULL } ;
static void sliderCB( puObject *)
{
glutPostRedisplay();
}
static void coordCB( puObject *)
{
glutPostRedisplay();
}
int main ( int argc, char **argv )
{
firsttime = TRUE;
glutInitWindowPosition( 100, 0 ) ;
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
main_window = glutCreateWindow ( "Complex PUI Application" ) ;
glutDisplayFunc ( displayfn ) ;
glutKeyboardFunc ( keyfn ) ;
glutSpecialFunc ( specialfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
#ifdef VOODOO
glutPassiveMotionFunc ( motionfn ) ;
#endif
glutIdleFunc ( displayfn ) ;
puInit () ;
#ifdef VOODOO
puShowCursor () ;
#endif
//hel = new fntTexFont ;
//tim = new fntTexFont ;
//hel -> load ( "../fnt/data/old/helvetica_medium.txf" ) ;
//tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
//puFont helvetica ( hel, 15 ) ;
//puFont times_medium ( tim, 13 ) ;
//puSetDefaultFonts ( helvetica, times_medium ) ;
puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ) ;
puSetDefaultColourScheme ( 0.3f, 0.4f, 0.6f, 1.0f) ;
timer_text = new puText ( 300, 10 ) ;
timer_text -> setColour ( PUCOL_LABEL, 1.0, 1.0, 1.0 ) ;
/* Make a button to hide the menu bar */
hide_menu_button = new puButton ( 10, 10, 150, 50 ) ;
hide_menu_button->setValue ( TRUE ) ;
hide_menu_button->setLegend ( "Hide the Menu" ) ;
hide_menu_button->setCallback ( hide_menu_cb ) ;
// hide_menu_button->setLegendPlace ( PUPLACE_CENTER ) ;
hide_menu_button->makeReturnDefault ( TRUE ) ;
/* Make the menu bar */
main_menu_bar = new puMenuBar () ;
{
main_menu_bar -> add_submenu ( "File", file_submenu, file_submenu_cb ) ;
main_menu_bar -> add_submenu ( "Edit", edit_submenu, edit_submenu_cb ) ;
main_menu_bar -> add_submenu ( "Help", help_submenu, help_submenu_cb ) ;
}
main_menu_bar -> close () ;
mygroup = new puGroup ( 40, 40 ) ;
input1 = new puInput ( 10, 70, 90, 90 ) ;
input2 = new puInput ( 10, 40, 90, 60 ) ;
mygroup->close () ;
slider_window = glutCreateWindow ( "Slider Window" ) ;
glutPositionWindow ( 20, 100 ) ;
glutReshapeWindow ( 150, 200 ) ;
glutDisplayFunc ( sliderdisplayfn ) ;
glutKeyboardFunc ( keyfn ) ;
glutSpecialFunc ( specialfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutPassiveMotionFunc ( motionfn ) ;
glutIdleFunc ( sliderdisplayfn ) ;
//load the texture for the 2nd window
//hel -> load ( "../fnt/data/old/helvetica_medium.txf" ) ;
//tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
puGroup *slider_group = new puGroup ( 0, 0 ) ; // Necessary so that "sliderdisplayfn" will draw all widgets
rspeedSlider = new puSlider (10,30,150,TRUE);
rspeedSlider->setDelta(0.1f);
rspeedSlider->setCBMode( PUSLIDER_DELTA );
rspeedSlider->setCallback(sliderCB);
rspeedSlider->setLabel ( "Speed" ) ;
rspeedSlider->setLabelPlace ( PUPLACE_BOTTOM_LEFT ) ;
rspeedSlider->setValue ( 0.8f ) ;
directSlider = new puSlider (80,30,150,TRUE);
directSlider->setDelta(0.1f);
directSlider->setCBMode( PUSLIDER_DELTA );
directSlider->setCallback(sliderCB);
directSlider->setLabel ( "Direction" ) ;
directSlider->setLabelPlace ( PUPLACE_BOTTOM_LEFT ) ;
slider_group -> close () ;
save_window = glutCreateWindow ( "Saving" ) ;
glutDisplayFunc ( savedisplayfn ) ;
glutKeyboardFunc ( keyfn ) ;
glutSpecialFunc ( specialfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutPassiveMotionFunc ( motionfn ) ;
glutIdleFunc ( savedisplayfn ) ;
glutReshapeFunc ( savereshapefn ) ;
glutHideWindow () ;
//load the texture for the save window
//hel -> load ( "../fnt/data/old/helvetica_medium.txf" ) ;
//tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
// Coordinate Selection Window
coordinate_window = glutCreateWindow ( "Coordinate Window" ) ;
glutPositionWindow ( 420, 100 ) ;
glutReshapeWindow ( 250, 400 ) ;
glutDisplayFunc ( coorddisplayfn ) ;
glutKeyboardFunc ( keyfn ) ;
glutSpecialFunc ( specialfn ) ;
glutMouseFunc ( mousefn ) ;
glutMotionFunc ( motionfn ) ;
glutPassiveMotionFunc ( motionfn ) ;
glutIdleFunc ( coorddisplayfn ) ;
glutReshapeFunc ( coordreshapefn ) ;
//load the texture for the 2nd window
//hel -> load ( "../fnt/data/old/helvetica_medium.txf" ) ;
//tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
puGroup *coordinate_group = new puGroup ( 0, 0 ) ; // Necessary so that "groupdisplayfn" will draw all widgets
x_coordinate = new puaBiSlider ( 50,10,350,TRUE ) ;
x_coordinate->setMinValue ( -20 ) ;
x_coordinate->setMaxValue ( 20 ) ;
x_coordinate->setCurrentMin ( -20 ) ;
x_coordinate->setCurrentMax ( 20 ) ;
// x_coordinate->setDelta(0.1);
// x_coordinate->setCBMode( PUSLIDER_DELTA );
x_coordinate->setCallback(coordCB);
x_coordinate->setLabel ( "X-coords" ) ;
x_coordinate->setLabelPlace ( PUPLACE_TOP_CENTERED ) ;
y_coordinate = new puaTriSlider (200,30,350,TRUE);
y_coordinate->setMinValue ( -20 ) ;
y_coordinate->setMaxValue ( 20 ) ;
y_coordinate->setCurrentMin ( -20 ) ;
y_coordinate->setCurrentMax ( 20 ) ;
y_coordinate->setFreezeEnds ( FALSE ) ;
y_coordinate->setValue ( 0 ) ;
// y_coordinate->setDelta(0.1);
// y_coordinate->setCBMode( PUSLIDER_DELTA );
y_coordinate->setCallback(coordCB);
y_coordinate->setLabel ( "Y-coords" ) ;
y_coordinate->setLabelPlace ( PUPLACE_BOTTOM_CENTERED ) ;
coordinate_group -> close () ;
// hel -> load ( "../fnt/data/old/helvetica_medium.txf" ) ;
// tim -> load ( "../fnt/data/old/times_medium.txf" ) ;
glutMainLoop () ;
return 0 ;
}

View File

@@ -0,0 +1,88 @@
# Microsoft Developer Studio Project File - Name="complex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=complex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "complex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "complex.mak" CFG="complex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "complex - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "complex - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "complex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pui.lib puAux.lib fnt.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"complex.exe" /libpath:"..\..\..\..\plib"
!ELSEIF "$(CFG)" == "complex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pui_d.lib puAux_d.lib fnt_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"complex.exe" /pdbtype:sept /libpath:"..\..\..\..\plib"
!ENDIF
# Begin Target
# Name "complex - Win32 Release"
# Name "complex - Win32 Debug"
# Begin Source File
SOURCE=.\complex.cxx
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,25 @@
# -*-Makefile-*- $Id: Makefile 1877 2004-02-25 11:01:31Z stromberg $
CXXFLAGS = $(shell fltk-config --use-gl --cxxflags) -Wall -O2 -DPU_USE_FLTK
LDFLAGS = $(shell fltk-config --use-gl --ldflags) -lplibpu -lplibfnt -lplibul
OBJS = main.o gui.o puf.o
fltk_demo: $(OBJS)
g++ $(OBJS) $(LDFLAGS) -o $@
clean:
rm -f gui.{h,cxx} *.o *~
%.o: %.cxx
g++ $(CXXFLAGS) -c $<
%.h %.cxx: %.fl
fluid -c $<
main.o gui.o: gui.h puf.h
puf.o: puf.h

Some files were not shown because too many files have changed in this diff Show More