Initial import.

This commit is contained in:
dborth 2009-04-23 17:32:29 +00:00
commit 429fc0a381
1398 changed files with 449159 additions and 0 deletions

18
SDL/BUGS Normal file
View file

@ -0,0 +1,18 @@
Bugs are now managed in the SDL bug tracker, here:
http://bugzilla.libsdl.org/
You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.
You may also find help at the SDL mailing list. Subscription information:
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
bugs discussed on the mailing list may be forgotten or missed.

139
SDL/Borland.html Normal file
View file

@ -0,0 +1,139 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Building SDL with Borland's C++ compilers</title>
<meta name="author"
content="David Snopek and updated by Dominique Louis.">
</head>
<body>
<xevol @newtonave.net=""> </xevol>
<h1>Building SDL with Borland's C++ compilers. </h1>
<b> by <a href="mailto:xevol@users.sourceforge.net"> David Snopek</a></b>
and updated by <b><a href="mailto:Dominique@SavageSoftware.com.au">Dominique
Louis</a></b> ( Last updated : 30th June 2003 ).<br>
<br>
These instructions cover how to compile SDL and its included test
programs using either Borland <a href="#bcbwin">C++ Builder 5, 6 for Windows</a>,
<a href="#k3">C++ Builder for Linux ( AKA Kylix 3 )</a> or the free <a
href="#bccc">Borland C++ command-line compiler</a>. <br>
<h3> <b> Extract the files </b> </h3>
<p> Unzip the Borland.zip archive into <b>this</b> directory. Do not unzip
it into any other directory because the makefiles ( *.mak ) and project
files ( *.bpr ) use relative paths to refer to the SDL sources. This should
create a directory named "Borland" inside of the top level SDL source directory.
</p>
<h3> <b><a name="bcbwin"></a> Using Borland C++ Builder 5, 6 for Windows </b>
</h3>
<p> Inside of the "Borland" directory there is a "bcb6" directory that contains
a number of Builder project files. Double-click on the "libSDL.bpg" file
icon. Once Builder has started click on the "<u>P</u>rojects" menu on
the menu-bar and go down to "B<u>u</u>ild All Projects" option. <br>
This will proceed to build SDL ( with Borland's calling convention ),
SDLmain, and all the <a href="#tests">test programs</a>. Currently, all
the <a href="#tests">test programs</a> are dynamically linked to Sam Lantinga's
SDL.dll.</p>
<p><b>NOTE :</b> Borland's "lib" format and Microsoft's "lib" format are incompatible.
&nbsp;<br>
If you wish to dynamically link to the SDL library supplied by Sam Lantinga
in each release, I have created the correct *.libs for SDL 1.2.4 and they
exist in the "/lib" directory.<br>
If you would like to create the *.lib files yourself, you will need to
make use of Borland's "implib.exe" utility.<br>
</p>
<p><tt>IMPLIB</tt> works like this: </p>
<pre> IMPLIB (destination lib name) (source dll)<br></pre>
<p> For example,</p>
<pre> IMPLIB SDL.lib SDL.dll<br></pre>
<p>This assumes that SDL.dll was compiled with Visual C++ or similar.<br>
</p>
<p>To learn more about the difference between Borland's and Microsoft's *.lib
format please read the article <a
href="http://www.bcbdev.com/articles/vcdll.htm">here</a>.<br>
</p>
<p> <b><br>
NOTE :</b> The C++ Builder for Windows project format, is not compatible
with the Kylix 3 project format, hence the reason why they are in separate
directories.</p>
<h3> <b><a name="bccc"></a> Using the free Borland C++ command-line compiler
</b> </h3>
<p> The free Borland compiler can be downloaded at no charge from <a
href="http://www.borland.com/bcppbuilder/freecompiler/"> the Borland website
</a>. Make sure that it is installed and properly configured. </p>
<p> Open an MS-DOS Prompt. Change to the "Borland\freebcc" directory under
the SDL source directory. Type "make -f SDL.mak" to build SDL and "make
-f SDLmain.mak". There are also makefiles for all of the <a
href="#tests">test programs</a>, if you wish to build them. All .exes and
DLLs are created in the "test" SDL directory. Ify ou would like to create
the DLL and all the test applications, I have thrown together a basic batchfile
called "makeall.bat" which should create everything in the right order. </p>
<h3> <b> Output files </b> </h3>
No matter which compiler you used, three important files should have
been produced:
<ul>
<li> SDL.dll ( Borland format ) </li>
<li> SDL.lib&nbsp;( Borland format ) </li>
<li> SDLmain.lib&nbsp;( Borland format ) </li>
</ul>
Both of the *.lib files will need to be added to all the projects
that use SDL and SDL.dll must be placed some where the Windows dynamic
linker can find it (either in your project directory or on the system
path, C:\WINDOWS\SYSTEM).
<h3> <b><a name="k3"></a> Using Borland C++ Builder for Linux ( AKA Kylix
3 ) </b> </h3>
<p> Inside of the "Borland" directory there is a "k3" directory that contains
a number of Builder project files. Double-click on the "libSDL.bpg" file
icon. Once Builder has started click on the "<u>P</u>rojects" menu on
the menu-bar and go down to "B<u>u</u>ild All Projects" option. This will
proceed to build all the <a href="#tests">test programs</a>.&nbsp;<br>
Linux users do not need *.lib files as the Shared Object is linked right
into the project ( very neat actually, Windows should do this sort of thing
as it is a lot easier for the developer ). <br>
<b>NOTE :</b>&nbsp;The C++ Builder for Windows project format, is not
compatible with the Kylix 3 project format, hence the reason why they are
in separate directories.</p>
<p> On Mandrake 8.1 the shared objects for SDL are located in the /usr/lib
directory as libSDL_*.so and the Mesa OpenGL shared objects are located
in /usr/X11R6/lib as libGL*.so<br>
<br>
So if your setup is different you may need to change the project file
so that they re-link to the ones on your system.<br>
<br>
On Mandrake 8.1 the headers files are located at /usr/include/SDL/.
So if you you have not installed the development RPMs ( usually named libSDL-devel*
) for SDL ( not included ) you may have to change the include directory
within some of the projects.<br>
</p>
<h3> Known Problems</h3>
The only known problem is that I ( Dominique Louis ), was unable to
create the projects that rebuilt the SDL shared objects under Linux, due
to time constraints and my lack of intimate knowledge of Linux.
<h3><a name="tests"><b> Test programs </b> </a></h3>
Some of the test programs require included media files ( *.wav; *.bmp
etc ). All the test programs are now created in the "test" directory, where
the media files are ( usually ) so they should be ready to go. <br>
<br>
<br>
<br>
</body>
</html>

458
SDL/COPYING Normal file
View file

@ -0,0 +1,458 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

92
SDL/CREDITS Normal file
View file

@ -0,0 +1,92 @@
Simple DirectMedia Layer CREDITS
Thanks to everyone who made this possible, including:
* Cliff Matthews, for giving me a reason to start this project. :)
-- Executor rocks! *grin*
* Scott Call, for making a home for SDL on the 'Net... Thanks! :)
* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
and Phoenix Kokido for financial contributions
* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
* Tim Jones for the new look of the SDL website
* Marco Kraus for setting up SDL merchandise
* Martin Donlon for his work on the SDL Documentation Project
* Ryan Gordon for helping everybody out and keeping the dream alive. :)
* Mattias Engdegård, for help with the Solaris port and lots of other help
* Max Watson, Matt Slot, and Kyle for help with the MacOS Classic port
* Stan Shebs, for the initial Mac OS X port
* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
* Patrick Trainor, Jim Boucher, and Mike Gorchak for the QNX Neutrino port
* Carsten Griwodz for the AIX port
* Gabriele Greco, for the Amiga port
* Patrice Mandin, for the Atari port
* Hannu Viitala for the EPOC port
* Marcus Mertama for the S60 port.
* Peter Valchev for nagging me about the OpenBSD port until I got it right. :)
* Kent B Mein, for a place to do the IRIX port
* Ash, for a place to do the OSF/1 Alpha port
* David Sowsy, for help with the BeOS port
* Eugenia Loli, for endless work on porting SDL games to BeOS
* Jon Taylor for the GGI front-end
* Paulus Esterhazy, for the Visual C++ testing and libraries
* Brenda Tantzen, for Metrowerks CodeWarrior on MacOS
* Chris Nentwich, for the Hermes assembly blitters
* Michael Vance and Jim Kutter for the X11 OpenGL support
* Stephane Peter, for the AAlib front-end and multi-threaded timer idea.
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
* Peter Wiklund, for the 1998 winning SDL logo,
and Arto Hamara, Steven Wong, and Kent Mein for other logo entries.
* Arne Claus, for the 2004 winning SDL logo,
and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson,
S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand,
Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller,
Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja
for other logo entries.
* Bob Pendleton and David Olofson for being long time contributors to
the SDL mailing list.
* Everybody at Loki Software, Inc. for their great contributions!
And a big hand to everyone else who gave me appreciation, advice,
and suggestions, especially the good folks on the SDL mailing list.
THANKS! :)
-- Sam Lantinga <slouken@libsdl.org>

23
SDL/INSTALL Normal file
View file

@ -0,0 +1,23 @@
To compile and install SDL:
1. Run './configure; make; make install'
If you are compiling for Windows using gcc, read the FAQ at:
http://www.libsdl.org/faq.php?action=listentries&category=4#42
If you are compiling using Visual C++ on Win32, you should read
the file VisualC.html
2. Look at the example programs in ./test, and check out the HTML
documentation in ./docs to see how to use the SDL library.
3. Join the SDL developer mailing list by sending E-mail to
sdl-request@libsdl.org
and put "subscribe" in the subject of the message.
Or alternatively you can use the web interface:
http://www.libsdl.org/mailing-list.php
That's it!
Sam Lantinga <slouken@libsdl.org>

BIN
SDL/MPWmake.sea.bin Normal file

Binary file not shown.

111
SDL/Makefile Normal file
View file

@ -0,0 +1,111 @@
# Directories.
OBJ_DIR := obj/wii
LIB_DIR := lib
BIN_DIR := bin/wii
SDL_OBJ_DIR := $(OBJ_DIR)/sdl
SDL_SRC_DIR := src
TEST_OBJ_DIR := $(OBJ_DIR)/test
TEST_SRC_DIR := test
# Tools.
PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/"
# Library source files.
SDL_SRCS := \
$(wildcard $(SDL_SRC_DIR)/*.c) \
$(wildcard $(SDL_SRC_DIR)/audio/*.c) \
$(wildcard $(SDL_SRC_DIR)/audio/dummy/*.c) \
$(wildcard $(SDL_SRC_DIR)/audio/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/cdrom/*.c) \
$(wildcard $(SDL_SRC_DIR)/cdrom/dummy/*.c) \
$(wildcard $(SDL_SRC_DIR)/cpuinfo/*.c) \
$(wildcard $(SDL_SRC_DIR)/events/*.c) \
$(wildcard $(SDL_SRC_DIR)/file/*.c) \
$(wildcard $(SDL_SRC_DIR)/file/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/joystick/*.c) \
$(wildcard $(SDL_SRC_DIR)/joystick/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/loadso/dummy/*.c) \
$(wildcard $(SDL_SRC_DIR)/main/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/stdlib/*.c) \
$(wildcard $(SDL_SRC_DIR)/thread/*.c) \
$(wildcard $(SDL_SRC_DIR)/thread/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/timer/*.c) \
$(wildcard $(SDL_SRC_DIR)/timer/wii/*.c) \
$(wildcard $(SDL_SRC_DIR)/video/*.c) \
$(wildcard $(SDL_SRC_DIR)/video/dummy/*.c) \
$(wildcard $(SDL_SRC_DIR)/video/wii/*.c)
# Library object files.
SDL_OBJS := $(subst $(SDL_SRC_DIR),$(SDL_OBJ_DIR),$(SDL_SRCS:.c=.o))
# Test source files.
# It can be useful to switch this variable around to select individual tests which are problematic.
TEST_SRCS := $(wildcard $(TEST_SRC_DIR)/*.c)
#TEST_SRCS := $(TEST_SRC_DIR)/testsprite.c
# Test object files.
TEST_OBJS := $(subst $(TEST_SRC_DIR)/,$(TEST_OBJ_DIR)/,$(TEST_SRCS:.c=.o))
# Test .DOL files.
TEST_DOLS := $(subst $(TEST_OBJ_DIR),$(BIN_DIR),$(TEST_OBJS:.o=.dol))
# What's a full build?
all: $(LIB_DIR)/libSDL.a install
# How to delete the intermediate files.
clean:
@echo Cleaning $(TEST_DOLS) $(LIB_DIR)/libSDL.a $(SDL_OBJS) $(TEST_OBJS)
@rm -f $(TEST_DOLS) $(LIB_DIR)/libSDL.a $(SDL_OBJS) $(TEST_OBJS)
# How to install to SD card ready for running.
install: $(TEST_DOLS)
@-mkdir -p dols
cp $(TEST_DOLS) dols
# How to build a library.
$(LIB_DIR)/libSDL.a: $(SDL_OBJS)
@echo Archiving $@
@-mkdir -p $(dir $@)
powerpc-gekko-ar crs $@ $(SDL_OBJS)
@echo ----
# How to build a DOL.
$(BIN_DIR)/%.dol: $(TEST_OBJ_DIR)/%.elf
@echo Creating DOL $@
@-mkdir -p $(dir $@)
#powerpc-gekko-objcopy -O binary $< $@
elf2dol $< $@
@echo ----
# Compilation flags.
#COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP)
COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP)
INCLUDES := -Iinclude -I$(DEVKITPRO)/libogc/include
#DEFINES := -DGEKKO -DDEBUG_ERROR -DDEBUG_TIMERS -DDEBUG_THREADS -DDEBUG_BUILD -DDEBUG_CONVERT -DSDL_AUDIO_DRIVER_WII
DEFINES := -DGEKKO -DSDL_AUDIO_DRIVER_WII
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
# Test link flags.
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib/wii -lSDL -lfat -lwiiuse -lbte -logc -lm
#LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib/wii -lSDL -lfat -lwiiuse -lbte -logc -lm
# -lsdcard
# How to link an ELF.
$(TEST_OBJ_DIR)/%.elf: $(TEST_OBJ_DIR)/%.o $(LIB_DIR)/libSDL.a
@echo Linking $@
@-mkdir -p $(dir $@)
powerpc-gekko-g++ -o $@ $< $(LDFLAGS)
#keep elf for debugging
#cp $@ /tmp/elf
# How to compile C file (Tests).
$(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.c
@echo Compiling $<
@-mkdir -p $(dir $@)
powerpc-gekko-gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SsED)
# How to compile C file (SDL library).
$(SDL_OBJ_DIR)/%.o: $(SDL_SRC_DIR)/%.c
@echo Compiling $<
@-mkdir -p $(dir $@)
powerpc-gekko-gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)

111
SDL/Makefile.dc Normal file
View file

@ -0,0 +1,111 @@
#GL=1
CC = sh-elf-gcc
AR = sh-elf-ar
ifdef GL
DEFS += -DSDL_VIDEO_OPENGL=1
TARGET = libSDL_gl.a
else
TARGET = libSDL.a
endif
CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude
SRCS = \
src/audio/dc/SDL_dcaudio.c \
src/audio/dc/aica.c \
src/audio/dummy/SDL_dummyaudio.c \
src/audio/SDL_audio.c \
src/audio/SDL_audiocvt.c \
src/audio/SDL_audiodev.c \
src/audio/SDL_mixer.c \
src/audio/SDL_wave.c \
src/cdrom/dc/SDL_syscdrom.c \
src/cdrom/SDL_cdrom.c \
src/events/SDL_active.c \
src/events/SDL_events.c \
src/events/SDL_expose.c \
src/events/SDL_keyboard.c \
src/events/SDL_mouse.c \
src/events/SDL_quit.c \
src/events/SDL_resize.c \
src/file/SDL_rwops.c \
src/joystick/dc/SDL_sysjoystick.c \
src/joystick/SDL_joystick.c \
src/loadso/dummy/SDL_sysloadso.c \
src/SDL.c \
src/SDL_error.c \
src/SDL_fatal.c \
src/stdlib/SDL_getenv.c \
src/stdlib/SDL_iconv.c \
src/stdlib/SDL_malloc.c \
src/stdlib/SDL_qsort.c \
src/stdlib/SDL_stdlib.c \
src/stdlib/SDL_string.c \
src/thread/dc/SDL_syscond.c \
src/thread/dc/SDL_sysmutex.c \
src/thread/dc/SDL_syssem.c \
src/thread/dc/SDL_systhread.c \
src/thread/SDL_thread.c \
src/timer/dc/SDL_systimer.c \
src/timer/SDL_timer.c \
src/video/dc/SDL_dcevents.c \
src/video/dc/SDL_dcvideo.c \
src/video/dummy/SDL_nullevents.c \
src/video/dummy/SDL_nullmouse.c \
src/video/dummy/SDL_nullvideo.c \
src/video/SDL_blit.c \
src/video/SDL_blit_0.c \
src/video/SDL_blit_1.c \
src/video/SDL_blit_A.c \
src/video/SDL_blit_N.c \
src/video/SDL_bmp.c \
src/video/SDL_cursor.c \
src/video/SDL_gamma.c \
src/video/SDL_pixels.c \
src/video/SDL_RLEaccel.c \
src/video/SDL_stretch.c \
src/video/SDL_surface.c \
src/video/SDL_video.c \
src/video/SDL_yuv.c \
src/video/SDL_yuv_sw.c \
OBJS = $(SRCS:.c=.o)
TEST = \
test/checkkeys.c \
test/graywin.c \
test/loopwave.c \
test/testalpha.c \
test/testbitmap.c \
test/testcdrom.c \
test/testerror.c \
test/testgamma.c \
test/testgl.c \
test/testhread.c \
test/testjoystick.c \
test/testkeys.c \
test/testlock.c \
test/testoverlay.c \
test/testpalette.c \
test/testsem.c \
test/testsprite.c \
test/testtimer.c \
test/testtypes.c \
test/testver.c \
test/testvidinfo.c \
test/testwin.c \
test/testwm.c \
test/threadwin.c \
test/torturethread.c \
$(TARGET): copy_config \
$(OBJS)
$(AR) rcs $(TARGET) $(OBJS)
copy_config:
@cp include/SDL_config.h.default include/SDL_config.h
clean:
rm -f include/SDL_config.h $(OBJS)

63
SDL/Makefile.ds Normal file
View file

@ -0,0 +1,63 @@
#LibSDL 1.2.12
#DS porting by Troy Davis(GPF)
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
ifeq ($(strip $(DEVKITARM)),)
DEVKITARM := $(DEVKITPRO)/devkitARM
endif
SRCS = $(shell echo ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/joystick/nds/*.c ./src/cdrom/dummy/*.c ./src/thread/generic/*.c ./src/timer/nds/*.c ./src/loadso/dummy/*.c ./src/audio/dummy/*.c ./src/audio/nds/*.c ./src/video/dummy/*.c ./src/video/nds/*.c)
OBJS = $(SRCS:.c=.o)
SUBDIRS=
CC=arm-eabi-gcc
CXX=arm-eabi-g++
LDSHARED=$(CXX)
AR=arm-eabi-ar rc
RANLIB=arm-eabi-ranlib
CFLAGS = -mthumb -mthumb-interwork \
-march=armv5te -mtune=arm946e-s \
-O2 -Wall -Wwrite-strings -Wpointer-arith \
-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -Iinclude
CXXFLAGS += $(CFLAGS)
all: $(DEVKITPRO)/libnds/lib/libSDL.a
$(DEVKITPRO)/libnds/lib/libSDL.a: $(OBJS)
$(AR) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
clean:
find . -name "*.o" |xargs rm -f
find . -name "*.d" |xargs rm -f
-rm -f *.elf
-rm -f *.nds
-rm -f *.gba
-rm -f *.arm9
-rm -f *.map
-rm -f *.img
-rm -Rf *.d
subdirs: $(patsubst %, _dir_%, $(SUBDIRS))
$(patsubst %, _dir_%, $(SUBDIRS)):
$(MAKE) -C $(patsubst _dir_%, %, $@)
clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS))
$(patsubst %, _clean_dir_%, $(SUBDIRS)):
$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean
#include $(DEVKITARM)/ds_rules

182
SDL/Makefile.in Normal file
View file

@ -0,0 +1,182 @@
# Makefile to build and install the SDL library
top_builddir = .
srcdir = @srcdir@
objects = build
depend = build-deps
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
auxdir = @ac_aux_dir@
distpath = $(srcdir)/..
distdir = SDL-@SDL_VERSION@
distfile = $(distdir).tar.gz
@SET_MAKE@
SHELL = @SHELL@
CC = @CC@
INCLUDE = @INCLUDE@
CFLAGS = @BUILD_CFLAGS@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
LDFLAGS = @BUILD_LDFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
NASM = @NASM@ @NASMFLAGS@
AR = @AR@
RANLIB = @RANLIB@
WINDRES = @WINDRES@
TARGET = libSDL.la
SOURCES = @SOURCES@
OBJECTS = @OBJECTS@
SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip symbian.zip WhatsNew Xcode.tar.gz
HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(srcdir)/configure: $(srcdir)/configure.in
@echo "Warning, configure.in is out of date"
#(cd $(srcdir) && sh autogen.sh && sh configure)
@sleep 3
Makefile: $(srcdir)/Makefile.in
$(SHELL) config.status $@
$(objects):
$(SHELL) $(auxdir)/mkinstalldirs $@
.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
depend:
@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
$(SHELL) $(auxdir)/makedep.sh
@for src in $(SDLMAIN_SOURCES); do \
obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \
echo "\$$(objects)/$$obj: $$src" >>$(depend); \
echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \
done
include $(depend)
$(objects)/$(TARGET): $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
$(AR) cru $@ $(SDLMAIN_OBJECTS)
$(RANLIB) $@
install: all install-bin install-hdrs install-lib install-data install-man
install-bin:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
install-hdrs:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
for file in $(HDRS); do \
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
install-data:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig
install-man:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
$(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \
done
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man
uninstall-bin:
rm -f $(DESTDIR)$(bindir)/sdl-config
uninstall-hdrs:
for file in $(HDRS); do \
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
done
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
-rmdir $(DESTDIR)$(includedir)/SDL
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
uninstall-data:
rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4
uninstall-man:
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
rm -f $(DESTDIR)$(mandir)/man3/$$file; \
done
clean:
rm -rf $(objects)
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
distclean: clean
rm -f Makefile include/SDL_config.h sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool $(depend)
rm -rf $(srcdir)/autom4te*
rm -rf $(srcdir)/test/autom4te*
find $(srcdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
dist $(distfile):
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
tar cf - $(DIST) | (cd $(distdir); tar xf -)
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
rm -rf `find $(distdir) -name .svn`
rm -rf $(distdir)/test/autom4te*
find $(distdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
tar cvf - $(distdir) | gzip --best >$(distfile)
rm -rf $(distdir)
rpm: $(distfile)
rpmbuild -ta $?
# Create a SVN snapshot that people can run update on
snapshot:
svn co http://svn.libsdl.org/branches/SDL-1.2
(cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache)
cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h
tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2
rm -f $(HOME)/SDL-1.2.zip
zip -r $(HOME)/SDL-1.2.zip SDL-1.2
rm -rf SDL-1.2

42
SDL/Makefile.minimal Normal file
View file

@ -0,0 +1,42 @@
# Makefile to build the SDL library
INCLUDE = -I./include
CFLAGS = -g -O2 $(INCLUDE)
AR = ar
RANLIB = ranlib
CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES = \
src/*.c \
src/audio/*.c \
src/cdrom/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
src/audio/dummy/*.c \
src/video/dummy/*.c \
src/joystick/dummy/*.c \
src/cdrom/dummy/*.c \
src/thread/generic/*.c \
src/timer/dummy/*.c \
src/loadso/dummy/*.c \
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
all: $(TARGET)
$(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@
$(CONFIG_H):
cp $(CONFIG_H).default $(CONFIG_H)
clean:
rm -f $(TARGET) $(OBJECTS)

49
SDL/README Normal file
View file

@ -0,0 +1,49 @@
Simple DirectMedia Layer
(SDL)
Version 1.2
---
http://www.libsdl.org/
This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.
The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS,
MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially
supported.
SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
Pike, Pliant, Python, Ruby, and Smalltalk.
This library is distributed under GNU LGPL version 2, which can be
found in the file "COPYING". This license allows you to use SDL
freely in commercial programs as long as you link with the dynamic
library.
The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation is available in HTML format in "docs/index.html", and
a documentation wiki is available online at:
http://www.libsdl.org/cgi/docwiki.cgi
The test programs in the "test" subdirectory are in the public domain.
Frequently asked questions are answered online:
http://www.libsdl.org/faq.php
If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)

13
SDL/README-SDL.txt Normal file
View file

@ -0,0 +1,13 @@
Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
designed to make it easy to write multi-media software, such as games and
emulators.
The Simple DirectMedia Layer library source code is available from:
http://www.libsdl.org/
This library is distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html

12
SDL/README.AmigaOS Normal file
View file

@ -0,0 +1,12 @@
The AmigaOS code has been removed from SDL, since it had been broken for a
long time and had a few bits of fairly invasive code #ifdef'd into the
SDL core.
However, there is an OS4 version of SDL here:
http://www.rcdrummond.net/amiga/index.html
And a MorphOS version here:
http://www.lehtoranta.net/powersdl/
--ryan.

13
SDL/README.BeOS Normal file
View file

@ -0,0 +1,13 @@
SDL on BeOS R5
==============
You can build SDL on BeOS like any other GNU style package.
e.g. ./configure && make && make install
By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.}
Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib,
so it can be found by the dynamic linker.
Enjoy!
Sam Lantinga (slouken@libsdl.org)

32
SDL/README.DC Normal file
View file

@ -0,0 +1,32 @@
SDL for Dreamcast (beta2)
BERO
berobero@users.sourceforge.net
http://www.geocities.co.jp/Playtown/2004/
this work with kos-newlib
http://sourceforge.net/projects/dcquake/
compile
- source environ.sh (from the KOS distribution)
- make -f Makefile.dc
compile with gl support
- install latest libgl from http://sourceforge.net/projects/dcquake/
- uncomment GL=1 in Makefile.dc
- make -f Makefile.dc clean
- make -f Makefile.dc
install
- copy include/*.h and libSDL.a or libSDL_gl.a for your enviroment
changelog:
beta2
- OpenGL support
- Hardware page flip support
beta
- thread, timer don't tested so much.
- not support OpenGL

63
SDL/README.MacOS Normal file
View file

@ -0,0 +1,63 @@
==============================================================================
Using the Simple DirectMedia Layer with MacOS 7,8,9 on PPC
==============================================================================
These instructions are for people using the Apple MPW environment:
http://developer.apple.com/tools/mpw-tools/
CodeWarrior projects are available in the CWprojects directory.
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
(This step isn't necessary if you have the SDL binary distribution)
First, unpack the MPWmake.sea.hqx archive and move SDL.make into the
SDL directory.
Start MPW
Set the current directory within MPW to the SDL toplevel directory.
Build "SDL" (Type Command-B and enter "SDL" in the dialog)
If everything compiles successfully, you now have the PPC libraries
"SDL" and "SDLmain.o" in the 'lib' subdirectory.
==============================================================================
II. Building the Simple DirectMedia Layer test programs:
First, unpack the MPWmake.sea.hqx archive, move the new rsrc directory to
the main SDL directory, and move the makefiles in the new test subdirectory
to the SDL 'test' subdirectory.
Start MPW
Set the current directory within MPW to the SDL 'test' subdirectory.
Build the programs that have an associated MPW makefile (file ending
with .make), including "testwin", "testalpha", and "graywin".
Copy the SDL library file into the test directory, and run!
==============================================================================
III. Building the Simple DirectMedia Layer demo programs:
Copy one of the test program Makefiles to the demo directory
and modify it to match the sources in the demo.
==============================================================================
IV. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================

186
SDL/README.MacOSX Normal file
View file

@ -0,0 +1,186 @@
==============================================================================
Using the Simple DirectMedia Layer with Mac OS X
==============================================================================
These instructions are for people using Apple's Mac OS X (pronounced
"ten").
From the developer's point of view, OS X is a sort of hybrid Mac and
Unix system, and you have the option of using either traditional
command line tools or Apple's IDE Xcode.
To build SDL using the command line, use the standard configure and make
process:
./configure
make
sudo make install
You can also build SDL as a Universal library (a single binary for both
PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using
the fatbuild.sh script in build-scripts:
sh build-scripts/fatbuild.sh
sudo build-scripts/fatbuild.sh install
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
ABI compatibility on Intel architectures. For best compatibility you
should compile your application the same way. A script which wraps
gcc to make this easy is provided in test/gcc-fat.sh
To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode.
==============================================================================
Using the Simple DirectMedia Layer with a traditional Makefile
==============================================================================
An existing autoconf/automake build system for your SDL app has good chances
to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
that you can distribute to users, you need to put the generated binary into a
so called "bundle", which basically is a fancy folder with a name like
"MyCoolGame.app".
To get this build automatically, add something like the following rule to
your Makefile.am:
bundle_contents = APP_NAME.app/Contents
APP_NAME_bundle: EXE_NAME
mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources
echo "APPL????" > $(bundle_contents)/PkgInfo
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
You should replace EXE_NAME with the name of the executable. APP_NAME is what
will be visible to the user in the Finder. Usually it will be the same
as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
usually is "TestGame". You might also want to use @PACKAGE@ to use the package
name as specified in your configure.in file.
If your project builds more than one application, you will have to do a bit
more. For each of your target applications, you need a seperate rule.
If you want the created bundles to be installed, you may want to add this
rule to your Makefile.am:
install-exec-hook: APP_NAME_bundle
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
mkdir -p $(DESTDIR)$(prefix)/Applications/
cp -r $< /$(DESTDIR)$(prefix)Applications/
This rule takes the Bundle created by the rule from step 3 and installs them
into $(DESTDIR)$(prefix)/Applications/.
Again, if you want to install multiple applications, you will have to augment
the make rule accordingly.
But beware! That is only part of the story! With the above, you end up with
a bare bone .app bundle, which is double clickable from the Finder. But
there are some more things you should do before shipping yor product...
1) The bundle right now probably is dynamically linked against SDL. That
means that when you copy it to another computer, *it will not run*,
unless you also install SDL on that other computer. A good solution
for this dilemma is to static link against SDL. On OS X, you can
achieve that by linkinag against the libraries listed by
sdl-config --static-libs
instead of those listed by
sdl-config --libs
Depending on how exactly SDL is integrated into your build systems, the
way to achieve that varies, so I won't describe it here in detail
2) Add an 'Info.plist' to your application. That is a special XML file which
contains some meta-information about your application (like some copyright
information, the version of your app, the name of an optional icon file,
and other things). Part of that information is displayed by the Finder
when you click on the .app, or if you look at the "Get Info" window.
More information about Info.plist files can be found on Apple's homepage.
As a final remark, let me add that I use some of the techniques (and some
variations of them) in Exult and ScummVM; both are available in source on
the net, so feel free to take a peek at them for inspiration!
==============================================================================
Using the Simple DirectMedia Layer with Xcode
==============================================================================
These instructions are for using Apple's Xcode IDE to build SDL applications.
- First steps
The first thing to do is to unpack the Xcode.tar.gz archive in the
top level SDL directory (where the Xcode.tar.gz archive resides).
Because Stuffit Expander will unpack the archive into a subdirectory,
you should unpack the archive manually from the command line:
cd [path_to_SDL_source]
tar zxf Xcode.tar.gz
This will create a new folder called Xcode, which you can browse
normally from the Finder.
- Building the Framework
The SDL Library is packaged as a framework bundle, an organized
relocatable folder heirarchy of executible code, interface headers,
and additional resources. For practical purposes, you can think of a
framework as a more user and system-friendly shared library, whose library
file behaves more or less like a standard UNIX shared library.
To build the framework, simply open the framework project and build it.
By default, the framework bundle "SDL.framework" is installed in
/Library/Frameworks. Therefore, the testers and project stationary expect
it to be located there. However, it will function the same in any of the
following locations:
~/Library/Frameworks
/Local/Library/Frameworks
/System/Library/Frameworks
- Build Options
There are two "Build Styles" (See the "Targets" tab) for SDL.
"Deployment" should be used if you aren't tweaking the SDL library.
"Development" should be used to debug SDL apps or the library itself.
- Building the Testers
Open the SDLTest project and build away!
- Using the Project Stationary
Copy the stationary to the indicated folders to access it from
the "New Project" and "Add target" menus. What could be easier?
- Setting up a new project by hand
Some of you won't want to use the Stationary so I'll give some tips:
* Create a new "Cocoa Application"
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
* Remove "main.c" from your project
* Remove "MainMenu.nib" from your project
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
* Add your files
* Clean and build
- Building from command line
Use pbxbuild in the same directory as your .pbproj file
- Running your app
You can send command line args to your app by either invoking it from
the command line (in *.app/Contents/MacOS) or by entering them in the
"Executibles" panel of the target settings.
- Implementation Notes
Some things that may be of interest about how it all works...
* Working directory
As defined in the SDL_main.m file, the working directory of your SDL app
is by default set to its parent. You may wish to change this to better
suit your needs.
* You have a Cocoa App!
Your SDL app is essentially a Cocoa application. When your app
starts up and the libraries finish loading, a Cocoa procedure is called,
which sets up the working directory and calls your main() method.
You are free to modify your Cocoa app with generally no consequence
to SDL. You cannot, however, easily change the SDL window itself.
Functionality may be added in the future to help this.
Known bugs are listed in the file "BUGS"

248
SDL/README.MiNT Normal file
View file

@ -0,0 +1,248 @@
==============================================================================
Using the Simple DirectMedia Layer on Atari
==============================================================================
If you want to build SDL from sources to create SDL programs on Atari:
see sections I - II.
If you want to create SDL programs on Atari using SDL binary build,
download it from my web site (URL at end of this file).
If you want to configure a program using SDL on Atari,
see sections IV - VI.
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
(This step isn't necessary if you have the SDL binary distribution)
Do the classic configure, with --disable-shared --enable-static and:
Tos version (should run everywhere):
--disable-threads
Tos does not support threads.
MiNT version (maybe Magic, only for multitasking OS):
--disable-pthreads --enable-pth
Mint and Magic may supports threads, so audio can be used with current
devices, like Sun audio, or disk-writing support. Like Tos, interrupt
audio without threads is more suited for Atari machines.
Then you can make ; make install it.
==============================================================================
II. Building the Simple DirectMedia Layer test programs:
Do the classic configure, then make.
Run them !
==============================================================================
III. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================
IV. What is supported:
Keyboard (GEMDOS, BIOS, GEM, Ikbd)
Mouse (XBIOS, GEM, Ikbd, /dev/mouse (non working atm, disabled))
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
Timer (VBL vector, GNU pth library)
Joysticks and joypads (Ikbd, Hardware)
Audio (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled)
Threads (Multitasking OS only via GNU pth library)
Shared object loader (using LDG library from http://ldg.atari.org/)
Audio CD (MetaDOS)
OpenGL (using Mesa offscreen rendering driver)
- Dependent driver combinations:
Video Kbd Mouse Timer Joysticks
xbios ikbd ikbd vbl(2) ikbd
xbios gemdos xbios vbl(2) xbios
xbios bios xbios vbl(2) xbios
gem gem gem(1) vbl(2) xbios
Audio O/S Misc
dma8 All Uses MFP Timer A interrupt
xbios TOS Uses MFP Timer A interrupt
xbios MiNT Uses MFP Timer A interrupt
xbios Magic Disabled
stfa All Uses MFP interrupt
mcsn TOS Uses MFP Timer A interrupt
mcsn MiNT Uses MiNT thread
mcsn Magic Disabled
gsxb All Uses GSXB callback
Joypad driver always uses hardware access.
OpenGL driver always uses OSMesa.
(1) GEM does not report relative mouse motion, so xbios mouse driver is used
to report this type event.
A preliminary driver for /dev/mouse device driver is present, but is disabled
till it can be used with other applications simultaneously.
(2) If you build SDL with threads using the GNU pth library, timers are
supported via the pth library.
==============================================================================
V. Environment variables:
SDL_VIDEODRIVER:
Set to 'xbios' to force xbios video driver
Set to 'gem' to force gem video driver
SDL_VIDEO_GL_DRIVER:
Set to filename to load as OpenGL library, if you use SDL_GL_LoadLibrary()
SDL_AUDIODRIVER:
Set to 'mint_gsxb' to force Atari GSXB audio driver
Set to 'mint_mcsn' to force Atari MCSN audio driver
Set to 'mint_stfa' to force Atari STFA audio driver
Set to 'mint_xbios' to force Atari Xbios audio driver
Set to 'mint_dma8' to force Atari 8 bits DMA audio driver
Set to 'audio' to force Sun /dev/audio audio driver
Set to 'disk' to force disk-writing audio driver
SDL_ATARI_EVENTSDRIVER
Set to 'ikbd' to force IKBD 6301 keyboard driver
Set to 'gemdos' to force gemdos keyboard driver
Set to 'bios' to force bios keyboard driver
SDL_JOYSTICK_ATARI:
Use any of these strings in the environment variable to enable or
disable a joystick:
'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
'porta-pad-[on|off]' for joypad and/or teamtap on port A
'porta-joy0-[on|off]' for joystick 0 on port A
'porta-joy1-[on|off]' for joystick 1 on port A
'porta-lp-[on|off]' for lightpen on port A
'porta-anpad-[on|off]' for analog paddle on port A
'portb-pad-[on|off]' for joypad and/or teamtap on port B
'portb-joy0-[on|off]' for joystick 0 on port B
'portb-joy1-[on|off]' for joystick 1 on port B
'portb-anpad-[on|off]' for analog paddle on port B
Default configuration is:
'ikbd-joy1-on' (if IKBD events driver enabled)
'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
'porta-pad-on portb-pad-on' (if available on the machine)
port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
On such a port, you can only use a joypad OR 1 or 2 joysticks OR
a lightpen OR an analog paddle. You must disable joypad before
setting another controller.
The second joystick port on IKBD is used by the mouse, so not usable.
Another problem with the IKBD: mouse buttons and joystick fire buttons
are wired together at the hardware level, it means:
port 0 port 0 port 1
mouse left button = joystick fire 0 = joystick fire 1
mouse right button = joystick fire 1 = joystick fire 0
Descriptions of joysticks/joypads:
- Joypads: 1 hat, 17 buttons (Atari Jaguar console-like).
- Joysticks: 1 hat, 1 button.
- Lightpen, analog paddles: 2 axis, 2 buttons. The 2 buttons are those
affected to 1 button joysticks on the same port.
==============================================================================
VI. More informations about drivers:
OpenGL:
The default is to use the Mesa offscreen driver (osmesa.ldg). If you want
to use an older OpenGL implementation, like mesa_gl.ldg or tiny_gl.ldg,
your program must use SDL_GL_LoadLibrary() to do so, and retrieve the
needed function pointers with SDL_LoadFunction(). In all cases, the OpenGL
context is taken care of by SDL itself, you just have to use gl* functions.
However, there is one OpenGL call that has a different prototype in the old
implementations: glOrtho(). In the old implementations, it has 6 float as
parameters, in the standard one, it has 6 double parameters. If you want
to compile testdyngl, or any other SDL program that loads its OpenGL
library, you must change the glOrtho() prototype used in this program. In
osmesa.ldg, you can retrieve a glOrtho() with double parameters, by
searching for the function "glOrtho6d".
Xbios video:
Video chip is detected using the _VDO cookie.
Screen enhancers are not supported, but could be if you know how to
use them.
ST, STE, Mega ST, Mega STE:
320x200x4 bits, shades of grey, available only for the purpose
of testing SDL.
TT:
320x480x8 and 320x240x8 (software double-lined mode).
Falcon:
All modes supported by the current monitor (RVB or VGA).
BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode.
Clones and any machine with monochrome monitor:
Not supported.
Gem video:
Automatically used if xbios not available.
All machines:
Only the current resolution, if 8 bits or higher depth.
IKBD keyboard, mouse and joystick driver:
Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
Hades has an IKBD, but xbios is not available for video, so IKBD
driver is disabled.
Gemdos and bios keyboard driver:
Available on all machines.
Mouse and joystick xbios driver:
Available on all machines (I think).
Joypad driver:
Available if _MCH cookie is STE or Falcon. Supports teamtap.
PTH timer driver:
Available with multitasking OS.
VBL timer driver:
Available on all machines (I think).
Audio drivers:
Cookies _SND, MCSN, STFA and GSXB used to detect supported audio
capabilities.
STE, Mega STE, TT:
8 bits DMA (hardware access)
STFA, MCSN or GSXB driver if installed
Falcon:
8 bits DMA (hardware access)
Xbios functions
STFA, MCSN or GSXB driver if installed
Other machines:
STFA, MCSN or GSXB driver if installed
STFA driver:
http://removers.free.fr/softs/stfa.html
GSXB driver:
http://assemsoft.atari.org/gsxb/
MacSound driver:
http://jf.omnis.ch/software/tos/
MagicSound driver (MCSN,GSXB compatible):
http://perso.wanadoo.fr/didierm/
X-Sound driver (GSXB compatible):
http://www.uni-ulm.de/~s_thuth/atari/xsound_e.html
--
Patrice Mandin <patmandin@gmail.com>
http://pmandin.atari.org/

22
SDL/README.NDS Normal file
View file

@ -0,0 +1,22 @@
The SDL port to the Nintendo DS
This port uses the devKitPro toolchain, available from:
http://www.devkitpro.org
Precompiled tools for cross-compiling on Linux are available from:
http://www.libsdl.org/extras/nds/devkitPro-20070503-linux.tar.gz
todo:
add ds console specific features/optimizations
mouse/keyboard support
dual screen support
build with:
cp include/SDL_config_nds.h include/SDL_config.h
make -f Makefile.ds
included is an arm9/arm7 template to allow for sound streaming support.
Enjoy, fix the source and share :)
Troy Davis(GPF)
http://gpf.dcemu.co.uk/

97
SDL/README.NanoX Normal file
View file

@ -0,0 +1,97 @@
=================================================================
Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API
=================================================================
Authors: Hsieh-Fu Tsai, clare@setabox.com
Greg Haerr, greg@censoft.com
This patch is against SDL version 1.2.4.
It enhances previous patch 0.8 by providing direct framebuffer
access as well as dynamic hardware pixel type support, not
requiring a compile-time option setting for different framebuffer
modes.
Tested against Microwindows version 0.89pre9.
Older Microwindows versions
===========================
If running on a version older than Microwindows 0.89pre9,
the following items might need to be patched in Microwindows.
1. Patch src/nanox/client.c::GrClose()
It fixes the client side GrClose(). In the original version,
GrOpen() can only be called once. When the GrOpen() is called at
the second time, the program will terminate. In order to prevent
this situation, we need to insert "nxSocket = -1" after
"close(nxSocket)" in GrClose(). If you do not have this problem,
you may skip this step.
2. Patch src/nanox/clientfb.c to return absolute x,y coordinates
when using GrGetWindowFBInfo(). Copy the version 0.89pre9
of src/nanox/clientfb.c to your system, or configure
using --disable-nanox-direct-fb.
=============
Quick Install
=============
1. ./configure --disable-video-x11 --disable-video-fbcon \
--enable-video-nanox \
--with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]
2. make clean
3. make
4. make install (as root)
============
Nitty-gritty
============
--enable-nanox-direct-fb Use direct framebuffer access
--enable-nanox-debug Show debug messages
--enable-nanox-share-memory Use shared-memory to speed up
When running multi-threaded applications using SDL, such
as SMPEG, set THREADSAFE=Y in Microwindows' config file,
to enable GrXXX() system call critical section support.
=============================================
Some programs can be used to test this patch.
=============================================
1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game)
2. http://www.libsdl.org/projects/newvox/
3. http://www.libsdl.org/projects/xflame/
4. http://www.libsdl.org/projects/optimum/
5. http://www.gnugeneration.com/software/loop/
6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4)
=========
Todo List
=========
1. Create hardware surface
2. Create YUVOverlay on hardware
3. Use OpenGL
4. Gamma correction
5. Hide/Change mouse pointer
6. Better window movement control with direct fb access
7. Palette handling in 8bpp could be improved
=====================
Supporting Institutes
=====================
Many thanks to go to Setabox Co., Ltd. and CML (Communication and
Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the
Department of Computer Science and Information Engineering of
National Taiwan University for supporting this porting project.
Century Embedded Technologies (http://embedded.censoft.com)
for this patch.
===================
Contact Information
===================
Welcome to give me any suggestion and to report bugs.
My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw
or greg@censoft.com

281
SDL/README.OS2 Normal file
View file

@ -0,0 +1,281 @@
===========
SDL on OS/2
===========
Last updated on May. 17, 2006.
1. How to compile?
------------------
To compile this, you'll need the followings installed:
- The OS/2 Developer's Toolkit
- The OpenWatcom compiler
(http://www.openwatcom.org)
First of all, you have to unzip the Watcom-OS2.zip file. This will result in a
file called "makefile" and a file called "setvars.cmd" in this folder (and some
more files...).
Please edit the second, fourth and fifth lines of setvars.cmd file
to set the folders where the toolkit, the OW compiler and the FSLib are.
You won't need NASM yet (The Netwide Assembler), you can leave that line.
Run setvars.cmd, and you should get a shell in which you can
compile SDL.
Check the "makefile" file. There is a line in there which determines if the
resulting SDL.DLL will be a 'debug' or a 'release' build. The 'debug' version
is full of printf()'s, so if something goes wrong, its output can help a lot
for debugging.
Then run "wmake".
This should create the SDL12.DLL and the corresponding SDL12.LIB file here.
To test applications, it's a good idea to use the 'debug' build of SDL, and
redirect the standard output and standard error output to files, to see what
happens internally in SDL.
(like: testsprite >stdout.txt 2>stderr.txt)
To rebuild SDL, use the following commands in this folder:
wmake clean
wmake
2. How to compile the testapps?
-------------------------------
Once you have SDL12.DLL compiled, navigate into the 'test' folder, copy in
there the newly built SDL12.DLL, and copy in there FSLib.DLL.
Then run "wmake" in there to compile some of the testapps.
3. What is missing?
-------------------
The following things are missing from this SDL implementation:
- MMX, SSE and 3DNOW! optimized video blitters?
- HW Video surfaces
- OpenGL support
4. Special Keys / Full-Screen support
-------------------------------------
There are two special hot-keys implemented:
- Alt+Home switches between fullscreen and windowed mode
- Alt+End simulates closing the window (can be used as a Panic key)
Only the LEFT Alt key will work.
5. Joysticks on SDL/2
---------------------
The Joystick detection only works for standard joysticks (2 buttons, 2 axes
and the like). Therefore, if you use a non-standard joystick, you should
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
file or CONFIG.SYS, so SDL applications can provide full capability to your
device. The syntax is:
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
the line should be:
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
If you want to add spaces in your joystick name, just surround it with
quotes or double-quotes:
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
or
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
Notive However that Balls and Hats are not supported under OS/2, and the
value will be ignored... but it is wise to define these correctly because
in the future those can be supported.
Also the number of buttons is limited to 2 when using two joysticks,
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
and 8 when using a joystick with 2 axes. Notice however these are limitations
of the Joystick Port hardware, not OS/2.
6. Proportional windows
-----------------------
For some SDL applications it can be handy to have proportional windows, so
the windows will keep their aspect ratio when resized.
This can be achieved in two ways:
- Before starting the given SDL application, set the
SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.:
SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe
- If you have a HOME environment variable set, then SDL will look for a file
in there called ".sdl.proportionals". If that file contains the name of the
currently running SDL executable, then that process will have proportional
windows automatically.
Please note that this file is created automatically with default values
at the first run.
7. Audio in SDL applications
----------------------------
Audio effects are one of the most important features in games. Creating audio
effects in sync with the game and without hickups and pauses in the audio are
very important things.
However there are multithreaded SDL applications that have tight loops as their
main logic loop. This kills performance in OS/2, and takes too much CPU from
other threads in the same process, for example from the thread to create the
sound effects.
For this reason, the OS/2 port of SDL can be instructed to run the audio thread
in high priority, which makes sure that there will be enough time for the
processing of the audio data.
At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well
written and well behaving SDL applications should work well in this mode.
For other applications, you can tell SDL/2 to run the audio thread at
TimeCritical priority by setting an env.variable before starting the SDL app:
SET SDL_USE_TIMECRITICAL_AUDIO=1
Please note that this is a bit risky, because if the SDL application runs a
tight infinite loop in this thread, this will make the whole system
unresponsive, so use it with care, and only for applications that need it!
8. Next steps...
----------------
Things to do:
- Implement missing stuffs (look for 'TODO' string in source code!)
- Finish video driver (the 'wincommon' can be a good example for missing
things like application icon and so on...)
- Enable MMX/SSE/SSE2 acceleration functions
- Rewrite CDROM support using DOS Ioctl for better support.
9. Contacts
-----------
You can contact the developers for bugs:
Area Developer email
General (Audio/Video/System) Doodle doodle@scenergy.dfmk.hu
CDROM and Joystick Caetano daniel@caetano.eng.br
Notice however that SDL/2 is 'in development' stage so ... if you want to help,
please, be our guest and contact us!
10. Changelog of the OS/2 port
------------------------------
Version 1.2.10 - 2006-05-17 - Doodle
- Small modifications for v1.2.10 release
- Changed DLL name to include version info (currently SDL12.dll)
Version 1.2 - 2006-05-01 - Doodle
- Modified makefile system to have only one makefile
- Included FSLib headers, DLL and LIB file
Version 1.2 - 2006-02-26 - Doodle
- Updated the official SDL version with the OS/2 specific changes.
- Added support for real unicode keycode conversion.
Version 1.2.7 - 2006-01-20 - Doodle
- Added support for selectively using timecritical priority for
audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable.
(e.g.:
SET SDL_USE_TIMECRITICAL_AUDIO=1
dosbox.exe
)
Version 1.2.7 - 2005-12-22 - Doodle
- Added support for proportional SDL windows.
There are two ways to have proportional (aspect-keeping) windows for
a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW
environment variable to something before starting the application
(e.g.:
SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe
)
or, if you have the HOME environment variable set, then SDL12.DLL will
create a file in that directory called .sdl.proportionals, and you can
put there the name of executable files that will be automatically made
proportional.
Version 1.2.7 - 2005-10-14 - Doodle
- Enabled Exception handler code in FSLib to be able to restore original
desktop video mode in case the application crashes.
- Added the missing FSLib_Uninitialize() call into SDL.
(The lack of it did not cause problems, but it's cleaner this way.)
- Fixed a mouse problem in Fullscreen mode where any mouse click
re-centered the mouse.
Version 1.2.7 - 2005-10-09 - Doodle
- Implemented window icon support
Version 1.2.7 - 2005-10-03 - Doodle
- Reworked semaphore support again
- Tuned thread priorities
Version 1.2.7 - 2005-10-02 - Doodle
- Added support for custom mouse pointers
- Fixed WM_CLOSE processing: give a chance to SDL app to ask user...
- Added support for MMX-accelerated audio mixers
- Other small fixes
Version 1.2.7 - 2005-09-12 - Doodle
- Small fixes for DosBox incorporated into public release
- Fixed semaphore support (SDL_syssem.c)
- Fixed FSLib to have good clipping in scaled window mode,
and to prevent occasional desktop freezes.
Version 1.2.7 - 2004-09-08a - Caetano
- Improved joystick support (general verifications about hardware).
- Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks.
- Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick.
- Improved Joystick test to handle every type of joystick and display only relevant information.
- Merged with Doodle 2004-09-08
- Little tid up in README.OS2
- Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2
Version 1.2.7 - 2004-09-07 - Caetano
- Merged with changes in headers for GCC compiling.
- Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1.
- Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so...
- Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support).
- Created separated Joystick test program to test only joystick functions.
- Improved joystick auto-centering.
- Improved the coordinate correction routine to use two scale factors for each axis.
Version 1.2.7 - 2004-07-05 - Caetano
- Corrected the time returned by status in CDROM support (it was incorrect)
- Added the testcdrom.c and corrected the linking directive (it was causing an error)
Version 1.2.7 - 2004-07-02a - Caetano
- Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment)
- Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c)
- Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support
- Added the "extra" SDL_types.h forgotten in 2004-07-02 version.
<End-Of-File>

50
SDL/README.PicoGUI Normal file
View file

@ -0,0 +1,50 @@
========================
Using SDL with PicoGUI
========================
- Originally contributed by Micah Dowty <micahjd@users.sourceforge.net>
PicoGUI is a scalable GUI system with a unique architecture, primarily focused
on scalability to various embedded systems. You can find more information
including a FAQ at http://picogui.org
To use the patch:
1. When compiling, add the "--enable-video-picogui" switch to ./configure
2. When running your program, ensure that the picogui driver for SDL
is in use by setting the SDL_VIDEODRIVER environment variable
to "picogui".
3. The program must also be linked to the C client library for PicoGUI
(libpgui.so). If the program is being compiled with a patched SDL
installed this should be done automatically. If you want to use an
existing binary with PicoGUI, you can set the LD_PRELOAD environment
variable to the path of your libpgui.so file.
Capabilities:
So far only basic functionality is provided on true color (linear16/24/32)
devices. Accessing a memory mapped bitmap, updating the display, and handling
mouse/keyboard input. This functionality has been tested with several
applications, including mplayer, Xine, sldroids, and Abuse.
TODO list:
- YUV overlays will be helpful for watching video on set top boxes or other
embedded devices that have some graphics acceleration hardware
- Account for rotated bitmap storage in pgserver
- Support for hiding or changing the cursor
- The display should be centered when the SDL application is smaller
than the PicoGUI panel
- Fullscreen or any other special modes
- Support for indexed and grayscale modes
- Probably much more...
--- The End ---

56
SDL/README.Porting Normal file
View file

@ -0,0 +1,56 @@
* Porting To A New Platform
The first thing you have to do when porting to a new platform, is look at
include/SDL_platform.h and create an entry there for your operating system.
The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
Ideally SDL_platform.h will be able to auto-detect the system it's building
on based on C preprocessor symbols.
There are two basic ways of building SDL at the moment:
1. The "UNIX" way: ./configure; make; make install
If you have a GNUish system, then you might try this. Edit configure.in,
take a look at the large section labelled:
"Set up the configuration based on the target platform!"
Add a section for your platform, and then re-run autogen.sh and build!
2. Using an IDE:
If you're using an IDE or other non-configure build system, you'll probably
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
add a section for your platform, and create a custom SDL_config_{platform}.h,
based on SDL_config.h.minimal and SDL_config.h.in
Add the top level include directory to the header search path, and then add
the following sources to the project:
src/*.c
src/audio/*.c
src/cdrom/*.c
src/cpuinfo/*.c
src/events/*.c
src/file/*.c
src/joystick/*.c
src/stdlib/*.c
src/thread/*.c
src/timer/*.c
src/video/*.c
src/audio/disk/*.c
src/video/dummy/*.c
src/joystick/dummy/*.c
src/cdrom/dummy/*.c
src/thread/generic/*.c
src/timer/dummy/*.c
src/loadso/dummy/*.c
Once you have a working library without any drivers, you can go back to each
of the major subsystems and start implementing drivers for your platform.
If you have any questions, don't hesitate to ask on the SDL mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)

155
SDL/README.QNX Normal file
View file

@ -0,0 +1,155 @@
README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
Last changed at 24 Apr 2004.
======================================================================
Table of Contents:
1. OpenGL.
2. Wheel and multi-button mouses.
3. CDROM handling issues.
4. Hardware video overlays.
5. Shared library building.
6. Some building issues.
7. Environment variables.
======================================================================
1. OpenGL:
OpenGL works well and is stable, but fullscreen mode has not been
heavily tested yet.
If you have QNX RtP version 6.1.0 or above you must download the
Photon3D runtime from http://developers.qnx.com or install it from the
public repository or from the public CD, available with QNX. OS versi-
ons below 6.1.0 are not supported.
When creating an OpenGL context, software renderer mode is artifi-
cially selected (QSSL made acceleration only for Voodoo boards in
fullscreen mode, sorry but I don't have this board to test OpenGL -
maybe it works or maybe not :)). If you want acceleration - you can
remove one line in the source code: find the file SDL_ph_image.c and
remove the following
OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
line in the ph_SetupOpenGLContext() function or change the argument to
PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
======================================================================
2. Wheel and multi-button mouses:
Photon emits keyboard events (key up and down) when the mouse
wheel is moved. The key_scan field appears valid, and it contains zero.
That is a basic method of detecting mouse wheel events under Photon.
It looks like a hack, but it works for me :) on various PC configura-
tions.
I've tested it on:
1. Genius Optical NetScroll/+ PS/2 (1 wheel)
2. A4Tech Optical GreatEye WheelMouse PS/2, model: WOP-35. (2 wheels
+ 2 additional buttons). The wheel for vertical scrolling works as
usual, but the second wheel for horizontal scrolling emits two se-
quential events up or down, so it can provide faster scrolling than
the first wheel. Additional buttons don't emit any events, but it
looks like they're handled by photon in an unusual way - like click
to front, but works not with any window, looks like a fun bug-o-fe-
ature :).
======================================================================
3. CDROM handling issues:
Access to CDROM can only be provided with 'root' privileges. I
can't do anything about that, /dev/cd0 has brw------- permissions and
root:root rights.
======================================================================
4. Hardware video overlays:
Overlays can flicker during window movement, resizing, etc. It
happens because the photon driver updates the real window contents be-
hind the overlay, then draws the temporary chroma key color over the
window contents. It can be done without using the chroma key but that
causes the overlay to always be on top. So flickering during window
movement is preferred instead.
Double buffering code is temporarily disabled in the photon driver
code, because on my GF2-MX it can accidentally cause a buffer switch,
which causes the old frame to show. S3 Savage4 has the same problem,
but ATI Rage 128 doesn't. I think it can be fixed later. Current code
works very well, so maybe double buffering is not needed right now.
Something strange happens when you try to move the window with the
overlay beyond the left border of the screen. The overlay tries to
stay at position x=0, but when attempting to move it a bit more it
jumps to position x=-60 (on GF2-MX, on ATI Rage128 this value a bit
smaller). It's really strange, looks like the overlay doesn't like
negative coordinates.
=======================================================================
5. Shared library building:
A shared library can be built, but before running the autogen.sh
script you must manually delete the libtool.m4 stuff from the acinclu-
de.m4 file (it comes after the ESD detection code up to the end of the
file), because the libtool stuff in the acinclude.m4 file was very old
in SDL distribution before the version 1.2.7 and doesn't knew anything
about QNX. SDL 1.2.7 distribution contains the new libtool.m4 script,
but anyway it is broken :), Just remove it, then run "libtoolize
--force --copy", delete the file aclocal.m4 if it is exists and after
that run the autogen.sh script. SDL 1.2.8 contains fixed libtool.m4,
ltmain.sh and config.sub files, so you can just run the autogen.sh
script.
======================================================================
6. Some building issues:
Feel free to not use the --disable-shared configure option if you'
ve read the above comment about 'Shared library building'. Otherwise
this option is strongly recommended, as without it the sdl-config
script will be broken.
Run the configure script without x11 support, e.g.:
a) for OpenGL support:
./configure --prefix=/usr \
--disable-video-x11 \
--disable-shared
b) without OpenGL support:
./configure --prefix=/usr \
--disable-video-x11 \
--disable-shared \
--disable-video-opengl
And of course dont forget to specify --disable-debug, which is on
by default, to disable debug and enable the expensive optimizations.
In the test directory also run the ./configure script without
x11 support, e.g.:
./configure --with-sdl-prefix=/usr \
--with-sdl-exec-prefix=/usr \
--prefix=/usr --without-x
======================================================================
7. Environment variables:
Please note that the photon driver is sensible to the following
environmental variables:
* SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable controls
the refresh rate in all fullscreen modes. Be carefull !!! Photon
drivers usually do not checking the maximum refresh rate, which video
adapter or monitor supports.
* SDL_VIDEO_WINDOW_POS - can be set in the "X,Y" format. If X and Y
coordinates are bigger than the current desktop resolution, then win-
dow positioning across virtual consoles is activated. If X and Y are
smaller than the desktop resolution then window positioning in the
current console is activated. The word "center" can be used instead of
coordinates, it produces the same behavior as SDL_VIDEO_CENTERED
environmental variable.
* SDL_VIDEO_CENTERED - if this environmental variable exists then the
window centering is perfomed in the current virtual console.
Notes: The SDL_VIDEO_CENTERED enviromental variable has greater pri-
ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup-
plied to the application.

84
SDL/README.Qtopia Normal file
View file

@ -0,0 +1,84 @@
==============================================================================
Using the Simple DirectMedia Layer with Qtopia/OPIE
==============================================================================
==============================================================================
I. Setting up the Qtopia development environment.
This document will not explain how to setup the Qtopia development
environment. That is outside the scope of the document. You can read
more on this subject in this excellent howto:
http://www.zauruszone.com/howtos/linux_compiler_setup_howto.html
==============================================================================
II. Building the Simple DirectMedia Layer libraries using the arm
cross-compiler
This is somewhat tricky since the name of the compiler binaries
differ from the standard. Also you should disable features not
needed. The command below works for me. Note that it's all one
line. You can also set the NM, LD etc environment variables
separately.
NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-video-qtopia --disable-video-dummy --disable-video-fbcon --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --prefix=/opt/Qtopia/sharp/ arm-unknown-linux-gnu
One thing to note is that the above configure will include joystick
support, even though you can't have joysticks on the Zaurus. The
reason for this is to avoid link / compile / runtime errors with
applications that have joystick support.
==============================================================================
III. Building the Simple DirectMedia Layer test programs:
After installing, making sure the correct sdl-config is in your
path, run configure like this:
NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar ./configure arm-unknown-linux-gnu
==============================================================================
IV. Application porting notes
One thing I have noticed is that applications sometimes don't exit
correctly. Their icon remains in the taskbar and they tend to
relaunch themselves automatically. I believe this problem doesn't
occur if you exit your application using the exit() method. However,
if you end main() with 'return 0;' or so, this seems to happen.
Also note that when running in landscape mode - i.e requesting a
window that is HEIGHT pixels wide and WIDTH pixels high, where WIDTH
and HEIGHT normally is 240 and 320 - the image is blitted so that
the hardware buttons are on the left side of the display. This might
not always be desirable but such is the code today.
==============================================================================
V. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================
VI. What is supported:
Keyboard (Sharp Zaurus)
Hardware buttons
Stylus input (mouse)
Video. Allows fullscreen both in portrait mode (up to WIDTHxHEIGHT
size window) and in landscape mode (up to HEIGHTxWIDTH).
All other SDL functionality works like a normal Linux system (threads,
audio etc).
--
David Hedbor <david@hedbor.org>
http://david.hedbor.org/ http://eongames.com/

130
SDL/README.RISCOS Normal file
View file

@ -0,0 +1,130 @@
Readme for RISC OS port of SDL
==============================
This document last updated on 2nd Februrary 2006
This is a RISC OS port of the Simple Direct Media Layer (SDL) by Alan Buckley with contributions from Peter Naulls.
Details of the SDL can be found at http://www.libsdl.org.
The source code including the RISC OS version can be obtained from:
http://www.libsdl.org.
Pre built libraries and many games and applications compiled for RISC OS using this library can be downloaded from The Unix Porting Project at http://www.riscos.info/unix/.
This is released under the LGPL see the file COPYING for details.
Compiling applications under RISC OS
====================================
Add -ISDL: for the C compiler flags if you include the files in the SDL directory. e.g. #include "SDL/SDL.h"
Add -ISDL:SDL for the C compiler flags if you include the files directly. e.g. #include "SDL/SDL.h"
Add -LSDL: -lSDL to the link stage of compilation.
For example, to compile the testbitmap.c sample you could use:
gcc -ISDL:SDL -LSDL: -lSDL testbitmap.c -otestbitmap
RISC OS port of SDL runtime information
=======================================
Runtime requirements
--------------------
This library currently needs a minimum of RISC OS 3.6. The source code for the library (and a lot of the programs built with it) also need long file names.
To use the audio you also need 16 bit sound and to have installed the DigitalRender module by Andreas Dehmel version 0.51 available from his
web site: http://home.t-online.de/~zarquon
This is loaded when needed by UnixLib.
Note: As most programs ported from other OSes use high resolution graphics and a memory back buffer a machine with a StrongARM processor and 1 or 2MB of VRAM (or a better machine) is recomended.
RISC OS runtime parameters
--------------------------
Several environmental variables have been defined to make porting programs easier (i.e. By setting these variable you do not need to have source code differences between OSes).
They are all defined on an application basis.
The <appname> used below is found as follows:
1. Use the name of the program unless it is !RunImage
2. Check the folder specification for the folder !RunImage is run from. If it is a folder name use that name, otherwise if it is an environmental variable of the form <XXX$Dir> use the value of XXX.
The variables are:
SDL$<appname>$TaskName
The name of the task for RISC OS. If omitted then <appname> is used for the task name,
SDL$<appname>$BackBuffer
Set to 1 to use a system memory back buffer for the screen in full screen mode. Some programs on other systems assume their is always a back buffer even though the SDL specification specifies this is not the case. The current RISC OS implementation uses direct writes to the screen if a hardware fullscreen is requested.
Set to 2 to use an ARM code full word copy. This is faster than the standard back buffer, but uses aligned words only so it is possible (but unlikely) for it to corrupt the screen for 8bpp and 16bpp modes.
Set to 3 to use a RISC OS sprite as the back buffer. This is usually the slowest for most SDL applications, however it may be useful in the future as Sprite acceleration is added to various hardware that runs RISC OS.
SDL$<appname>$CloseAction - set the action for the close icon. Again as programs don't match the specification you can set this to 0 to remove the close icon from the main window for applications where this does not affect the program.
RISC OS SDL port API notes
==========================
Current level of implementation
-------------------------------
The following list is an overview of how much of the SDL is implemented. The areas match the main areas of the SDL.
video - Mostly done. Doesn't cover gamma, YUV-overlay or OpenGL.
Window Manager - Mostly done. SetIcon/IconifyWindow not implemented.
Events - Mostly done. Resize and some joystick events missing.
Joystick - Currently assumes a single joystick with 4 buttons.
Audio - Done
CDROM - Not implemented.
Threads - Done
Timers - Done
Thread support can be removed by defining DISABLE_THREADS and recompiling the library.
SDL API notes
-------------
This section contains additional notes on some specific commands.
SDL_SetVideoMode
On RISC OS a fullscreen mode directly accesses the screen. This can be modified by the environmental variable (SDL$<appname>$BackBuffer) or by using the SDL_SWSURFACE flag to write to an offscreen buffer that is updated using SDL_UpdateRects.
Open GL is not supported so SDL_OPENGL and SDL_OPENGLBLIT flags fail.
SDL_RESIZEABLE and SDL_NOFRAME flags are not supported.
SDL_SetColors
In a wimp mode the screen colours are not changed for a hardware palette instead the RISC OS sprite colour mapping is used to get the best matching colours.
SDL_CreateCursor
Inverted colour is not supported.
SDL_WM_ToggleFullScreen
Currently this won't work if the application starts up in Fullscreen mode.
Toggling to fullscreen will only work if the monitor is set up to support the exact screen size requested.
SDL_EnableUNICODE
Unicode translation used here is only really accurate for 7 bit characters.
SDL_NumJoysticks/JoystickName etc.
Hardcoded to expect only 1 joystick with 4 buttons if the Joystick module is loaded.
SDL_GetTicks
Timer used has only a centisecond accuracy. This applies to other time related functions.
SDL_Delay
Modified to poll keyboard/mouse during the delay on the event thread.
Notes on current implementation
-------------------------------
Keyboard and mouse are polled so if too long a time is spent between a call to SDL_PumpEvents, functions that use it, or SDL_Delay events can be missed.

23
SDL/README.Symbian Normal file
View file

@ -0,0 +1,23 @@
==============================================================================
Using the Simple DirectMedia Layer with S60 3.x / Symbian 9.x
==============================================================================
These instuctions are for people developing for S60 3.x. S60 3.x
uses Symbian OS so you need S60 SDK.
extract "symbian.zip" into this folder.
go to symbian folder
bldmake bldfiles
abld build
That produces WINSCW and ARMV5 versions of sdl.dll runtime library
and sdl.lib for development.
The sdlexe.dll/sdlexe.lib and sdlmain.lib are for easy SDL S60
integration, please see http://www.mbnet.fi/~mertama/sdl.html
for further info.

17
SDL/README.WII Normal file
View file

@ -0,0 +1,17 @@
The SDL port to the Nintendo Wii
This port uses the devKitPro toolchain, available from:
http://www.devkitpro.org
todo:
use gx for display
use libfat for file access
build with:
cp include/SDL_config_wii.h include/SDL_config.h
make -f Makefile.wii
Original SDL gamecube port - taken from www.devkitpro.org
Port to Wii by mindcry (http://mindcry.cpl.de/wii/)
Many fixes (threading, audio among other stuff) by Yohanes Nugroho (http://tinyhack.com)
Renamed everything from GameCube to Wii. Built against SDL SVN - David Hudson (http://cs-sdl.sourceforge.net)

133
SDL/README.Watcom Normal file
View file

@ -0,0 +1,133 @@
Using SDL under Windows with the OpenWatcom compiler
====================================================
Prerequisites
-------------
I have done the port under Windows XP Home with SP2 installed. Windows
2000 should also be working. I'm not so sure about ancient Windows NT,
since only DirectX 3 is available there. Building should be possible,
but running the compiled applications will probalbly fail with
SDL_VIDEODRIVER=directx. The windib driver should work, though.
To compile and use the SDL with Open Watcom you will need the following:
- Open Watcom compiler. I used version 1.5. The environment variables
PATH, WATCOM and INCLUDE need to be set appropriately - please consult
the OpenWatcom documentation and instructions given during the
installation of the compiler.
My setup looks like this in owvars.bat:
set WATCOM=C:\watcom
set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt
set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw
- A fairly recent DirectX SDK. The original unmodified DX8 SDK works, as
well as the minimal DirectX 7 SDK from the Allegro download site
(<http://alleg.sourceforge.net/files/dx70_min.zip>).
- The SDL sources from Subversion
- The file Watcom-Win32.zip (now available in Subversion)
Building the Library
--------------------
1) In the SDL base directory extract the archive Watcom-Win32.zip. This
creates a subdirectory named 'watcom'.
2) The makefile expects the environment variable DXDIR to be set to the
base directory of a DirectX SDK. I have tried a stock DX8 SDK from
Microsoft as well as the minimal DirectX 7 SDK from the Allegro
download site.
You can also edit the makefile directly and hard code your path to
the SDK on your system.
I have this in my setup:
set DXDIR=D:\devel\DX8_SDK
3) Enter the watcom directory and run
wmake sdl
4) All tests from the test directory are working and can be built by
running
wmake tests
Notes:
The makefile offers some options to tweak the way the library is built.
You have at your disposal the option to build a static (default)
library, or a DLL (with tgt=dll). You can also choose whether to build
a Release (default) or a Debug version (with build=debug) of the tests
and library. Please consult the usage comment at the top of the
makefile for usage instructions.
If you specify a test target (i.e. 'wmake tests' for all tests, or
selected targets like 'wmake testgl testvidinfo testoverlay2'), the
tests are always freshly compiled and linked. This is done to
minimise hassle when switching between library versions (static vs.
DLL), because they require subtly different options.
Also, the test executables are put directly into the test directory,
so they can find their data files. The clean target of the makefile
removes the test executables and the SDL.dll file from the test
directory.
To use the library in your own projects with Open Watcom, you can use
the way the tests are built as base of your own build environment.
The library can also be built with the stack calling convention of the
compiler (-6s instead of -6r).
Test applications
-----------------
I've tried to make all tests work. The following table gives an overview
of the current status.
Testname Status
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
checkkeys +
graywin +
loopwave +
testalpha +
testbitmap +
testdyngl +
testerror +
testfile +
testgamma +
testgl +
testhread +
testiconv - (all failed)
testkeys +
testlock +
testoverlay + (needs 'set SDL_VIDEODRIVER=directx')
testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx')
testpalette +
testplatform +
testsem +
testsprite +
testtimer +
testver +
testvidinfo +
testwin ? (fading doesn't seem right)
testwm +
torturethread +
testcdrom +
testjoystick not tested
threadwin +
testcursor +
TODO
----
There is room for further improvement:
- Test joystick functionality.
- Investigate fading issue in 'testwin' test.
- Fix the UTF-8 support.
- Adapt the makefile/object file list to support more target systems
- Use "#pragma aux" syntax for the CPU info functions.
Questions and Comments
----------------------
Please direct any questions or comments to me: <mailto:macpete@gmx.de>
Happy Coding!
Marc Peter

55
SDL/README.WinCE Normal file
View file

@ -0,0 +1,55 @@
Project files for embedded Visual C++ 3.0, 4.0 and
Visual Studio 2005 can be found in VisualCE.zip
SDL supports GAPI and WinDib output for Windows CE.
GAPI driver supports:
- all possible WinCE devices (Pocket PC, Smartphones, HPC)
with different orientations of video memory and resolutions.
- 4, 8 and 16 bpp devices
- special handling of 8bpp on 8bpp devices
- VGA mode, you can even switch between VGA and GAPI in runtime
(between 240x320 and 480x640 for example). On VGA devices you can
use either GAPI or VGA.
- Landscape mode and automatic rotation of buttons and stylus coordinates.
To enable landscape mode make width of video screen bigger than height.
For example:
SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN)
- WM2005
- SDL_ListModes
NOTE:
There are several SDL features not available in the WinCE port of SDL.
- DirectX is not yet available
- Semaphores are not available
- Joystick support is not available
- CD-ROM control is not available
In addition, there are several features that run in "degraded" mode:
Preprocessor Symbol Effect
=================== =================================
SDL_systimer.c:
USE_GETTICKCOUNT Less accurate values for SDL time functions
USE_SETTIMER Use only a single marginally accurate timer
SDL_syswm.c:
DISABLE_ICON_SUPPORT Can't set the runtime window icon
SDL_sysmouse.c:
USE_STATIC_CURSOR Only the arrow cursor is available
SDL_sysevents.c:
NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus
SDL_dibevents.c:
NO_GETKEYBOARDSTATE Very limited keycode translation
SDL_dibvideo.c:
NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp
NO_CHANGEDISPLAYSETTINGS No fullscreen support
NO_GAMMA_SUPPORT Gamma correction not available

107
SDL/README.wscons Normal file
View file

@ -0,0 +1,107 @@
==============================================================================
Using the Simple DirectMedia Layer with OpenBSD/wscons
==============================================================================
The wscons SDL driver can be used to run SDL programs on OpenBSD
without running X. So far, the driver only runs on the Sharp Zaurus,
but the driver is written to be easily extended for other machines.
The main missing pieces are blitting routines for anything but 16 bit
displays, and keycode maps for other keyboards. Also, there is no
support for hardware palettes.
There is currently no mouse support.
To compile SDL with support for wscons, use the
"--enable-video-wscons" option when running configure. I used the
following command line:
./configure --disable-oss --disable-ltdl --enable-pthread-sem \
--disable-esd --disable-arts --disable-video-aalib \
--enable-openbsdaudio --enable-video-wscons \
--prefix=/usr/local --sysconfdir=/etc
Setting the console device to use
=================================
When starting an SDL program on a wscons console, the driver uses the
current virtual terminal (usually /dev/ttyC0). To force the driver to
use a specific terminal device, set the environment variable
SDL_WSCONSDEV:
bash$ SDL_WSCONSDEV=/dev/ttyC1 ./some-sdl-program
This is especially useful when starting an SDL program from a remote
login prompt (which is great for development). If you do this, and
want to use keyboard input, you should avoid having some other program
reading from the used virtual console (i.e., do not have a getty
running).
Rotating the display
====================
The display can be rotated by the wscons SDL driver. This is useful
for the Sharp Zaurus, since the display hardware is wired so that it
is correctly rotated only when the display is folded into "PDA mode."
When using the Zaurus in "normal," or "keyboard" mode, the hardware
screen is rotated 90 degrees anti-clockwise.
To let the wscons SDL driver rotate the screen, set the environment
variable SDL_VIDEO_WSCONS_ROTATION to "CW", "CCW", or "UD", for
clockwise, counter clockwise, and upside-down rotation respectively.
"CW" makes the screen appear correct on a Sharp Zaurus SL-C3100.
When using rotation in the driver, a "shadow" frame buffer is used to
hold the intermediary display, before blitting it to the actual
hardware frame buffer. This slows down performance a bit.
For completeness, the rotation "NONE" can be specified to use a shadow
frame buffer without actually rotating. Unsetting
SDL_VIDEO_WSCONS_ROTATION, or setting it to '' turns off the shadow
frame buffer for maximum performance.
Running MAME
============
Since my main motivation for writing the driver was playing MAME on
the Zaurus, I'll give a few hints:
XMame compiles just fine under OpenBSD.
I'm not sure this is strictly necessary, but set
MY_CPU = arm
in makefile.unix, and
CFLAGS.arm = -DLSB_FIRST -DALIGN_INTS -DALIGN_SHORTS
in src/unix/unix.max
to be sure.
The latest XMame (0.101 at this writing) is a very large program.
Either tinker with the make files to compile a version without support
for all drivers, or, get an older version of XMame. My recommendation
would be 0.37b16.
When running MAME, DO NOT SET SDL_VIDEO_WSCONS_ROTATION! Performace
is MUCH better without this, and it is COMPLETELY UNNECESSARY, since
MAME can rotate the picture itself while drawing, and does so MUCH
FASTER.
Use the Xmame command line option "-ror" to rotate the picture to the
right.
Acknowledgments
===============
I studied the wsfb driver for XFree86/Xorg quite a bit before writing
this, so there ought to be some similarities.
--
Staffan Ulfberg <staffan@ulfberg.se>

140
SDL/SDL.qpg.in Normal file
View file

@ -0,0 +1,140 @@
<QPG:Generation>
<QPG:Options>
<QPG:User unattended="yes" verbosity="0" listfiles="yes"/>
<QPG:Defaults type="qnx_package"/>
<QPG:Source></QPG:Source>
<QPG:Release date="today" number="+"/>
<QPG:Build></QPG:Build>
<QPG:FileSorting strip="yes"/>
<QPG:Package targets="standart"/>
<QPG:Repository generate="yes"/>
<QPG:FinalDir></QPG:FinalDir>
<QPG:Cleanup></QPG:Cleanup>
</QPG:Options>
<QPG:Responsible>
<QPG:Company>QNX.ORG.RU Community</QPG:Company>
<QPG:Department></QPG:Department>
<QPG:Group></QPG:Group>
<QPG:Team>QNX.ORG.RU Team</QPG:Team>
<QPG:Employee>Mike Gorchak</QPG:Employee>
<QPG:EmailAddress>mike@malva.ua</QPG:EmailAddress>
</QPG:Responsible>
<QPG:Values>
<QPG:Files>
<QPG:Add file="./COPYING" install="LicenseUrl/" handling="repdata"/>
<QPG:Add permissions="0755" file="./src/.libs/libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@" install="/usr/lib/"/>
<QPG:Add filetype="symlink" file="libSDL.so" install="/usr/lib/" linkto="libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.lai" install="/usr/lib/libSDL.la"/>
<QPG:Add permissions="0644" file="./src/main/libSDLmain.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./include/*.h" install="/usr/include/SDL/"/>
<QPG:Add permissions="0755" file="./sdl-config" install="/usr/bin/"/>
<QPG:Add permissions="0644" file="./BUGS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./COPYING" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./CREDITS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./INSTALL" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README-SDL.txt" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.CVS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.QNX" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./TODO" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./WhatsNew" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./docs.html" install="/usr/share/doc/SDL12/Changes.html"/>
<QPG:Add permissions="0644" file="./docs/index.html" install="/usr/share/doc/SDL12/docs/"/>
<QPG:Add permissions="0644" file="./docs/html/*.html" install="/usr/share/doc/SDL12/docs/html/"/>
<QPG:Add permissions="0644" file="./docs/man3/*.3" install="/usr/share/man/man3/"/>
<QPG:Add permissions="0644" file="./sdl.m4" install="/usr/share/aclocal/"/>
</QPG:Files>
<QPG:PackageFilter>
<QPM:PackageManifest>
<QPM:PackageDescription>
<QPM:PackageType>Library</QPM:PackageType>
<QPM:PackageName>SDL</QPM:PackageName>
<QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber>
<QPM:PackageRepository>http://qnx.org.ru/repository</QPM:PackageRepository>
<QPM:FileVersion>2.6</QPM:FileVersion>
</QPM:PackageDescription>
<QPM:ProductDescription>
<QPM:ProductName>Simple DirectMedia Layer (SDL)</QPM:ProductName>
<QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
<QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
<QPM:VendorName>Public</QPM:VendorName>
<QPM:VendorInstallName>public</QPM:VendorInstallName>
<QPM:VendorURL>http://www.libsdl.org</QPM:VendorURL>
<QPM:VendorEmbedURL/>
<QPM:VendorEmail>slouken@libsdl.org</QPM:VendorEmail>
<QPM:AuthorName>Sam Lantinga</QPM:AuthorName>
<QPM:AuthorURL>http://www.libsdl.org</QPM:AuthorURL>
<QPM:AuthorEmbedURL/>
<QPM:AuthorEmail>slouken@libsdl.org</QPM:AuthorEmail>
<QPM:ProductIconSmall/>
<QPM:ProductIconLarge/>
<QPM:ProductDescriptionShort>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://www.libsdl.org</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL/>
</QPM:ProductDescription>
<QPM:ReleaseDescription>
<QPM:ReleaseVersion>@VERSION@</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor/>
<QPM:ReleaseNoteMajor/>
<QPM:ReleaseBuild>1</QPM:ReleaseBuild>
<QPM:CountryExclude/>
<QPM:ReleaseCopyright>GNU Lesser General Public License</QPM:ReleaseCopyright>
</QPM:ReleaseDescription>
<QPM:ContentDescription>
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
<QPM:ContentKeyword>SDL,audio,graphics,demos,games,emulators,direct,media,layer</QPM:ContentKeyword>
<QPM:TargetOS>qnx6</QPM:TargetOS>
<QPM:HostOS>none</QPM:HostOS>
<QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
<QPM:DisplayEnvironment xmlmultiple="true">Console</QPM:DisplayEnvironment>
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
<QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
</QPM:ContentDescription>
<QPM:LicenseUrl>repdata://LicenseUrl/COPYING</QPM:LicenseUrl>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
</QPG:Values>
</QPG:Generation>

113
SDL/SDL.spec Normal file
View file

@ -0,0 +1,113 @@
Summary: Simple DirectMedia Layer
Name: SDL
Version: 1.2.13
Release: 1
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
URL: http://www.libsdl.org/
License: LGPL
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
%ifos linux
Provides: libSDL-1.2.so.0
%endif
%define __defattr %defattr(-,root,root)
%define __soext so
%description
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
%package devel
Summary: Libraries, includes and more to develop SDL applications.
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
This is the libraries, include files and other resources you can use
to develop SDL applications.
%prep
%setup -q
%build
%ifos linux
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
%else
%configure
%endif
make
%install
rm -rf $RPM_BUILD_ROOT
%ifos linux
make install prefix=$RPM_BUILD_ROOT%{prefix} \
bindir=$RPM_BUILD_ROOT%{_bindir} \
libdir=$RPM_BUILD_ROOT%{_libdir} \
includedir=$RPM_BUILD_ROOT%{_includedir} \
datadir=$RPM_BUILD_ROOT%{_datadir} \
mandir=$RPM_BUILD_ROOT%{_mandir}
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
%else
%makeinstall
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{__defattr}
%doc README-SDL.txt COPYING CREDITS BUGS
%{_libdir}/lib*.%{__soext}.*
%files devel
%{__defattr}
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
%doc docs/index.html docs/html
%{_bindir}/*-config
%{_libdir}/lib*.a
%{_libdir}/lib*.la
%{_libdir}/lib*.%{__soext}
%dir %{_includedir}/SDL
%{_includedir}/SDL/*.h
%{_libdir}/pkgconfig/sdl.pc
%{_datadir}/aclocal/*
%{_mandir}/man3/*
%changelog
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
- Removed support for Darwin, due to build problems on ps2linux
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
- Added support for Darwin, updated spec file
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
- Re-integrated spec file into SDL distribution
- 'name' and 'version' come from configure
- Some of the documentation is devel specific
- Removed SMP support from %build - it doesn't work with libtool anyway
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
- Hacked Mandrake sdl spec to build 1.1
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
- Build Release
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
- Added docs
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
- v 1.0.0
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- First spec file for Mandrake distribution.
# end of file

113
SDL/SDL.spec.in Normal file
View file

@ -0,0 +1,113 @@
Summary: Simple DirectMedia Layer
Name: SDL
Version: @SDL_VERSION@
Release: 1
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
URL: http://www.libsdl.org/
License: LGPL
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
%ifos linux
Provides: libSDL-1.2.so.0
%endif
%define __defattr %defattr(-,root,root)
%define __soext so
%description
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
%package devel
Summary: Libraries, includes and more to develop SDL applications.
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
This is the libraries, include files and other resources you can use
to develop SDL applications.
%prep
%setup -q
%build
%ifos linux
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
%else
%configure
%endif
make
%install
rm -rf $RPM_BUILD_ROOT
%ifos linux
make install prefix=$RPM_BUILD_ROOT%{prefix} \
bindir=$RPM_BUILD_ROOT%{_bindir} \
libdir=$RPM_BUILD_ROOT%{_libdir} \
includedir=$RPM_BUILD_ROOT%{_includedir} \
datadir=$RPM_BUILD_ROOT%{_datadir} \
mandir=$RPM_BUILD_ROOT%{_mandir}
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
%else
%makeinstall
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{__defattr}
%doc README-SDL.txt COPYING CREDITS BUGS
%{_libdir}/lib*.%{__soext}.*
%files devel
%{__defattr}
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
%doc docs/index.html docs/html
%{_bindir}/*-config
%{_libdir}/lib*.a
%{_libdir}/lib*.la
%{_libdir}/lib*.%{__soext}
%dir %{_includedir}/SDL
%{_includedir}/SDL/*.h
%{_libdir}/pkgconfig/sdl.pc
%{_datadir}/aclocal/*
%{_mandir}/man3/*
%changelog
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
- Removed support for Darwin, due to build problems on ps2linux
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
- Added support for Darwin, updated spec file
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
- Re-integrated spec file into SDL distribution
- 'name' and 'version' come from configure
- Some of the documentation is devel specific
- Removed SMP support from %build - it doesn't work with libtool anyway
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
- Hacked Mandrake sdl spec to build 1.1
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
- Build Release
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
- Added docs
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
- v 1.0.0
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- First spec file for Mandrake distribution.
# end of file

25
SDL/TODO Normal file
View file

@ -0,0 +1,25 @@
Wish list for the 1.3 development branch:
http://bugzilla.libsdl.org/
* Add mousewheel events (new unified event architecture?)
* DirectInput joystick support needs to be implemented
* Be able to enumerate and select available audio and video drivers
* Fullscreen video mode support for Mac OS X
* Explicit vertical retrace wait (maybe separate from SDL_Flip?)
* Shaped windows, windows without borders
* Multiple windows, multiple display support
* SDL_INIT_EVENTTHREAD on Windows and MacOS?
* Add a timestamp to events
* Add audio input API
* Add hardware accelerated scaled blit
* Add hardware accelerated alpha blits
* Redesign blitting architecture to allow blit plugins
In the jump from 1.2 to 1.3, we should change the SDL_Rect members to
int and evaluate all the rest of the datatypes. This is the only place
we should do it though, since the 1.2 series should not break binary
compatibility in this way.
Requests:
* PCM and CDROM volume control (deprecated, but possible)

171
SDL/VisualC.html Normal file
View file

@ -0,0 +1,171 @@
<HTML>
<HEAD>
<TITLE>Using SDL with Microsoft Visual C++</TITLE>
</HEAD>
<BODY>
<H1>
Using SDL with Microsoft Visual C++ 5,6&nbsp;and 7
</H1>
<H3>
by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
James Turk</A>
</H3>
<p>
You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php">
the SDL Download web site </A>, or you can build SDL yourself.
</p>
<H3>
Building SDL
</H3>
<P>
Unzip the <CODE>VisualC.zip</CODE> file into the directory that contains this
file (<CODE>VisualC.html</CODE>).
</P>
<P>
Be certain that you unzip the zip file for your compiler into <strong>this</strong>
directory and not any other directory. If you are using WinZip, be careful to
make sure that it extracts to <strong>this</strong> folder, because it's
convenient feature of unzipping to a folder with the name of the file currently
being unzipped will get you in trouble if you use it right now. And that's all
I have to say about that.
</P>
<P>
Now that it's unzipped, go into the VisualC
directory that is created, and double-click on the VC++ file "<CODE>SDL.dsw</CODE>"<STRONG><FONT color="#009900">
("<CODE>SDL.sln</CODE>").</FONT></STRONG> This should open up the IDE.
</P>
<P>
You may be prompted at this point to upgrade the workspace, should you be using
a more recent version of Visual C++. If so, allow the workspace to be upgraded.
</P>
<P>
Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
</P>
<P>
This is done by right clicking on each project in turn (Projects are listed in
the Workspace panel in the FileView tab), and selecting "Build".
</P>
<P>
If you get an error about SDL_config.h being missing, you should
copy include/SDL_config.h.default to include/SDL_config.h and try again.
</P>
<P>
You may get a few warnings, but you should not get any errors. You do have to
have at least the DirectX 5 SDK installed, however. The latest
version of DirectX can be downloaded or purchased on a cheap CD (my
recommendation) from <A HREF="http://www.microsoft.com">Microsoft </A>.
</P>
<P>
Later, we will refer to the following .lib and .dll files that have just been
generated:
</P>
<ul>
<li> SDL.dll</li>
<li> SDL.lib</li>
<li> SDLmain.lib</li>
</ul>
<P>
Search for these using the Windows Find (Windows-F) utility, if you don't
already know where they should be. For those of you with a clue, look inside
the Debug or Release directories of the subdirectories of the Project folder.
(It might be easier to just use Windows Find if this sounds confusing. And
don't worry about needing a clue; we all need visits from the clue fairy
frequently.)
</P>
<H3>
Creating a Project with SDL
</H3>
<P>
Create a project as a Win32 Application.
</P>
<P>
Create a C++ file for your project.
</P>
<P>
Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
tab|Code Generation|Runtime Library </CODE>.
</P>
<P>
Add the SDL <CODE>include</CODE> directory to your list of includes in the
menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
.
<br>
<STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
add the include and library directories to the list that VC7 keeps. Do this by
selecting Tools|Options|Projects|VC++ Directories and under the "Show
Directories For:" dropbox select "Include Files", and click the "New Directory
Icon" and add the [SDLROOT]\include directory (ex. If you installed to
c:\SDL-1.2.5\ add c:\SDL-1.2.5\include).&nbsp;Proceed to&nbsp;change the
dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
</P>
<P>
The "include directory" I am referring to is the <CODE>include</CODE> folder
within the main SDL directory (the one that this HTML file located within).
</P>
<P>
Now we're going to use the files that we had created earlier in the Build SDL
step.
</P>
<P>
Copy the following files into your Project directory:
</P>
<ul>
<li> SDL.dll</li>
</ul>
<P>
Add the following files to your project (It is not necessary to copy them to
your project directory):
</P>
<ul>
<li> SDL.lib </li>
<li> SDLmain.lib</li>
</ul>
<P>
(To add them to your project, right click on your project, and select "Add
files to project")
</P>
<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
desireable to add them to the linker options: Project|Properties|Linker|Command
Line and type the names of the libraries to link with in the "Additional
Options:" box.&nbsp; Note: This must be done&nbsp;for&nbsp;each&nbsp;build
configuration (eg. Release,Debug).</FONT></STRONG></P>
<H3>
SDL 101, First Day of Class
</H3>
<P>
Now create the basic body of your project. The body of your program should take
the following form: <CODE>
<PRE>
#include "SDL.h"
int main( int argc, char* argv[] )
{
// Body of the program goes here.
return 0;
}
</PRE>
</CODE>
<P></P>
<H3>
That's it!
</H3>
<P>
I hope that this document has helped you get through the most difficult part of
using the SDL: installing it. Suggestions for improvements to this document
should be sent to the writers of this document.
</P>
<P>
Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
</P>
<P>
This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
Sam Lantinga</A>.
</P>
<P>
Later, it was converted to HTML and expanded into the document that you see
today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
</P>
<P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
</P>
</BODY>
</HTML>

716
SDL/WhatsNew Normal file
View file

@ -0,0 +1,716 @@
This is a list of API changes in SDL's version history.
Version 1.0:
1.2.13:
Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants.
1.2.12:
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
of the screensaver on Mac OS X and X11.
1.2.10:
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used
to fill them in:
SDL_AUDIO_FREQUENCY
SDL_AUDIO_FORMAT
SDL_AUDIO_CHANNELS
SDL_AUDIO_SAMPLES
If an environment variable is not specified, it will be set
to a reasonable default value.
Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment
variable, currently supported on X11 Xinerama configurations.
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
Added current_w and current_h to the SDL_VideoInfo structure,
which is set to the desktop resolution during video intialization,
and then set to the current resolution when a video mode is set.
SDL_SetVideoMode() now accepts 0 for width or height and will use
the current video mode (or the desktop mode if no mode has been set.)
Added SDL_GetKeyRepeat()
Added SDL_config.h, with defaults for various build environments.
1.2.7:
Added CPU feature detection functions to SDL_cpuinfo.h:
SDL_HasRDTSC(), SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE(),
SDL_HasAltiVec()
Added function to create RWops from const memory: SDL_RWFromConstMem()
1.2.6:
Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
1.2.5:
Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
1.2.0:
Added SDL_VIDEOEXPOSE event to signal that the screen needs to
be redrawn. This is currently only delivered to OpenGL windows
on X11, though it may be delivered in the future when the video
memory is lost under DirectX.
1.1.8:
You can pass SDL_NOFRAME to SDL_VideoMode() to create a window
that has no title bar or frame decoration. Fullscreen video
modes automatically have this flag set.
Added a function to query the clipping rectangle for a surface:
void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
Added a function to query the current event filter:
SDL_EventFilter SDL_GetEventFilter(void)
If you pass -1 to SDL_ShowCursor(), it won't change the current
cursor visibility state, but will still return it.
SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning
you can nest them as deep as you want, as long as each lock call
has a matching unlock call. The surface remains locked until the
last matching unlock call.
Note that you may not blit to or from a locked surface.
1.1.7:
The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take
arrays of Uint16 values instead of Uint8 values. For the most part,
you can just take your old values and shift them up 8 bits to get
new correct values for your gamma ramps.
You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface()
and SDL will try to RLE accelerate colorkey and alpha blits in the
resulting surface.
1.1.6:
Added a function to return the thread ID of a specific thread:
Uint32 SDL_GetThreadID(SDL_Thread *thread)
If 'thread' is NULL, this function returns the id for this thread.
1.1.5:
The YUV overlay structure has been changed to use an array of
pitches and pixels representing the planes of a YUV image, to
better enable hardware acceleration. The YV12 and IYUV formats
each have three planes, corresponding to the Y, U, and V portions
of the image, while packed pixel YUV formats just have one plane.
For palettized mode (8bpp), the screen colormap is now split in
a physical and a logical palette. The physical palette determines
what colours the screen pixels will get when displayed, and the
logical palette controls the mapping from blits to/from the screen.
A new function, SDL_SetPalette() has been added to change
logical and physical palettes separately. SDL_SetColors() works
just as before, and is equivalent to calling SDL_SetPalette() with
a flag argument of (SDL_LOGPAL|SDL_PHYSPAL).
SDL_BlitSurface() no longer modifies the source rectangle, only the
destination rectangle. The width/height members of the destination
rectangle are ignored, only the position is used.
The old source clipping function SDL_SetClipping() has been replaced
with a more useful function to set the destination clipping rectangle:
SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect)
Added a function to see what subsystems have been initialized:
Uint32 SDL_WasInit(Uint32 flags)
The Big Alpha Flip: SDL now treats alpha as opacity like everybody
else, and not as transparency:
A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255
A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0
Values between 0 and 255 vary from fully transparent to fully opaque.
New functions:
SDL_DisplayFormatAlpha()
Returns a surface converted to a format with alpha-channel
that can be blit efficiently to the screen. (In other words,
like SDL_DisplayFormat() but the resulting surface has
an alpha channel.) This is useful for surfaces with alpha.
SDL_MapRGBA()
Works as SDL_MapRGB() but takes an additional alpha parameter.
SDL_GetRGBA()
Works as SDL_GetRGB() but also returns the alpha value
(SDL_ALPHA_OPAQUE for formats without an alpha channel)
Both SDL_GetRGB() and SDL_GetRGBA() now always return values in
the [0..255] interval. Previously, SDL_GetRGB() would return
(0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format.
(N.B.: This is broken for bit fields < 3 bits.)
SDL_MapRGB() returns pixels in which the alpha channel is set opaque.
SDL_SetAlpha() can now be used for both setting the per-surface
alpha, using the new way of thinking of alpha, and also to enable
and disable per-pixel alpha blending for surfaces with an alpha
channel:
To disable alpha blending:
SDL_SetAlpha(surface, 0, 0);
To re-enable alpha blending:
SDL_SetAlpha(surface, SDL_SRCALPHA, 0);
Surfaces with an alpha channel have blending enabled by default.
SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests
RLE acceleration of blits, just as like with SDL_SetColorKey().
This flag can be set for both surfaces with an alpha channel
and surfaces with an alpha value set by SDL_SetAlpha().
As always, RLE surfaces must be locked before pixel access is
allowed, and unlocked before any other SDL operations are done
on it.
The blit semantics for surfaces with and without alpha and colorkey
have now been defined:
RGBA->RGB:
SDL_SRCALPHA set:
alpha-blend (using alpha-channel).
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy RGB.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.
RGB->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source per-surface alpha value);
set destination alpha to opaque.
SDL_SRCALPHA not set:
copy RGB, set destination alpha to opaque.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key.
RGBA->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source alpha channel) the RGB values;
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.
RGB->RGB:
SDL_SRCALPHA set:
alpha-blend (using the source per-surface alpha value).
SDL_SRCALPHA not set:
copy RGB.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key.
As a special case, blits from surfaces with per-surface alpha
value of 128 (50% transparency) are optimised and much faster
than other alpha values. This does not apply to surfaces with
alpha channels (per-pixel alpha).
New functions for manipulating the gamma of the display have
been added:
int SDL_SetGamma(float red, float green, float blue);
int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
Gamma ramps are tables with 256 entries which map the screen color
components into actually displayed colors. For an example of
implementing gamma correction and gamma fades, see test/testgamma.c
Gamma control is not supported on all hardware.
1.1.4:
The size of the SDL_CDtrack structure changed from 8 to 12 bytes
as the size of the length member was extended to 32 bits.
You can now use SDL for 2D blitting with a GL mode by passing the
SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or
32 bpp, and the data in the framebuffer is put into the GL scene
when you call SDL_UpdateRects(), and the scene will be visible
when you call SDL_GL_SwapBuffers().
Run the "testgl" test program with the -logo command line option
to see an example of this blending of 2D and 3D in SDL.
1.1.3:
Added SDL_FreeRW() to the API, to complement SDL_AllocRW()
Added resizable window support - just add SDL_RESIZABLE to the
SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events.
See SDL_events.h for details on the new SDL_ResizeEvent structure.
Added condition variable support, based on mutexes and semaphores.
SDL_CreateCond()
SDL_DestroyCond()
SDL_CondSignal()
SDL_CondBroadcast()
SDL_CondWait()
SDL_CondTimedWait()
The new function prototypes are in SDL_mutex.h
Added counting semaphore support, based on the mutex primitive.
SDL_CreateSemaphore()
SDL_DestroySemaphore()
SDL_SemWait()
SDL_SemTryWait()
SDL_SemWaitTimeout()
SDL_SemPost()
SDL_SemValue()
The new function prototypes are in SDL_mutex.h
Added support for asynchronous blitting. To take advantage of this,
you must set the SDL_ASYNCBLIT flag when setting the video mode and
creating surfaces that you want accelerated in this way. You must
lock surfaces that have this flag set, and the lock will block until
any queued blits have completed.
Added YUV video overlay support.
The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU.
This function creates an overlay surface:
SDL_CreateYUVOverlay()
You must lock and unlock the overlay to get access to the data:
SDL_LockYUVOverlay() SDL_UnlockYUVOverlay()
You can then display the overlay:
SDL_DisplayYUVOverlay()
You must free the overlay when you are done using it:
SDL_FreeYUVOverlay()
See SDL_video.h for the full function prototypes.
The joystick hat position constants have been changed:
Old constant New constant
------------ ------------
0 SDL_HAT_CENTERED
1 SDL_HAT_UP
2 SDL_HAT_RIGHTUP
3 SDL_HAT_RIGHT
4 SDL_HAT_RIGHTDOWN
5 SDL_HAT_DOWN
6 SDL_HAT_LEFTDOWN
7 SDL_HAT_LEFT
8 SDL_HAT_LEFTUP
The new constants are bitmasks, so you can check for the
individual axes like this:
if ( hat_position & SDL_HAT_UP ) {
}
and you'll catch left-up, up, and right-up.
1.1.2:
Added multiple timer support:
SDL_AddTimer() and SDL_RemoveTimer()
SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL.
1.1.0:
Added initial OpenGL support.
First set GL attributes (such as RGB depth, alpha depth, etc.)
SDL_GL_SetAttribute()
Then call SDL_SetVideoMode() with the SDL_OPENGL flag.
Perform all of your normal GL drawing.
Finally swap the buffers with the new SDL function:
SDL_GL_SwapBuffers()
See the new 'testgl' test program for an example of using GL with SDL.
You can load GL extension functions by using the function:
SDL_GL_LoadProcAddress()
Added functions to initialize and cleanup specific SDL subsystems:
SDL_InitSubSystem() and SDL_QuitSubSystem()
Added user-defined event type:
typedef struct {
Uint8 type;
int code;
void *data1;
void *data2;
} SDL_UserEvent;
This structure is in the "user" member of an SDL_Event.
Added a function to push events into the event queue:
SDL_PushEvent()
Example of using the new SDL user-defined events:
{
SDL_Event event;
event.type = SDL_USEREVENT;
event.user.code = my_event_code;
event.user.data1 = significant_data;
event.user.data2 = 0;
SDL_PushEvent(&event);
}
Added a function to get mouse deltas since last query:
SDL_GetRelativeMouseState()
Added a boolean datatype to SDL_types.h:
SDL_bool = { SDL_TRUE, SDL_FALSE }
Added a function to get the current audio status:
SDL_GetAudioState();
It returns one of:
SDL_AUDIO_STOPPED,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
Added an AAlib driver (ASCII Art) - by Stephane Peter.
1.0.6:
The input grab state is reset after each call to SDL_SetVideoMode().
The input is grabbed by default in fullscreen mode, and ungrabbed in
windowed mode. If you want to set input grab to a particular value,
you should set it after each call to SDL_SetVideoMode().
1.0.5:
Exposed SDL_AudioInit(), SDL_VideoInit()
Added SDL_AudioDriverName() and SDL_VideoDriverName()
Added new window manager function:
SDL_WM_ToggleFullScreen()
This is currently implemented only on Linux
The ALT-ENTER code has been removed - it's not appropriate for a
lib to bind keys when they aren't even emergency escape sequences.
ALT-ENTER functionality can be implemented with the following code:
int Handle_AltEnter(const SDL_Event *event)
{
if ( event->type == SDL_KEYDOWN ) {
if ( (event->key.keysym.sym == SDLK_RETURN) &&
(event->key.keysym.mod & KMOD_ALT) ) {
SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
return(0);
}
}
return(1);
}
SDL_SetEventFilter(Handle_AltEnter);
1.0.3:
Under X11, if you grab the input and hide the mouse cursor,
the mouse will go into a "relative motion" mode where you
will always get relative motion events no matter how far in
each direction you move the mouse - relative motion is not
bounded by the edges of the window (though the absolute values
of the mouse positions are clamped by the size of the window).
The SVGAlib, framebuffer console, and DirectInput drivers all
have this behavior naturally, and the GDI and BWindow drivers
never go into "relative motion" mode.
1.0.2:
Added a function to enable keyboard repeat:
SDL_EnableKeyRepeat()
Added a function to grab the mouse and keyboard input
SDL_WM_GrabInput()
Added a function to iconify the window.
SDL_WM_IconifyWindow()
If this function succeeds, the application will receive an event
signaling SDL_APPACTIVE event
1.0.1:
Added constants to SDL_audio.h for 16-bit native byte ordering:
AUDIO_U16SYS, AUDIO_S16SYS
1.0.0:
New public release
Version 0.11:
0.11.5:
A new function SDL_GetVideoSurface() has been added, and returns
a pointer to the current display surface.
SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and
a new function SDL_CreateRGBSurfaceFrom() has been added to allow
creating an SDL surface from an existing pixel data buffer.
Added SDL_GetRGB() to the headers and documentation.
0.11.4:
SDL_SetLibraryPath() is no longer meaningful, and has been removed.
0.11.3:
A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from
installing fatal signal handlers on operating systems that support
them.
Version 0.9:
0.9.15:
SDL_CreateColorCursor() has been removed. Color cursors should
be implemented as sprites, blitted by the application when the
cursor moves. To get smooth color cursor updates when the app
is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This
allows you to handle the mouse motion in another thread from an
event filter function, but is currently only supported by Linux
and BeOS. Note that you'll have to protect the display surface
from multi-threaded access by using mutexes if you do this.
Thread-safe surface support has been removed from SDL.
This makes blitting somewhat faster, by removing SDL_MiddleBlit().
Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead.
You can make your surfaces thread-safe by allocating your own
mutex and making lock/unlock calls around accesses to your surface.
0.9.14:
SDL_GetMouseState() now takes pointers to int rather than Uint16.
If you set the SDL_WINDOWID environment variable under UNIX X11,
SDL will use that as the main window instead of creating it's own.
This is an unsupported extension to SDL, and not portable at all.
0.9.13:
Added a function SDL_SetLibraryPath() which can be used to specify
the directory containing the SDL dynamic libraries. This is useful
for commercial applications which ship with particular versions
of the libraries, and for security on multi-user systems.
If this function is not used, the default system directories are
searched using the native dynamic object loading mechanism.
In order to support C linkage under Visual C++, you must declare
main() without any return type:
main(int argc, char *argv[]) {
/* Do the program... */
return(0);
}
C++ programs should also return a value if compiled under VC++.
The blit_endian member of the SDL_VideoInfo struct has been removed.
SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there
is now no longer any function to translate a keysym to a character.
The SDL_keysym structure has been extended with a 'scancode' and
'unicode' member. The 'scancode' is a hardware specific scancode
for the key that was pressed, and may be 0. The 'unicode' member
is a 16-bit UNICODE translation of the key that was pressed along
with any modifiers or compose keys that have been pressed.
If no UNICODE translation exists for the key, 'unicode' will be 0.
Added a function SDL_EnableUNICODE() to enable/disable UNICODE
translation of character keypresses. Translation defaults off.
To convert existing code to use the new API, change code which
uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(),
and change code which uses it to get the ASCII value of a sym to
use the 'unicode' member of the event keysym.
0.9.12:
There is partial support for 64-bit datatypes. I don't recommend
you use this if you have a choice, because 64-bit datatypes are not
supported on many platforms. On platforms for which it is supported,
the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and
you can use the Uint64 and Sint64 datatypes.
Added functions to SDL_endian.h to support 64-bit datatypes:
SDL_SwapLE64(), SDL_SwapBE64(),
SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64()
A new member "len_ratio" has been added to the SDL_AudioCVT structure,
and allows you to determine either the original buffer length or the
converted buffer length, given the other.
A new function SDL_FreeWAV() has been added to the API to free data
allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since
the gcc compiled DLL uses a different heap than VC++ compiled apps.
SDL now has initial support for international keyboards using the
Latin character set.
If a particular mapping is desired, you can set the DEFAULT_KEYBOARD
compile-time variable, or you can set the environment variable
"SDL_KEYBOARD" to a string identifying the keyboard mapping you desire.
The valid values for these variables can be found in SDL_keyboard.c
Full support for German and French keyboards under X11 is implemented.
0.9.11:
The THREADED_EVENTS compile-time define has been replaced with the
SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(),
SDL will create a separate thread to perform input event handling.
If this flag is passed to SDL_Init(), and the OS doesn't support
event handling in a separate thread, SDL_Init() will fail.
Be sure to add calls to SDL_Delay() in your main thread to allow
the OS to schedule your event thread, or it may starve, leading
to slow event delivery and/or dropped events.
Currently MacOS and Win32 do not support this flag, while BeOS
and Linux do support it. I recommend that your application only
use this flag if absolutely necessary.
The SDL thread function passed to SDL_CreateThread() now returns a
status. This status can be retrieved by passing a non-NULL pointer
as the 'status' argument to SDL_WaitThread().
The volume parameter to SDL_MixAudio() has been increased in range
from (0-8) to (0-128)
SDL now has a data source abstraction which can encompass a file,
an area of memory, or any custom object you can envision. It uses
these abstractions, SDL_RWops, in the endian read/write functions,
and the built-in WAV and BMP file loaders. This means you can load
WAV chunks from memory mapped files, compressed archives, network
pipes, or anything else that has a data read abstraction.
There are three built-in data source abstractions:
SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem()
along with a generic data source allocation function:
SDL_AllocRW()
These data sources can be used like stdio file pointers with the
following convenience functions:
SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose()
These functions are defined in the new header file "SDL_rwops.h"
The endian swapping functions have been turned into macros for speed
and SDL_CalculateEndian() has been removed. SDL_endian.h now defines
SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on
the endianness of the host system.
The endian read/write functions now take an SDL_RWops pointer
instead of a stdio FILE pointer, to support the new data source
abstraction.
The SDL_*LoadWAV() functions have been replaced with a single
SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's
first parameter, and a flag whether or not to automatically
free it as the second parameter. SDL_LoadWAV() is a macro for
backward compatibility and convenience:
SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced
with a single function that takes a SDL_RWops pointer as it's
first parameter, and a flag whether or not to automatically
free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP()
are macros for backward compatibility and convenience:
SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...);
SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...);
Note that these functions use SDL_RWseek() extensively, and should
not be used on pipes or other non-seekable data sources.
0.9.10:
The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been
extended to support multiple types of display drivers, as well as
safe access to the X11 display when THREADED_EVENTS is enabled.
The new structures are documented in the SDL_syswm.h header file.
Thanks to John Elliott <jce@seasip.demon.co.uk>, the UK keyboard
should now work properly, as well as the "Windows" keys on US
keyboards.
The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab
instead of trying to open each block device on the system.
The CD must be listed in /etc/fstab as using the iso9660 filesystem.
On Linux, if you define THREADED_EVENTS at compile time, a separate
thread will be spawned to gather X events asynchronously from the
graphics updates. This hasn't been extensively tested, but it does
provide a means of handling keyboard and mouse input in a separate
thread from the graphics thread. (This is now enabled by default.)
A special access function SDL_PeepEvents() allows you to manipulate
the event queue in a thread-safe manner, including peeking at events,
removing events of a specified type, and adding new events of arbitrary
type to the queue (use the new 'user' member of the SDL_Event type).
If you use SDL_PeepEvents() to gather events, then the main graphics
thread needs to call SDL_PumpEvents() periodically to drive the event
loop and generate input events. This is not necessary if SDL has been
compiled with THREADED_EVENTS defined, but doesn't hurt.
A new function SDL_ThreadID() returns the identifier associated with
the current thread.
0.9.9:
The AUDIO_STEREO format flag has been replaced with a new 'channels'
member of the SDL_AudioSpec structure. The channels are 1 for mono
audio, and 2 for stereo audio. In the future more channels may be
supported for 3D surround sound.
The SDL_MixAudio() function now takes an additional volume parameter,
which should be set to SDL_MIX_MAXVOLUME for compatibility with the
original function.
The CD-ROM functions which take a 'cdrom' parameter can now be
passed NULL, and will act on the last successfully opened CD-ROM.
0.9.8:
No changes, bugfixes only.
0.9.7:
No changes, bugfixes only.
0.9.6:
Added a fast rectangle fill function: SDL_FillRect()
Addition of a useful function for getting info on the video hardware:
const SDL_VideoInfo *SDL_GetVideoInfo(void)
This function replaces SDL_GetDisplayFormat().
Initial support for double-buffering:
Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode()
Update the screen with a new function: SDL_Flip()
SDL_AllocSurface() takes two new flags:
SDL_SRCCOLORKEY means that the surface will be used for colorkey blits
and if the hardware supports hardware acceleration of colorkey blits
between two surfaces in video memory, to place the surface in video
memory if possible, otherwise it will be placed in system memory.
SDL_SRCALPHA means that the surface will be used for alpha blits and
if the hardware supports hardware acceleration of alpha blits between
two surfaces in video memory, to place the surface in video memory
if possible, otherwise it will be placed in system memory.
SDL_HWSURFACE now means that the surface will be created with the
same format as the display surface, since having surfaces in video
memory is only useful for fast blitting to the screen, and you can't
blit surfaces with different surface formats in video memory.
0.9.5:
You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume
that the icon consists of the entire image.
SDL_LowerBlit() is back -- but don't use it on the display surface.
It is exactly the same as SDL_MiddleBlit(), but doesn't check for
thread safety.
Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take
a FILE pointer instead of a file name.
Added CD-ROM audio control API:
SDL_CDNumDrives()
SDL_CDName()
SDL_CDOpen()
SDL_CDStatus()
SDL_CDPlayTracks()
SDL_CDPlay()
SDL_CDPause()
SDL_CDResume()
SDL_CDStop()
SDL_CDEject()
SDL_CDClose()
0.9.4:
No changes, bugfixes only.
0.9.3:
Mouse motion event now includes relative motion information:
Sint16 event->motion.xrel, Sint16 event->motion.yrel
X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT
(Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile)
0.9.2:
No changes, bugfixes only.
0.9.1:
Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now
automatically mapped on blit.
0.8.0:
SDL stable release

6724
SDL/acinclude.m4 Normal file

File diff suppressed because it is too large Load diff

19
SDL/autogen.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
#
echo "Generating build information using autoconf"
echo "This may take a while ..."
# Regenerate configuration files
cp acinclude.m4 aclocal.m4
found=false
for autoconf in autoconf autoconf259 autoconf-2.59
do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
done
if test x$found = xfalse; then
echo "Couldn't find autoconf, aborting"
exit 1
fi
(cd test; sh autogen.sh)
# Run configure for this platform
echo "Now you are ready to run ./configure"

1526
SDL/build-scripts/config.guess vendored Normal file

File diff suppressed because it is too large Load diff

1657
SDL/build-scripts/config.sub vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,316 @@
#!/bin/sh
#
# Build a fat binary on Mac OS X, thanks Ryan!
# Number of CPUs (for make -j)
NCPU=`sysctl -n hw.ncpu`
NJOB=$NCPU
#NJOB=`expr $NCPU + 1`
# Generic, cross-platform CFLAGS you always want go here.
CFLAGS="-O3 -g -pipe"
# Locate Xcode SDK path
SDK_PATH=/Developer/SDKs
if [ ! -d $SDK_PATH ]; then
echo "Couldn't find SDK path"
exit 1
fi
# See if we can use 10.2 or 10.3 runtime compatibility
if [ -d "$SDK_PATH/MacOSX10.2.8.sdk" ]; then
# PowerPC configure flags (10.2 runtime compatibility)
# We dynamically load X11, so using the system X11 headers is fine.
CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
# PowerPC compiler flags
CC_PPC="gcc-3.3 -arch ppc"
CXX_PPC="g++-3.3 -arch ppc"
CFLAGS_PPC=""
CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
-nostdinc \
-F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \
-I$SDK_PATH/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
-isystem $SDK_PATH/MacOSX10.2.8.sdk/usr/include"
# PowerPC linker flags
LFLAGS_PPC="-arch ppc \
-L$SDK_PATH/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
-F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \
-Wl,-syslibroot,$SDK_PATH/MacOSX10.2.8.sdk"
else # 10.2 or 10.3 SDK
# PowerPC configure flags (10.3 runtime compatibility)
# We dynamically load X11, so using the system X11 headers is fine.
CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
# PowerPC compiler flags
CC_PPC="gcc-4.0 -arch ppc"
CXX_PPC="g++-4.0 -arch ppc"
CFLAGS_PPC=""
CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1030 \
-nostdinc \
-F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \
-I$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include \
-isystem $SDK_PATH/MacOSX10.3.9.sdk/usr/include"
# PowerPC linker flags
LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.3 \
-L$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 \
-F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \
-Wl,-syslibroot,$SDK_PATH/MacOSX10.3.9.sdk"
fi # 10.2 or 10.3 SDK
# Intel configure flags (10.4 runtime compatibility)
# We dynamically load X11, so using the system X11 headers is fine.
CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
# Intel compiler flags
CC_X86="gcc-4.0 -arch i386"
CXX_X86="g++-4.0 -arch i386"
CFLAGS_X86="-mmacosx-version-min=10.4"
CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
-nostdinc \
-F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
-I$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \
-isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include"
# Intel linker flags
LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
-L$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1 \
-Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk"
#
# Find the configure script
#
srcdir=`dirname $0`/..
auxdir=$srcdir/build-scripts
cd $srcdir
#
# Figure out which phase to build:
# all,
# configure, configure-ppc, configure-x86,
# make, make-ppc, make-x86, merge
# install
# clean
if test x"$1" = x; then
phase=all
else
phase="$1"
fi
case $phase in
all)
configure_ppc="yes"
configure_x86="yes"
make_ppc="yes"
make_x86="yes"
merge="yes"
;;
configure)
configure_ppc="yes"
configure_x86="yes"
;;
configure-ppc)
configure_ppc="yes"
;;
configure-x86)
configure_x86="yes"
;;
make)
make_ppc="yes"
make_x86="yes"
merge="yes"
;;
make-ppc)
make_ppc="yes"
;;
make-x86)
make_x86="yes"
;;
merge)
merge="yes"
;;
install)
install_bin="yes"
install_hdrs="yes"
install_lib="yes"
install_data="yes"
install_man="yes"
;;
install-bin)
install_bin="yes"
;;
install-hdrs)
install_hdrs="yes"
;;
install-lib)
install_lib="yes"
;;
install-data)
install_data="yes"
;;
install-man)
install_man="yes"
;;
clean)
clean_ppc="yes"
clean_x86="yes"
;;
clean-ppc)
clean_ppc="yes"
;;
clean-x86)
clean_x86="yes"
;;
*)
echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]"
exit 1
;;
esac
case `uname -p` in
powerpc)
native_path=ppc
;;
*86)
native_path=x86
;;
*)
echo "Couldn't figure out native architecture path"
exit 1
;;
esac
#
# Create the build directories
#
for dir in build build/ppc build/x86; do
if test -d $dir; then
:
else
mkdir $dir || exit 1
fi
done
#
# Build the PowerPC binary
#
if test x$configure_ppc = xyes; then
(cd build/ppc && \
sh ../../configure $CONFIG_PPC CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
fi
if test x$make_ppc = xyes; then
(cd build/ppc && ls include && make -j$NJOB) || exit 3
fi
#
# Build the Intel binary
#
if test x$configure_x86 = xyes; then
(cd build/x86 && \
sh ../../configure $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
fi
if test x$make_x86 = xyes; then
(cd build/x86 && make -j$NJOB) || exit 3
fi
#
# Combine into fat binary
#
if test x$merge = xyes; then
output=.libs
sh $auxdir/mkinstalldirs build/$output
cd build
target=`find . -mindepth 3 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
(lipo -create -o $output/$target `find . -mindepth 3 -type f -name "*.dylib"` &&
ln -sf $target $output/libSDL-1.2.0.dylib &&
ln -sf $target $output/libSDL.dylib &&
lipo -create -o $output/libSDL.a */build/.libs/libSDL.a &&
cp $native_path/build/.libs/libSDL.la $output &&
cp $native_path/build/.libs/libSDL.lai $output &&
cp $native_path/build/libSDL.la . &&
lipo -create -o libSDLmain.a */build/libSDLmain.a &&
echo "Build complete!" &&
echo "Files can be found in the build directory.") || exit 4
cd ..
fi
#
# Install
#
do_install()
{
echo $*
$* || exit 5
}
if test x$prefix = x; then
prefix=/usr/local
fi
if test x$exec_prefix = x; then
exec_prefix=$prefix
fi
if test x$bindir = x; then
bindir=$exec_prefix/bin
fi
if test x$libdir = x; then
libdir=$exec_prefix/lib
fi
if test x$includedir = x; then
includedir=$prefix/include
fi
if test x$datadir = x; then
datadir=$prefix/share
fi
if test x$mandir = x; then
mandir=$prefix/man
fi
if test x$install_bin = xyes; then
do_install sh $auxdir/mkinstalldirs $bindir
do_install /usr/bin/install -c -m 755 build/$native_path/sdl-config $bindir/sdl-config
fi
if test x$install_hdrs = xyes; then
do_install sh $auxdir/mkinstalldirs $includedir/SDL
for src in $srcdir/include/*.h; do \
file=`echo $src | sed -e 's|^.*/||'`; \
do_install /usr/bin/install -c -m 644 $src $includedir/SDL/$file; \
done
do_install /usr/bin/install -c -m 644 $srcdir/include/SDL_config_macosx.h $includedir/SDL/SDL_config.h
fi
if test x$install_lib = xyes; then
do_install sh $auxdir/mkinstalldirs $libdir
do_install sh build/$native_path/libtool --mode=install /usr/bin/install -c build/libSDL.la $libdir/libSDL.la
do_install /usr/bin/install -c -m 644 build/libSDLmain.a $libdir/libSDLmain.a
do_install ranlib $libdir/libSDLmain.a
fi
if test x$install_data = xyes; then
do_install sh $auxdir/mkinstalldirs $datadir/aclocal
do_install /usr/bin/install -c -m 644 $srcdir/sdl.m4 $datadir/aclocal/sdl.m4
fi
if test x$install_man = xyes; then
do_install sh $auxdir/mkinstalldirs $mandir/man3
for src in $srcdir/docs/man3/*.3; do \
file=`echo $src | sed -e 's|^.*/||'`; \
do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \
done
fi
#
# Clean up
#
do_clean()
{
echo $*
$* || exit 6
}
if test x$clean_x86 = xyes; then
do_clean rm -r build/x86
fi
if test x$clean_ppc = xyes; then
do_clean rm -r build/ppc
fi

View file

@ -0,0 +1,323 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-02-02.21
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

6864
SDL/build-scripts/ltmain.sh Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,93 @@
#!/bin/sh
#
# Generate dependencies from a list of source files
# Check to make sure our environment variables are set
if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$output" = x; then
echo "SOURCES, INCLUDE, and output needs to be set"
exit 1
fi
cache_prefix=".#$$"
generate_var()
{
echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
}
search_deps()
{
base=`echo $1 | sed 's|/[^/]*$||'`
grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
while read file
do cache=${cache_prefix}_`generate_var $file`
if test -f $cache; then
: # We already ahve this cached
else
: >$cache
for path in $base `echo $INCLUDE | sed 's|-I||g'`
do dep="$path/$file"
if test -f "$dep"; then
echo " $dep \\" >>$cache
search_deps $dep >>$cache
break
fi
done
fi
cat $cache
done
}
:>${output}.new
for src in $SOURCES
do echo "Generating dependencies for $src"
ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
if test x"$ext" = x"rc"; then
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"`
else
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
fi
echo "\$(objects)/$obj: $src \\" >>${output}.new
search_deps $src | sort | uniq >>${output}.new
case $ext in
c) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
cc) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
m) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
asm) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@
__EOF__
;;
S) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
rc) cat >>${output}.new <<__EOF__
\$(WINDRES) $src \$@
__EOF__
;;
*) echo "Unknown file extension: $ext";;
esac
echo "" >>${output}.new
done
mv ${output}.new ${output}
rm -f ${cache_prefix}*

View file

@ -0,0 +1,99 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here

View file

@ -0,0 +1,21 @@
#!/bin/sh
#
# libtool assumes that the compiler can handle the -fPIC flag
# This isn't always true (for example, nasm can't handle it)
command=""
while [ $# -gt 0 ]; do
case "$1" in
-?PIC)
# Ignore -fPIC and -DPIC options
;;
-fno-common)
# Ignore -fPIC and -DPIC options
;;
*)
command="$command $1"
;;
esac
shift
done
echo $command
exec $command

2835
SDL/configure.in Normal file

File diff suppressed because it is too large Load diff

497
SDL/docs.html Normal file
View file

@ -0,0 +1,497 @@
<HTML>
<HEAD><TITLE>SDL Stable Release</TITLE></HEAD>
<BODY BGCOLOR="#FFEBCD" TEXT="#000000">
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<P>
This source is stable, and is fully tested on all supported platforms.<br>
Please send bug reports or questions to the SDL mailing list:<br>
<a href="http://www.libsdl.org/mailing-list.php"
>http://www.libsdl.org/mailing-list.php</a><br>
The latest stable release may be found on the
<a href="http://www.libsdl.org/">SDL website</A>.
</P>
<H2> <A HREF="docs/index.html">API Documentation</A> </H2>
<H2> SDL 1.2.14 Release Notes </H2>
<P>
SDL 1.2.14 is a minor bug fix release.
</P>
<H3> General Notes </H3>
<BLOCKQUOTE>
<P>
Fixed flicker when resizing the SDL window
</P>
</BLOCKQUOTE>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
Added configure option --enable-screensaver, to allow enabling the screensaver by default.
</P>
<P>
Use XResetScreenSaver() instead of disabling screensaver entirely.
</P>
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
</P>
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
</P>
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<H2> SDL 1.2.13 Release Notes </H2>
<P>
SDL 1.2.13 is a minor bug fix release.
</P>
<H3> General Notes </H3>
<BLOCKQUOTE>
<P>
Fixed link error when building with Intel Compiler 10.
</P>
<P>
Removed stray C++ comment from public headers.
</P>
</BLOCKQUOTE>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
Fixed crash in SDL_SoftStretch() on secure operating systems.
</P>
<P>
Fixed undefined symbol on X11 implementations without UTF-8 support.
</P>
<P>
Worked around BadAlloc error when using XVideo on the XFree86 Intel Integrated Graphics driver.
</P>
<P>
Scan for all joysticks on Linux instead of stopping at one that was removed.
</P>
<P>
Fixed use of sdl-config arguments in sdl.m4
</P>
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
Fixed crash when a video driver reports higher than 32 bpp video modes.
</P>
<P>
Fixed restoring the desktop after setting a 24-bit OpenGL video mode.
</P>
<P>
Fixed window titles on Windows 95/98/ME.
</P>
<P>
Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants for extended mouse buttons.
</P>
<P>
Added support for quoted command line arguments.
</P>
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
SDL now builds on Mac OS X 10.5 (Leopard).
</P>
<P>
Fixed high frequency crash involving text input.
</P>
<P>
Fixed beeping when the escape key is pressed and UNICODE translation is enabled.
</P>
<P>
Improved trackpad scrolling support.
</P>
<P>
Fixed joystick hat reporting for certain joysticks.
</P>
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<H2> SDL 1.2.12 Release Notes </H2>
<P>
SDL 1.2.12 is a minor bug fix release.
</P>
<H3> General Notes </H3>
<BLOCKQUOTE>
<P>
Added support for the PulseAudio sound server: http://www.pulseaudio.org/
</P>
<P>
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11.
</P>
<P>
Fixed buffer overrun crash when resampling audio rates.
</P>
<P>
Fixed audio bug where converting to mono was doubling the volume.
</P>
<P>
Fixed off-by-one error in the C implementation of SDL_revcpy()
</P>
<P>
Fixed compiling with Sun Studio.
</P>
<P>
Support for AmigaOS has been removed from the main SDL code.
</P>
<P>
Support for Nokia 9210 "EPOC" driver has been removed from the main SDL code.
</P>
<P>
Unofficial support for the S60/SymbianOS platform has been added.
</P>
<P>
Unofficial support for the Nintendo DS platform has been added.
</P>
<P>
Reenabled MMX assembly for YUV overlay processing (GNU C Compiler only).
</P>
</BLOCKQUOTE>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
Fixed detection of X11 DGA mouse support.
</P>
<P>
Improved XIM support for asian character sets.
</P>
<P>
The GFX_Display has been added to the X11 window information in SDL_syswm.h.
</P>
<P>
Fixed PAGE_SIZE compile error in the fbcon video driver on newer Linux kernels.
</P>
<P>
Fixed hang or crash at startup if aRts can't access the hardware.
</P>
<P>
Fixed relative mouse mode when the cursor starts outside the X11 window.
</P>
<P>
Fixed accidental free of stack memory in X11 mouse acceleration code.
</P>
<P>
Closed minor memory leak in XME code.
</P>
<P>
Fixed TEXTRELs in the library to resolve some PIC issues.
</P>
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
The GDI video driver makes better use of the palette in 8-bit modes.
</P>
<P>
The windib driver now supports more mouse buttons with WM_XBUTTON events.
</P>
<P>
On Windows, SDL_SetVideoMode() will re-create the window instead of failing if the multisample settings are changed.
</P>
<P>
Added support for UTF-8 window titles on Windows.
</P>
<P>
Fixed joystick detection on Windows.
</P>
<P>
Improved performance with Win32 file I/O.
</P>
<P>
Fixed HBITMAP leak in GAPI driver.
</P>
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
Added support for multi-axis controllers like 3Dconnxion's SpaceNavigator on Mac OS X.
</P>
<P>
Fixed YUV overlay crash inside Quicktime on Intel Mac OS X.
</P>
<P>
Fixed blitting alignment in Altivec alpha blit functions.
</P>
<P>
Keys F13, F14, and F15 are now usable on Apple keyboards under Mac OS X.
</P>
<P>
Fixed joystick calibration code on Mac OS X.
</P>
<P>
Fixed mouse jitter when multiple motion events are queued up in Mac OS X.
</P>
<P>
Fixed changing the cursor in fullscreen mode on Mac OS X.
</P>
</BLOCKQUOTE>
<H3> Mac OS Classic Notes </H3>
<BLOCKQUOTE>
<P>
Added support for gamma ramps to both toolbox and DrawSprocket video drivers.
</P>
</BLOCKQUOTE>
<H3> BeOS Notes </H3>
<BLOCKQUOTE>
<P>
Implemented mouse grabbing and mouse relative mode on BeOS.
</P>
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<H2> SDL 1.2.11 Release Notes </H2>
<P>
SDL 1.2.11 is a minor bug fix release.
</P>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
Dynamic X11 loading is only enabled with gcc 4 supporting -fvisibility=hidden. This fixes crashes related to symbol collisions, and allows building on Solaris and IRIX.
</P>
<P>
Fixed building SDL with Xinerama disabled.
</P>
<P>
Fixed DRI OpenGL library loading, using RTLD_GLOBAL in dlopen().
</P>
<P>
Added pkgconfig configuration support.
</P>
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
Setting SDL_GL_SWAP_CONTROL now works with Windows OpenGL.
</P>
<P>
The Win32 window positioning code works properly for windows with menus.
</P>
<P>
DirectSound audio quality has been improved on certain sound cards.
</P>
<P>
Fixed 5.1 audio channel ordering on Windows and Mac OS X.
</P>
<P>
Plugged a couple of minor memory leaks in the windib video driver.
</P>
<P>
Fixed type collision with stdint.h when building with gcc on Win32.
</P>
<P>
Fixed building with the Digital Mars Compiler on Win32.
</P>
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
The Quartz video driver supports 32x32 cursors on Mac OS X 10.3 and above.
</P>
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<H2> SDL 1.2.10 Release Notes </H2>
<P>
SDL 1.2.10 is a major release, featuring a revamp of the build system and many API improvements and bug fixes.
</P>
<H3> API enhancements </H3>
<UL>
<LI>
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used
to fill them in:
<pre><code>
SDL_AUDIO_FREQUENCY
SDL_AUDIO_FORMAT
SDL_AUDIO_CHANNELS
SDL_AUDIO_SAMPLES
</code></pre>
If an environment variable is not specified, it will be set
to a reasonable default value.
<LI>
SDL_SetVideoMode() now accepts 0 for width or height and will use
the current video mode (or the desktop mode if no mode has been set.)
<LI>
Added current_w and current_h to the SDL_VideoInfo structure,
which is set to the desktop resolution during video intialization,
and then set to the current resolution when a video mode is set.
<LI>
SDL_GL_LoadLibrary() will load the system default OpenGL library
if it is passed NULL as a parameter.
<LI>
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
<LI>
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
<LI>
SDL_WM_SetCaption() now officially takes UTF-8 title and icon strings, and displays international characters on supported platforms.
<LI>
Added SDL_GetKeyRepeat() to query the key repeat settings.
<LI>
Added the "dummy" audio driver, which can be used to emulate audio
output without a sound card.
<LI>
Added SDL_config.h, with defaults for various build environments.
</UL>
<H3> General Notes </H3>
<BLOCKQUOTE>
<P>
The SDL website now has an <A HREF="http://www.libsdl.org/rss/rss.xml">RSS feed</A>!
<P>
The SDL development source code is now managed with <A HREF="http://www.libsdl.org/svn.php">Subversion</A>.
<P>
SDL now uses the Bugzilla <A HREF="http://bugzilla.libsdl.org/">bug tracking system</A>, hosted by icculus.org.
<P>
SDL is licensed under version 2.1 of the GNU Lesser General Public License.
<P>
The entire build system has been revamped to make it much more portable, including versions of C library functions to make it possible to run SDL on a minimal embedded environment. See README.Porting in the SDL source distribution for information on how to port SDL to a new platform.
<P>
SDL_opengl.h has been updated with the latest glext.h from <A HREF="http://oss.sgi.com/projects/ogl-sample/registry/">http://oss.sgi.com/projects/ogl-sample/registry/</A>
<P>
Alex Volkov contributed highly optimized RGB <-> RGBA blitters.
</BLOCKQUOTE>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
The X11 libraries are dynamically loaded at runtime by default. This allows the distributed version of SDL to run on systems without X11 libraries installed.
<P>
The XiG XME extension code is now included in the X11 video driver by default.
<P>
XRandR support for video mode switching has been added to the X11 driver, but is disabled because of undesired interactions with window managers. You can enable this by setting the environment variable SDL_VIDEO_X11_XRANDR to 1.
<P>
Xinerama multi-head displays are properly handled now, and the SDL_VIDEO_FULLSCREEN_HEAD environment variable can be used to select the screen used for fullscreen video modes. Note that changing the video modes only works on screen 0.
<P>
XVidMode video modes are now sorted so they maintain the refresh rates specified in the X11 configuration file.
<P>
SDL windows are no longer transparent in X11 compositing systems like XGL.
<P>
The mouse is properly released by the X11 video driver if the fullscreen window loses focus.
<P>
The X11 input driver now uses XIM to handle international input.
<P>
The screensaver and DPMS monitor blanking are disabled while SDL games are running under the X11 and DGA video drivers. This behavior will be formalized and selectable in SDL 1.3.
<P>
Fixed a bug preventing stereo OpenGL contexts from being selected on the X11 driver.
<P>
The DGA video driver now waits for pending blits involving surfaces before they are freed. This prevents display oddities when using SDL_DisplayFormat() to convert many images.
<P>
The framebuffer console video driver now has a parser for /etc/fb.modes for improved video mode handling.
<P>
The framebuffer console video driver now allows asynchronous VT switching, and restores the full contents of the screen when switched back.
<P>
The framebuffer console now uses CTRL-ALT-FN to switch virtual terminals, to avoid collisions with application key bindings.
<P>
The framebuffer console input driver correctly sets IMPS/2 mode for wheel mice. It also properly detects when gpm is in IMPS/2 protocol mode, or passing raw protocol from an IMPS/2 mouse.
<P>
The SVGAlib video driver now has support for banked (non-linear) video modes.
<P>
A video driver for OpenBSD on the Sharp Zaurus has been contributed by Staffan Ulfberg. See the file README.wscons in the SDL source distribution for details.
<P>
Many patches have been incorporated from *BSD ports.
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
The "windib" video driver is the default now, to prevent problems with certain laptops, 64-bit Windows, and Windows Vista. The DirectX driver is still available, and can be selected by setting the environment variable SDL_VIDEODRIVER to "directx".
<P>
SDL has been ported to 64-bit Windows.
<P>
Dmitry Yakimov contributed a GAPI video driver for Windows CE.
<P>
The default fullscreen refresh rate has been increased to match the desktop refresh rate, when using equivalent resolutions. A full API for querying and selecting refresh rates is planned for SDL 1.3.
<P>
Dialog boxes are now shown when SDL is in windowed OpenGL mode.
<P>
The SDL window is recreated when necessary to maintain OpenGL context attributes, when switching between windowed and fullscreen modes.
<P>
An SDL_VIDEORESIZE event is properly sent when the SDL window is maximized and restored.
<P>
Window positions are retained when switching between fullscreen and windowed modes.
<P>
ToUnicode() is used, when available, for improved handling of international keyboard input.
<P>
The PrtScrn is now treated normally with both key down and key up events.
<P>
Pressing ALT-F4 now delivers an SDL_QUIT event to SDL applications.
<P>
Joystick names are now correct for joysticks which have been unplugged and then plugged back in since booting.
<P>
An MCI error when playing the last track on a CD-ROM has been fixed.
<P>
OpenWatcom projects for building SDL have been provided by Marc Peter.
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
SDL now supports building Universal binaries, both through Xcode projects and when using configure/make. See README.MacOSX in the SDL source archive for details.
<P>
The X11 video driver with GLX support can be built on Mac OS X, if the X11 development SDK is installed.
<P>
Transitions between fullscreen resolutions and windowed mode now use a much faster asynchronous fade to hide desktop flicker.
<P>
Icons set with SDL_WM_SetIcon() now have the proper colors on Intel Macs.
</BLOCKQUOTE>
<H3> OS/2 Notes </H3>
<BLOCKQUOTE>
<P>
Projects for building SDL on OS/2 with OpenWatcom have been contributed by Doodle. See the file README.OS2 in the SDL source distribution for details.
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
</BODY>
</HTML>

242
SDL/docs/html/audio.html Normal file
View file

@ -0,0 +1,242 @@
<HTML
><HEAD
><TITLE
>Audio</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_JoystickClose"
HREF="sdljoystickclose.html"><LINK
REL="NEXT"
TITLE="SDL_AudioSpec"
HREF="sdlaudiospec.html"><META
NAME="KEYWORD"
CONTENT="audio"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdljoystickclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlaudiospec.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="AUDIO"
></A
>Chapter 10. Audio</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlaudiospec.html"
>SDL_AudioSpec</A
>&nbsp;--&nbsp;Audio Specification Structure</DT
><DT
><A
HREF="sdlopenaudio.html"
>SDL_OpenAudio</A
>&nbsp;--&nbsp;Opens the audio device with the desired parameters.</DT
><DT
><A
HREF="sdlpauseaudio.html"
>SDL_PauseAudio</A
>&nbsp;--&nbsp;Pauses and unpauses the audio callback processing</DT
><DT
><A
HREF="sdlgetaudiostatus.html"
>SDL_GetAudioStatus</A
>&nbsp;--&nbsp;Get the current audio state</DT
><DT
><A
HREF="sdlloadwav.html"
>SDL_LoadWAV</A
>&nbsp;--&nbsp;Load a WAVE file</DT
><DT
><A
HREF="sdlfreewav.html"
>SDL_FreeWAV</A
>&nbsp;--&nbsp;Frees previously opened WAV data</DT
><DT
><A
HREF="sdlaudiocvt.html"
>SDL_AudioCVT</A
>&nbsp;--&nbsp;Audio Conversion Structure</DT
><DT
><A
HREF="sdlbuildaudiocvt.html"
>SDL_BuildAudioCVT</A
>&nbsp;--&nbsp;Initializes a SDL_AudioCVT structure for conversion</DT
><DT
><A
HREF="sdlconvertaudio.html"
>SDL_ConvertAudio</A
>&nbsp;--&nbsp;Convert audio data to a desired audio format.</DT
><DT
><A
HREF="sdlmixaudio.html"
>SDL_MixAudio</A
>&nbsp;--&nbsp;Mix audio data</DT
><DT
><A
HREF="sdllockaudio.html"
>SDL_LockAudio</A
>&nbsp;--&nbsp;Lock out the callback function</DT
><DT
><A
HREF="sdlunlockaudio.html"
>SDL_UnlockAudio</A
>&nbsp;--&nbsp;Unlock the callback function</DT
><DT
><A
HREF="sdlcloseaudio.html"
>SDL_CloseAudio</A
>&nbsp;--&nbsp;Shuts down audio processing and closes the audio device.</DT
></DL
></DIV
><P
>Sound on the computer is translated from waves that you hear into a series of
values, or samples, each representing the amplitude of the wave. When these
samples are sent in a stream to a sound card, an approximation of the original
wave can be recreated. The more bits used to represent the amplitude, and the
greater frequency these samples are gathered, the closer the approximated
sound is to the original, and the better the quality of sound.</P
><P
>This library supports both 8 and 16 bit signed and unsigned sound samples,
at frequencies ranging from 11025 Hz to 44100 Hz, depending on the
underlying hardware. If the hardware doesn't support the desired audio
format or frequency, it can be emulated if desired (See
<A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio()</TT
></A
>)</P
><P
>A commonly supported audio format is 16 bits per sample at 22050 Hz.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdljoystickclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlaudiospec.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_JoystickClose</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_AudioSpec</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

260
SDL/docs/html/cdrom.html Normal file
View file

@ -0,0 +1,260 @@
<HTML
><HEAD
><TITLE
>CD-ROM</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CloseAudio"
HREF="sdlcloseaudio.html"><LINK
REL="NEXT"
TITLE="SDL_CDNumDrives"
HREF="sdlcdnumdrives.html"><META
NAME="KEYWORD"
CONTENT="cdrom"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcloseaudio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdnumdrives.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="CDROM"
></A
>Chapter 11. CD-ROM</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlcdnumdrives.html"
>SDL_CDNumDrives</A
>&nbsp;--&nbsp;Returns the number of CD-ROM drives on the system.</DT
><DT
><A
HREF="sdlcdname.html"
>SDL_CDName</A
>&nbsp;--&nbsp;Returns a human-readable, system-dependent identifier for the CD-ROM.</DT
><DT
><A
HREF="sdlcdopen.html"
>SDL_CDOpen</A
>&nbsp;--&nbsp;Opens a CD-ROM drive for access.</DT
><DT
><A
HREF="sdlcdstatus.html"
>SDL_CDStatus</A
>&nbsp;--&nbsp;Returns the current status of the given drive.</DT
><DT
><A
HREF="sdlcdplay.html"
>SDL_CDPlay</A
>&nbsp;--&nbsp;Play a CD</DT
><DT
><A
HREF="sdlcdplaytracks.html"
>SDL_CDPlayTracks</A
>&nbsp;--&nbsp;Play the given CD track(s)</DT
><DT
><A
HREF="sdlcdpause.html"
>SDL_CDPause</A
>&nbsp;--&nbsp;Pauses a CDROM</DT
><DT
><A
HREF="sdlcdresume.html"
>SDL_CDResume</A
>&nbsp;--&nbsp;Resumes a CDROM</DT
><DT
><A
HREF="sdlcdstop.html"
>SDL_CDStop</A
>&nbsp;--&nbsp;Stops a CDROM</DT
><DT
><A
HREF="sdlcdeject.html"
>SDL_CDEject</A
>&nbsp;--&nbsp;Ejects a CDROM</DT
><DT
><A
HREF="sdlcdclose.html"
>SDL_CDClose</A
>&nbsp;--&nbsp;Closes a SDL_CD handle</DT
><DT
><A
HREF="sdlcd.html"
>SDL_CD</A
>&nbsp;--&nbsp;CDROM Drive Information</DT
><DT
><A
HREF="sdlcdtrack.html"
>SDL_CDtrack</A
>&nbsp;--&nbsp;CD Track Information Structure</DT
></DL
></DIV
><P
>SDL supports audio control of up to 32 local CD-ROM drives at once.</P
><P
>You use this API to perform all the basic functions of a CD player,
including listing the tracks, playing, stopping, and ejecting the CD-ROM.
(Currently, multi-changer CD drives are not supported.)</P
><P
>Before you call any of the SDL CD-ROM functions, you must first call
"<TT
CLASS="FUNCTION"
>SDL_Init(SDL_INIT_CDROM)</TT
>", which scans the system for
CD-ROM drives, and sets the program up for audio control. Check the
return code, which should be <SPAN
CLASS="RETURNVALUE"
>0</SPAN
>, to see if there
were any errors in starting up.</P
><P
>After you have initialized the library, you can find out how many drives
are available using the <TT
CLASS="FUNCTION"
>SDL_CDNumDrives()</TT
> function.
The first drive listed is the system default CD-ROM drive. After you have
chosen a drive, and have opened it with <TT
CLASS="FUNCTION"
>SDL_CDOpen()</TT
>,
you can check the status and start playing if there's a CD in the drive.</P
><P
>A CD-ROM is organized into one or more tracks, each consisting of a certain
number of "frames". Each frame is ~2K in size, and at normal playing speed,
a CD plays 75 frames per second. SDL works with the number of frames on a
CD, but this can easily be converted to the more familiar minutes/seconds
format by using the <TT
CLASS="FUNCTION"
>FRAMES_TO_MSF()</TT
> macro.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcloseaudio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdnumdrives.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CloseAudio</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDNumDrives</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

216
SDL/docs/html/event.html Normal file
View file

@ -0,0 +1,216 @@
<HTML
><HEAD
><TITLE
>Events</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_WM_GrabInput"
HREF="sdlwmgrabinput.html"><LINK
REL="NEXT"
TITLE="SDL Event Structures."
HREF="eventstructures.html"><META
NAME="KEYWORD"
CONTENT="events"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlwmgrabinput.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="eventstructures.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="EVENT"
></A
>Chapter 8. Events</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="event.html#AEN3691"
>Introduction</A
></DT
><DT
><A
HREF="eventstructures.html"
>SDL Event Structures.</A
></DT
><DT
><A
HREF="eventfunctions.html"
>Event Functions.</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN3691"
></A
>Introduction</H1
><P
>Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to:
<PRE
CLASS="PROGRAMLISTING"
>SDL_Init(SDL_INIT_VIDEO);</PRE
>
Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like <A
HREF="sdlpollevent.html"
><TT
CLASS="FUNCTION"
>SDL_PollEvent</TT
></A
> and <A
HREF="sdlpeepevents.html"
><TT
CLASS="FUNCTION"
>SDL_PeepEvents</TT
></A
> you can observe and handle waiting input events.</P
><P
>The key to event handling in SDL is the <A
HREF="sdlevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
></A
> union. The event queue itself is composed of a series of <SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
> unions, one for each waiting event. <SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
> unions are read from the queue with the <TT
CLASS="FUNCTION"
>SDL_PollEvent</TT
> function and it is then up to the application to process the information stored with them.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlwmgrabinput.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="eventstructures.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_WM_GrabInput</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL Event Structures.</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,481 @@
<HTML
><HEAD
><TITLE
>Event Functions.</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Events"
HREF="event.html"><LINK
REL="PREVIOUS"
TITLE="SDLKey"
HREF="sdlkey.html"><LINK
REL="NEXT"
TITLE="SDL_PumpEvents"
HREF="sdlpumpevents.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlkey.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Events</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlpumpevents.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="EVENTFUNCTIONS"
></A
>Event Functions.</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlpumpevents.html"
>SDL_PumpEvents</A
>&nbsp;--&nbsp;Pumps the event loop, gathering events from the input devices.</DT
><DT
><A
HREF="sdlpeepevents.html"
>SDL_PeepEvents</A
>&nbsp;--&nbsp;Checks the event queue for messages and optionally returns them.</DT
><DT
><A
HREF="sdlpollevent.html"
>SDL_PollEvent</A
>&nbsp;--&nbsp;Polls for currently pending events.</DT
><DT
><A
HREF="sdlwaitevent.html"
>SDL_WaitEvent</A
>&nbsp;--&nbsp;Waits indefinitely for the next available event.</DT
><DT
><A
HREF="sdlpushevent.html"
>SDL_PushEvent</A
>&nbsp;--&nbsp;Pushes an event onto the event queue</DT
><DT
><A
HREF="sdlseteventfilter.html"
>SDL_SetEventFilter</A
>&nbsp;--&nbsp;Sets up a filter to process all events before they are posted
to the event queue.</DT
><DT
><A
HREF="sdlgeteventfilter.html"
>SDL_GetEventFilter</A
>&nbsp;--&nbsp;Retrieves a pointer to he event filter</DT
><DT
><A
HREF="sdleventstate.html"
>SDL_EventState</A
>&nbsp;--&nbsp;This function allows you to set the state of processing certain events.</DT
><DT
><A
HREF="sdlgetkeystate.html"
>SDL_GetKeyState</A
>&nbsp;--&nbsp;Get a snapshot of the current keyboard state</DT
><DT
><A
HREF="sdlgetmodstate.html"
>SDL_GetModState</A
>&nbsp;--&nbsp;Get the state of modifier keys.</DT
><DT
><A
HREF="sdlsetmodstate.html"
>SDL_SetModState</A
>&nbsp;--&nbsp;Set the current key modifier state</DT
><DT
><A
HREF="sdlgetkeyname.html"
>SDL_GetKeyName</A
>&nbsp;--&nbsp;Get the name of an SDL virtual keysym</DT
><DT
><A
HREF="sdlenableunicode.html"
>SDL_EnableUNICODE</A
>&nbsp;--&nbsp;Enable UNICODE translation</DT
><DT
><A
HREF="sdlenablekeyrepeat.html"
>SDL_EnableKeyRepeat</A
>&nbsp;--&nbsp;Set keyboard repeat rate.</DT
><DT
><A
HREF="sdlgetmousestate.html"
>SDL_GetMouseState</A
>&nbsp;--&nbsp;Retrieve the current state of the mouse</DT
><DT
><A
HREF="sdlgetrelativemousestate.html"
>SDL_GetRelativeMouseState</A
>&nbsp;--&nbsp;Retrieve the current state of the mouse</DT
><DT
><A
HREF="sdlgetappstate.html"
>SDL_GetAppState</A
>&nbsp;--&nbsp;Get the state of the application</DT
><DT
><A
HREF="sdljoystickeventstate.html"
>SDL_JoystickEventState</A
>&nbsp;--&nbsp;Enable/disable joystick event polling</DT
></DL
></DIV
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN5312"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlpumpevents.html"
>SDL_PumpEvents</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Pumps the event loop, gathering events from the input devices</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlpeepevents.html"
>SDL_PeepEvents</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Checks the event queue for messages and optionally returns them</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlpollevent.html"
>SDL_PollEvent</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Polls for currently pending events</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlwaitevent.html"
>SDL_WaitEvent</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Waits indefinitely for the next available event</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlpushevent.html"
>SDL_PushEvent</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Pushes an event onto the event queue</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlseteventfilter.html"
>SDL_SetEventFilter</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Sets up a filter to process all events</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdleventstate.html"
>SDL_EventState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Allows you to set the state of processing certain events</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetkeystate.html"
>SDL_GetKeyState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Get a snapshot of the current keyboard state</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetmodstate.html"
>SDL_GetModState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Get the state of modifier keys</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlsetmodstate.html"
>SDL_SetModState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Set the state of modifier keys</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetkeyname.html"
>SDL_GetKeyName</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Get the name of an SDL virtual keysym</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlenableunicode.html"
>SDL_EnableUNICODE</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Enable UNICODE translation</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlenablekeyrepeat.html"
>SDL_EnableKeyRepeat</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Set keyboard repeat rate</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetmousestate.html"
>SDL_GetMouseState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Retrieve the current state of the mouse</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetrelativemousestate.html"
>SDL_GetRelativeMouseState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Retrieve the current state of the mouse</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdlgetappstate.html"
>SDL_GetAppState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Get the state of the application</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="sdljoystickeventstate.html"
>SDL_JoystickEventState</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Enable/disable joystick event polling</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlkey.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlpumpevents.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDLKey</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="event.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_PumpEvents</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,233 @@
<HTML
><HEAD
><TITLE
>SDL Event Structures.</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Events"
HREF="event.html"><LINK
REL="PREVIOUS"
TITLE="Events"
HREF="event.html"><LINK
REL="NEXT"
TITLE="SDL_Event"
HREF="sdlevent.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="event.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Events</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlevent.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="EVENTSTRUCTURES"
></A
>SDL Event Structures.</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlevent.html"
>SDL_Event</A
>&nbsp;--&nbsp;General event structure</DT
><DT
><A
HREF="sdlactiveevent.html"
>SDL_ActiveEvent</A
>&nbsp;--&nbsp;Application visibility event structure</DT
><DT
><A
HREF="sdlkeyboardevent.html"
>SDL_KeyboardEvent</A
>&nbsp;--&nbsp;Keyboard event structure</DT
><DT
><A
HREF="sdlmousemotionevent.html"
>SDL_MouseMotionEvent</A
>&nbsp;--&nbsp;Mouse motion event structure</DT
><DT
><A
HREF="sdlmousebuttonevent.html"
>SDL_MouseButtonEvent</A
>&nbsp;--&nbsp;Mouse button event structure</DT
><DT
><A
HREF="sdljoyaxisevent.html"
>SDL_JoyAxisEvent</A
>&nbsp;--&nbsp;Joystick axis motion event structure</DT
><DT
><A
HREF="sdljoybuttonevent.html"
>SDL_JoyButtonEvent</A
>&nbsp;--&nbsp;Joystick button event structure</DT
><DT
><A
HREF="sdljoyhatevent.html"
>SDL_JoyHatEvent</A
>&nbsp;--&nbsp;Joystick hat position change event structure</DT
><DT
><A
HREF="sdljoyballevent.html"
>SDL_JoyBallEvent</A
>&nbsp;--&nbsp;Joystick trackball motion event structure</DT
><DT
><A
HREF="sdlresizeevent.html"
>SDL_ResizeEvent</A
>&nbsp;--&nbsp;Window resize event structure</DT
><DT
><A
HREF="sdlexposeevent.html"
>SDL_ExposeEvent</A
>&nbsp;--&nbsp;Quit requested event</DT
><DT
><A
HREF="sdlsyswmevent.html"
>SDL_SysWMEvent</A
>&nbsp;--&nbsp;Platform-dependent window manager event.</DT
><DT
><A
HREF="sdluserevent.html"
>SDL_UserEvent</A
>&nbsp;--&nbsp;A user-defined event type</DT
><DT
><A
HREF="sdlquitevent.html"
>SDL_QuitEvent</A
>&nbsp;--&nbsp;Quit requested event</DT
><DT
><A
HREF="sdlkeysym.html"
>SDL_keysym</A
>&nbsp;--&nbsp;Keysym structure</DT
><DT
><A
HREF="sdlkey.html"
>SDLKey</A
>&nbsp;--&nbsp;Keysym definitions.</DT
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="event.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlevent.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Events</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="event.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_Event</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

225
SDL/docs/html/general.html Normal file
View file

@ -0,0 +1,225 @@
<HTML
><HEAD
><TITLE
>General</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="NEXT"
TITLE="SDL_Init"
HREF="sdlinit.html"><META
NAME="KEYWORD"
CONTENT="general"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="reference.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlinit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="GENERAL"
></A
>Chapter 5. General</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlinit.html"
>SDL_Init</A
>&nbsp;--&nbsp;Initializes SDL</DT
><DT
><A
HREF="sdlinitsubsystem.html"
>SDL_InitSubSystem</A
>&nbsp;--&nbsp;Initialize subsystems</DT
><DT
><A
HREF="sdlquitsubsystem.html"
>SDL_QuitSubSystem</A
>&nbsp;--&nbsp;Shut down a subsystem</DT
><DT
><A
HREF="sdlquit.html"
>SDL_Quit</A
>&nbsp;--&nbsp;Shut down SDL</DT
><DT
><A
HREF="sdlwasinit.html"
>SDL_WasInit</A
>&nbsp;--&nbsp;Check which subsystems are initialized</DT
><DT
><A
HREF="sdlgeterror.html"
>SDL_GetError</A
>&nbsp;--&nbsp;Get SDL error string</DT
><DT
><A
HREF="sdlenvvars.html"
>SDL_envvars</A
>&nbsp;--&nbsp;SDL environment variables</DT
></DL
></DIV
><P
>Before SDL can be used in a program it must be initialized with <A
HREF="sdlinit.html"
><TT
CLASS="FUNCTION"
>SDL_Init</TT
></A
>. <TT
CLASS="FUNCTION"
>SDL_Init</TT
> initializes all the subsystems that the user requests (video, audio, joystick, timers and/or cdrom). Once SDL is initialized with <TT
CLASS="FUNCTION"
>SDL_Init</TT
> subsystems can be shut down and initialized as needed using <A
HREF="sdlinitsubsystem.html"
><TT
CLASS="FUNCTION"
>SDL_InitSubSystem</TT
></A
> and <A
HREF="sdlquitsubsystem.html"
><TT
CLASS="FUNCTION"
>SDL_QuitSubSystem</TT
></A
>.</P
><P
>SDL must also be shut down before the program exits to make sure it cleans up correctly. Calling <A
HREF="sdlquit.html"
><TT
CLASS="FUNCTION"
>SDL_Quit</TT
></A
> shuts down all subsystems and frees any resources allocated to SDL.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlinit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL Reference</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_Init</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

174
SDL/docs/html/guide.html Normal file
View file

@ -0,0 +1,174 @@
<HTML
><HEAD
><TITLE
>SDL Guide</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="NEXT"
TITLE="Preface"
HREF="guidepreface.html"></HEAD
><BODY
CLASS="PART"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidepreface.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="PART"
><A
NAME="GUIDE"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
>I. SDL Guide</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guidepreface.html"
>Preface</A
></DT
><DT
>1. <A
HREF="guidethebasics.html"
>The Basics</A
></DT
><DT
>2. <A
HREF="guidevideo.html"
>Graphics and Video</A
></DT
><DT
>3. <A
HREF="guideinput.html"
>Input handling</A
></DT
><DT
>4. <A
HREF="guideexamples.html"
>Examples</A
></DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidepreface.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL Library Documentation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Preface</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,148 @@
<HTML
><HEAD
><TITLE
>About SDLdoc</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Preface"
HREF="guidepreface.html"><LINK
REL="PREVIOUS"
TITLE="Preface"
HREF="guidepreface.html"><LINK
REL="NEXT"
TITLE="Credits"
HREF="guidecredits.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidepreface.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Preface</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidecredits.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEABOUTSDLDOC"
></A
>About SDLdoc</H1
><P
>SDLdoc (The SDL Documentation Project) was formed to completely rewrite the SDL documentation and to keep it continually up to date. The team consists completely of volunteers ranging from people working with SDL in their spare time to people who use SDL in their everyday working lives.</P
><P
>The latest version of this documentation can always be found here: http://sdldoc.csn.ul.ie Downloadable PS, man pages and html tarballs are available at http://sdldoc.csn.ul.ie/pub/</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidepreface.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidecredits.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Preface</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guidepreface.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Credits</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,228 @@
<HTML
><HEAD
><TITLE
>Audio Examples</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Examples"
HREF="guideexamples.html"><LINK
REL="PREVIOUS"
TITLE="Event Examples"
HREF="guideeventexamples.html"><LINK
REL="NEXT"
TITLE="CDROM Examples"
HREF="guidecdromexamples.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideeventexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Examples</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidecdromexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEAUDIOEXAMPLES"
></A
>Audio Examples</H1
><P
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN382"
></A
>Opening the audio device</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> SDL_AudioSpec wanted;
extern void fill_audio(void *udata, Uint8 *stream, int len);
/* Set the audio format */
wanted.freq = 22050;
wanted.format = AUDIO_S16;
wanted.channels = 2; /* 1 = mono, 2 = stereo */
wanted.samples = 1024; /* Good low-latency value for callback */
wanted.callback = fill_audio;
wanted.userdata = NULL;
/* Open the audio device, forcing the desired format */
if ( SDL_OpenAudio(&#38;wanted, NULL) &#60; 0 ) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
return(-1);
}
return(0);</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN386"
></A
>Playing audio</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> static Uint8 *audio_chunk;
static Uint32 audio_len;
static Uint8 *audio_pos;
/* The audio function callback takes the following parameters:
stream: A pointer to the audio buffer to be filled
len: The length (in bytes) of the audio buffer
*/
void fill_audio(void *udata, Uint8 *stream, int len)
{
/* Only play if we have data left */
if ( audio_len == 0 )
return;
/* Mix as much data as possible */
len = ( len &#62; audio_len ? audio_len : len );
SDL_MixAudio(stream, audio_pos, len, SDL_MIX_MAXVOLUME);
audio_pos += len;
audio_len -= len;
}
/* Load the audio data ... */
;;;;;
audio_pos = audio_chunk;
/* Let the callback function play the audio chunk */
SDL_PauseAudio(0);
/* Do some processing */
;;;;;
/* Wait for sound to complete */
while ( audio_len &#62; 0 ) {
SDL_Delay(100); /* Sleep 1/10 second */
}
SDL_CloseAudio();</PRE
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideeventexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidecdromexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Event Examples</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>CDROM Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,240 @@
<HTML
><HEAD
><TITLE
>Initializing SDL</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="The Basics"
HREF="guidethebasics.html"><LINK
REL="PREVIOUS"
TITLE="The Basics"
HREF="guidethebasics.html"><LINK
REL="NEXT"
TITLE="Graphics and Video"
HREF="guidevideo.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidethebasics.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. The Basics</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidevideo.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEBASICSINIT"
></A
>Initializing SDL</H1
><P
>SDL is composed of eight subsystems - Audio, CDROM, Event Handling, File I/O, Joystick Handling, Threading, Timers and Video. Before you can use any of these subsystems they must be initialized by calling <A
HREF="sdlinit.html"
><TT
CLASS="FUNCTION"
>SDL_Init</TT
></A
> (or <A
HREF="sdlinitsubsystem.html"
><TT
CLASS="FUNCTION"
>SDL_InitSubSystem</TT
></A
>). <TT
CLASS="FUNCTION"
>SDL_Init</TT
> must be called before any other SDL function. It automatically initializes the Event Handling, File I/O and Threading subsystems and it takes a parameter specifying which other subsystems to initialize. So, to initialize the default subsystems and the Video subsystems you would call:
<PRE
CLASS="PROGRAMLISTING"
> SDL_Init ( SDL_INIT_VIDEO );</PRE
>
To initialize the default subsystems, the Video subsystem and the Timers subsystem you would call:
<PRE
CLASS="PROGRAMLISTING"
> SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER );</PRE
></P
><P
><TT
CLASS="FUNCTION"
>SDL_Init</TT
> is complemented by <A
HREF="sdlquit.html"
><TT
CLASS="FUNCTION"
>SDL_Quit</TT
></A
> (and <A
HREF="sdlquitsubsystem.html"
><TT
CLASS="FUNCTION"
>SDL_QuitSubSystem</TT
></A
>). <TT
CLASS="FUNCTION"
>SDL_Quit</TT
> shuts down all subsystems, including the default ones. It should always be called before a SDL application exits.</P
><P
>With <TT
CLASS="FUNCTION"
>SDL_Init</TT
> and <TT
CLASS="FUNCTION"
>SDL_Quit</TT
> firmly embedded in your programmers toolkit you can write your first and most basic SDL application. However, we must be prepare to handle errors. Many SDL functions return a value and indicates whether the function has succeeded or failed, <TT
CLASS="FUNCTION"
>SDL_Init</TT
>, for instance, returns -1 if it could not initialize a subsystem. SDL provides a useful facility that allows you to determine exactly what the problem was, every time an error occurs within SDL an error message is stored which can be retrieved using <TT
CLASS="FUNCTION"
>SDL_GetError</TT
>. Use this often, you can never know too much about an error.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN60"
></A
><P
><B
>Example 1-1. Initializing SDL</B
></P
><PRE
CLASS="PROGRAMLISTING"
>#include "SDL.h" /* All SDL App's need this */
#include &#60;stdio.h&#62;
int main(int argc, char *argv[]) {
printf("Initializing SDL.\n");
/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}
printf("SDL initialized.\n");
printf("Quiting SDL.\n");
/* Shutdown all subsystems */
SDL_Quit();
printf("Quiting....\n");
exit(0);
}&#13;</PRE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidethebasics.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidevideo.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The Basics</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guidethebasics.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Graphics and Video</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,275 @@
<HTML
><HEAD
><TITLE
>CDROM Examples</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Examples"
HREF="guideexamples.html"><LINK
REL="PREVIOUS"
TITLE="Audio Examples"
HREF="guideaudioexamples.html"><LINK
REL="NEXT"
TITLE="Time Examples"
HREF="guidetimeexamples.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideaudioexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Examples</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidetimeexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDECDROMEXAMPLES"
></A
>CDROM Examples</H1
><P
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN393"
></A
>Listing CD-ROM drives</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> #include "SDL.h"
/* Initialize SDL first */
if ( SDL_Init(SDL_INIT_CDROM) &#60; 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
/* Find out how many CD-ROM drives are connected to the system */
printf("Drives available: %d\n", SDL_CDNumDrives());
for ( i=0; i&#60;SDL_CDNumDrives(); ++i ) {
printf("Drive %d: \"%s\"\n", i, SDL_CDName(i));
}</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN397"
></A
>Opening the default drive</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> SDL_CD *cdrom;
CDstatus status;
char *status_str;
cdrom = SDL_CDOpen(0);
if ( cdrom == NULL ) {
fprintf(stderr, "Couldn't open default CD-ROM drive: %s\n",
SDL_GetError());
exit(2);
}
status = SDL_CDStatus(cdrom);
switch (status) {
case CD_TRAYEMPTY:
status_str = "tray empty";
break;
case CD_STOPPED:
status_str = "stopped";
break;
case CD_PLAYING:
status_str = "playing";
break;
case CD_PAUSED:
status_str = "paused";
break;
case CD_ERROR:
status_str = "error state";
break;
}
printf("Drive status: %s\n", status_str);
if ( status &#62;= CD_PLAYING ) {
int m, s, f;
FRAMES_TO_MSF(cdrom-&#62;cur_frame, &#38;m, &#38;s, &#38;f);
printf("Currently playing track %d, %d:%2.2d\n",
cdrom-&#62;track[cdrom-&#62;cur_track].id, m, s);
}</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN401"
></A
>Listing the tracks on a CD</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> SDL_CD *cdrom; /* Assuming this has already been set.. */
int i;
int m, s, f;
SDL_CDStatus(cdrom);
printf("Drive tracks: %d\n", cdrom-&#62;numtracks);
for ( i=0; i&#60;cdrom-&#62;numtracks; ++i ) {
FRAMES_TO_MSF(cdrom-&#62;track[i].length, &#38;m, &#38;s, &#38;f);
if ( f &#62; 0 )
++s;
printf("\tTrack (index %d) %d: %d:%2.2d\n", i,
cdrom-&#62;track[i].id, m, s);
}</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN405"
></A
>Play an entire CD</H2
><P
><PRE
CLASS="PROGRAMLISTING"
> SDL_CD *cdrom; /* Assuming this has already been set.. */
// Play entire CD:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
// Play last track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
SDL_CDPlayTracks(cdrom, cdrom-&#62;numtracks-1, 0, 0, 0);
}
// Play first and second track and 10 seconds of third track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 2, CD_FPS * 10);</PRE
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideaudioexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidetimeexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Audio Examples</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Time Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,195 @@
<HTML
><HEAD
><TITLE
>Credits</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Preface"
HREF="guidepreface.html"><LINK
REL="PREVIOUS"
TITLE="About SDLdoc"
HREF="guideaboutsdldoc.html"><LINK
REL="NEXT"
TITLE="The Basics"
HREF="guidethebasics.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideaboutsdldoc.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Preface</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidethebasics.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDECREDITS"
></A
>Credits</H1
><P
><P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>Sam Lantinga, slouken@libsdl.org</TD
></TR
><TR
><TD
>Martin Donlon, akawaka@skynet.ie</TD
></TR
><TR
><TD
>Mattias Engdegård</TD
></TR
><TR
><TD
>Julian Peterson</TD
></TR
><TR
><TD
>Ken Jordan</TD
></TR
><TR
><TD
>Maxim Sobolev</TD
></TR
><TR
><TD
>Wesley Poole</TD
></TR
><TR
><TD
>Michael Vance</TD
></TR
><TR
><TD
>Andreas Umbach</TD
></TR
><TR
><TD
>Andreas Hofmeister</TD
></TR
></TBODY
></TABLE
><P
></P
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideaboutsdldoc.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidethebasics.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>About SDLdoc</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guidepreface.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The Basics</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,247 @@
<HTML
><HEAD
><TITLE
>Event Examples</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Examples"
HREF="guideexamples.html"><LINK
REL="PREVIOUS"
TITLE="Examples"
HREF="guideexamples.html"><LINK
REL="NEXT"
TITLE="Audio Examples"
HREF="guideaudioexamples.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Examples</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideaudioexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEEVENTEXAMPLES"
></A
>Event Examples</H1
><P
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN375"
></A
>Filtering and Handling Events</H2
><P
><PRE
CLASS="PROGRAMLISTING"
>#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
#include "SDL.h"
/* This function may run in a separate event thread */
int FilterEvents(const SDL_Event *event) {
static int boycott = 1;
/* This quit event signals the closing of the window */
if ( (event-&#62;type == SDL_QUIT) &#38;&#38; boycott ) {
printf("Quit event filtered out -- try again.\n");
boycott = 0;
return(0);
}
if ( event-&#62;type == SDL_MOUSEMOTION ) {
printf("Mouse moved to (%d,%d)\n",
event-&#62;motion.x, event-&#62;motion.y);
return(0); /* Drop it, we've handled it */
}
return(1);
}
int main(int argc, char *argv[])
{
SDL_Event event;
/* Initialize the SDL library (starts the event loop) */
if ( SDL_Init(SDL_INIT_VIDEO) &#60; 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
/* Clean up on exit, exit on window close and interrupt */
atexit(SDL_Quit);
/* Ignore key events */
SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
SDL_EventState(SDL_KEYUP, SDL_IGNORE);
/* Filter quit and mouse motion events */
SDL_SetEventFilter(FilterEvents);
/* The mouse isn't much use unless we have a display for reference */
if ( SDL_SetVideoMode(640, 480, 8, 0) == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}
/* Loop waiting for ESC+Mouse_Button */
while ( SDL_WaitEvent(&#38;event) &#62;= 0 ) {
switch (event.type) {
case SDL_ACTIVEEVENT: {
if ( event.active.state &#38; SDL_APPACTIVE ) {
if ( event.active.gain ) {
printf("App activated\n");
} else {
printf("App iconified\n");
}
}
}
break;
case SDL_MOUSEBUTTONDOWN: {
Uint8 *keys;
keys = SDL_GetKeyState(NULL);
if ( keys[SDLK_ESCAPE] == SDL_PRESSED ) {
printf("Bye bye...\n");
exit(0);
}
printf("Mouse button pressed\n");
}
break;
case SDL_QUIT: {
printf("Quit requested, quitting.\n");
exit(0);
}
break;
}
}
/* This should never happen */
printf("SDL_WaitEvent error: %s\n", SDL_GetError());
exit(1);
}</PRE
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideaudioexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Examples</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Audio Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,188 @@
<HTML
><HEAD
><TITLE
>Examples</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="PREVIOUS"
TITLE="Handling the Keyboard"
HREF="guideinputkeyboard.html"><LINK
REL="NEXT"
TITLE="Event Examples"
HREF="guideeventexamples.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideinputkeyboard.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideeventexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="GUIDEEXAMPLES"
></A
>Chapter 4. Examples</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guideexamples.html#AEN369"
>Introduction</A
></DT
><DT
><A
HREF="guideeventexamples.html"
>Event Examples</A
></DT
><DT
><A
HREF="guideaudioexamples.html"
>Audio Examples</A
></DT
><DT
><A
HREF="guidecdromexamples.html"
>CDROM Examples</A
></DT
><DT
><A
HREF="guidetimeexamples.html"
>Time Examples</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN369"
></A
>Introduction</H1
><P
>For the moment these examples are taken directly from the old SDL documentation. By the 1.2 release these examples should hopefully deal with most common SDL programming problems.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideinputkeyboard.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideeventexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Handling the Keyboard</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Event Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,739 @@
<HTML
><HEAD
><TITLE
>Input handling</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="PREVIOUS"
TITLE="Using OpenGL With SDL"
HREF="guidevideoopengl.html"><LINK
REL="NEXT"
TITLE="Handling the Keyboard"
HREF="guideinputkeyboard.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidevideoopengl.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideinputkeyboard.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="GUIDEINPUT"
></A
>Chapter 3. Input handling</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guideinput.html#GUIDEINPUTJOYSTICK"
>Handling Joysticks</A
></DT
><DT
><A
HREF="guideinputkeyboard.html"
>Handling the Keyboard</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEINPUTJOYSTICK"
></A
>Handling Joysticks</H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN135"
></A
>Initialization</H2
><P
>The first step in using a joystick in a SDL program is to initialize the Joystick subsystems of SDL. This done by passing the <TT
CLASS="LITERAL"
>SDL_INIT_JOYSTICK</TT
> flag to <A
HREF="sdlinit.html"
><TT
CLASS="FUNCTION"
>SDL_Init</TT
></A
>. The joystick flag will usually be used in conjunction with other flags (like the video flag) because the joystick is usually used to control something.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN141"
></A
><P
><B
>Example 3-1. Initializing SDL with Joystick Support</B
></P
><PRE
CLASS="PROGRAMLISTING"
> if (SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) &#60; 0)
{
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}</PRE
></DIV
><P
>This will attempt to start SDL with both the video and the joystick subsystems activated.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN145"
></A
>Querying</H2
><P
>If we have reached this point then we can safely assume that the SDL library has been initialized and that the Joystick subsystem is active. We can now call some video and/or sound functions to get things going before we need the joystick. Eventually we have to make sure that there is actually a joystick to work with. It's wise to always check even if you know a joystick will be present on the system because it can also help detect when the joystick is unplugged. The function used to check for joysticks is <A
HREF="sdlnumjoysticks.html"
><TT
CLASS="FUNCTION"
>SDL_NumJoysticks</TT
></A
>.</P
><P
>This function simply returns the number of joysticks available on the system. If it is at least one then we are in good shape. The next step is to determine which joystick the user wants to use. If the number of joysticks available is only one then it is safe to assume that one joystick is the one the user wants to use. SDL has a function to get the name of the joysticks as assigned by the operations system and that function is <A
HREF="sdljoystickname.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickName</TT
></A
>. The joystick is specified by an index where 0 is the first joystick and the last joystick is the number returned by <TT
CLASS="FUNCTION"
>SDL_NumJoysticks</TT
> - 1. In the demonstration a list of all available joysticks is printed to stdout.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN154"
></A
><P
><B
>Example 3-2. Querying the Number of Available Joysticks</B
></P
><PRE
CLASS="PROGRAMLISTING"
> printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
printf("The names of the joysticks are:\n");
for( i=0; i &#60; SDL_NumJoysticks(); i++ )
{
printf(" %s\n", SDL_JoystickName(i));
}</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN157"
></A
>Opening a Joystick and Receiving Joystick Events</H2
><P
>SDL's event driven architecture makes working with joysticks a snap. Joysticks can trigger 4 different types of events:
<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="sdljoyaxisevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_JoyAxisEvent</SPAN
></A
></TD
><TD
>Occurs when an axis changes</TD
></TR
><TR
><TD
><A
HREF="sdljoyballevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_JoyBallEvent</SPAN
></A
></TD
><TD
>Occurs when a joystick trackball's position changes</TD
></TR
><TR
><TD
><A
HREF="sdljoyhatevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_JoyHatEvent</SPAN
></A
></TD
><TD
>Occurs when a hat's position changes</TD
></TR
><TR
><TD
><A
HREF="sdljoybuttonevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_JoyButtonEvent</SPAN
></A
></TD
><TD
>Occurs when a button is pressed or released</TD
></TR
></TBODY
></TABLE
><P
></P
></P
><P
>Events are received from all joysticks opened. The first thing that needs to be done in order to receive joystick events is to call <A
HREF="sdljoystickeventstate.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickEventState</TT
></A
> with the <TT
CLASS="LITERAL"
>SDL_ENABLE</TT
> flag. Next you must open the joysticks that you want to receive envents from. This is done with the <A
HREF="sdljoystickopen.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickOpen</TT
></A
> function. For the example we are only interested in events from the first joystick on the system, regardless of what it may be. To receive events from it we would do this:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN183"
></A
><P
><B
>Example 3-3. Opening a Joystick</B
></P
><PRE
CLASS="PROGRAMLISTING"
> SDL_Joystick *joystick;
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);</PRE
></DIV
><P
>If we wanted to receive events for other joysticks we would open them with calls to <TT
CLASS="FUNCTION"
>SDL_JoystickOpen</TT
> just like we opened joystick 0, except we would store the <SPAN
CLASS="STRUCTNAME"
>SDL_Joystick</SPAN
> structure they return in a different pointer. We only need the joystick pointer when we are querying the joysticks or when we are closing the joystick.</P
><P
>Up to this point all the code we have is used just to initialize the joysticks in order to read values at run time. All we need now is an event loop, which is something that all SDL programs should have anyway to receive the systems quit events. We must now add code to check the event loop for at least some of the above mentioned events. Let's assume our event loop looks like this:
<PRE
CLASS="PROGRAMLISTING"
> SDL_Event event;
/* Other initializtion code goes here */
/* Start main game loop here */
while(SDL_PollEvent(&#38;event))
{
switch(event.type)
{
case SDL_KEYDOWN:
/* handle keyboard stuff here */
break;
case SDL_QUIT:
/* Set whatever flags are necessary to */
/* end the main game loop here */
break;
}
}
/* End loop here */</PRE
>
To handle Joystick events we merely add cases for them, first we'll add axis handling code. Axis checks can get kinda of tricky because alot of the joystick events received are junk. Joystick axis have a tendency to vary just a little between polling due to the way they are designed. To compensate for this you have to set a threshold for changes and ignore the events that have'nt exceeded the threshold. 10% is usually a good threshold value. This sounds a lot more complicated than it is. Here is the Axis event handler:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN191"
></A
><P
><B
>Example 3-4. Joystick Axis Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> case SDL_JOYAXISMOTION: /* Handle Joystick Motion */
if ( ( event.jaxis.value &#60; -3200 ) || (event.jaxis.value &#62; 3200 ) )
{
/* code goes here */
}
break;</PRE
></DIV
><P
>Another trick with axis events is that up-down and left-right movement are two different sets of axes. The most important axis is axis 0 (left-right) and axis 1 (up-down). To handle them seperatly in the code we do the following:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN195"
></A
><P
><B
>Example 3-5. More Joystick Axis Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> case SDL_JOYAXISMOTION: /* Handle Joystick Motion */
if ( ( event.jaxis.value &#60; -3200 ) || (event.jaxis.value &#62; 3200 ) )
{
if( event.jaxis.axis == 0)
{
/* Left-right movement code goes here */
}
if( event.jaxis.axis == 1)
{
/* Up-Down movement code goes here */
}
}
break;</PRE
></DIV
><P
>Ideally the code here should use <TT
CLASS="STRUCTFIELD"
><I
>event.jaxis.value</I
></TT
> to scale something. For example lets assume you are using the joystick to control the movement of a spaceship. If the user is using an analog joystick and they push the stick a little bit they expect to move less than if they pushed it a lot. Designing your code for this situation is preferred because it makes the experience for users of analog controls better and remains the same for users of digital controls.</P
><P
>If your joystick has any additional axis then they may be used for other sticks or throttle controls and those axis return values too just with different <TT
CLASS="STRUCTFIELD"
><I
>event.jaxis.axis</I
></TT
> values.</P
><P
>Button handling is simple compared to the axis checking.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN203"
></A
><P
><B
>Example 3-6. Joystick Button Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */
if ( event.jbutton.button == 0 )
{
/* code goes here */
}
break;</PRE
></DIV
><P
>Button checks are simpler than axis checks because a button can only be pressed or not pressed. The <TT
CLASS="LITERAL"
>SDL_JOYBUTTONDOWN</TT
> event is triggered when a button is pressed and the <TT
CLASS="LITERAL"
>SDL_JOYBUTTONUP</TT
> event is fired when a button is released. We do have to know what button was pressed though, that is done by reading the <TT
CLASS="STRUCTFIELD"
><I
>event.jbutton.button</I
></TT
> field.</P
><P
>Lastly when we are through using our joysticks we should close them with a call to <A
HREF="sdljoystickclose.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickClose</TT
></A
>. To close our opened joystick 0 we would do this at the end of our program:
<PRE
CLASS="PROGRAMLISTING"
> SDL_JoystickClose(joystick);</PRE
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN214"
></A
>Advanced Joystick Functions</H2
><P
>That takes care of the controls that you can count on being on every joystick under the sun, but there are a few extra things that SDL can support. Joyballs are next on our list, they are alot like axis with a few minor differences. Joyballs store relative changes unlike the the absolute postion stored in a axis event. Also one trackball event contains both the change in x and they change in y. Our case for it is as follows:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN217"
></A
><P
><B
>Example 3-7. Joystick Ball Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> case SDL_JOYBALLMOTION: /* Handle Joyball Motion */
if( event.jball.ball == 0 )
{
/* ball handling */
}
break;</PRE
></DIV
><P
>The above checks the first joyball on the joystick. The change in position will be stored in <TT
CLASS="STRUCTFIELD"
><I
>event.jball.xrel</I
></TT
> and <TT
CLASS="STRUCTFIELD"
><I
>event.jball.yrel</I
></TT
>.</P
><P
>Finally we have the hat event. Hats report only the direction they are pushed in. We check hat's position with the bitmasks:
<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_CENTERED</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_UP</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_RIGHT</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_DOWN</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_LEFT</TT
></TD
></TR
></TBODY
></TABLE
><P
></P
>
Also there are some predefined combinations of the above:
<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_RIGHTUP</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_RIGHTDOWN</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_LEFTUP</TT
></TD
></TR
><TR
><TD
><TT
CLASS="LITERAL"
>SDL_HAT_LEFTDOWN</TT
></TD
></TR
></TBODY
></TABLE
><P
></P
>
Our case for the hat may resemble the following:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN244"
></A
><P
><B
>Example 3-8. Joystick Hat Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> case SDL_JOYHATMOTION: /* Handle Hat Motion */
if ( event.jhat.value &#38; SDL_HAT_UP )
{
/* Do up stuff here */
}
if ( event.jhat.value &#38; SDL_HAT_LEFT )
{
/* Do left stuff here */
}
if ( event.jhat.value &#38; SDL_HAT_RIGHTDOWN )
{
/* Do right and down together stuff here */
}
break;</PRE
></DIV
><P
>In addition to the queries for number of joysticks on the system and their names there are additional functions to query the capabilities of attached joysticks:
<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="sdljoysticknumaxes.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickNumAxes</TT
></A
></TD
><TD
>Returns the number of joysitck axes</TD
></TR
><TR
><TD
><A
HREF="sdljoysticknumbuttons.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickNumButtons</TT
></A
></TD
><TD
>Returns the number of joysitck buttons</TD
></TR
><TR
><TD
><A
HREF="sdljoysticknumballs.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickNumBalls</TT
></A
></TD
><TD
>Returns the number of joysitck balls</TD
></TR
><TR
><TD
><A
HREF="sdljoysticknumhats.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickNumHats</TT
></A
></TD
><TD
>Returns the number of joysitck hats</TD
></TR
></TBODY
></TABLE
><P
></P
>
To use these functions we just have to pass in the joystick structure we got when we opened the joystick. For Example:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN265"
></A
><P
><B
>Example 3-9. Querying Joystick Characteristics</B
></P
><PRE
CLASS="PROGRAMLISTING"
> int number_of_buttons;
SDL_Joystick *joystick;
joystick = SDL_JoystickOpen(0);
number_of_buttons = SDL_JoystickNumButtons(joystick);</PRE
></DIV
><P
>This block of code would get the number of buttons on the first joystick in the system. </P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidevideoopengl.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideinputkeyboard.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Using OpenGL With SDL</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Handling the Keyboard</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,746 @@
<HTML
><HEAD
><TITLE
>Handling the Keyboard</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Input handling"
HREF="guideinput.html"><LINK
REL="PREVIOUS"
TITLE="Input handling"
HREF="guideinput.html"><LINK
REL="NEXT"
TITLE="Examples"
HREF="guideexamples.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guideinput.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Input handling</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEINPUTKEYBOARD"
></A
>Handling the Keyboard</H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN271"
></A
>Keyboard Related Structures</H2
><P
>It should make it a lot easier to understand this tutorial is you are familiar with the data types involved in keyboard access, so I'll explain them first.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN274"
></A
>SDLKey</H3
><P
><SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
> is an enumerated type defined in SDL/include/SDL_keysym.h and detailed <A
HREF="sdlkey.html"
>here</A
>. Each <SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
> symbol represents a key, <TT
CLASS="LITERAL"
>SDLK_a</TT
> corresponds to the 'a' key on a keyboard, <TT
CLASS="LITERAL"
>SDLK_SPACE</TT
> corresponds to the space bar, and so on.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN282"
></A
>SDLMod</H3
><P
>SDLMod is an enumerated type, similar to <SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
>, however it enumerates keyboard modifiers (Control, Alt, Shift). The full list of modifier symbols is <A
HREF="sdlkey.html#SDLMOD"
>here</A
>. <SPAN
CLASS="STRUCTNAME"
>SDLMod</SPAN
> values can be AND'd together to represent several modifiers.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN288"
></A
>SDL_keysym</H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 scancode;
SDLKey sym;
SDLMod mod;
Uint16 unicode;
} SDL_keysym;</PRE
><P
>The <SPAN
CLASS="STRUCTNAME"
>SDL_keysym</SPAN
> structure describes a key press or a key release. The <TT
CLASS="STRUCTFIELD"
><I
>scancode</I
></TT
> field is hardware specific and should be ignored unless you know what your doing. The <TT
CLASS="STRUCTFIELD"
><I
>sym</I
></TT
> field is the <SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
> value of the key being pressed or released. The <TT
CLASS="STRUCTFIELD"
><I
>mod</I
></TT
> field describes the state of the keyboard modifiers at the time the key press or release occurred. So a value of <TT
CLASS="LITERAL"
>KMOD_NUM | KMOD_CAPS | KMOD_LSHIFT</TT
> would mean that Numlock, Capslock and the left shift key were all press (or enabled in the case of the lock keys). Finally, the <TT
CLASS="STRUCTFIELD"
><I
>unicode</I
></TT
> field stores the 16-bit unicode value of the key.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>It should be noted and understood that this field is only valid when the <SPAN
CLASS="STRUCTNAME"
>SDL_keysym</SPAN
> is describing a key press, not a key release. Unicode values only make sense on a key press because the unicode value describes an international character and only key presses produce characters. More information on Unicode can be found at <A
HREF="http://www.unicode.org"
TARGET="_top"
>www.unicode.org</A
></P
></BLOCKQUOTE
></DIV
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>Unicode translation must be enabled using the <A
HREF="sdlenableunicode.html"
><TT
CLASS="FUNCTION"
>SDL_EnableUNICODE</TT
></A
> function.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN307"
></A
>SDL_KeyboardEvent</H3
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 type;
Uint8 state;
SDL_keysym keysym;
} SDL_KeyboardEvent;</PRE
><P
>The <SPAN
CLASS="STRUCTNAME"
>SDL_KeyboardEvent</SPAN
> describes a keyboard event (obviously). The <TT
CLASS="STRUCTFIELD"
><I
>key</I
></TT
> member of the <A
HREF="sdlevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
></A
> union is a <SPAN
CLASS="STRUCTNAME"
>SDL_KeyboardEvent</SPAN
> structure. The <TT
CLASS="STRUCTFIELD"
><I
>type</I
></TT
> field specifies whether the event is a key release (<TT
CLASS="LITERAL"
>SDL_KEYUP</TT
>) or a key press (<TT
CLASS="LITERAL"
>SDL_KEYDOWN</TT
>) event. The <TT
CLASS="STRUCTFIELD"
><I
>state</I
></TT
> is largely redundant, it reports the same information as the <TT
CLASS="STRUCTFIELD"
><I
>type</I
></TT
> field but uses different values (<TT
CLASS="LITERAL"
>SDL_RELEASED</TT
> and <TT
CLASS="LITERAL"
>SDL_PRESSED</TT
>). The <TT
CLASS="STRUCTFIELD"
><I
>keysym</I
></TT
> contains information of the key press or release that this event represents (see above).</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN324"
></A
>Reading Keyboard Events</H2
><P
>Reading keybaord events from the event queue is quite simple (the event queue and using it is described <A
HREF="sdlevent.html"
>here</A
>). We read events using <A
HREF="sdlpollevent.html"
><TT
CLASS="FUNCTION"
>SDL_PollEvent</TT
></A
> in a <TT
CLASS="LITERAL"
>while()</TT
> loop and check for <TT
CLASS="LITERAL"
>SDL_KEYUP</TT
> and <TT
CLASS="LITERAL"
>SDL_KEYDOWN</TT
> events using a <TT
CLASS="LITERAL"
>switch</TT
> statement, like so:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN334"
></A
><P
><B
>Example 3-10. Reading Keyboard Events</B
></P
><PRE
CLASS="PROGRAMLISTING"
> SDL_Event event;
.
.
/* Poll for events. SDL_PollEvent() returns 0 when there are no */
/* more events on the event queue, our while loop will exit when */
/* that occurs. */
while( SDL_PollEvent( &#38;event ) ){
/* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
switch( event.type ){
case SDL_KEYDOWN:
printf( "Key press detected\n" );
break;
case SDL_KEYUP:
printf( "Key release detected\n" );
break;
default:
break;
}
}
.
.</PRE
></DIV
><P
>This is a very basic example. No information about the key press or release is interpreted. We will explore the other extreme out our first full example below - reporting all available information about a keyboard event.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN338"
></A
>A More Detailed Look</H2
><P
>Before we can read events SDL must be initialised with <A
HREF="sdlinit.html"
><TT
CLASS="FUNCTION"
>SDL_Init</TT
></A
> and a video mode must be set using <A
HREF="sdlsetvideomode.html"
><TT
CLASS="FUNCTION"
>SDL_SetVideoMode</TT
></A
>. There are, however, two other functions we must use to obtain all the information required. We must enable unicode translation by calling <TT
CLASS="FUNCTION"
>SDL_EnableUNICODE(1)</TT
> and we must convert <SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
> values into something printable, using <A
HREF="sdlgetkeyname.html"
><TT
CLASS="FUNCTION"
>SDL_GetKeyName</TT
></A
></P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>It is useful to note that unicode values &#60; 0x80 translate directly a characters ASCII value. THis is used in the example below</P
></BLOCKQUOTE
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN351"
></A
><P
><B
>Example 3-11. Interpreting Key Event Information</B
></P
><PRE
CLASS="PROGRAMLISTING"
>&#13; #include "SDL.h"
/* Function Prototypes */
void PrintKeyInfo( SDL_KeyboardEvent *key );
void PrintModifiers( SDLMod mod );
/* main */
int main( int argc, char *argv[] ){
SDL_Event event;
int quit = 0;
/* Initialise SDL */
if( SDL_Init( SDL_INIT_VIDEO ) &#60; 0){
fprintf( stderr, "Could not initialise SDL: %s\n", SDL_GetError() );
exit( -1 );
}
/* Set a video mode */
if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
fprintf( stderr, "Could not set video mode: %s\n", SDL_GetError() );
SDL_Quit();
exit( -1 );
}
/* Enable Unicode translation */
SDL_EnableUNICODE( 1 );
/* Loop until an SDL_QUIT event is found */
while( !quit ){
/* Poll for events */
while( SDL_PollEvent( &#38;event ) ){
switch( event.type ){
/* Keyboard event */
/* Pass the event data onto PrintKeyInfo() */
case SDL_KEYDOWN:
case SDL_KEYUP:
PrintKeyInfo( &#38;event.key );
break;
/* SDL_QUIT event (window close) */
case SDL_QUIT:
quit = 1;
break;
default:
break;
}
}
}
/* Clean up */
SDL_Quit();
exit( 0 );
}
/* Print all information about a key event */
void PrintKeyInfo( SDL_KeyboardEvent *key ){
/* Is it a release or a press? */
if( key-&#62;type == SDL_KEYUP )
printf( "Release:- " );
else
printf( "Press:- " );
/* Print the hardware scancode first */
printf( "Scancode: 0x%02X", key-&#62;keysym.scancode );
/* Print the name of the key */
printf( ", Name: %s", SDL_GetKeyName( key-&#62;keysym.sym ) );
/* We want to print the unicode info, but we need to make */
/* sure its a press event first (remember, release events */
/* don't have unicode info */
if( key-&#62;type == SDL_KEYDOWN ){
/* If the Unicode value is less than 0x80 then the */
/* unicode value can be used to get a printable */
/* representation of the key, using (char)unicode. */
printf(", Unicode: " );
if( key-&#62;keysym.unicode &#60; 0x80 &#38;&#38; key-&#62;keysym.unicode &#62; 0 ){
printf( "%c (0x%04X)", (char)key-&#62;keysym.unicode,
key-&#62;keysym.unicode );
}
else{
printf( "? (0x%04X)", key-&#62;keysym.unicode );
}
}
printf( "\n" );
/* Print modifier info */
PrintModifiers( key-&#62;keysym.mod );
}
/* Print modifier info */
void PrintModifiers( SDLMod mod ){
printf( "Modifers: " );
/* If there are none then say so and return */
if( mod == KMOD_NONE ){
printf( "None\n" );
return;
}
/* Check for the presence of each SDLMod value */
/* This looks messy, but there really isn't */
/* a clearer way. */
if( mod &#38; KMOD_NUM ) printf( "NUMLOCK " );
if( mod &#38; KMOD_CAPS ) printf( "CAPSLOCK " );
if( mod &#38; KMOD_LCTRL ) printf( "LCTRL " );
if( mod &#38; KMOD_RCTRL ) printf( "RCTRL " );
if( mod &#38; KMOD_RSHIFT ) printf( "RSHIFT " );
if( mod &#38; KMOD_LSHIFT ) printf( "LSHIFT " );
if( mod &#38; KMOD_RALT ) printf( "RALT " );
if( mod &#38; KMOD_LALT ) printf( "LALT " );
if( mod &#38; KMOD_CTRL ) printf( "CTRL " );
if( mod &#38; KMOD_SHIFT ) printf( "SHIFT " );
if( mod &#38; KMOD_ALT ) printf( "ALT " );
printf( "\n" );
}</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN354"
></A
>Game-type Input</H2
><P
>I have found that people using keyboard events for games and other interactive applications don't always understand one fundemental point.</P
><A
NAME="AEN357"
></A
><BLOCKQUOTE
CLASS="BLOCKQUOTE"
><P
>Keyboard events <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>only</I
></SPAN
> take place when a keys state changes from being unpressed to pressed, and vice versa.</P
></BLOCKQUOTE
><P
>Imagine you have an image of an alien that you wish to move around using the cursor keys: when you pressed the left arrow key you want him to slide over to the left, and when you press the down key you want him to slide down the screen. Examine the following code; it highlights an error that many people have made.
<PRE
CLASS="PROGRAMLISTING"
> /* Alien screen coordinates */
int alien_x=0, alien_y=0;
.
.
/* Initialise SDL and video modes and all that */
.
/* Main game loop */
/* Check for events */
while( SDL_PollEvent( &#38;event ) ){
switch( event.type ){
/* Look for a keypress */
case SDL_KEYDOWN:
/* Check the SDLKey values and move change the coords */
switch( event.key.keysym.sym ){
case SDLK_LEFT:
alien_x -= 1;
break;
case SDLK_RIGHT:
alien_x += 1;
break;
case SDLK_UP:
alien_y -= 1;
break;
case SDLK_DOWN:
alien_y += 1;
break;
default:
break;
}
}
}
}
.
.</PRE
>
At first glance you may think this is a perfectly reasonable piece of code for the task, but it isn't. Like I said keyboard events only occur when a key changes state, so the user would have to press and release the left cursor key 100 times to move the alien 100 pixels to the left.</P
><P
>To get around this problem we must not use the events to change the position of the alien, we use the events to set flags which are then used in a seperate section of code to move the alien. Something like this:</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN363"
></A
><P
><B
>Example 3-12. Proper Game Movement</B
></P
><PRE
CLASS="PROGRAMLISTING"
> /* Alien screen coordinates */
int alien_x=0, alien_y=0;
int alien_xvel=0, alien_yvel=0;
.
.
/* Initialise SDL and video modes and all that */
.
/* Main game loop */
/* Check for events */
while( SDL_PollEvent( &#38;event ) ){
switch( event.type ){
/* Look for a keypress */
case SDL_KEYDOWN:
/* Check the SDLKey values and move change the coords */
switch( event.key.keysym.sym ){
case SDLK_LEFT:
alien_xvel = -1;
break;
case SDLK_RIGHT:
alien_xvel = 1;
break;
case SDLK_UP:
alien_yvel = -1;
break;
case SDLK_DOWN:
alien_yvel = 1;
break;
default:
break;
}
break;
/* We must also use the SDL_KEYUP events to zero the x */
/* and y velocity variables. But we must also be */
/* careful not to zero the velocities when we shouldn't*/
case SDL_KEYUP:
switch( event.key.keysym.sym ){
case SDLK_LEFT:
/* We check to make sure the alien is moving */
/* to the left. If it is then we zero the */
/* velocity. If the alien is moving to the */
/* right then the right key is still press */
/* so we don't tocuh the velocity */
if( alien_xvel &#60; 0 )
alien_xvel = 0;
break;
case SDLK_RIGHT:
if( alien_xvel &#62; 0 )
alien_xvel = 0;
break;
case SDLK_UP:
if( alien_yvel &#60; 0 )
alien_yvel = 0;
break;
case SDLK_DOWN:
if( alien_yvel &#62; 0 )
alien_yvel = 0;
break;
default:
break;
}
break;
default:
break;
}
}
.
.
/* Update the alien position */
alien_x += alien_xvel;
alien_y += alien_yvel;</PRE
></DIV
><P
>As can be seen, we use two extra variables, alien_xvel and alien_yvel, which represent the motion of the ship, it is these variables that we update when we detect keypresses and releases.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guideinput.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Input handling</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guideinput.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,178 @@
<HTML
><HEAD
><TITLE
>Preface</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="PREVIOUS"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="NEXT"
TITLE="About SDLdoc"
HREF="guideaboutsdldoc.html"></HEAD
><BODY
CLASS="PREFACE"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guide.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideaboutsdldoc.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="PREFACE"
><H1
><A
NAME="GUIDEPREFACE"
></A
>Preface</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guidepreface.html#GUIDEABOUTSDL"
>About SDL</A
></DT
><DT
><A
HREF="guideaboutsdldoc.html"
>About SDLdoc</A
></DT
><DT
><A
HREF="guidecredits.html"
>Credits</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEABOUTSDL"
></A
>About SDL</H1
><P
>The SDL library is designed to make it easy to write games that run on Linux, *BSD, MacOS, Win32 and BeOS using the various native high-performance media interfaces, (for video, audio, etc) and presenting a single source-code level API to your application. SDL is a fairly low level API, but using it, completely portable applications can be written with a great deal of flexibility.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideaboutsdldoc.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL Guide</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>About SDLdoc</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,173 @@
<HTML
><HEAD
><TITLE
>The Basics</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="PREVIOUS"
TITLE="Credits"
HREF="guidecredits.html"><LINK
REL="NEXT"
TITLE="Initializing SDL"
HREF="guidebasicsinit.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidecredits.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidebasicsinit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="GUIDETHEBASICS"
></A
>Chapter 1. The Basics</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guidethebasics.html#GUIDEINTRODUCTION"
>Introduction</A
></DT
><DT
><A
HREF="guidebasicsinit.html"
>Initializing SDL</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEINTRODUCTION"
></A
>Introduction</H1
><P
>The SDL Guide section is pretty incomplete. If you feel you have anything to add mail akawaka@skynet.ie or visit http://akawaka.csn.ul.ie/tne/.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidecredits.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidebasicsinit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Credits</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Initializing SDL</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,183 @@
<HTML
><HEAD
><TITLE
>Time Examples</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Examples"
HREF="guideexamples.html"><LINK
REL="PREVIOUS"
TITLE="CDROM Examples"
HREF="guidecdromexamples.html"><LINK
REL="NEXT"
TITLE="SDL Reference"
HREF="reference.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidecdromexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Examples</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="reference.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDETIMEEXAMPLES"
></A
>Time Examples</H1
><P
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN412"
></A
>Time based game loop</H2
><P
><PRE
CLASS="PROGRAMLISTING"
>#define TICK_INTERVAL 30
static Uint32 next_time;
Uint32 time_left(void)
{
Uint32 now;
now = SDL_GetTicks();
if(next_time &#60;= now)
return 0;
else
return next_time - now;
}
/* main game loop */
next_time = SDL_GetTicks() + TICK_INTERVAL;
while ( game_running ) {
update_game_state();
SDL_Delay(time_left());
next_time += TICK_INTERVAL;
}&#13;</PRE
></P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidecdromexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>CDROM Examples</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guideexamples.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL Reference</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,463 @@
<HTML
><HEAD
><TITLE
>Graphics and Video</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Guide"
HREF="guide.html"><LINK
REL="PREVIOUS"
TITLE="Initializing SDL"
HREF="guidebasicsinit.html"><LINK
REL="NEXT"
TITLE="Using OpenGL With SDL"
HREF="guidevideoopengl.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidebasicsinit.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guidevideoopengl.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="GUIDEVIDEO"
></A
>Chapter 2. Graphics and Video</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="guidevideo.html#GUIDEVIDEOINTRO"
>Introduction to SDL Video</A
></DT
><DT
><A
HREF="guidevideoopengl.html"
>Using OpenGL With SDL</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEVIDEOINTRO"
></A
>Introduction to SDL Video</H1
><P
>Video is probably the most common thing that SDL is used for, and
so it has the most complete subsystem. Here are a few
examples to demonstrate the basics.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN68"
></A
>Initializing the Video Display</H2
><P
>This is what almost all SDL programs have to do in one way or
another.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN71"
></A
><P
><B
>Example 2-1. Initializing the Video Display</B
></P
><PRE
CLASS="PROGRAMLISTING"
> SDL_Surface *screen;
/* Initialize the SDL library */
if( SDL_Init(SDL_INIT_VIDEO) &#60; 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
/* Clean up on exit */
atexit(SDL_Quit);
/*
* Initialize the display in a 640x480 8-bit palettized mode,
* requesting a software surface
*/
screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN74"
></A
>Initializing the Best Video Mode</H2
><P
>If you have a preference for a certain pixel depth but will accept any
other, use SDL_SetVideoMode with SDL_ANYFORMAT as below. You can also
use SDL_VideoModeOK() to find the native video mode that is closest to
the mode you request.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN77"
></A
><P
><B
>Example 2-2. Initializing the Best Video Mode</B
></P
><PRE
CLASS="PROGRAMLISTING"
> /* Have a preference for 8-bit, but accept any depth */
screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE|SDL_ANYFORMAT);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}
printf("Set 640x480 at %d bits-per-pixel mode\n",
screen-&#62;format-&#62;BitsPerPixel);</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN80"
></A
>Loading and Displaying a BMP File</H2
><P
>The following function loads and displays a BMP file given as
argument, once SDL is initialised and a video mode has been set.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN83"
></A
><P
><B
>Example 2-3. Loading and Displaying a BMP File</B
></P
><PRE
CLASS="PROGRAMLISTING"
>void display_bmp(char *file_name)
{
SDL_Surface *image;
/* Load the BMP file into a surface */
image = SDL_LoadBMP(file_name);
if (image == NULL) {
fprintf(stderr, "Couldn't load %s: %s\n", file_name, SDL_GetError());
return;
}
/*
* Palettized screen modes will have a default palette (a standard
* 8*8*4 colour cube), but if the image is palettized as well we can
* use that palette for a nicer colour matching
*/
if (image-&#62;format-&#62;palette &#38;&#38; screen-&#62;format-&#62;palette) {
SDL_SetColors(screen, image-&#62;format-&#62;palette-&#62;colors, 0,
image-&#62;format-&#62;palette-&#62;ncolors);
}
/* Blit onto the screen surface */
if(SDL_BlitSurface(image, NULL, screen, NULL) &#60; 0)
fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());
SDL_UpdateRect(screen, 0, 0, image-&#62;w, image-&#62;h);
/* Free the allocated BMP surface */
SDL_FreeSurface(image);
}</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN86"
></A
>Drawing Directly to the Display</H2
><P
>The following two functions can be used to get and set single
pixels of a surface. They are carefully written to work with any depth
currently supported by SDL. Remember to lock the surface before
calling them, and to unlock it before calling any other SDL
functions.</P
><P
>To convert between pixel values and their red, green, blue
components, use SDL_GetRGB() and SDL_MapRGB().</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN90"
></A
><P
><B
>Example 2-4. getpixel()</B
></P
><PRE
CLASS="PROGRAMLISTING"
>/*
* Return the pixel value at (x, y)
* NOTE: The surface must be locked before calling this!
*/
Uint32 getpixel(SDL_Surface *surface, int x, int y)
{
int bpp = surface-&#62;format-&#62;BytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface-&#62;pixels + y * surface-&#62;pitch + x * bpp;
switch(bpp) {
case 1:
return *p;
case 2:
return *(Uint16 *)p;
case 3:
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
return p[0] &#60;&#60; 16 | p[1] &#60;&#60; 8 | p[2];
else
return p[0] | p[1] &#60;&#60; 8 | p[2] &#60;&#60; 16;
case 4:
return *(Uint32 *)p;
default:
return 0; /* shouldn't happen, but avoids warnings */
}
}</PRE
></DIV
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN93"
></A
><P
><B
>Example 2-5. putpixel()</B
></P
><PRE
CLASS="PROGRAMLISTING"
>/*
* Set the pixel at (x, y) to the given value
* NOTE: The surface must be locked before calling this!
*/
void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
{
int bpp = surface-&#62;format-&#62;BytesPerPixel;
/* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface-&#62;pixels + y * surface-&#62;pitch + x * bpp;
switch(bpp) {
case 1:
*p = pixel;
break;
case 2:
*(Uint16 *)p = pixel;
break;
case 3:
if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
p[0] = (pixel &#62;&#62; 16) &#38; 0xff;
p[1] = (pixel &#62;&#62; 8) &#38; 0xff;
p[2] = pixel &#38; 0xff;
} else {
p[0] = pixel &#38; 0xff;
p[1] = (pixel &#62;&#62; 8) &#38; 0xff;
p[2] = (pixel &#62;&#62; 16) &#38; 0xff;
}
break;
case 4:
*(Uint32 *)p = pixel;
break;
}
}</PRE
></DIV
><P
>The following code uses the putpixel() function above to set a
yellow pixel in the middle of the screen.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN97"
></A
><P
><B
>Example 2-6. Using putpixel()</B
></P
><PRE
CLASS="PROGRAMLISTING"
>&#13; /* Code to set a yellow pixel at the center of the screen */
int x, y;
Uint32 yellow;
/* Map the color yellow to this display (R=0xff, G=0xFF, B=0x00)
Note: If the display is palettized, you must set the palette first.
*/
yellow = SDL_MapRGB(screen-&#62;format, 0xff, 0xff, 0x00);
x = screen-&#62;w / 2;
y = screen-&#62;h / 2;
/* Lock the screen for direct access to the pixels */
if ( SDL_MUSTLOCK(screen) ) {
if ( SDL_LockSurface(screen) &#60; 0 ) {
fprintf(stderr, "Can't lock screen: %s\n", SDL_GetError());
return;
}
}
putpixel(screen, x, y, yellow);
if ( SDL_MUSTLOCK(screen) ) {
SDL_UnlockSurface(screen);
}
/* Update just the part of the display that we've changed */
SDL_UpdateRect(screen, x, y, 1, 1);
return;&#13;</PRE
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidebasicsinit.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guidevideoopengl.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Initializing SDL</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guide.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Using OpenGL With SDL</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,730 @@
<HTML
><HEAD
><TITLE
>Using OpenGL With SDL</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Graphics and Video"
HREF="guidevideo.html"><LINK
REL="PREVIOUS"
TITLE="Graphics and Video"
HREF="guidevideo.html"><LINK
REL="NEXT"
TITLE="Input handling"
HREF="guideinput.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidevideo.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Graphics and Video</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="guideinput.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GUIDEVIDEOOPENGL"
></A
>Using OpenGL With SDL</H1
><P
>SDL has the ability to create and use OpenGL contexts on several platforms(Linux/X11, Win32, BeOS, MacOS Classic/Toolbox, Mac OS X, FreeBSD/X11 and Solaris/X11). This allows you to use SDL's audio, event handling, threads and times in your OpenGL applications (a function often performed by GLUT).</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN103"
></A
>Initialisation</H2
><P
>Initialising SDL to use OpenGL is not very different to initialising SDL normally. There are three differences; you must pass <TT
CLASS="LITERAL"
>SDL_OPENGL</TT
> to <A
HREF="sdlsetvideomode.html"
><TT
CLASS="FUNCTION"
>SDL_SetVideoMode</TT
></A
>, you must specify several GL attributes (depth buffer size, framebuffer sizes) using <A
HREF="sdlglsetattribute.html"
><TT
CLASS="FUNCTION"
>SDL_GL_SetAttribute</TT
></A
> and finally, if you wish to use double buffering you must specify it as a GL attribute, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
> by passing the <TT
CLASS="LITERAL"
>SDL_DOUBLEBUF</TT
> flag to <TT
CLASS="FUNCTION"
>SDL_SetVideoMode</TT
>.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN114"
></A
><P
><B
>Example 2-7. Initializing SDL with OpenGL</B
></P
><PRE
CLASS="PROGRAMLISTING"
> /* Information about the current video settings. */
const SDL_VideoInfo* info = NULL;
/* Dimensions of our window. */
int width = 0;
int height = 0;
/* Color depth in bits of our window. */
int bpp = 0;
/* Flags we will pass into SDL_SetVideoMode. */
int flags = 0;
/* First, initialize SDL's video subsystem. */
if( SDL_Init( SDL_INIT_VIDEO ) &#60; 0 ) {
/* Failed, exit. */
fprintf( stderr, "Video initialization failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}
/* Let's get some video information. */
info = SDL_GetVideoInfo( );
if( !info ) {
/* This should probably never happen. */
fprintf( stderr, "Video query failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}
/*
* Set our width/height to 640/480 (you would
* of course let the user decide this in a normal
* app). We get the bpp we will request from
* the display. On X11, VidMode can't change
* resolution, so this is probably being overly
* safe. Under Win32, ChangeDisplaySettings
* can change the bpp.
*/
width = 640;
height = 480;
bpp = info-&#62;vfmt-&#62;BitsPerPixel;
/*
* Now, we want to setup our requested
* window attributes for our OpenGL window.
* We want *at least* 5 bits of red, green
* and blue. We also want at least a 16-bit
* depth buffer.
*
* The last thing we do is request a double
* buffered window. '1' turns on double
* buffering, '0' turns it off.
*
* Note that we do not use SDL_DOUBLEBUF in
* the flags to SDL_SetVideoMode. That does
* not affect the GL attribute state, only
* the standard 2D blitting setup.
*/
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
/*
* We want to request that SDL provide us
* with an OpenGL window, in a fullscreen
* video mode.
*
* EXERCISE:
* Make starting windowed an option, and
* handle the resize events properly with
* glViewport.
*/
flags = SDL_OPENGL | SDL_FULLSCREEN;
/*
* Set the video mode
*/
if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
/*
* This could happen for a variety of reasons,
* including DISPLAY not being set, the specified
* resolution not being available, etc.
*/
fprintf( stderr, "Video mode set failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}</PRE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN117"
></A
>Drawing</H2
><P
>Apart from initialisation, using OpenGL within SDL is the same as using OpenGL
with any other API, e.g. GLUT. You still use all the same function calls and
data types. However if you are using a double-buffered display, then you must
use
<A
HREF="sdlglswapbuffers.html"
><TT
CLASS="FUNCTION"
>SDL_GL_SwapBuffers()</TT
></A
>
to swap the buffers and update the display. To request double-buffering
with OpenGL, use
<A
HREF="sdlglsetattribute.html"
><TT
CLASS="FUNCTION"
>SDL_GL_SetAttribute</TT
></A
>
with <TT
CLASS="LITERAL"
>SDL_GL_DOUBLEBUFFER</TT
>, and use
<A
HREF="sdlglgetattribute.html"
><TT
CLASS="FUNCTION"
>SDL_GL_GetAttribute</TT
></A
>
to see if you actually got it.</P
><P
>A full example code listing is now presented below.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN128"
></A
><P
><B
>Example 2-8. SDL and OpenGL</B
></P
><PRE
CLASS="PROGRAMLISTING"
>/*
* SDL OpenGL Tutorial.
* (c) Michael Vance, 2000
* briareos@lokigames.com
*
* Distributed under terms of the LGPL.
*/
#include &#60;SDL/SDL.h&#62;
#include &#60;GL/gl.h&#62;
#include &#60;GL/glu.h&#62;
#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
static GLboolean should_rotate = GL_TRUE;
static void quit_tutorial( int code )
{
/*
* Quit SDL so we can release the fullscreen
* mode and restore the previous video settings,
* etc.
*/
SDL_Quit( );
/* Exit program. */
exit( code );
}
static void handle_key_down( SDL_keysym* keysym )
{
/*
* We're only interested if 'Esc' has
* been presssed.
*
* EXERCISE:
* Handle the arrow keys and have that change the
* viewing position/angle.
*/
switch( keysym-&#62;sym ) {
case SDLK_ESCAPE:
quit_tutorial( 0 );
break;
case SDLK_SPACE:
should_rotate = !should_rotate;
break;
default:
break;
}
}
static void process_events( void )
{
/* Our SDL event placeholder. */
SDL_Event event;
/* Grab all the events off the queue. */
while( SDL_PollEvent( &#38;event ) ) {
switch( event.type ) {
case SDL_KEYDOWN:
/* Handle key presses. */
handle_key_down( &#38;event.key.keysym );
break;
case SDL_QUIT:
/* Handle quit requests (like Ctrl-c). */
quit_tutorial( 0 );
break;
}
}
}
static void draw_screen( void )
{
/* Our angle of rotation. */
static float angle = 0.0f;
/*
* EXERCISE:
* Replace this awful mess with vertex
* arrays and a call to glDrawElements.
*
* EXERCISE:
* After completing the above, change
* it to use compiled vertex arrays.
*
* EXERCISE:
* Verify my windings are correct here ;).
*/
static GLfloat v0[] = { -1.0f, -1.0f, 1.0f };
static GLfloat v1[] = { 1.0f, -1.0f, 1.0f };
static GLfloat v2[] = { 1.0f, 1.0f, 1.0f };
static GLfloat v3[] = { -1.0f, 1.0f, 1.0f };
static GLfloat v4[] = { -1.0f, -1.0f, -1.0f };
static GLfloat v5[] = { 1.0f, -1.0f, -1.0f };
static GLfloat v6[] = { 1.0f, 1.0f, -1.0f };
static GLfloat v7[] = { -1.0f, 1.0f, -1.0f };
static GLubyte red[] = { 255, 0, 0, 255 };
static GLubyte green[] = { 0, 255, 0, 255 };
static GLubyte blue[] = { 0, 0, 255, 255 };
static GLubyte white[] = { 255, 255, 255, 255 };
static GLubyte yellow[] = { 0, 255, 255, 255 };
static GLubyte black[] = { 0, 0, 0, 255 };
static GLubyte orange[] = { 255, 255, 0, 255 };
static GLubyte purple[] = { 255, 0, 255, 0 };
/* Clear the color and depth buffers. */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
/* We don't want to modify the projection matrix. */
glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );
/* Move down the z-axis. */
glTranslatef( 0.0, 0.0, -5.0 );
/* Rotate. */
glRotatef( angle, 0.0, 1.0, 0.0 );
if( should_rotate ) {
if( ++angle &#62; 360.0f ) {
angle = 0.0f;
}
}
/* Send our triangle data to the pipeline. */
glBegin( GL_TRIANGLES );
glColor4ubv( red );
glVertex3fv( v0 );
glColor4ubv( green );
glVertex3fv( v1 );
glColor4ubv( blue );
glVertex3fv( v2 );
glColor4ubv( red );
glVertex3fv( v0 );
glColor4ubv( blue );
glVertex3fv( v2 );
glColor4ubv( white );
glVertex3fv( v3 );
glColor4ubv( green );
glVertex3fv( v1 );
glColor4ubv( black );
glVertex3fv( v5 );
glColor4ubv( orange );
glVertex3fv( v6 );
glColor4ubv( green );
glVertex3fv( v1 );
glColor4ubv( orange );
glVertex3fv( v6 );
glColor4ubv( blue );
glVertex3fv( v2 );
glColor4ubv( black );
glVertex3fv( v5 );
glColor4ubv( yellow );
glVertex3fv( v4 );
glColor4ubv( purple );
glVertex3fv( v7 );
glColor4ubv( black );
glVertex3fv( v5 );
glColor4ubv( purple );
glVertex3fv( v7 );
glColor4ubv( orange );
glVertex3fv( v6 );
glColor4ubv( yellow );
glVertex3fv( v4 );
glColor4ubv( red );
glVertex3fv( v0 );
glColor4ubv( white );
glVertex3fv( v3 );
glColor4ubv( yellow );
glVertex3fv( v4 );
glColor4ubv( white );
glVertex3fv( v3 );
glColor4ubv( purple );
glVertex3fv( v7 );
glColor4ubv( white );
glVertex3fv( v3 );
glColor4ubv( blue );
glVertex3fv( v2 );
glColor4ubv( orange );
glVertex3fv( v6 );
glColor4ubv( white );
glVertex3fv( v3 );
glColor4ubv( orange );
glVertex3fv( v6 );
glColor4ubv( purple );
glVertex3fv( v7 );
glColor4ubv( green );
glVertex3fv( v1 );
glColor4ubv( red );
glVertex3fv( v0 );
glColor4ubv( yellow );
glVertex3fv( v4 );
glColor4ubv( green );
glVertex3fv( v1 );
glColor4ubv( yellow );
glVertex3fv( v4 );
glColor4ubv( black );
glVertex3fv( v5 );
glEnd( );
/*
* EXERCISE:
* Draw text telling the user that 'Spc'
* pauses the rotation and 'Esc' quits.
* Do it using vetors and textured quads.
*/
/*
* Swap the buffers. This this tells the driver to
* render the next frame from the contents of the
* back-buffer, and to set all rendering operations
* to occur on what was the front-buffer.
*
* Double buffering prevents nasty visual tearing
* from the application drawing on areas of the
* screen that are being updated at the same time.
*/
SDL_GL_SwapBuffers( );
}
static void setup_opengl( int width, int height )
{
float ratio = (float) width / (float) height;
/* Our shading model--Gouraud (smooth). */
glShadeModel( GL_SMOOTH );
/* Culling. */
glCullFace( GL_BACK );
glFrontFace( GL_CCW );
glEnable( GL_CULL_FACE );
/* Set the clear color. */
glClearColor( 0, 0, 0, 0 );
/* Setup our viewport. */
glViewport( 0, 0, width, height );
/*
* Change to the projection matrix and set
* our viewing volume.
*/
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
/*
* EXERCISE:
* Replace this with a call to glFrustum.
*/
gluPerspective( 60.0, ratio, 1.0, 1024.0 );
}
int main( int argc, char* argv[] )
{
/* Information about the current video settings. */
const SDL_VideoInfo* info = NULL;
/* Dimensions of our window. */
int width = 0;
int height = 0;
/* Color depth in bits of our window. */
int bpp = 0;
/* Flags we will pass into SDL_SetVideoMode. */
int flags = 0;
/* First, initialize SDL's video subsystem. */
if( SDL_Init( SDL_INIT_VIDEO ) &#60; 0 ) {
/* Failed, exit. */
fprintf( stderr, "Video initialization failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}
/* Let's get some video information. */
info = SDL_GetVideoInfo( );
if( !info ) {
/* This should probably never happen. */
fprintf( stderr, "Video query failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}
/*
* Set our width/height to 640/480 (you would
* of course let the user decide this in a normal
* app). We get the bpp we will request from
* the display. On X11, VidMode can't change
* resolution, so this is probably being overly
* safe. Under Win32, ChangeDisplaySettings
* can change the bpp.
*/
width = 640;
height = 480;
bpp = info-&#62;vfmt-&#62;BitsPerPixel;
/*
* Now, we want to setup our requested
* window attributes for our OpenGL window.
* We want *at least* 5 bits of red, green
* and blue. We also want at least a 16-bit
* depth buffer.
*
* The last thing we do is request a double
* buffered window. '1' turns on double
* buffering, '0' turns it off.
*
* Note that we do not use SDL_DOUBLEBUF in
* the flags to SDL_SetVideoMode. That does
* not affect the GL attribute state, only
* the standard 2D blitting setup.
*/
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
/*
* We want to request that SDL provide us
* with an OpenGL window, in a fullscreen
* video mode.
*
* EXERCISE:
* Make starting windowed an option, and
* handle the resize events properly with
* glViewport.
*/
flags = SDL_OPENGL | SDL_FULLSCREEN;
/*
* Set the video mode
*/
if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
/*
* This could happen for a variety of reasons,
* including DISPLAY not being set, the specified
* resolution not being available, etc.
*/
fprintf( stderr, "Video mode set failed: %s\n",
SDL_GetError( ) );
quit_tutorial( 1 );
}
/*
* At this point, we should have a properly setup
* double-buffered window for use with OpenGL.
*/
setup_opengl( width, height );
/*
* Now we want to begin our normal app process--
* an event loop with a lot of redrawing.
*/
while( 1 ) {
/* Process incoming events. */
process_events( );
/* Draw the screen. */
draw_screen( );
}
/*
* EXERCISE:
* Record timings using SDL_GetTicks() and
* and print out frames per second at program
* end.
*/
/* Never reached. */
return 0;
}</PRE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidevideo.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="guideinput.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Graphics and Video</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="guidevideo.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Input handling</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

1156
SDL/docs/html/index.html Normal file

File diff suppressed because it is too large Load diff

296
SDL/docs/html/joystick.html Normal file
View file

@ -0,0 +1,296 @@
<HTML
><HEAD
><TITLE
>Joystick</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_JoystickEventState"
HREF="sdljoystickeventstate.html"><LINK
REL="NEXT"
TITLE="SDL_NumJoysticks"
HREF="sdlnumjoysticks.html"><META
NAME="KEYWORD"
CONTENT="joystick"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdljoystickeventstate.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlnumjoysticks.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="JOYSTICK"
></A
>Chapter 9. Joystick</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlnumjoysticks.html"
>SDL_NumJoysticks</A
>&nbsp;--&nbsp;Count available joysticks.</DT
><DT
><A
HREF="sdljoystickname.html"
>SDL_JoystickName</A
>&nbsp;--&nbsp;Get joystick name.</DT
><DT
><A
HREF="sdljoystickopen.html"
>SDL_JoystickOpen</A
>&nbsp;--&nbsp;Opens a joystick for use.</DT
><DT
><A
HREF="sdljoystickopened.html"
>SDL_JoystickOpened</A
>&nbsp;--&nbsp;Determine if a joystick has been opened</DT
><DT
><A
HREF="sdljoystickindex.html"
>SDL_JoystickIndex</A
>&nbsp;--&nbsp;Get the index of an SDL_Joystick.</DT
><DT
><A
HREF="sdljoysticknumaxes.html"
>SDL_JoystickNumAxes</A
>&nbsp;--&nbsp;Get the number of joystick axes</DT
><DT
><A
HREF="sdljoysticknumballs.html"
>SDL_JoystickNumBalls</A
>&nbsp;--&nbsp;Get the number of joystick trackballs</DT
><DT
><A
HREF="sdljoysticknumhats.html"
>SDL_JoystickNumHats</A
>&nbsp;--&nbsp;Get the number of joystick hats</DT
><DT
><A
HREF="sdljoysticknumbuttons.html"
>SDL_JoystickNumButtons</A
>&nbsp;--&nbsp;Get the number of joysitck buttons</DT
><DT
><A
HREF="sdljoystickupdate.html"
>SDL_JoystickUpdate</A
>&nbsp;--&nbsp;Updates the state of all joysticks</DT
><DT
><A
HREF="sdljoystickgetaxis.html"
>SDL_JoystickGetAxis</A
>&nbsp;--&nbsp;Get the current state of an axis</DT
><DT
><A
HREF="sdljoystickgethat.html"
>SDL_JoystickGetHat</A
>&nbsp;--&nbsp;Get the current state of a joystick hat</DT
><DT
><A
HREF="sdljoystickgetbutton.html"
>SDL_JoystickGetButton</A
>&nbsp;--&nbsp;Get the current state of a given button on a given joystick</DT
><DT
><A
HREF="sdljoystickgetball.html"
>SDL_JoystickGetBall</A
>&nbsp;--&nbsp;Get relative trackball motion</DT
><DT
><A
HREF="sdljoystickclose.html"
>SDL_JoystickClose</A
>&nbsp;--&nbsp;Closes a previously opened joystick</DT
></DL
></DIV
><P
>Joysticks, and other similar input devices, have a very strong role in game playing and SDL provides comprehensive support for them. Axes, Buttons, POV Hats and trackballs are all supported.</P
><P
>Joystick support is initialized by passed the <TT
CLASS="LITERAL"
>SDL_INIT_JOYSTICK</TT
> flag to <A
HREF="sdlinit.html"
><TT
CLASS="FUNCTION"
>SDL_Init</TT
></A
>. Once initilized joysticks must be opened using <A
HREF="sdljoystickopen.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickOpen</TT
></A
>.</P
><P
>While using the functions describe in this secton may seem like the best way to access and read from joysticks, in most cases they aren't. Ideally joysticks should be read using the <A
HREF="event.html"
>event</A
> system. To enable this, you must set the joystick event processing state with <A
HREF="sdljoystickeventstate.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickEventState</TT
></A
>. Joysticks must be <A
HREF="sdljoystickopen.html"
>opened</A
> before they can be used of course.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>If you are <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
> handling the joystick via the event queue then you must explicitly request a joystick update by calling <A
HREF="sdljoystickupdate.html"
><TT
CLASS="FUNCTION"
>SDL_JoystickUpdate</TT
></A
>.</P
></BLOCKQUOTE
></DIV
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>Force Feedback is not yet support. Sam (slouken@libsdl.org) is soliciting suggestions from people with force-feedback experience on the best wat to desgin the API.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdljoystickeventstate.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlnumjoysticks.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_JoystickEventState</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_NumJoysticks</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,194 @@
<HTML
><HEAD
><TITLE
>SDL Reference</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Time Examples"
HREF="guidetimeexamples.html"><LINK
REL="NEXT"
TITLE="General"
HREF="general.html"></HEAD
><BODY
CLASS="PART"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="guidetimeexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="general.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="PART"
><A
NAME="REFERENCE"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
>II. SDL Reference</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>5. <A
HREF="general.html"
>General</A
></DT
><DT
>6. <A
HREF="video.html"
>Video</A
></DT
><DT
>7. <A
HREF="wm.html"
>Window Management</A
></DT
><DT
>8. <A
HREF="event.html"
>Events</A
></DT
><DT
>9. <A
HREF="joystick.html"
>Joystick</A
></DT
><DT
>10. <A
HREF="audio.html"
>Audio</A
></DT
><DT
>11. <A
HREF="cdrom.html"
>CD-ROM</A
></DT
><DT
>12. <A
HREF="thread.html"
>Multi-threaded Programming</A
></DT
><DT
>13. <A
HREF="time.html"
>Time</A
></DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="guidetimeexamples.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="general.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Time Examples</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>General</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,335 @@
<HTML
><HEAD
><TITLE
>SDL_ActiveEvent</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Event Structures."
HREF="eventstructures.html"><LINK
REL="PREVIOUS"
TITLE="SDL_Event"
HREF="sdlevent.html"><LINK
REL="NEXT"
TITLE="SDL_KeyboardEvent"
HREF="sdlkeyboardevent.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlevent.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlkeyboardevent.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLACTIVEEVENT"
></A
>SDL_ActiveEvent</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN3955"
></A
><H2
>Name</H2
>SDL_ActiveEvent&nbsp;--&nbsp;Application visibility event structure</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3958"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 type;
Uint8 gain;
Uint8 state;
} SDL_ActiveEvent;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3961"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN3963"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>type</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="LITERAL"
>SDL_ACTIVEEVENT.</TT
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>0 if the event is a loss or 1 if it is a gain.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>state</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="LITERAL"
>SDL_APPMOUSEFOCUS</TT
> if mouse focus was gained or lost, <TT
CLASS="LITERAL"
>SDL_APPINPUTFOCUS</TT
> if input focus was gained or lost, or <TT
CLASS="LITERAL"
>SDL_APPACTIVE</TT
> if the application was iconified (<TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
>=0) or restored(<TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
>=1).</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3984"
></A
><H2
>Description</H2
><P
><SPAN
CLASS="STRUCTNAME"
>SDL_ActiveEvent</SPAN
> is a member of the <A
HREF="sdlevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
></A
> union and is used when an event of type <TT
CLASS="LITERAL"
>SDL_ACTIVEEVENT</TT
> is reported.</P
><P
>When the mouse leaves or enters the window area a <TT
CLASS="LITERAL"
>SDL_APPMOUSEFOCUS</TT
> type activation event occurs, if the mouse entered the window then <TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
> will be 1, otherwise <TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
> will be 0. A <TT
CLASS="LITERAL"
>SDL_APPINPUTFOCUS</TT
> type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a <TT
CLASS="LITERAL"
>SDL_APPACTIVE</TT
> type event occurs when the application is either minimised/iconified (<TT
CLASS="STRUCTFIELD"
><I
>gain</I
></TT
>=0) or restored.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>This event does not occur when an application window is first created.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN4000"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlevent.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Event</SPAN
></A
>,
<A
HREF="sdlgetappstate.html"
><TT
CLASS="FUNCTION"
>SDL_GetAppState</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlevent.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlkeyboardevent.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_Event</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="eventstructures.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_KeyboardEvent</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,296 @@
<HTML
><HEAD
><TITLE
>SDL_AddTimer</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Time"
HREF="time.html"><LINK
REL="PREVIOUS"
TITLE="SDL_Delay"
HREF="sdldelay.html"><LINK
REL="NEXT"
TITLE="SDL_RemoveTimer"
HREF="sdlremovetimer.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdldelay.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlremovetimer.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLADDTIMER"
></A
>SDL_AddTimer</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8482"
></A
><H2
>Name</H2
>SDL_AddTimer&nbsp;--&nbsp;Add a timer which will call a callback after the specified number of milliseconds has
elapsed.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8485"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN8486"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>SDL_TimerID <B
CLASS="FSFUNC"
>SDL_AddTimer</B
></CODE
>(Uint32 interval, SDL_NewTimerCallback callback, void *param);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SDLNEWTIMERCALLBACK"
></A
><H2
>Callback</H2
><PRE
CLASS="PROGRAMLISTING"
>/* type definition for the "new" timer callback function */
typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8495"
></A
><H2
>Description</H2
><P
>Adds a callback function to be run after the specified number of
milliseconds has elapsed. The callback function is passed the current
timer interval and the user supplied parameter from the
<TT
CLASS="FUNCTION"
>SDL_AddTimer</TT
> call and returns the next timer
interval. If the returned value from the callback is the same as the one
passed in, the periodic alarm continues, otherwise a new alarm is
scheduled.</P
><P
>To cancel a currently running timer call
<A
HREF="sdlremovetimer.html"
>SDL_RemoveTimer</A
> with the
timer ID returned from
<TT
CLASS="FUNCTION"
>SDL_AddTimer</TT
>.</P
><P
>The timer callback function may run in a different thread than your
main program, and so shouldn't call any functions from within itself.
You may always call <A
HREF="sdlpushevent.html"
>SDL_PushEvent</A
>, however.</P
><P
>The granularity of the timer is platform-dependent, but you should count
on it being at least 10 ms as this is the most common number.
This means that if
you request a 16 ms timer, your callback will run approximately 20 ms
later on an unloaded system. If you wanted to set a flag signaling
a frame update at 30 frames per second (every 33 ms), you might set a
timer for 30 ms (see example below).
If you use this function, you need to pass <TT
CLASS="LITERAL"
>SDL_INIT_TIMER</TT
>
to <A
HREF="sdlinit.html"
>SDL_Init</A
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8507"
></A
><H2
>Return Value</H2
><P
>Returns an ID value for the added timer or
<SPAN
CLASS="RETURNVALUE"
>NULL</SPAN
> if there was an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8511"
></A
><H2
>Examples</H2
><P
><PRE
CLASS="PROGRAMLISTING"
>my_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);</PRE
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8515"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlremovetimer.html"
><TT
CLASS="FUNCTION"
>SDL_RemoveTimer</TT
></A
>,
<A
HREF="sdlpushevent.html"
><TT
CLASS="FUNCTION"
>SDL_PushEvent</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdldelay.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlremovetimer.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_Delay</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="time.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_RemoveTimer</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,556 @@
<HTML
><HEAD
><TITLE
>SDL_AudioCVT</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Audio"
HREF="audio.html"><LINK
REL="PREVIOUS"
TITLE="SDL_FreeWAV"
HREF="sdlfreewav.html"><LINK
REL="NEXT"
TITLE="SDL_BuildAudioCVT"
HREF="sdlbuildaudiocvt.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlfreewav.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlbuildaudiocvt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLAUDIOCVT"
></A
>SDL_AudioCVT</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN6884"
></A
><H2
>Name</H2
>SDL_AudioCVT&nbsp;--&nbsp;Audio Conversion Structure</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6887"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
int needed;
Uint16 src_format;
Uint16 dest_format;
double rate_incr;
Uint8 *buf;
int len;
int len_cvt;
int len_mult;
double len_ratio;
void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
int filter_index;
} SDL_AudioCVT;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6890"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN6892"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>needed</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Set to one if the conversion is possible</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>src_format</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio format of the source</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>dest_format</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio format of the destination</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>rate_incr</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Rate conversion increment</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio buffer</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Length of the original audio buffer in bytes</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>len_cvt</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Length of converted audio buffer in bytes (calculated)</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> must be <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
> bytes in size(calculated)</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>len_ratio</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Final audio size is <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>len_ratio</I
></TT
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>filters[10](..)</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Pointers to functions needed for this conversion</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>filter_index</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Current conversion function</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6944"
></A
><H2
>Description</H2
><P
>The <SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
> is used to convert audio data between different formats. A <SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
> structure is created with the <A
HREF="sdlbuildaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_BuildAudioCVT</TT
></A
> function, while the actual conversion is done by the <A
HREF="sdlconvertaudio.html"
><TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
></A
> function.</P
><P
>Many of the fields in the <SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
> structure should be considered private and their function will not be discussed here.</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><SPAN
CLASS="TYPE"
>Uint8 *</SPAN
><TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
></DT
><DD
><P
>This points to the audio data that will be used in the conversion. It is both the source and the destination, which means the converted audio data overwrites the original data. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure <TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> is large enough. See below.</P
></DD
><DT
><SPAN
CLASS="TYPE"
>int</SPAN
> <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
></DT
><DD
><P
>This is the length of the original audio data in bytes.</P
></DD
><DT
><SPAN
CLASS="TYPE"
>int</SPAN
> <TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
></DT
><DD
><P
>As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data. The length of <TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> should be <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
>.</P
></DD
><DT
><SPAN
CLASS="TYPE"
>double</SPAN
> <TT
CLASS="STRUCTFIELD"
><I
>len_ratio</I
></TT
></DT
><DD
><P
>When you have finished converting your audio data, you need to know how much of your audio buffer is valid. <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>len_ratio</I
></TT
> is the size of the converted audio data in bytes. This is very similar to <TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
>, however when the convert audio data is shorter than the original <TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
> would be 1. <TT
CLASS="STRUCTFIELD"
><I
>len_ratio</I
></TT
>, on the other hand, would be a fractional number between 0 and 1.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6989"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlbuildaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_BuildAudioCVT</TT
></A
>,
<A
HREF="sdlconvertaudio.html"
><TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
></A
>,
<A
HREF="sdlaudiospec.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_AudioSpec</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlfreewav.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlbuildaudiocvt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_FreeWAV</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_BuildAudioCVT</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,589 @@
<HTML
><HEAD
><TITLE
>SDL_AudioSpec</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Audio"
HREF="audio.html"><LINK
REL="PREVIOUS"
TITLE="Audio"
HREF="audio.html"><LINK
REL="NEXT"
TITLE="SDL_OpenAudio"
HREF="sdlopenaudio.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="audio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlopenaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLAUDIOSPEC"
></A
>SDL_AudioSpec</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN6507"
></A
><H2
>Name</H2
>SDL_AudioSpec&nbsp;--&nbsp;Audio Specification Structure</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6510"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
int freq;
Uint16 format;
Uint8 channels;
Uint8 silence;
Uint16 samples;
Uint32 size;
void (*callback)(void *userdata, Uint8 *stream, int len);
void *userdata;
} SDL_AudioSpec;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6513"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN6515"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>freq</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio frequency in samples per second</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>format</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio data format</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>channels</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Number of channels: 1 mono, 2 stereo</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>silence</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio buffer silence value (calculated)</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>samples</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio buffer size in samples</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>size</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Audio buffer size in bytes (calculated)</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>callback(..)</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Callback function for filling the audio buffer</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>userdata</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Pointer the user data which is passed to the callback function</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6550"
></A
><H2
>Description</H2
><P
>The <SPAN
CLASS="STRUCTNAME"
>SDL_AudioSpec</SPAN
> structure is used to describe the format of some audio data. This structure is used by <A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio</TT
></A
> and <A
HREF="sdlloadwav.html"
><TT
CLASS="FUNCTION"
>SDL_LoadWAV</TT
></A
>. While all fields are used by <TT
CLASS="FUNCTION"
>SDL_OpenAudio</TT
> only <TT
CLASS="STRUCTFIELD"
><I
>freq</I
></TT
>, <TT
CLASS="STRUCTFIELD"
><I
>format</I
></TT
>, <TT
CLASS="STRUCTFIELD"
><I
>samples</I
></TT
> and <TT
CLASS="STRUCTFIELD"
><I
>channels</I
></TT
> are used by <TT
CLASS="FUNCTION"
>SDL_LoadWAV</TT
>. We will detail these common members here.</P
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN6564"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>freq</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>format</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Specifies the size and type of each sample element
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>AUDIO_U8</TT
></DT
><DD
><P
>Unsigned 8-bit samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_S8</TT
></DT
><DD
><P
>Signed 8-bit samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_U16</TT
> or <TT
CLASS="LITERAL"
>AUDIO_U16LSB</TT
></DT
><DD
><P
>Unsigned 16-bit little-endian samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_S16</TT
> or <TT
CLASS="LITERAL"
>AUDIO_S16LSB</TT
></DT
><DD
><P
>Signed 16-bit little-endian samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_U16MSB</TT
></DT
><DD
><P
>Unsigned 16-bit big-endian samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_S16MSB</TT
></DT
><DD
><P
>Signed 16-bit big-endian samples</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_U16SYS</TT
></DT
><DD
><P
>Either <TT
CLASS="LITERAL"
>AUDIO_U16LSB</TT
> or <TT
CLASS="LITERAL"
>AUDIO_U16MSB</TT
> depending on you systems endianness</P
></DD
><DT
><TT
CLASS="LITERAL"
>AUDIO_S16SYS</TT
></DT
><DD
><P
>Either <TT
CLASS="LITERAL"
>AUDIO_S16LSB</TT
> or <TT
CLASS="LITERAL"
>AUDIO_S16MSB</TT
> depending on you systems endianness</P
></DD
></DL
></DIV
></P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>channels</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>The number of seperate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>samples</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>When used with <A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio</TT
></A
> this refers to the size of the audio buffer in samples. A sample a chunk of audio data of the size specified in <TT
CLASS="PARAMETER"
><I
>format</I
></TT
> mulitplied by the number of channels. When the <SPAN
CLASS="STRUCTNAME"
>SDL_AudioSpec</SPAN
> is used with <A
HREF="sdlloadwav.html"
><TT
CLASS="FUNCTION"
>SDL_LoadWAV</TT
></A
> <TT
CLASS="STRUCTFIELD"
><I
>samples</I
></TT
> is set to 4096.</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6639"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio</TT
></A
>,
<A
HREF="sdlloadwav.html"
><TT
CLASS="FUNCTION"
>SDL_LoadWAV</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlopenaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Audio</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_OpenAudio</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,339 @@
<HTML
><HEAD
><TITLE
>SDL_BlitSurface</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Video"
HREF="video.html"><LINK
REL="PREVIOUS"
TITLE="SDL_ConvertSurface"
HREF="sdlconvertsurface.html"><LINK
REL="NEXT"
TITLE="SDL_FillRect"
HREF="sdlfillrect.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlconvertsurface.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlfillrect.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLBLITSURFACE"
></A
>SDL_BlitSurface</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN2299"
></A
><H2
>Name</H2
>SDL_BlitSurface&nbsp;--&nbsp;This performs a fast blit from the source surface to the destination surface.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN2302"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN2303"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_BlitSurface</B
></CODE
>(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN2309"
></A
><H2
>Description</H2
><P
>This performs a fast blit from the source surface to the destination surface.</P
><P
>The width and height in <TT
CLASS="PARAMETER"
><I
>srcrect</I
></TT
> determine the
size of the copied rectangle. Only the position is used in the
<TT
CLASS="PARAMETER"
><I
>dstrect</I
></TT
> (the width and height are ignored).</P
><P
>If <TT
CLASS="PARAMETER"
><I
>srcrect</I
></TT
> is <TT
CLASS="LITERAL"
>NULL</TT
>, the
entire surface is copied. If <TT
CLASS="PARAMETER"
><I
>dstrect</I
></TT
> is
<TT
CLASS="LITERAL"
>NULL</TT
>, then the destination position (upper left
corner) is (0, 0).</P
><P
>The final blit rectangle is saved in
<TT
CLASS="PARAMETER"
><I
>dstrect</I
></TT
> after all clipping is performed
(<TT
CLASS="PARAMETER"
><I
>srcrect</I
></TT
> is not modified).</P
><P
>The blit function should not be called on a locked surface.</P
><P
>The results of blitting operations vary greatly depending on whether <TT
CLASS="LITERAL"
>SDL_SRCAPLHA</TT
> is set or not. See <A
HREF="sdlsetalpha.html"
>SDL_SetAlpha</A
> for an explaination of how this affects your results. Colorkeying and alpha attributes also interact with surface blitting, as the following pseudo-code should hopefully explain.
<PRE
CLASS="PROGRAMLISTING"
>if (source surface has SDL_SRCALPHA set) {
if (source surface has alpha channel (that is, format-&#62;Amask != 0))
blit using per-pixel alpha, ignoring any colour key
else {
if (source surface has SDL_SRCCOLORKEY set)
blit using the colour key AND the per-surface alpha value
else
blit using the per-surface alpha value
}
} else {
if (source surface has SDL_SRCCOLORKEY set)
blit using the colour key
else
ordinary opaque rectangular blit
}</PRE
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN2328"
></A
><H2
>Return Value</H2
><P
>If the blit is successful, it returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
>,
otherwise it returns <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
>.</P
><P
>If either of the surfaces were in video memory, and the blit returns
<SPAN
CLASS="RETURNVALUE"
>-2</SPAN
>, the video memory was lost, so it should be
reloaded with artwork and re-blitted:
<PRE
CLASS="PROGRAMLISTING"
> while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
while ( SDL_LockSurface(image)) &#60; 0 )
SDL_Delay(10);
-- Write image pixels to image-&#62;pixels --
SDL_UnlockSurface(image);
}</PRE
>
This happens under DirectX 5.0 when the system switches away from your
fullscreen application. Locking the surface will also fail until you
have access to the video memory again.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN2336"
></A
><H2
>See Also</H2
><P
><A
HREF="sdllocksurface.html"
><TT
CLASS="FUNCTION"
>SDL_LockSurface</TT
></A
>,
<A
HREF="sdlfillrect.html"
><TT
CLASS="FUNCTION"
>SDL_FillRect</TT
></A
>,
<A
HREF="sdlsurface.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Surface</SPAN
></A
>,
<A
HREF="sdlrect.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_Rect</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlconvertsurface.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlfillrect.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_ConvertSurface</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="video.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_FillRect</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,291 @@
<HTML
><HEAD
><TITLE
>SDL_BuildAudioCVT</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Audio"
HREF="audio.html"><LINK
REL="PREVIOUS"
TITLE="SDL_AudioCVT"
HREF="sdlaudiocvt.html"><LINK
REL="NEXT"
TITLE="SDL_ConvertAudio"
HREF="sdlconvertaudio.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlaudiocvt.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlconvertaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLBUILDAUDIOCVT"
></A
>SDL_BuildAudioCVT</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7002"
></A
><H2
>Name</H2
>SDL_BuildAudioCVT&nbsp;--&nbsp;Initializes a SDL_AudioCVT structure for conversion</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7005"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7006"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_BuildAudioCVT</B
></CODE
>(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7012"
></A
><H2
>Description</H2
><P
>Before an <A
HREF="sdlaudiocvt.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
></A
> structure can be used to convert audio data it must be initialized with source and destination information. </P
><P
><TT
CLASS="PARAMETER"
><I
>src_format</I
></TT
> and <TT
CLASS="PARAMETER"
><I
>dst_format</I
></TT
> are the source and destination format of the conversion. (For information on audio formats see <A
HREF="sdlaudiospec.html"
><SPAN
CLASS="STRUCTNAME"
> SDL_AudioSpec</SPAN
></A
>). <TT
CLASS="PARAMETER"
><I
>src_channels</I
></TT
> and <TT
CLASS="PARAMETER"
><I
>dst_channels</I
></TT
> are the number of channels in the source and destination formats. Finally, <TT
CLASS="PARAMETER"
><I
>src_rate</I
></TT
> and <TT
CLASS="PARAMETER"
><I
>dst_rate</I
></TT
> are the frequency or samples-per-second of the source and destination formats. Once again, see <A
HREF="sdlaudiospec.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_AudioSpec</SPAN
></A
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7028"
></A
><H2
>Return Values</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> if the filter could not be built or 1 if it could.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7032"
></A
><H2
>Examples</H2
><P
>See <A
HREF="sdlconvertaudio.html"
><TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
></A
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7037"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlconvertaudio.html"
><TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
></A
>,
<A
HREF="sdlaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_AudioCVT</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlaudiocvt.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlconvertaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_AudioCVT</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_ConvertAudio</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

359
SDL/docs/html/sdlcd.html Normal file
View file

@ -0,0 +1,359 @@
<HTML
><HEAD
><TITLE
>SDL_CD</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDClose"
HREF="sdlcdclose.html"><LINK
REL="NEXT"
TITLE="SDL_CDtrack"
HREF="sdlcdtrack.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdtrack.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCD"
></A
>SDL_CD</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7566"
></A
><H2
>Name</H2
>SDL_CD&nbsp;--&nbsp;CDROM Drive Information</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7569"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
int id;
CDstatus status;
int numtracks;
int cur_track;
int cur_frame;
SDL_CDtrack track[SDL_MAX_TRACKS+1];
} SDL_CD;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7572"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN7574"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>id</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Private drive identifier</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>status</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Drive <A
HREF="sdlcdstatus.html"
>status</A
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>numtracks</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Number of tracks on the CD</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>cur_track</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Current track</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>cur_frame</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Current frame offset within the track</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>track</I
></TT
>[SDL_MAX_TRACKS+1]</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Array of track descriptions. (see <A
HREF="sdlcdtrack.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CDtrack</SPAN
></A
>)</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7604"
></A
><H2
>Description</H2
><P
>An <SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
> structure is returned by <A
HREF="sdlcdopen.html"
><TT
CLASS="FUNCTION"
>SDL_CDOpen</TT
></A
>. It represents an opened CDROM device and stores information on the layout of the tracks on the disc.</P
><P
>A frame is the base data unit of a CD. <TT
CLASS="LITERAL"
>CD_FPS</TT
> frames is equal to 1 second of music. SDL provides two macros for converting between time and frames: <TT
CLASS="LITERAL"
>FRAMES_TO_MSF(f, M,S,F)</TT
> and <TT
CLASS="LITERAL"
>MSF_TO_FRAMES</TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7614"
></A
><H2
>Examples</H2
><PRE
CLASS="PROGRAMLISTING"
>int min, sec, frame;
int frame_offset;
FRAMES_TO_MSF(cdrom-&#62;cur_frame, &#38;min, &#38;sec, &#38;frame);
printf("Current Position: %d minutes, %d seconds, %d frames\n", min, sec, frame);
frame_offset=MSF_TO_FRAMES(min, sec, frame);</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7617"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdopen.html"
><TT
CLASS="FUNCTION"
>SDL_CDOpen</TT
></A
>,
<A
HREF="sdlcdtrack.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CDtrack</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdtrack.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDClose</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDtrack</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,217 @@
<HTML
><HEAD
><TITLE
>SDL_CDClose</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDEject"
HREF="sdlcdeject.html"><LINK
REL="NEXT"
TITLE="SDL_CD"
HREF="sdlcd.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdeject.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcd.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDCLOSE"
></A
>SDL_CDClose</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7541"
></A
><H2
>Name</H2
>SDL_CDClose&nbsp;--&nbsp;Closes a SDL_CD handle</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7544"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7545"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>void <B
CLASS="FSFUNC"
>SDL_CDClose</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7551"
></A
><H2
>Description</H2
><P
>Closes the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
> handle.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7555"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdopen.html"
><TT
CLASS="FUNCTION"
>SDL_CDOpen</TT
></A
>,
<A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdeject.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcd.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDEject</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CD</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,226 @@
<HTML
><HEAD
><TITLE
>SDL_CDEject</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDStop"
HREF="sdlcdstop.html"><LINK
REL="NEXT"
TITLE="SDL_CDClose"
HREF="sdlcdclose.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdstop.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdclose.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDEJECT"
></A
>SDL_CDEject</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7513"
></A
><H2
>Name</H2
>SDL_CDEject&nbsp;--&nbsp;Ejects a CDROM</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7516"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7517"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDEject</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7523"
></A
><H2
>Description</H2
><P
>Ejects the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7527"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7532"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdstop.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdclose.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDStop</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDClose</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,239 @@
<HTML
><HEAD
><TITLE
>SDL_CDName</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDNumDrives"
HREF="sdlcdnumdrives.html"><LINK
REL="NEXT"
TITLE="SDL_CDOpen"
HREF="sdlcdopen.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdnumdrives.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdopen.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDNAME"
></A
>SDL_CDName</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7240"
></A
><H2
>Name</H2
>SDL_CDName&nbsp;--&nbsp;Returns a human-readable, system-dependent identifier for the CD-ROM.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7243"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7244"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>const char *<B
CLASS="FSFUNC"
>SDL_CDName</B
></CODE
>(int drive);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7250"
></A
><H2
>Description</H2
><P
>Returns a human-readable, system-dependent identifier for the CD-ROM. <TT
CLASS="PARAMETER"
><I
>drive</I
></TT
> is the index of the drive. Drive indices start to 0 and end at <TT
CLASS="FUNCTION"
>SDL_CDNumDrives()</TT
>-1.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7255"
></A
><H2
>Examples</H2
><P
><P
></P
><UL
><LI
><P
>"/dev/cdrom"</P
></LI
><LI
><P
>"E:"</P
></LI
><LI
><P
>"/dev/disk/ide/1/master"</P
></LI
></UL
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7265"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdnumdrives.html"
><TT
CLASS="FUNCTION"
>SDL_CDNumDrives</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdnumdrives.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdopen.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDNumDrives</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDOpen</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,205 @@
<HTML
><HEAD
><TITLE
>SDL_CDNumDrives</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="NEXT"
TITLE="SDL_CDName"
HREF="sdlcdname.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="cdrom.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdname.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDNUMDRIVES"
></A
>SDL_CDNumDrives</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7218"
></A
><H2
>Name</H2
>SDL_CDNumDrives&nbsp;--&nbsp;Returns the number of CD-ROM drives on the system.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7221"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7222"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDNumDrives</B
></CODE
>(void);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7228"
></A
><H2
>Description</H2
><P
>Returns the number of CD-ROM drives on the system.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7231"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdopen.html"
><TT
CLASS="FUNCTION"
>SDL_CDOpen</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdname.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>CD-ROM</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDName</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,275 @@
<HTML
><HEAD
><TITLE
>SDL_CDOpen</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDName"
HREF="sdlcdname.html"><LINK
REL="NEXT"
TITLE="SDL_CDStatus"
HREF="sdlcdstatus.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdname.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdstatus.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDOPEN"
></A
>SDL_CDOpen</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7274"
></A
><H2
>Name</H2
>SDL_CDOpen&nbsp;--&nbsp;Opens a CD-ROM drive for access.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7277"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7278"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>SDL_CD *<B
CLASS="FSFUNC"
>SDL_CDOpen</B
></CODE
>(int drive);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7284"
></A
><H2
>Description</H2
><P
>Opens a CD-ROM drive for access. It returns a <A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
> structure on success, or <TT
CLASS="LITERAL"
>NULL</TT
> if the drive was invalid or busy. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a <TT
CLASS="LITERAL"
>NULL</TT
> CD-ROM handle. </P
><P
>Drives are numbered starting with 0.
Drive 0 is the system default CD-ROM.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7292"
></A
><H2
>Examples</H2
><PRE
CLASS="PROGRAMLISTING"
>SDL_CD *cdrom;
int cur_track;
int min, sec, frame;
SDL_Init(SDL_INIT_CDROM);
atexit(SDL_Quit);
/* Check for CD drives */
if(!SDL_CDNumDrives()){
/* None found */
fprintf(stderr, "No CDROM devices available\n");
exit(-1);
}
/* Open the default drive */
cdrom=SDL_CDOpen(0);
/* Did if open? Check if cdrom is NULL */
if(!cdrom){
fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError());
exit(-1);
}
/* Print Volume info */
printf("Name: %s\n", SDL_CDName(0));
printf("Tracks: %d\n", cdrom-&#62;numtracks);
for(cur_track=0;cur_track &#60; cdrom-&#62;numtracks; cur_track++){
FRAMES_TO_MSF(cdrom-&#62;track[cur_track].length, &#38;min, &#38;sec, &#38;frame);
printf("\tTrack %d: Length %d:%d\n", cur_track, min, sec);
}
SDL_CDClose(cdrom);</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7295"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
>,
<A
HREF="sdlcdtrack.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CDtrack</SPAN
></A
>,
<A
HREF="sdlcdclose.html"
><TT
CLASS="FUNCTION"
>SDL_CDClose</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdname.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdstatus.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDName</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDStatus</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,233 @@
<HTML
><HEAD
><TITLE
>SDL_CDPause</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDPlayTracks"
HREF="sdlcdplaytracks.html"><LINK
REL="NEXT"
TITLE="SDL_CDResume"
HREF="sdlcdresume.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdplaytracks.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdresume.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDPAUSE"
></A
>SDL_CDPause</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7425"
></A
><H2
>Name</H2
>SDL_CDPause&nbsp;--&nbsp;Pauses a CDROM</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7428"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7429"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDPause</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7435"
></A
><H2
>Description</H2
><P
>Pauses play on the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7439"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7444"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdplay.html"
><TT
CLASS="FUNCTION"
>SDL_CDPlay</TT
></A
>,
<A
HREF="sdlcdresume.html"
><TT
CLASS="FUNCTION"
>SDL_CDResume</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdplaytracks.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdresume.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDPlayTracks</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDResume</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,243 @@
<HTML
><HEAD
><TITLE
>SDL_CDPlay</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDStatus"
HREF="sdlcdstatus.html"><LINK
REL="NEXT"
TITLE="SDL_CDPlayTracks"
HREF="sdlcdplaytracks.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdstatus.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdplaytracks.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDPLAY"
></A
>SDL_CDPlay</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7343"
></A
><H2
>Name</H2
>SDL_CDPlay&nbsp;--&nbsp;Play a CD</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7346"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7347"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDPlay</B
></CODE
>(SDL_CD *cdrom, int start, int length);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7353"
></A
><H2
>Description</H2
><P
>Plays the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
>, starting a frame <TT
CLASS="PARAMETER"
><I
>start</I
></TT
> for <TT
CLASS="PARAMETER"
><I
>length</I
></TT
> frames.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7359"
></A
><H2
>Return Values</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7364"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdplaytracks.html"
><TT
CLASS="FUNCTION"
>SDL_CDPlayTracks</TT
></A
>,
<A
HREF="sdlcdstop.html"
><TT
CLASS="FUNCTION"
>SDL_CDStop</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdstatus.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdplaytracks.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDStatus</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDPlayTracks</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,325 @@
<HTML
><HEAD
><TITLE
>SDL_CDPlayTracks</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDPlay"
HREF="sdlcdplay.html"><LINK
REL="NEXT"
TITLE="SDL_CDPause"
HREF="sdlcdpause.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdplay.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdpause.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDPLAYTRACKS"
></A
>SDL_CDPlayTracks</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7375"
></A
><H2
>Name</H2
>SDL_CDPlayTracks&nbsp;--&nbsp;Play the given CD track(s)</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7378"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7379"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDPlayTracks</B
></CODE
>(SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes));</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7385"
></A
><H2
>Description</H2
><P
><TT
CLASS="FUNCTION"
>SDL_CDPlayTracks</TT
> plays the given CD starting at track
<TT
CLASS="PARAMETER"
><I
>start_track</I
></TT
>, for <TT
CLASS="PARAMETER"
><I
>ntracks</I
></TT
> tracks. </P
><P
><TT
CLASS="PARAMETER"
><I
>start_frame</I
></TT
> is the frame offset, from the beginning of the <TT
CLASS="PARAMETER"
><I
>start_track</I
></TT
>, at which to start. <TT
CLASS="PARAMETER"
><I
>nframes</I
></TT
> is the frame offset, from the beginning of the last track (<TT
CLASS="PARAMETER"
><I
>start_track</I
></TT
>+<TT
CLASS="PARAMETER"
><I
>ntracks</I
></TT
>), at which to end playing.</P
><P
><TT
CLASS="FUNCTION"
>SDL_CDPlayTracks</TT
> should only be called after calling
<A
HREF="sdlcdstatus.html"
><TT
CLASS="FUNCTION"
>SDL_CDStatus</TT
></A
>
to get track information about the CD.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>Data tracks are ignored.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7403"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
>, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
>
if there was an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7408"
></A
><H2
>Examples</H2
><P
><PRE
CLASS="PROGRAMLISTING"
>/* assuming cdrom is a previously opened device */
/* Play the entire CD */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
/* Play the first track */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
SDL_CDPlayTracks(cdrom, 0, 0, 1, 0);
/* Play first 15 seconds of the 2nd track */
if(CD_INDRIVE(SDL_CDStatus(cdrom)))
SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);</PRE
>
&#13;</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7412"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdplay.html"
><TT
CLASS="FUNCTION"
>SDL_CDPlay</TT
></A
>,
<A
HREF="sdlcdstatus.html"
><TT
CLASS="FUNCTION"
>SDL_CDStatus</TT
></A
>,
<A
HREF="sdlcd.html"
><TT
CLASS="FUNCTION"
>SDL_CD</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdplay.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdpause.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDPlay</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDPause</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,233 @@
<HTML
><HEAD
><TITLE
>SDL_CDResume</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDPause"
HREF="sdlcdpause.html"><LINK
REL="NEXT"
TITLE="SDL_CDStop"
HREF="sdlcdstop.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdpause.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdstop.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDRESUME"
></A
>SDL_CDResume</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7455"
></A
><H2
>Name</H2
>SDL_CDResume&nbsp;--&nbsp;Resumes a CDROM</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7458"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7459"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDResume</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7465"
></A
><H2
>Description</H2
><P
>Resumes play on the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7469"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7474"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdplay.html"
><TT
CLASS="FUNCTION"
>SDL_CDPlay</TT
></A
>,
<A
HREF="sdlcdpause.html"
><TT
CLASS="FUNCTION"
>SDL_CDPause</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdpause.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdstop.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDPause</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDStop</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,273 @@
<HTML
><HEAD
><TITLE
>SDL_CDStatus</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDOpen"
HREF="sdlcdopen.html"><LINK
REL="NEXT"
TITLE="SDL_CDPlay"
HREF="sdlcdplay.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdopen.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdplay.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDSTATUS"
></A
>SDL_CDStatus</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7308"
></A
><H2
>Name</H2
>SDL_CDStatus&nbsp;--&nbsp;Returns the current status of the given drive.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7311"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7312"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>CDstatus <B
CLASS="FSFUNC"
>SDL_CDStatus</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>/* Given a status, returns true if there's a disk in the drive */
#define CD_INDRIVE(status) ((int)status &#62; 0)</PRE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7319"
></A
><H2
>Description</H2
><P
>This function returns the current status of the given drive. Status is described like so:
<PRE
CLASS="PROGRAMLISTING"
>typedef enum {
CD_TRAYEMPTY,
CD_STOPPED,
CD_PLAYING,
CD_PAUSED,
CD_ERROR = -1
} CDstatus;</PRE
></P
><P
>If the drive has a CD in it, the table of contents of the CD and current
play position of the CD will be stored in the SDL_CD structure.</P
><P
>The macro <TT
CLASS="LITERAL"
>CD_INDRIVE</TT
> is provided for convenience,
and given a status returns true if there's a disk in the drive.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
><TT
CLASS="FUNCTION"
>SDL_CDStatus</TT
> also updates the <A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
> structure passed to it.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7331"
></A
><H2
>Example</H2
><PRE
CLASS="PROGRAMLISTING"
>int playTrack(int track)
{
int playing = 0;
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
/* clamp to the actual number of tracks on the CD */
if (track &#62;= cdrom-&#62;numtracks) {
track = cdrom-&#62;numtracks-1;
}
if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
playing = 1;
}
}
return playing;
}</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7334"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcd.html"
><TT
CLASS="FUNCTION"
>SDL_CD</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdopen.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdplay.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDOpen</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDPlay</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,226 @@
<HTML
><HEAD
><TITLE
>SDL_CDStop</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CDResume"
HREF="sdlcdresume.html"><LINK
REL="NEXT"
TITLE="SDL_CDEject"
HREF="sdlcdeject.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcdresume.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcdeject.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDSTOP"
></A
>SDL_CDStop</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7485"
></A
><H2
>Name</H2
>SDL_CDStop&nbsp;--&nbsp;Stops a CDROM</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7488"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7489"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CDStop</B
></CODE
>(SDL_CD *cdrom);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7495"
></A
><H2
>Description</H2
><P
>Stops play on the given <TT
CLASS="PARAMETER"
><I
>cdrom</I
></TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7499"
></A
><H2
>Return Value</H2
><P
>Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7504"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcdplay.html"
><TT
CLASS="FUNCTION"
>SDL_CDPlay</TT
></A
>,</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcdresume.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcdeject.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CDResume</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CDEject</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,313 @@
<HTML
><HEAD
><TITLE
>SDL_CDtrack</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="CD-ROM"
HREF="cdrom.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CD"
HREF="sdlcd.html"><LINK
REL="NEXT"
TITLE="Multi-threaded Programming"
HREF="thread.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcd.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="thread.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCDTRACK"
></A
>SDL_CDtrack</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7628"
></A
><H2
>Name</H2
>SDL_CDtrack&nbsp;--&nbsp;CD Track Information Structure</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7631"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 id;
Uint8 type;
Uint32 length;
Uint32 offset;
} SDL_CDtrack;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7634"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN7636"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>id</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Track number (0-99)</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>type</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="LITERAL"
>SDL_AUDIO_TRACK</TT
> or <TT
CLASS="LITERAL"
>SDL_DATA_TRACK</TT
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>length</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Length, in frames, of this track</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>offset</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Frame offset to the beginning of this track</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7657"
></A
><H2
>Description</H2
><P
><SPAN
CLASS="STRUCTNAME"
>SDL_CDtrack</SPAN
> stores data on each track on a CD, its fields should be pretty self explainatory. It is a member a the <A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
> structure.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>Frames can be converted to standard timings. There are <TT
CLASS="LITERAL"
>CD_FPS</TT
> frames per second, so <SPAN
CLASS="STRUCTNAME"
>SDL_CDtrack</SPAN
>.<TT
CLASS="STRUCTFIELD"
><I
>length</I
></TT
>/<TT
CLASS="LITERAL"
>CD_FPS</TT
>=length_in_seconds.</P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7669"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcd.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_CD</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcd.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="thread.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CD</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Multi-threaded Programming</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,205 @@
<HTML
><HEAD
><TITLE
>SDL_CloseAudio</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Audio"
HREF="audio.html"><LINK
REL="PREVIOUS"
TITLE="SDL_UnlockAudio"
HREF="sdlunlockaudio.html"><LINK
REL="NEXT"
TITLE="CD-ROM"
HREF="cdrom.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlunlockaudio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="cdrom.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCLOSEAUDIO"
></A
>SDL_CloseAudio</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7180"
></A
><H2
>Name</H2
>SDL_CloseAudio&nbsp;--&nbsp;Shuts down audio processing and closes the audio device.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7183"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7184"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>void <B
CLASS="FSFUNC"
>SDL_CloseAudio</B
></CODE
>(void);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7190"
></A
><H2
>Description</H2
><P
>This function shuts down audio processing and closes the audio device.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7193"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio</TT
></A
> </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlunlockaudio.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="cdrom.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_UnlockAudio</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>CD-ROM</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

300
SDL/docs/html/sdlcolor.html Normal file
View file

@ -0,0 +1,300 @@
<HTML
><HEAD
><TITLE
>SDL_Color</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Video"
HREF="video.html"><LINK
REL="PREVIOUS"
TITLE="SDL_Rect"
HREF="sdlrect.html"><LINK
REL="NEXT"
TITLE="SDL_Palette"
HREF="sdlpalette.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlrect.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlpalette.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCOLOR"
></A
>SDL_Color</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN3082"
></A
><H2
>Name</H2
>SDL_Color&nbsp;--&nbsp;Format independent color description</DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3085"
></A
><H2
>Structure Definition</H2
><PRE
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 unused;
} SDL_Color;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3088"
></A
><H2
>Structure Data</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN3090"
></A
><P
></P
><TABLE
BORDER="0"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>r</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Red intensity</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>g</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Green intensity</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>b</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Blue intensity</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="STRUCTFIELD"
><I
>unused</I
></TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Unused</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3109"
></A
><H2
>Description</H2
><P
><SPAN
CLASS="STRUCTNAME"
>SDL_Color</SPAN
> describes a color in a format independent way. You can convert a <SPAN
CLASS="STRUCTNAME"
>SDL_Color</SPAN
> to a pixel value for a certain pixel format using <A
HREF="sdlmaprgb.html"
><TT
CLASS="FUNCTION"
>SDL_MapRGB</TT
></A
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3116"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlpixelformat.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_PixelFormat</SPAN
></A
>,
<A
HREF="sdlsetcolors.html"
><TT
CLASS="FUNCTION"
>SDL_SetColors</TT
></A
>,
<A
HREF="sdlpalette.html"
><TT
CLASS="FUNCTION"
>SDL_Palette</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlrect.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlpalette.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_Rect</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="video.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_Palette</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,224 @@
<HTML
><HEAD
><TITLE
>SDL_CondBroadcast</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Multi-threaded Programming"
HREF="thread.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CondSignal"
HREF="sdlcondsignal.html"><LINK
REL="NEXT"
TITLE="SDL_CondWait"
HREF="sdlcondwait.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcondsignal.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcondwait.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCONDBROADCAST"
></A
>SDL_CondBroadcast</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8337"
></A
><H2
>Name</H2
>SDL_CondBroadcast&nbsp;--&nbsp;Restart all threads waiting on a condition variable</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8340"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN8341"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"
#include "SDL_thread.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CondBroadcast</B
></CODE
>(SDL_cond *cond);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8347"
></A
><H2
>Description</H2
><P
>Restarts all threads that are waiting on the condition variable, <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
>. Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8353"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcondsignal.html"
><TT
CLASS="FUNCTION"
>SDL_CondSignal</TT
></A
>,
<A
HREF="sdlcondwait.html"
><TT
CLASS="FUNCTION"
>SDL_CondWait</TT
></A
>&#13;</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcondsignal.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcondwait.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CondSignal</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="thread.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CondWait</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,224 @@
<HTML
><HEAD
><TITLE
>SDL_CondSignal</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Multi-threaded Programming"
HREF="thread.html"><LINK
REL="PREVIOUS"
TITLE="SDL_DestroyCond"
HREF="sdldestroycond.html"><LINK
REL="NEXT"
TITLE="SDL_CondBroadcast"
HREF="sdlcondbroadcast.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdldestroycond.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcondbroadcast.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCONDSIGNAL"
></A
>SDL_CondSignal</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8310"
></A
><H2
>Name</H2
>SDL_CondSignal&nbsp;--&nbsp;Restart a thread wait on a condition variable</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8313"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN8314"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"
#include "SDL_thread.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CondSignal</B
></CODE
>(SDL_cond *cond);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8320"
></A
><H2
>Description</H2
><P
>Restart one of the threads that are waiting on the condition variable, <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
>. Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> on success of <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8326"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcondwait.html"
><TT
CLASS="FUNCTION"
>SDL_CondWait</TT
></A
>,
<A
HREF="sdlcondbroadcast.html"
><TT
CLASS="FUNCTION"
>SDL_CondBroadcast</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdldestroycond.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcondbroadcast.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_DestroyCond</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="thread.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CondBroadcast</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,231 @@
<HTML
><HEAD
><TITLE
>SDL_CondWait</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Multi-threaded Programming"
HREF="thread.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CondBroadcast"
HREF="sdlcondbroadcast.html"><LINK
REL="NEXT"
TITLE="SDL_CondWaitTimeout"
HREF="sdlcondwaittimeout.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcondbroadcast.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlcondwaittimeout.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCONDWAIT"
></A
>SDL_CondWait</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8364"
></A
><H2
>Name</H2
>SDL_CondWait&nbsp;--&nbsp;Wait on a condition variable</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8367"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN8368"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"
#include "SDL_thread.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CondWait</B
></CODE
>(SDL_cond *cond, SDL_mutex *mut);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8374"
></A
><H2
>Description</H2
><P
>Wait on the condition variable <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> and unlock the provided mutex. The mutex must the locked before entering this function. Returns <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> when it is signalled, or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8380"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcondwaittimeout.html"
><TT
CLASS="FUNCTION"
>SDL_CondWaitTimeout</TT
></A
>,
<A
HREF="sdlcondsignal.html"
><TT
CLASS="FUNCTION"
>SDL_CondSignal</TT
></A
>,
<A
HREF="sdlmutexp.html"
><TT
CLASS="FUNCTION"
>SDL_mutexP</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcondbroadcast.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlcondwaittimeout.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CondBroadcast</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="thread.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_CondWaitTimeout</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,230 @@
<HTML
><HEAD
><TITLE
>SDL_CondWaitTimeout</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Multi-threaded Programming"
HREF="thread.html"><LINK
REL="PREVIOUS"
TITLE="SDL_CondWait"
HREF="sdlcondwait.html"><LINK
REL="NEXT"
TITLE="Time"
HREF="time.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlcondwait.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="time.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCONDWAITTIMEOUT"
></A
>SDL_CondWaitTimeout</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8393"
></A
><H2
>Name</H2
>SDL_CondWaitTimeout&nbsp;--&nbsp;Wait on a condition variable, with timeout</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8396"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN8397"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"
#include "SDL_thread.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_CondWaitTimeout</B
></CODE
>(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8403"
></A
><H2
>Description</H2
><P
>Wait on the condition variable <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> for, at most, <TT
CLASS="PARAMETER"
><I
>ms</I
></TT
> milliseconds. <TT
CLASS="PARAMETER"
><I
>mut</I
></TT
> is unlocked so it must be locked when the function is called. Returns <TT
CLASS="LITERAL"
>SDL_MUTEX_TIMEDOUT</TT
> if the condition is not signalled in the allotted time, <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> if it was signalled or <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> on an error.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN8412"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlcondwait.html"
><TT
CLASS="FUNCTION"
>SDL_CondWait</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlcondwait.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="time.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_CondWait</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="thread.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Time</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View file

@ -0,0 +1,407 @@
<HTML
><HEAD
><TITLE
>SDL_ConvertAudio</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Audio"
HREF="audio.html"><LINK
REL="PREVIOUS"
TITLE="SDL_BuildAudioCVT"
HREF="sdlbuildaudiocvt.html"><LINK
REL="NEXT"
TITLE="SDL_MixAudio"
HREF="sdlmixaudio.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdlbuildaudiocvt.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlmixaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SDLCONVERTAUDIO"
></A
>SDL_ConvertAudio</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN7048"
></A
><H2
>Name</H2
>SDL_ConvertAudio&nbsp;--&nbsp;Convert audio data to a desired audio format.</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN7051"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN7052"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include "SDL.h"</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int <B
CLASS="FSFUNC"
>SDL_ConvertAudio</B
></CODE
>(SDL_AudioCVT *cvt);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7058"
></A
><H2
>Description</H2
><P
><TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
> takes one parameter, <TT
CLASS="PARAMETER"
><I
>cvt</I
></TT
>, which was previously initilized. Initilizing a <A
HREF="sdlaudiocvt.html"
><SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
></A
> is a two step process. First of all, the structure must be passed to <A
HREF="sdlbuildaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_BuildAudioCVT</TT
></A
> along with source and destination format parameters. Secondly, the <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> and <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
> fields must be setup. <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> should point to the audio data and <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
> should be set to the length of the audio data in bytes. Remember, the length of the buffer pointed to by <TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
> show be <TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>len_mult</I
></TT
> bytes in length.</P
><P
>Once the <SPAN
CLASS="STRUCTNAME"
>SDL_AudioCVT</SPAN
>structure is initilized then we can pass it to <TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
>, which will convert the audio data pointer to by <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
>. If <TT
CLASS="FUNCTION"
>SDL_ConvertAudio</TT
> returned <SPAN
CLASS="RETURNVALUE"
>0</SPAN
> then the conversion was completed successfully, otherwise <SPAN
CLASS="RETURNVALUE"
>-1</SPAN
> is returned.</P
><P
>If the conversion completed successfully then the converted audio data can be read from <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>buf</I
></TT
>. The amount of valid, converted, audio data in the buffer is equal to <SPAN
CLASS="STRUCTNAME"
>cvt</SPAN
>-&#62;<TT
CLASS="STRUCTFIELD"
><I
>len</I
></TT
>*<TT
CLASS="STRUCTFIELD"
><I
>cvt</I
></TT
>-&#62;<SPAN
CLASS="STRUCTNAME"
>len_ratio</SPAN
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7093"
></A
><H2
>Examples</H2
><PRE
CLASS="PROGRAMLISTING"
>/* Converting some WAV data to hardware format */
void my_audio_callback(void *userdata, Uint8 *stream, int len);
SDL_AudioSpec *desired, *obtained;
SDL_AudioSpec wav_spec;
SDL_AudioCVT wav_cvt;
Uint32 wav_len;
Uint8 *wav_buf;
int ret;
/* Allocated audio specs */
desired = malloc(sizeof(SDL_AudioSpec));
obtained = malloc(sizeof(SDL_AudioSpec));
/* Set desired format */
desired-&#62;freq=22050;
desired-&#62;format=AUDIO_S16LSB;
desired-&#62;samples=8192;
desired-&#62;callback=my_audio_callback;
desired-&#62;userdata=NULL;
/* Open the audio device */
if ( SDL_OpenAudio(desired, obtained) &#60; 0 ){
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
exit(-1);
}
free(desired);
/* Load the test.wav */
if( SDL_LoadWAV("test.wav", &#38;wav_spec, &#38;wav_buf, &#38;wav_len) == NULL ){
fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
SDL_CloseAudio();
free(obtained);
exit(-1);
}
/* Build AudioCVT */
ret = SDL_BuildAudioCVT(&#38;wav_cvt,
wav_spec.format, wav_spec.channels, wav_spec.freq,
obtained-&#62;format, obtained-&#62;channels, obtained-&#62;freq);
/* Check that the convert was built */
if(ret==-1){
fprintf(stderr, "Couldn't build converter!\n");
SDL_CloseAudio();
free(obtained);
SDL_FreeWAV(wav_buf);
}
/* Setup for conversion */
wav_cvt.buf = malloc(wav_len * wav_cvt.len_mult);
wav_cvt.len = wav_len;
memcpy(wav_cvt.buf, wav_buf, wav_len);
/* We can delete to original WAV data now */
SDL_FreeWAV(wav_buf);
/* And now we're ready to convert */
SDL_ConvertAudio(&#38;wav_cvt);
/* do whatever */
.
.
.
.
&#13;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN7096"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlbuildaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_BuildAudioCVT</TT
></A
>,
<A
HREF="sdlaudiocvt.html"
><TT
CLASS="FUNCTION"
>SDL_AudioCVT</TT
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlbuildaudiocvt.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlmixaudio.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_BuildAudioCVT</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="audio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_MixAudio</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

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