Compare commits

..

26 Commits

Author SHA1 Message Date
James Turk
002cc1b5e0 fixed a /0 bug 2007-05-13 15:18:37 +00:00
James Turk
4f3a81d4bd 0.1 progress 2006-03-07 23:28:09 +00:00
James Turk
6ab43b80d9 removed SpinDoctor, oops 2005-11-23 19:38:51 +00:00
James Turk
e0ceb50565 files3 2005-11-19 05:31:28 +00:00
James Turk
54a5bed091 *** empty log message *** 2005-11-19 05:30:53 +00:00
James Turk
312afef4ca .txt->.html 2005-11-15 06:01:12 +00:00
James Turk
f5486d8b1b no need for LGPL, only will confuse people 2005-11-15 05:49:56 +00:00
James Turk
2f47a139ef .txt->.html 2005-11-15 05:48:31 +00:00
James Turk
b62c66f570 .txt->.html 2005-11-15 05:06:00 +00:00
James Turk
48b29114f5 .txt->.html 2005-11-15 04:11:05 +00:00
James Turk
22d81ed146 .txt->.html 2005-11-15 04:01:43 +00:00
James Turk
4fb8e96267 windowed/fullscreen fix 2005-11-15 02:59:08 +00:00
James Turk
ea8ba7d458 tutorial index 2005-11-14 20:14:18 +00:00
James Turk
d2c3194bdb added tutorial 01 2005-11-14 20:02:39 +00:00
James Turk
b1996330df *** empty log message *** 2005-11-13 08:01:04 +00:00
James Turk
f7bc2ac6dd documentation cleanup 2005-11-13 07:59:48 +00:00
James Turk
9c8f42df8d Updated website for MT 2005-10-30 21:08:57 +00:00
James Turk
8b16a21ec3 abstracted AudioCore, created OALAudioCore 2005-10-28 22:13:03 +00:00
James Turk
3ba1927472 precondition checks for run() 2005-10-28 22:12:44 +00:00
James Turk
39280103f6 OpenAL 1.0/1.1 issues 2005-10-15 04:57:19 +00:00
James Turk
d8751e1d71 commenting 2005-10-15 04:56:37 +00:00
James Turk
ab008b050f Pen circle drawing revisited 2005-08-23 21:55:03 +00:00
James Turk
2d8ba79bf0 win32-mingw guidelines 2005-08-19 07:23:38 +00:00
James Turk
b433bda56d linux-gcc binary release guidelines 2005-08-19 06:14:49 +00:00
James Turk
293cc496b9 create archive in correct location 2005-08-19 05:42:51 +00:00
James Turk
215f02ad9e release script updated 2005-08-19 05:34:58 +00:00
62 changed files with 1395 additions and 1357 deletions

View File

@ -1,10 +1,22 @@
Changelog for Photon
$Id: CHANGELOG.txt,v 1.11 2005/08/18 07:05:34 cozman Exp $
$Id: CHANGELOG.txt,v 1.15 2005/11/15 06:01:12 cozman Exp $
! : Major Changes (potentially breaking existing code)
+ : New Features
* : Minor Changes (bugfixes and behind-the-scenes changes)
0.1.0
! Changed createDisplay to use an enum to set fullscreen/windowed mode.
* Added first official tutorial.
* Converted text-file documentation to HTML documentation, allowing online
docs to more closely mirror offline docs in content.
* Major documentation sweep, much more useful for casual users. Also fixed
tons of documentation mismatches.
* Fixed bug where app would hang if run() was called with no active state or
before the display was created.
* Changed AudioCore to be pure virtual with OALAudioCore implementing it.
* Fixed issues with OpenAL 1.1 new types.
* Rewrote circle drawing code in Pen, major speed up.
0.0.2 - Released 2005-18-08
! Removed InputListener, opting to move features into State class.

41
CREDITS.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU">
<head>
<title>Photon Credits</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
</head>
<body>
<!-- cut here for DevBlog -->
<p>The following people have contributed code to photon:</p>
<ul>
<li><a href="mailto:cozman@users.sf.net">James Turk</a> - Main Developer</li>
</ul>
<p> ..yeah this list is too short right now, so help out ;)</p>
<hr />
<p>In addition, I'd like to thank:</p>
<ul>
<li><a href="http://sourceforge.net">Sourceforge.net</a> - Providing hosting for the project and CVS.</li>
<li>The <a href="http://gamedev.net">GameDev.net</a> community for answering my (often complex) questions</li>
<li>Richard 'Superpig' Fine for his <a href="http://www.gamedev.net/reference/programming/features/enginuity1/">Enginuity articles</a>, which influenced my Kernel/Task design.</li>
<li>Jesse Maurais and <a href="http://devmaster.net">DevMaster.net</a> for the OpenAL tutorials</li>
<li>Everyone responsible for <a href="http://freemind.sf.net">FreeMind</a></li>
<li>The <a href="http://ubuntulinux.com">Ubuntu</a> Team</li>
<li>Makoto Matsumoto and Takuji Nishimura for authoring the <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html">Mersenne Twister</a> algorithm, and making it freely available.</li>
<li>Sean and Gamer Tazar from the old CoZ team, where ZEngine was born</li>
<li>Everyone who contributed to, used, or downloaded ZEngine</li>
</ul>
<p><em>$Id: CREDITS.html,v 1.1 2005/11/15 04:11:05 cozman Exp $</em></p>
<!-- cut here for DevBlog -->
</body>
</html>

View File

@ -1,21 +0,0 @@
The following people have contributed code to photon:
James Turk <cozman@users.sf.net>
..yeah this list is too short right now, so help out ;)
In addition, I'd like to thank:
* Sourceforge.net - Providing hosting for the project and CVS.
* Sean and Gamer Tazar from the old CoZ team, where ZEngine was born
* Everyone who contributed to, used, or downloaded ZEngine
* Sam Lantinga and the rest of the SDL crew (without SDL, no ZEngine,
without ZEngine, no photon)
* The GameDev.net community for answering my (often complex) questions
* Richard 'Superpig' Fine for his Enginuity articles, which influenced my
TaskManager/Task design.
* Jesse Maurais and DevMaster.net for the OpenAL tutorials
* Everyone responsible for FreeMind (http://freemind.sf.net)
* The Ubuntu Team (http://ubuntulinux.com)
* Makoto Matsumoto and Takuji Nishimura for authoring the Mersenne Twister
algorithm, and making it freely available.
http://www.math.keio.ac.jp/~matumoto/emt.html
$Id: CREDITS.txt,v 1.3 2005/08/17 17:39:49 cozman Exp $

200
IFAQ.html Normal file
View File

@ -0,0 +1,200 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU">
<head>
<title>Photon iFAQ (inFrequently Asked Questions)</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
</head>
<body>
<!-- cut here for DevBlog -->
<ul>
<li><strong>General Questions</strong>
<ul>
<li><a href="#ans1-1">What is Photon?</a></li>
<li><a href="#ans1-2">Where do I get Photon?</a></li>
<li><a href="#ans1-3">How do I build Photon?</a></li>
<li><a href="#ans1-4">Does Photon use proprietary libraries like DirectX?</a></li>
<li><a href="#ans1-5">When will features X, Y, and Z be completed?</a></li>
<li><a href="#ans1-6">What if I have something to add?</a></li>
</ul></li>
<li><strong>Usage Questions</strong>
<ul>
<li><a href="#ans2-1">How do I compile a Photon application?</a></li>
<li><a href="#ans2-2">Are there any tutorials?</a></li>
<li><a href="#ans2-3">I am using Photon, can I tell the world?</a></li>
</ul></li>
<li><strong>Licensing Questions</strong>
<ul>
<li><a href="#ans3-1">How is Photon licensed?</a></li>
<li><a href="#ans3-2"> Why is Photon licensed like that, why not use LGPL or something?</a></li>
<li><a href="#ans3-3">I don't get it. What can I do with Photon?</a></li>
<li><a href="#ans3-4">So what can't I do with Photon?</a></li>
</ul></li>
<li><strong>History Questions</strong>
<ul>
<li><a href="#ans4-1">Photon seems familiar.. where have I seen a similar API before?</a></li>
<li><a href="#ans4-2">Why shouldn't I use ZEngine?</a></li>
<li><a href="#ans4-3">Why should I use ZEngine?</a></li>
<li><a href="#ans4-4">Wasn't there some GUI lib for ZEngine?</a></li>
</ul></li>
<li><strong>Other Questions</strong>
<ul>
<li><a href="#ans5-1">You are a king, can I give you money?</a></li>
<li><a href="#ans5-2">How can I be as great as you?</a></li>
<li><a href="#ans5-3">What else are you working on?</a></li>
<li><a href="#ans5-4">Want to work on something with me?</a></li>
</ul></li>
</ul>
<hr />
<h2>General Questions</h2>
<h3><a name="ans1-1">What is Photon?</a></h3>
<p>Photon is an API which is designed primarily to ease creation of hardware
accelerated 2D games with OpenGL and other open source &amp; cross platform
libraries. Photon aims to simplify portable game development, enabling
developers to focus on the gameplay. Photon uses OpenGL for hardware
accelerated rotation, alpha blending, resizing, and drawing. Photon is built
entirely on free software, using libraries like GLFW, PhysFS, OpenAL, and
boost. Using Photon does not require knowledge of any of these libraries as
their needed functionality is wrapped entirely within Photon's rich class
library so that anyone with a decent grasp of C++ can use Photon.
<br /><br />
Photon is a cross platform API, designed to run on as many operating systems
as possible, and OS support is only limited by libraries which Photon
depends on, at the moment Photon should run on Windows, Linux, OSX, and
other Operating Systems which have OpenGL support.</p>
<h3><a name="ans1-2">Where do I get Photon?</a></h3>
<p><a href="http://photon.sourceforge.net">http://photon.sourceforge.net</a>
is the home page.
<a href="http://sourceforge.net/projects/photon/">http://sourceforge.net/projects/photon/</a>
is the project page.</p>
<h3><a name="ans1-3">How do I build Photon?</a></h3>
<p>At the moment building photon relies upon SCons. As of Photon 0.0.2 experimental
project files are available for <a href="http://www.codeblocks.org/">Code::Blocks</a>
and <a href="http://www.bloodshed.net/devcpp.html">Dev-C++</a>.
Visual C++ project files are a high priority.</p>
<h3><a name="ans1-4">Does Photon use proprietary libraries like DirectX?</a></h3>
<p>Photon only uses free open source libraries, so that by using Photon you are
not subjected to any proprietary licensing terms.</p>
<h3><a name="ans1-5">When will features X, Y, and Z be completed?</a></h3>
<p>When I get to them, I can only work on Photon in my spare time, if you have a
specific request let me know and I can give you an estimate of when I plan
on getting to it. There's always the option that you help out and then the
feature will be added sooner rather than later.</p>
<h3><a name="ans1-6">What if I have something to add?</a></h3>
<p> Feel free to contribute to Photon, bugfixes are greatly appreciated. Not
all submitted features can be accepted, but I'll usually at least add a
link to your submission if it cannot be included in the standard
distribution for some reason. (Extensions to Photon which uses non-free
or non-portable libraries fall into this category, I appreciate them
but usually won't make them part of the standard distribution.)</p>
<h2>Usage Questions</h2>
<h3><a name="ans2-1">How do I compile a Photon application?</a></h3>
<p>That depends upon your compiler, generally there are several things that
need to be done:</p>
<ul>
<li>When compiling make sure all includes are in the include path of your compiler.</li>
<li>When linking make sure all libraries are in the library path of your compiler.</li>
<li>Ensure that you link against photon and all dependency libraries (photon, GLFW, OpenAL, OpenGL, GLU, PhysFS, Corona, and Freetype).</li>
<li>If you are using OpenAL, be sure to define PHOTON_USE_OPENAL</li>
</ul>
<p>
On a command line compiler like g++ this would look something like:</p>
<pre>
g++ -DPHOTON_USE_OPENAL -c -o test.o test.cpp
g++ -o test test.o -lphoton -lglfw -lopenal -lGL -lGLU -lphysfs -lcorona -lfreetype
</pre>
<h3><a name="ans2-2">Are there any tutorials?</a></h3>
<p>No. Well not yet, I do have intent to write basic tutorials on using
Photon, as well as porting some existing tutorials on various subjects to
Photon.</p>
<h3><a name="ans2-3">I am using Photon, can I tell the world?</a></h3>
<p>Sure, if you're using it and you feel comfortable admitting that, I admire
your honesty. In all seriousness, this is greatly appreciated, and greatly
beneficial to the Photon community, the more people using it the more people
to help find bugs, suggest features, and maybe some of them will think of
something cool to add for the rest of us.</p>
<h2>Licensing Questions</h2>
<h3><a name="ans3-1">How is Photon licensed?</a></h3>
<p>Photon is licensed under a zlib-style license, see LICENSE.html. </p>
<h3><a name="ans3-2">Why is Photon licensed like that, why not use LGPL or something?</a></h3>
<p>First of all, I prefer zlib licensed libraries, as you can see, Photon
depends primarily on zlib licensed libraries. I also don't feel that I
should try to restrict what people do with Photon, as the people who will
try to steal work aren't going to care what license it was under in the
first place.</p>
<h3><a name="ans3-3">I don't get it. What can I do with Photon?</a></h3>
<p>You are allowed to do almost anything you want with Photon including use it
in commercial applications.</p>
<h3><a name="ans3-4">So what can't I do with Photon?</a></h3>
<p>You cannot claim you wrote it, distribute altered versions that are not
clearly marked as such, or remove or alter the license of the Photon
source. You also cannot sue me for damages if Photon hurts you, your
pet, or your feelings.</p>
<h2>History Questions</h2>
<h3><a name="ans4-1">Photon seems familiar.. where have I seen a similar API before?</a></h3>
<p>Photon used to be ZEngine, but when I decided to do a major rewrite the name
changed. I am the author of both ZEngine and Photon, but thank you for your
concern.</p>
<h3><a name="ans4-2">Why shouldn't I use ZEngine?</a></h3>
<p>Photon does practically everything ZEngine did, but is being actively
developed. Photon also uses a fairly different design than ZEngine, which I
hope most will enjoy.</p>
<h3><a name="ans4-3">Why should I use ZEngine?</a></h3>
<p>In case you want to port to a platform with no OpenGL, or maybe you like
the letter 'Z' before every class name. If you hate the new style, and
would prefer to kick it old school, ZEngine is a fine choice.</p>
<h3><a name="ans4-4">Wasn't there some GUI lib for ZEngine?</a></h3>
<p>Yes, Gewi was the GUI for ZEngine, and was separate from the core of
ZEngine. In Photon Gewi will become photon::gui, but is not yet completed.
Because of the modular core method and resource management, the inside has
been rewritten, and a number of bugs have been fixed. photon::gui will be
a major improvement over Gewi.</p>
<h2>Other Questions</h2>
<h3><a name="ans5-1">You are a king, can I give you money?</a></h3>
<p>Sure.. I guess, I'd prefer you donate it to a better project than Photon
but if you have to donate money to me because you're using Photon in some
amazing application and you feel guilty making millions off of my "hard"
work.. email me, I'll try to talk you out of it, or suggest a better use
of funds.</p>
<h3><a name="ans5-2">How can I be as great as you?</a></h3>
<p>Help me out on Photon.. write some documentation, anything, if you're not
sure how to help, email me, I'll let you know what needs to be done.</p>
<h3><a name="ans5-3">What else are you working on?</a></h3>
<p>That's a secret right now.</p>
<h3><a name="ans5-4">Want to work on something with me?</a></h3>
<p>Depending on how much time I have, and how interested I am in the project,
maybe. If you want me to work on something I'd love to hear from you,
even if I don't have time at the moment. If the project in question
uses Photon you get bonus points, but is not a requirement for me to work
with you.</p>
<p><em>$Id: IFAQ.html,v 1.2 2005/11/15 06:01:12 cozman Exp $</em></p>
<!-- cut here for DevBlog -->
</body>
</html>

136
IFAQ.txt
View File

@ -1,136 +0,0 @@
IfAQ (Infrequently Asked Questions)
$Id: IFAQ.txt,v 1.2 2005/08/07 07:12:46 cozman Exp $
--basic questions--
Q. What is Photon?
A. Photon is an API which is designed primarily to ease creation of hardware
accelerated 2D games with OpenGL and other open source & cross platform
libraries. Photon aims to simplify portable game development, enabling
developers to focus on the gameplay. Photon uses OpenGL for hardware
accelerated rotation, alpha blending, resizing, and drawing. Photon is built
entirely on free software, using libraries like GLFW, PhysFS, OpenAL, and
boost. Using Photon does not require knowledge of any of these libraries as
their needed functionality is wrapped entirely within Photons rich class
library so that anyone with a decent grasp of C++ can use Photon.
Photon is a cross platform API, designed to run on as many operating systems
as possible, and OS support is only limited by libraries which Photon
depends on, at the moment Photon should run on Windows, Linux, OSX, and
other Operating Systems which have OpenGL support.
Q. Where do I get Photon?
A. http://photon.sourceforge.net is the home page.
http://sourceforge.net/projects/photon/ is the project page.
Q. How do I build Photon?
A. At the moment building photon relies upon SCons. See INSTALL.txt for more
information. Visual C++ project files are a priority as well.
--usage questions--
Q. How do I compile a Photon application?
A. That depends upon your compiler, this isn't a sufficient answer is it?
To Be Completed
Q. Are there any tutorials?
A. No. Well not yet, I do have intent to write basic tutorials on using
Photon, as well as porting some existing tutorials on various subjects to
Photon.
Q. I am using Photon, can I tell the world?
A. Sure, if you're using it and you feel comfortable admitting that, I admire
your honesty. In all seriousness, this is greatly appreciated, and greatly
beneficial to the Photon community, the more people using it the more people
to help find bugs, suggest features, and maybe some of them will think of
something cool to add for the rest of us.
--licensing questions--
Q. How is Photon licensed?
A. Photon is licensed under a zlib-style license, see LICENSE.txt.
Q. Why is Photon licensed like that, why not use LGPL or something?
A. First of all, I prefer zlib licensed libraries, as you can see, Photon
depends primarily on zlib licensed libraries. I also don't feel that I
should try to restrict what people do with Photon, as the people who will
try to steal work aren't going to care what license it was under in the
first place.
Q. I don't get it. What can I do with Photon?
A. You are allowed to do almost anything you want with Photon including use it
in commercial applications.
Q. So what can't I do with Photon?
A. You cannot claim you wrote it, distribute altered versions that are not
clearly marked as such, or remove or alter the license of the Photon
source. You also cannot sue me for damages if Photon hurts you, your
pet, or your feelings.
Q. Does Photon use proprietary libraries like DirectX?
A. Photon only uses free open source libraries, so that by using Photon you are
not subjected to any proprietary licensing terms.
Q. When will features X, Y, and Z be completed?
A. When I get to them, I can only work on Photon in my spare time, if you have a
specific request let me know and I can give you an estimate of when I plan
on getting to it. There's always the option that you help out and then the
feature will be added sooner rather than later.
Q. What if I have something to add?
A. Feel free to contribute to Photon, bugfixes are greatly appreciated. Not
all submitted features can be accepted, but I'll usually at least add a
link to your submission if it cannot be included in the standard
distribution for some reason. (Extensions to Photon which uses non-free
or non-portable libraries fall into this category, I appreciate them
but usually won't make them part of the standard distribution.)
--history questions--
Q. Photon seems familiar.. where have I seen a similar API before?
or
You ripped off that ZEngine guy!
A. Photon used to be ZEngine, but when I decided to do a major rewrite the name
changed. I am the author of both ZEngine and Photon, but thank you for your
concern.
Q. Why shouldn't I use ZEngine?
A. Photon does practically everything ZEngine did, but is being actively
developed. Photon also uses a fairly different design than ZEngine, which I
hope most will enjoy.
Q. Why should I use ZEngine?
A. In case you want to port to a platform with no OpenGL, or maybe you like
the letter 'Z' before every class name. If you hate the new style, and
would prefer to kick it old school, ZEngine is a fine choice.
Q. Wasn't there some GUI lib for ZEngine?
A. Yes, Gewi was the GUI for ZEngine, and was separate from the core of
ZEngine. In Photon Gewi will become photon::gui, but is not yet completed.
Because of the modular core method and resource management, the inside has
been rewritten, and a number of bugs have been fixed. photon::gui will be
a major improvement over Gewi.
--other questions--
Q. You are a king, can I give you money?
A. Sure.. I guess, I'd prefer you donate it to a better project than Photon
but if you have to donate money to me because you're using Photon in some
amazing application and you feel guilty making millions off of my "hard"
work.. email me, I'll try to talk you out of it, or suggest a better use
of funds.
Q. How can I be as great as you?
A. Help me out on Photon.. write some documentation, anything, if you're not
sure how to help, email me, I'll let you know what needs to be done.
Q. What else do you work on, besides Photon?
A. That's a secret right now.
Q. Want to work on something with me?
A. Depending on how much time I have, and how interested I am in the project,
maybe. If you want me to work on something I'd love to hear from you,
even if I don't have time at the moment. If the project in question
uses Photon you get bonus points, but is not a requirement for me to work
with you.
-James Turk <cozman@users.sf.net>

54
INSTALL.html Normal file
View File

@ -0,0 +1,54 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU">
<head>
<title>Photon iFAQ (inFrequently Asked Questions)</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
</head>
<body>
<!-- cut here for DevBlog -->
<p>There are several ways to build photon:</p>
<ul>
<li><a href="http://www.scons.org">SCons</a> Build Tool</li>
<li><a href="http://www.bloodshed.net/devcpp.html">Dev-C++ 5</a> Windows IDE</li>
<li><a href="http://codeblocks.org">Code::Blocks</a> Windows/Linux IDE</li>
</ul>
<h2>Building with SCons</h2>
<ol>
<li>Enter the photon directory.
</li><li>Type 'scons' - building should begin assuming all dependencies are found.
this will result in the photon library being built in the lib/ folder.</li>
<li><em>Optional:</em> Type 'scons test' to build test programs, test programs will be
built in the test/ folder.</li>
<li><em>Optional:</em> Type 'scons docs' to build documentation in the docs/ folder.
[requires <a href="http://naturaldocs.org">NaturalDocs</a>]</li>
<li>Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.</li>
</ol>
<h2>Building with Code::Blocks</h2>
<ol>
<li>Open the photon.workspace file in Code::Blocks</li>
<li>Build the library by compiling the project named photon.</li>
<li><em>Optional:</em> Build any tests by running the other projects.</li>
<li>Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.</li>
</ol>
<h2>Building with Dev-C++</h2>
<ol>
<li>Run the photon.dev project in the devcpp directory, building libphoton.a</li>
<li><em>Optional:</em> Build any tests by running the other projects in the devcpp
directory.</li>
<li>Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.</li>
</ol>
<p><em>$Id: INSTALL.html,v 1.1 2005/11/15 05:48:31 cozman Exp $</em></p>
<!-- cut here for DevBlog -->
</body>
</html>

View File

@ -1,31 +0,0 @@
There are several ways to build photon:
- SCons Build Tool http://www.scons.org
- Dev-C++ 5 Windows IDE http://www.bloodshed.net/devcpp.html
- Code::Blocks Windows/Linux IDE http://codeblocks.org
Building with SCons
1) Enter the photon directory.
2) Type 'scons' - building should begin assuming all dependencies are found.
this will result in the photon library being built in the lib/ folder.
3) Optional: Type 'scons test' to build test programs, test programs will be
built in the test/ folder.
4) Optional: Type 'scons docs' to build documentation in the docs/ folder.
[requires NaturalDocs (http://naturaldocs.org)]
5) Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.
Building with Dev-C++
1) Run the photon.dev project in the devcpp directory, building libphoton.a
2) Optional: Build any tests by running the other projects in the devcpp
directory.
3) Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.
Building with Code::Blocks
1) Open the photon.workspace file in Code::Blocks
2) Build the library by compiling the project named photon.
3) Optional: Build any tests by running the other projects.
4) Copy the photon library from the lib/ folder and the contents of photon's
include/ directory to somewhere in your compilers search path.
$Id: INSTALL.txt,v 1.2 2005/08/10 05:37:57 cozman Exp $

481
LGPL.txt
View File

@ -1,481 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 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 library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
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 Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the 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 a program 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.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
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, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
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 compile 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) 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.
c) 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.
d) 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 source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
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 to
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 Library 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
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

85
LIBRARIES.html Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU">
<head>
<title>Photon Dependencies</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
</head>
<body>
<!-- cut here for DevBlog -->
<p>Photon uses several other libraries, which fall under a variety of licenses:</p>
<ul>
<li><a href="http://glfw.sourceforge.net/">GLFW</a> - zlib license</li>
<li><a href="http://boost.org/">Boost</a> - Boost Software License</li>
<li><a href="http://icculus.org/physfs/">PhysFS</a> - zlib license</li>
<li><a href="http://corona.sourceforge.net/">Corona</a> - zlib license</li>
<li><a href="http://freetype.org/">Freetype2</a> - Freetype License (FTL)</li>
<li><a href="http://openal.org/">OpenAL</a>* - LGPL</li>
</ul>
<p>*OpenAL support is optional, if OpenAL is not found, photon can be compiled
without it. This is done so that those wishing to keep their application
free of LGPL libraries may do so while still using photon.</p>
<hr />
<p>Understanding and complying with Open Source licenses can be a daunting task,
but in this case is rather simple. If you are distributing an application which
uses photon and it's dependencies you must do the following:</p>
<ol>
<li>To satisfy the zlib license that photon and most of the other libs use,
you simply must not claim you wrote them & not remove the zlib license
in license.txt, also any changes must be marked if that applies to you.</li>
<li> Complying with the Boost Software License is the easiest, if distributing
Boost source code, you must include the BSL, if distributing object
code (eg. library or executable) nothing actually needs to be done.</li>
<li>To comply with the Freetype license you must not claim you wrote it,
but you must also give credit to the authors. The credit clause is
the only real difference between the Freetype License and the zlib
license.</li>
<li>If you are using OpenAL, you are most likely dynamically linking (using
a .dll or .so) which means that in order to comply with the LGPL you
must: Make it clear that you are using OpenAL in your credits file,
include a copy of the LGPL with any binaries, provide a link to the
OpenAL source code or provide the source code yourself.</li>
</ol>
<p>If you comply with all three licenses (don't take credit for what you didn't do,
credit Freetype and OpenAL, and provide the LGPL and a link to OpenAL's source
you can do what you wish with your application, including make it closed source
and/or sell it)</p>
<hr />
<p>For convenience I have written a licensing template that should satisfy most
users of photon. It is essentially what I would use in distributing any
binaries made with photon and it's dependencies. (Note: I credit the zlib
libraries which isn't necessary but I feel it's proper.)</p>
<pre>
--------EXAMPLE CREDITS FILE
This application uses Photon which is available from
http://photon.sourceforge.net/ and is licensed under a zlib license.
Other libraries used indirectly or directly by this program include:
GLFW - http://glfw.sourceforge.net/ - zlib license
Boost - http://boost.org/ - Boost Software License
PhysFS - http://icculus.org/physfs/ - zlib license
Corona - http://corona.sourceforge.net/ - zlib license
Freetype2 - http://freetype.org/ - Freetype License (FTL)
OpenAL - http://openal.org/ - LGPL
To comply with the LGPL a copy of a copy of the LGPL is provided in this
directory as LGPL.txt.
A copy of the OpenAL source is available from http://openal.org/
</pre>
<p><em>$Id: LIBRARIES.html,v 1.1 2005/11/15 05:06:00 cozman Exp $</em></p>
<!-- cut here for DevBlog -->
</body>
</html>

View File

@ -1,57 +0,0 @@
$Id: LIBRARIES.txt,v 1.1 2005/07/20 21:56:33 cozman Exp $
Photon uses several other libraries, which fall under a variety of licenses:
GLFW - http://glfw.sourceforge.net/ - zlib license
PhysFS - http://icculus.org/physfs/ - zlib license
Corona - http://corona.sourceforge.net/ - zlib license
Freetype2 - http://freetype.org/ - Freetype License (FTL)
OpenAL* - http://openal.org/ - LGPL
*OpenAL support is optional, if OpenAL is not found, photon can be compiled
without it. This is done so that those wishing to keep their application
free of LGPL libraries may do so while still using photon.
------------
Understanding and complying with Open Source licenses can be a daunting task,
but in this case is rather simple. If you are distributing an application which
uses photon and it's dependencies you must do the following:
1) To satisfy the zlib license that photon and most of the other libs use,
you simply must not claim you wrote them & not remove the zlib license
in license.txt, also any changes must be marked if that applies to you.
2) To comply with the Freetype license you must not claim you wrote it,
but you must also give credit to the authors. The credit clause is
the only real difference between the Freetype License and the zlib
license.
3) If you are using OpenAL, you are most likely dynamically linking (using
a .dll or .so) which means that in order to comply with the LGPL you
must: Make it clear that you are using OpenAL in your credits file,
include a copy of the LGPL with any binaries, provide a link to the
OpenAL source code or provide the source code yourself.
If you comply with all three licenses (don't take credit for what you didn't do,
credit Freetype and OpenAL, and provide the LGPL and a link to OpenAL's source
you can do what you wish with your application, including make it closed source
and/or sell it)
For convenience I have written a licensing template that should satisfy most
users of photon. It is essentially what I would use in distributing any
binaries made with photon and it's dependencies. (Note: I credit the zlib
libraries which isn't necessary but I feel it's proper.)
--------EXAMPLE CREDITS FILE
This application uses Photon which is available from
http://photon.sourceforge.net/ and is licensed under a zlib license.
Photon (and this application) uses several other zlib-licensed libraries:
GLFW - http://glfw.sourceforge.net/
PhysFS - http://icculus.org/physfs/
Corona - http://corona.sourceforge.net/
Photon (and this application) also uses Freetype2 which is licensed under the
Freetype license.
Photon (and this application) also uses OpenAL which is licensed under the LGPL
To comply with the LGPL a copy of a copy of the LGPL is provided in this
directory as LGPL.txt. A copy of the OpenAL source is available from
http://openal.org/

View File

@ -1,13 +1,13 @@
Thank you for downloading photon,
photon is an API which is designed primarily to ease creation of hardware
Photon is an API which is designed primarily to ease creation of hardware
accelerated 2D games with OpenGL and other open source & cross platform
libraries. Photon aims to simplify portable game development, enabling
developers to focus on the gameplay. Photon uses OpenGL for hardware accelerated
rotation, alpha blending, resizing, and drawing. Photon is built entirely on
free software, using libraries like GLFW, PhysFS, OpenAL, and boost. Using
Photon does not require knowledge of any of these libraries as their needed
functionality is wrapped entirely within Photons rich class library so that
anyone with a decent grasp of C++ can use Photon.
free software, using libraries including including GLFW, PhysFS, OpenAL, Corona,
Freetype and boost.. Using Photon does not require knowledge of any of these
libraries as their needed functionality is wrapped entirely within Photons rich
class library so that anyone with a decent grasp of C++ can use Photon.
photon is a cross platform API, designed primarily for game development.
photon is designed to run on as many operating systems as possible, and OS
support is only limited by libraries which Photon depends on, at the moment
@ -18,13 +18,13 @@ which have OpenGL support.
If this is a source distribution you'll need to build photon before you can use
it in your own applications, for details on how to build and install photon
check out INSTALL.txt.
check out INSTALL.html
If this is a binary distribution you can start using photon right away by
linking the photon library (found in the lib/ subfolder) and it's dependencies
with your applications.
If you need any help or have any questions check out IFAQ.txt or visit photon's
If you need any help or have any questions check out IFAQ.html or visit photon's
homepage at http://photon.sourceforge.net/.
$Id: README.txt,v 1.1 2005/07/17 22:41:03 cozman Exp $
$Id: README.txt,v 1.3 2005/11/15 06:01:12 cozman Exp $

View File

@ -1,4 +1,4 @@
Process:
Prerelease:
human: bump version numbers*
script: checkout fresh CVS
script: check building of library & tests
@ -11,6 +11,7 @@ Process:
run only one set of tests (Code::Blocks/Dev-C++ use same compiler)
check MSVC build
run tests
Release:
script: tag CVS with version number `cvs rtag release-MAJOR_MINOR_RELEASE photon`
script: fresh CVS export `cvs -z3 -d:ext:cozman@cvs.sourceforge.net:/cvsroot/photon export -r release-MAJOR_MINOR_RELEASE photon`
script: build docs with `scons docs`
@ -18,7 +19,20 @@ Process:
script: rename directory to photon-MAJOR.MINOR
script: package source with tar cjf photon-MAJOR.MINOR.RELEASE-src.tar.bz2 photon-MAJOR.MINOR/
human: place in sourceforge File Release System
script: upload docs to sourceforge webspace
human: upload docs to sourceforge webspace
Post-release:
human: generate photon-x.y.z-linux-gcc.tar.bz2
extract photon-x.y.z-src.tar.bz2
run `scons`
remove non-distribution files (regenerated by scons)
write a README-PREBUILT.txt
upload to sourceforge File Release system
human: generate photon-x.y.z-win32-mingw.zip
extract photon-x.y.z-src.tar.bz2
build libphoton.a and libphoton-noal.a
remove non-distribution files (regenerated by scons or IDE)
write a README-PREBUILT.txt
upload to sourceforge File Release system
human: write release announcement
*Version Number Locations:
@ -29,8 +43,18 @@ Process:
release.sh
**Non-Distribution Files:
photon/.cvsignore
photon/.sconf_temp/
photon/build/
photon/docs/.cvsignore
photon/include/.sconsign
photon/include/*/.sconsign
photon/include/*/*/.sconsign
photon/ndoc/
photon/ndoc/.cvsignore
photon/.cvsignore
photon/config.log
photon/RELEASE-HOWTO.txt
photon/release.sh
$Id: RELEASE-HOWTO.txt,v 1.6 2005/08/18 07:05:34 cozman Exp $
$Id: RELEASE-HOWTO.txt,v 1.9 2005/08/19 07:23:38 cozman Exp $

View File

@ -5,7 +5,7 @@
# James Turk (jpt2433@rit.edu)
#
# Version:
# $Id: SConstruct,v 1.23 2005/08/18 02:23:47 cozman Exp $
# $Id: SConstruct,v 1.27 2005/11/23 19:38:51 cozman Exp $
import os,os.path
import glob
@ -70,10 +70,13 @@ if not env.GetOption('clean'):
Exit(1)
if not conf.CheckLibWithHeader('freetype', 'ft2build.h', 'C++'):
print 'Freetype2 not found, exiting.'
Exit(1)
Exit(1)
if not conf.CheckLibWithHeader('corona', 'corona.h', 'C++'):
print 'Corona not found, exiting.'
Exit(1)
if not conf.CheckCXXHeader('boost/utility.hpp'):
print 'Boost not found, exiting.'
Exit(1)
if conf.CheckLibWithHeader(OAL_LIB, 'AL/al.h', 'C++'):
conf.env.Append(CPPFLAGS='-DPHOTON_USE_OPENAL')
else:
@ -93,8 +96,10 @@ env.Default(LIBRARY)
# Documentation
ndoc = env.Command('docs/index.html', './include',
"""NaturalDocs -nag -i $SOURCES -o HTML ./docs -p ./ndoc""")
"""NaturalDocs -nag -i $SOURCES -i ndoc/pages -i ndoc/tutorials -o HTML ./docs -p ./ndoc""")
env.Alias("docs",ndoc)
env.AlwaysBuild(ndoc)
# Tests:
tests = []
@ -104,12 +109,7 @@ for test_src in test_srcs:
test_name = test_src.replace('_test.cpp','')
tests.append(env.Program(test_name, source=test_src, LIBPATH='./lib',
LIBS=['photon','glfw',OAL_LIB,OGL_LIB,GLU_LIB,
'physfs','corona','freetype']))
'physfs','corona','freetype']))
env.Alias('tests',tests)
# Visual C++ Projects
#if(os.name == 'nt'):
# msvc = env.MSVSProject(target = 'msvc/photon' + env['MSVSPROJECTSUFFIX'],
# srcs = getFilesMulti(SRC_DIRS, '*.cpp'), incs = INC_FILES,
# buildtarget = lib, variant = 'Release')
# env.Alias('msvc',msvc)

View File

@ -3,3 +3,5 @@ javascript
index.html
index
files
files2
files3

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Application.hpp,v 1.22 2005/08/17 06:35:56 cozman Exp $
// $Id: Application.hpp,v 1.24 2005/11/15 02:59:08 cozman Exp $
#ifndef PHOTON_APPLICATION_HPP
#define PHOTON_APPLICATION_HPP
@ -28,8 +28,9 @@ namespace photon
{
// Class: Application
// Photon main class, contains functions that control creation of the display,
// setting the OpenGL view, input handling, timing, and <State> management.
// Application main class, contains functions that control creation of the
// display, setting the OpenGL view, input handling, timing, and <State>
// management.
//
// Application is a <Singleton> and therefore should be accessed through
// Application::getInstance(). (Application Singleton is created/destroyed
@ -51,17 +52,18 @@ public:
public:
// Function: run
// Runs application until a quit is requested either via the operating
// system (ex. Alt-F4) or through a call to <quit>.
// system (ex Alt-F4) or through a call to <quit>.
//
// Should not be called before a <State> has been set and a display has
// been created via <createDisplay>.
// Throws:
// <PreconditionException> if called before a <State> has been set
// and a display has been created via <createDisplay>.
void run();
// called by run while !quit()
// called internally by run while !quit()
void update();
// Function: quit
// Sets Quit flag, terminating application.
// Sets quit flag, terminating application.
void quit();
// Function: getUpdateTaskManager
@ -69,7 +71,7 @@ public:
// this TaskManager are executed after the current <State::update>.
//
// Returns:
// Reference to "Update TaskManager"
// Reference to "Update <TaskManager>"
util::TaskManager& getUpdateTaskManager();
// Function: getRenderTaskManager
@ -77,7 +79,7 @@ public:
// this TaskManager are executed after the current <State::render>.
//
// Returns:
// Reference to "Render TaskManager"
// Reference to "Render <TaskManager>"
util::TaskManager& getRenderTaskManager();
// Function: isActive
@ -91,7 +93,8 @@ public:
// Group: Window
public:
// Function: createDisplay
// This function attempts to create a display with the given parameters.
// This function attempts to create a display with the given parameters.
// Takes arguments for R,G,B,A values separately, generally not needed.
//
// Parameters:
// width - desired width of display
@ -102,15 +105,18 @@ public:
// alphaBits - desired bits per pixel for alpha value
// depthBits - desired bitdepth of depth buffer
// stencilBits - desired bitdepth of stencil buffer
// fullscreen - true: fullscreen, false: windowed
// [title - title of application, optional]
// fullscreen - <DisplayMode>, DISP_FULLSCREEN or DISP_WINDOWED
// [title - title of application, optional]
void createDisplay(uint width, uint height,
uint redBits, uint greenBits, uint blueBits,
uint alphaBits, uint depthBits, uint stencilBits,
bool fullscreen, const std::string& title="Photon App");
DisplayMode mode,
const std::string& title="Photon App");
// Function: createDisplay
// This function attempts to create a display with the given parameters.
// Takes one consolidated bpp value, which is generally preferred over
// separate R,G,B,A values.
//
// Parameters:
// width - desired width of display
@ -118,10 +124,10 @@ public:
// bpp - desired bits per pixel (aka bitdepth) of display
// depthBits - desired bitdepth of depth buffer
// stencilBits - desired bitdepth of stencil buffer
// fullscreen - true: fullscreen, false: windowed
// fullscreen - <DisplayMode>, DISP_FULLSCREEN or DISP_WINDOWED
// [title - title of application, optional]
void createDisplay(uint width, uint height, uint bpp,
uint depthBits, uint stencilBits, bool fullscreen,
uint depthBits, uint stencilBits, DisplayMode mode,
const std::string& title="Photon App");
// Function: setTitle
@ -180,7 +186,7 @@ public:
// Creates a viewport with a given 3D perspective inside of a rectangular
// portion of the screen.
//
// Note that <setDepthTestMode>(true) will be called as a side effect.
// Note that <setDepthBufferParams> (true) will be called as a side effect.
//
// Parameters:
// x - X coord for top left corner of new viewport.
@ -196,7 +202,7 @@ public:
// Function: setPerspectiveView
// Sets entire screen as current viewport with a given 3D perspective.
//
// Note that <setDepthTestMode>(true) will be called as a side effect.
// Note that <setDepthBufferParams> (true) will be called as a side effect.
//
// Parameters:
// fovy - The y axis field of view angle, in degrees.
@ -329,7 +335,7 @@ public:
// Function: setFixedUpdateStep
// Sets a fixed timestep to be used in calls to the current <State's>
// update method. This allows stability in physics systems.
// update method. This greatly enhances stability in physics systems.
//
// Parameters:
// enable - if true, will enable fixed timestepping (if false will disable)
@ -343,10 +349,10 @@ public:
// Group: State Management
public:
// Function: setState
// Set the current Application <State>, removing all other <States>.
// Set the current Application <State>, first popping all current states.
//
// Template Parameters:
// StateT - Class derived from <State> to set as current.
// StateT - <State>-derived class to make current state.
template<class StateT>
void setState();
@ -354,7 +360,7 @@ public:
// Push a new <State>, does not remove old <State>.
//
// Template Parameters:
// StateT - Class derived from <State> to push.
// StateT - <State>-derived class to push.
template<class StateT>
void pushState();
@ -369,18 +375,24 @@ public:
// Get the Application's <AudioCore>, should only be called after
// <initAudioCore>.
//
// Note that this function only exists if photon is compiled with Audio
// support enabled.
//
// Return:
// Reference to the <AudioCore>.
audio::AudioCore& getAudioCore();
// Function: initAudioCore
// Initialize the <AudioCore>, should be done before attempting to access
// it via <getAudioCore>.
//
// Arguments:
// deviceName - Optional name for desired Audio device, will use default
// device if none specified.
void initAudioCore(const std::string& deviceName="");
audio::AudioCore& getAudioCore();
// Function: initAudioCore
// Initialize the <AudioCore>, should be done before attempting to access
// it via <getAudioCore>.
//
// Note that this function only exists if photon is compiled with Audio
// support enabled.
//
// Arguments:
// deviceName - Optional name for desired Audio device, will use default
// device if none specified.
void initAudioCore(const std::string& deviceName="");
#endif //PHOTON_USE_OPENAL
// Callbacks

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Log.hpp,v 1.8 2005/08/02 23:07:52 cozman Exp $
// $Id: Log.hpp,v 1.9 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_LOG_HPP
#define PHOTON_LOG_HPP
@ -28,11 +28,11 @@ class Log
// Group: (Con/De)structors
public:
// Function: Log
// Log constructor, initializes log singleton.
// Log constructor, initializes a log with no sinks.
Log();
// Function: ~Log
// Log destructor, destroys log singleton.
// Log destructor, destroys log, flushing output streams/closing sinks.
~Log();
// Group: Sink Maintenance

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: LogSink.hpp,v 1.2 2005/02/16 06:58:05 cozman Exp $
// $Id: LogSink.hpp,v 1.3 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_LOGSINK_HPP
#define PHOTON_LOGSINK_HPP
@ -42,8 +42,8 @@ enum LogLevel
};
// Class: LogSink
// Base class for all LogSinks to be used with <Log>, derived classes must
// define message(LogLevel level, std::string string).
// Virtual base class for all LogSinks to be used with <Log>, derived classes
// must define writeMessage(LogLevel level, std::string string).
// A LogSink recieves any messages passed to the log it's registered with.
//
// Children:
@ -103,7 +103,9 @@ private:
typedef shared_ptr<LogSink> LogSinkPtr;
// Class: ConsoleSink
// <LogSink> to be used with <Log> for simple console output.
// <LogSink> to be used with <Log> for simple console output. Note that due
// to nature of buffered I/O it is important to flush the stream to see output
// in realtime with ConsoleSink
//
// See Also:
// <TextSink>, <HTMLSink>

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: ResourceManaged.hpp,v 1.8 2005/08/08 19:19:24 cozman Exp $
// $Id: ResourceManaged.hpp,v 1.9 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_RESOURCEMANAGED_HPP
#define PHOTON_RESOURCEMANAGED_HPP
@ -22,20 +22,24 @@ namespace photon
// resources that can be controlled, such as textures and music, can be
// derived. Resource managed classes rely on a <ResourceManager>.
//
// Unless extending Photon, generally ResourceManaged does not need to be
// directly used. For this reason public documentation is not availble. See
// ResourceManaged.hpp for documentation.
//
// Children:
// <Texture>, <Image>
//
// <Sample>
// <Source>
template<class ResMgrT>
class ResourceManaged
{
// Group: (Con/De)structors
// Nondoc-Group: (Con/De)structors
public:
// Function: ResourceManaged
// Nondoc-Function: ResourceManaged
// Default constructor.
ResourceManaged();
// Function: ResourceManaged
// Nondoc-Function: ResourceManaged
// Initializing constructor, calls <open> with a filename/zipname.
//
// Parameters:
@ -45,45 +49,45 @@ public:
// <open>
ResourceManaged(const std::string& name);
// Function: ~ResourceManaged
// Nondoc-Function: ~ResourceManaged
// Destructor, calls <release>.
virtual ~ResourceManaged();
ResourceManaged& operator=(const ResourceManaged &rhs);
// Group: General
// Nondoc-Group: General
public:
// Function: open
// Nondoc-Function: open
// Opens new resource via the associated <ResourceManager>.
//
// Parameters:
// name - name of resource
virtual void open(const std::string& name);
// Function: release
// Nondoc-Function: release
// Removes a reference to the resource, releasing if needed.
// Generally called by destructor, so should rarely be called.
virtual void release();
// Group: Accessors
// Nondoc-Group: Accessors
public:
// Function: getName
// Nondoc-Function: getName
// Get the name associated with the resource.
//
// Returns:
// Name of resource, or empty string if no resource is loaded.
std::string getName() const;
// Group: Resource Manager Access
// Nondoc-Group: Resource Manager Access
public:
static ResMgrT resMgr_;
// Function: cleanUp
// Nondoc-Function: cleanUp
// Cleans up any unused resources of the type.
// (Ex. Image::cleanUp() will unload all images.)
static void cleanUp();
// Function: addResource
// Nondoc-Function: addResource
// Define a new named resource.
// (Ex. Image::addResource("monkey","images/monkey.png") would
// make it so that any attempts to load "monkey" would load the image
@ -95,7 +99,7 @@ public:
static void addResource(const std::string& name,
const typename ResMgrT::ResDescT& desc);
// Function: addResource
// Nondoc-Function: addResource
// Define a new unaliased resource. (name == path).
// (Ex. Image::addResource("images/monkey.png") is essentially the same as
// Image::addResource("images/monkey.png","images/monkey.png")

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: State.hpp,v 1.4 2005/08/16 06:32:39 cozman Exp $
// $Id: State.hpp,v 1.5 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_STATE_HPP
#define PHOTON_STATE_HPP
@ -24,10 +24,10 @@ namespace photon
// to manage the state that the game is in.
//
// Implement as many or as few of the members of State as needed (the only
// necessary member being <render>) and make the state as current via
// <Application::setState>. Once a state is made current it's
// update and render methods will be called every frame until either a new
// state is made current or the application ends.
// necessary member being <render>) and make the state current via
// <Application::setState>/<Application::pushState>. Once a state is made
// current it's update and render methods will be called every frame until
// either a new state is made current or the application ends.
//
// The active state is also notified of events as they occur, overloading any
// of the on* functions will result in the overloaded version being called
@ -111,8 +111,8 @@ public:
// Called when the mouse is moved with the amount the mouse was moved by
// NOT with the new position.
//
// If the new position is needed it can be obtained via <getMouseX> and
// <getMouseY>.
// If the new position is needed it can be obtained via
// <Application::getMouseX> and <Application::getMouseY>.
//
// Parameters:
// delta - Change in mouse position.

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: AudioCore.hpp,v 1.13 2005/08/08 19:19:25 cozman Exp $
// $Id: AudioCore.hpp,v 1.15 2005/10/28 22:13:33 cozman Exp $
#ifdef PHOTON_USE_OPENAL
@ -15,6 +15,11 @@
#include "AL/al.h" // This file depends on OpenAL
#include "AL/alc.h"
// define ALchar if it isn't available
#ifndef ALchar
#define ALchar ALubyte
#endif
#include "util/VersionInfo.hpp"
namespace photon
@ -32,25 +37,34 @@ class AudioCore
public:
// Function: AudioCore
// Initialize underlying APIs and setup <Task> internals.
//AudioCore();
AudioCore(const std::string& deviceName);
AudioCore(const std::string& deviceName) {};
// Function: ~AudioCore
// Shutdown underlying APIs.
~AudioCore();
virtual ~AudioCore() { };
// Group: Accessors
public:
// Function: getAudioDeviceName
// Get name of active audio device.
//
// Returns:
// Name of audio device currently in use.
std::string getAudioDeviceName() const;
// Group: Error Checking
// Returns name of audio device currently in use, if available from
// underlying audio API..
virtual std::string getAudioDeviceName() const=0;
};
class OALAudioCore : public AudioCore
{
public:
// Function: checkOpenALError
OALAudioCore(const std::string& deviceName);
~OALAudioCore();
public:
std::string getAudioDeviceName() const;
public:
// No-Doc Function: checkOpenALError
// Checks for OpenAL internal errors, returning a descriptive string if
// the OpenAL error state is currently set. Will return an empty string
// if there is no error set.
@ -59,7 +73,7 @@ public:
// String describing OpenAL error, empty string if no error exists.
static std::string checkOpenALError();
// Function: throwOpenALError
// No-Doc Function: throwOpenALError
// Checks for OpenAL internal errors, throwing an <APIError> if the OpenAL
// error state is set and doing nothing if not. Optionally makes the
// thrown exception more descriptive by adding in a function string
@ -76,14 +90,13 @@ public:
private:
util::VersionInfo initOpenAL(const std::string& deviceName);
// data members
// data members specific to implementation
private:
ALfloat listenerPos_[3];
ALfloat listenerVel_[3];
ALfloat listenerOri_[6];
};
}
}

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Source.hpp,v 1.4 2005/08/08 21:39:41 cozman Exp $
// $Id: Source.hpp,v 1.5 2005/10/28 22:13:33 cozman Exp $
#ifdef PHOTON_USE_OPENAL
@ -23,17 +23,20 @@ namespace audio
{
// Class: Source
// Simple OO wrapper around an OpenAL source, defines the interface used for
// Sample and Music.
// Simple wrapper object around an OpenAL source, defines the interface used
// for Sample and Music.
//
// Source is a template class and can not be used directly, use either Sample
// or Music. Sample is for playing small files such as sound effects. Music
// is for streaming files such as background music.
//
// Source is a resource managed class, and therefore all resources should
// be registered using <Source::addResource> and then loaded by their assigned
// name via <Source::open> or the appropriate constructor.
//
// Operators:
// - Source = Source
// - bool : True if source has loaded buffer, false if not.
// - ostream& << Source
template <class ResMgrT>
class Source : public ResourceManaged<ResMgrT>
{
@ -69,7 +72,7 @@ public:
public:
// Function: open
// Opens an audio file, supported formats are WAV and Ogg.
// Opens an audio file, supported formats are WAV and Ogg Vorbis.
//
// Parameters:
// name - Name of the Source <Resource> to open.
@ -168,7 +171,7 @@ template<class ResMgrT>
Source<ResMgrT>::Source()
{
alGenSources(1, &sourceID_);
AudioCore::throwOpenALError("Source::Source()");
OALAudioCore::throwOpenALError("Source::Source()");
}
template<class ResMgrT>
@ -176,14 +179,14 @@ Source<ResMgrT>::Source(const Source &rhs) :
ResourceManaged<ResMgrT>(rhs)
{
alGenSources(1, &sourceID_);
AudioCore::throwOpenALError("Source::Source(const Source&)");
OALAudioCore::throwOpenALError("Source::Source(const Source&)");
}
template<class ResMgrT>
Source<ResMgrT>::Source(const std::string& name)
{
alGenSources(1, &sourceID_);
AudioCore::throwOpenALError("Source::Source(const std::string&)");
OALAudioCore::throwOpenALError("Source::Source(const std::string&)");
open(name);
}
@ -205,14 +208,14 @@ void Source<ResMgrT>::open(const std::string& name)
ResourceManaged<ResMgrT>::resMgr_.getAudioData(
ResourceManaged<ResMgrT>::getName(), bufferID);
// attach buffer to source
// attach buffer to source and set default settings
alSourcei(sourceID_, AL_BUFFER, bufferID);
alSourcef(sourceID_, AL_PITCH, 1.0);
alSourcef(sourceID_, AL_GAIN, 1.0);
alSourcefv(sourceID_, AL_POSITION, ORIGIN);
alSourcefv(sourceID_, AL_VELOCITY, ORIGIN);
AudioCore::throwOpenALError("Source::open");
OALAudioCore::throwOpenALError("Source::open");
}
template<class ResMgrT>
@ -233,7 +236,7 @@ Source<ResMgrT>& Source<ResMgrT>::operator=(const Source<ResMgrT>& rhs)
alSourcefv(sourceID_, AL_POSITION, ORIGIN);
alSourcefv(sourceID_, AL_VELOCITY, ORIGIN);
AudioCore::throwOpenALError("Source::operator=");
OALAudioCore::throwOpenALError("Source::operator=");
}
return *this;
}
@ -241,7 +244,7 @@ Source<ResMgrT>& Source<ResMgrT>::operator=(const Source<ResMgrT>& rhs)
template<class ResMgrT>
Source<ResMgrT>::operator bool() const
{
return isValid();
return isValid(); // do the work in isValid to avoid split implementation
}
template<class ResMgrT>
@ -252,7 +255,7 @@ void Source<ResMgrT>::play()
throw PreconditionException("Invalid Source::play call.");
}
alSourcePlay(sourceID_);
alSourcePlay(sourceID_); // play it
}
template<class ResMgrT>
@ -263,7 +266,7 @@ void Source<ResMgrT>::stop()
throw PreconditionException("Invalid Source::stop call.");
}
alSourceStop(sourceID_);
alSourceStop(sourceID_); // stop it
}
template<class ResMgrT>
@ -274,7 +277,7 @@ void Source<ResMgrT>::pause()
throw PreconditionException("Invalid Source::pause call.");
}
alSourcePause(sourceID_);
alSourcePause(sourceID_); // pause it
}
template<class ResMgrT>
@ -285,7 +288,7 @@ void Source<ResMgrT>::rewind()
throw PreconditionException("Invalid Source::rewind call.");
}
alSourceRewind(sourceID_);
alSourceRewind(sourceID_); // rewind it (doesn't stop)
}
template<class ResMgrT>
@ -296,13 +299,13 @@ void Source<ResMgrT>::setLooping(bool loop)
throw PreconditionException("Invalid Source::setLooping call.");
}
alSourcei(sourceID_, AL_LOOPING, loop);
alSourcei(sourceID_, AL_LOOPING, loop); // toggle looping
}
template<class ResMgrT>
bool Source<ResMgrT>::isValid() const
{
return alIsSource(sourceID_) == AL_TRUE;
return alIsSource(sourceID_) == AL_TRUE; // true if valid audio loaded
}
template<class ResMgrT>
@ -313,7 +316,7 @@ bool Source<ResMgrT>::isPlaying() const
throw PreconditionException("Invalid Source::isPlaying call.");
}
// check state
// check state using OpenAL query function
int state;
alGetSourcei(sourceID_, AL_SOURCE_STATE, &state);
return state == AL_PLAYING;
@ -327,7 +330,7 @@ bool Source<ResMgrT>::isLooping() const
throw PreconditionException("Invalid Source::isLooping call.");
}
// check looping status
// query looping status
int loop;
alGetSourcei(sourceID_, AL_LOOPING, &loop);
return loop == AL_TRUE;
@ -337,6 +340,7 @@ template<class ResMgrT>
void Source<ResMgrT>::addResource(const std::string& name,
const std::string& path)
{
// adds an aliased resource
ResourceManaged<ResMgrT>::resMgr_.newResource(name,
ResourceDescriptor(path));
}
@ -344,6 +348,7 @@ void Source<ResMgrT>::addResource(const std::string& name,
template<class ResMgrT>
void Source<ResMgrT>::addResource(const std::string& path)
{
// add non-aliased resource
ResourceManaged<ResMgrT>::resMgr_.newResource(path,
ResourceDescriptor(path));
}

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: entrypoint.hpp,v 1.10 2005/08/16 06:32:39 cozman Exp $
// $Id: entrypoint.hpp,v 1.11 2005/11/15 02:59:08 cozman Exp $
#ifndef PHOTON_ENTRYPOINT_HPP
@ -33,7 +33,7 @@
// Application& app(Application::getInstance);
//
// // create window
// app.createDisplay(800,600,32,0,0,false);
// app.createDisplay(800,600,32,0,0,DISP_WINDOWED);
//
// // set current state
// app.setState<MainMenu>();

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: exceptions.hpp,v 1.6 2005/07/19 01:31:37 cozman Exp $
// $Id: exceptions.hpp,v 1.7 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_EXCEPTIONS_HPP
#define PHOTON_EXCEPTIONS_HPP
@ -101,8 +101,8 @@ public:
};
// Class: ArgumentException
// ArgumentException should be thrown when an argument is passed to a function
// that is invalid.
// ArgumentException should be thrown when an invalid argument is passed to a
// function.
//
// Parent:
// <Exception>
@ -130,7 +130,7 @@ public:
};
// Class: RangeException
// RangeException should be thrown if something (such as an array bound) is out
// RangeException should be thrown if something (such as an array index) is out
// of bounds.
//
// Parent:

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Circle.hpp,v 1.3 2005/07/18 05:58:03 cozman Exp $
// $Id: Circle.hpp,v 1.4 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_MATH_CIRCLE_HPP
#define PHOTON_MATH_CIRCLE_HPP
@ -23,7 +23,10 @@ class Rect;
// Defines geometric entity known as a circle.
//
// A plane curve everywhere equidistant from a given fixed point, the center.
// <http://dictionary.com>
// (<http://dictionary.com>)
//
// Exists mainly to provide a bounding circle for objects, simplifying
// collision detection.
//
// Operators:
// - Circle == Circle
@ -116,17 +119,11 @@ public:
// Group: Accessors
public:
// Function: getCenter
// Get center <Point2>.
//
// Returns:
// Center point.
// Get center <Vector2::Point2>.
Point2 getCenter() const;
// Function: getRadius
// Get radius of Circle.
//
// Returns:
// Radius of circle.
scalar getRadius() const;
friend std::ostream& operator<<(std::ostream &o, const Circle &circle);

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Rect.hpp,v 1.2 2005/03/03 09:25:19 cozman Exp $
// $Id: Rect.hpp,v 1.3 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_MATH_RECT_HPP
#define PHOTON_MATH_RECT_HPP
@ -22,8 +22,11 @@ class Circle;
// Class: Rect
// Defines geometric entity known as a rectangle.
//
// A four-sided plane figure with four right angles. <http://dictionary.com>
// A four-sided plane figure with four right angles. (<http://dictionary.com>)
//
// Exists mainly to provide a bounding rectangle for objects, simplifying
// collision detection.
//
// Operators:
// - Rect == Rect
// - ostream& << Rect
@ -33,7 +36,7 @@ class Rect
public:
// Function: Rect
// Initializes rectangle at (0,0) with size of 0.
// Initializes rectangle at (0,0) with width/height of 0.
Rect();
// Function: Rect
@ -64,14 +67,14 @@ bool operator==(const Rect &rhs) const;
public:
// Function: moveTo
// move rectangle to new location.
// Move rectangle to new location.
//
// Parameters:
// topleft - Point describing new top left corner.
void moveTo(const Point2 &topleft);
// Function: moveRel
// move rectangle relative to current position.
// Move rectangle relative to current position.
//
// Parameters:
// xMove - Distance to move horizontally.
@ -79,7 +82,7 @@ public:
void moveRel(scalar xMove, scalar yMove);
// Function: resize
// set new size for rectangle.
// Set new size for rectangle.
//
// Parameters:
// width - New width for rectangle.
@ -87,7 +90,7 @@ public:
void resize(scalar width, scalar height);
// Function: resizeRel
// set new size for rectangle, relative to current size.
// Set new size for rectangle, relative to current size.
//
// Parameters:
// widthDelta - Change to be applied to width of rectangle.
@ -139,7 +142,7 @@ public:
bool contains(const Rect &rect) const;
// Function: calcIntersection
// calculates & returns the intersection of two rectangles.
// Calculates & returns the intersection of two rectangles.
//
// Parameters:
// rect - Rectangle to find & calculate area of intersection with.
@ -155,87 +158,51 @@ public:
public:
// Function: getX
// Get x coord of rectangle. (top left corner)
//
// Returns:
// Returns x coord of top left corner of rectangle.
// Get x coord of top left corner of rectangle.
scalar getX() const;
// Function: getY
// Get y coord of rectangle. (top left corner)
//
// Returns:
// Returns y coord of top left corner of rectangle.
// Get y coord of top left corner of rectangle.
scalar getY() const;
// Function: getTop
// Get y coord of top side of rectangle.
//
// Returns:
// Returns y coord of top side of rectangle.
scalar getTop() const;
// Function: getLeft
// Get x coord of left side of rectangle.
//
// Returns:
// Returns x coord of left side rectangle.
scalar getLeft() const;
// Function: getBottom
// Get y coord of bottom side of rectangle.
//
// Returns:
// Returns y coord of bottom side of rectangle.
scalar getBottom() const;
// Function: getRight
// Get x coord of right side of rectangle.
//
// Returns:
// Returns x coord of right side rectangle.
scalar getRight() const;
// Function: getWidth
// Get width of rectangle.
//
// Returns:
// Returns width of rectangle.
scalar getWidth() const;
// Function: getHeight
// Get height of rectangle.
//
// Returns:
// Height of rectangle.
scalar getHeight() const;
// Function: getTopLeft
// Get top left corner of rectangle.
//
// Returns:
// Top left corner of rectangle.
Point2 getTopLeft() const;
// Function: getTopRight
// Get top right corner of rectangle.
//
// Returns:
// Top right corner of rectangle.
Point2 getTopRight() const;
// Function: getBottomLeft
// Get bottom left corner of rectangle.
//
// Returns:
// Bottom left corner of rectangle.
Point2 getBottomLeft() const;
// Function: getBottomRight
// Get bottom right corner of rectangle.
//
// Returns:
// Bottom right corner of rectangle.
Point2 getBottomRight() const;
friend std::ostream& operator<<(std::ostream &o, const Rect &rect);

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Vector2.hpp,v 1.5 2005/07/17 02:40:58 cozman Exp $
// $Id: Vector2.hpp,v 1.6 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_MATH_VECTOR2_HPP
#define PHOTON_MATH_VECTOR2_HPP
@ -21,7 +21,7 @@ namespace math
// Class: Vector2
// Represents a two-dimensional vector. A quantity specified by a magnitude
// and a direction. Vector is oriented in classical 2D graphics format with
// and a direction. Vector is oriented in classic 2D graphics format with
// origin at top corner of screen.
//
// Operators:
@ -83,7 +83,7 @@ public:
void set(scalar nx, scalar ny);
// Function: resolveDeg
// resolve vector, given a magnitude & angle in degrees.
// Resolve vector, given a magnitude & angle in degrees.
//
// Parameters:
// magnitude - Magnitude of new vector.
@ -95,7 +95,7 @@ public:
// Function: resolveRad
// resolve vector, given a magnitude & angle in radians.
// Resolve vector, given a magnitude & angle in radians.
//
// Parameters:
// magnitude - Magnitude of new vector.
@ -137,7 +137,7 @@ public:
public:
// Function: getMagnitude
// Get length of vector.
// Determine length of vector.
//
// Returns:
// Length of the vector.
@ -147,13 +147,13 @@ public:
// Angle of vector in degrees, angle is calculated with respect to positive
// X axis.
//
// | |90<EFBFBD>
// | |90
// | |
// | |
// |180<EFBFBD>-----------------------0<EFBFBD> or 360<EFBFBD>
// |180-----------------------0 or 360
// | |
// | |
// | |270<EFBFBD>
// | |270
//
// Returns:
// Angle of vector (in degrees).

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: math.hpp,v 1.6 2005/07/18 05:58:03 cozman Exp $
// $Id: math.hpp,v 1.7 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_MATH_MATH_HPP
#define PHOTON_MATH_MATH_HPP
@ -48,7 +48,7 @@ T clamp(T val, C low, C high);
// Parameters:
// val1 - First value to compare.
// val2 - Second value to compare.
// epsilon - Epsilon value, defaults to 0.0001.
// epsilon - Epsilon value, defaults to 0.000001.
//
// Returns:
// true if |val1-val2| < epsilon, meaning values are approximately equal

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: types.hpp,v 1.8 2005/08/12 06:26:00 cozman Exp $
// $Id: types.hpp,v 1.10 2005/11/15 02:59:08 cozman Exp $
#ifndef PHOTON_TYPES_HPP
#define PHOTON_TYPES_HPP
@ -39,7 +39,7 @@ typedef double scalar;
// Group: STL/Boost Types
// Type: StrVec
// Typedef for vector of strings, which is used all throughout photon.
// Typedef for vector of strings, which is used throughout photon.
typedef std::vector<std::string> StrVec;
// Type: shared_ptr
@ -49,7 +49,10 @@ using boost::shared_ptr;
// Group: Enums
// Enum: KeyCode
// Enumeration defining keys, used in <Application::keyPressed>.
// Enumeration for keys, includes printable characters and special keys.
//
// Keys are shown roughly in the order they appear on the keyboard to aid
// finding a specific key.
//
// Enums:
// KEY_ESC - Escape key
@ -305,7 +308,7 @@ enum KeyCode
};
// Enum: MouseButton
// Enumeration defining buttons, used in <Application::mouseButtonPressed>.
// Enumeration defining mouse buttons.
//
// MB_LEFT - Left mouse button.
// MB_MIDDLE - Middle mouse button.
@ -327,6 +330,16 @@ enum ScrollDir
SCROLL_UP, SCROLL_DOWN
};
// Enum: DisplayMode
// Enumeration defining types of displays.
//
// DISP_WINDOWED - Windowed Mode
// DISP_FULLSCREEN - Fullscreen Mode
enum DisplayMode
{
DISP_WINDOWED, DISP_FULLSCREEN
};
}
#endif //PHOTON_TYPES_HPP

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: ConfigFile.hpp,v 1.6 2005/07/19 01:31:37 cozman Exp $
// $Id: ConfigFile.hpp,v 1.7 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_CONFIGFILE_HPP
#define PHOTON_UTIL_CONFIGFILE_HPP
@ -69,7 +69,7 @@ public:
public:
// Function: open
// open a file, processing it as an INI-like config file.
// Open a file, processing it as an INI-like config file.
//
// Parameters:
// filename - Name of ConfigFile to open.

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: FileBuffer.hpp,v 1.4 2005/06/10 07:06:06 cozman Exp $
// $Id: FileBuffer.hpp,v 1.5 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_FILEBUFFER_HPP
#define PHOTON_UTIL_FILEBUFFER_HPP
@ -23,8 +23,14 @@ namespace util
{
// Class: FileBuffer
// Class for reading data from a file, uses PhysFS <http://physfs.icculus.org>
// and is capable of reading from archives on the search path.
// Class for reading data from a file, uses PhysFS
// (<http://physfs.icculus.org>)
// and is capable of reading from archives on the search path.
//
// All paths used are relative to the search path.
// By default only files within the directory the application is running or
// it's subdirectories are accessible. Additional directories may be added
// to the search path via <addToSearchPath>.
class FileBuffer
{
@ -38,7 +44,8 @@ public:
// Initializing constructor, calls <open>.
//
// Parameters:
// filename - Name of file to load.
// filename - Name of file to load. (See notes on how FileBuffer handles
// paths at top of page)
FileBuffer(const std::string& filename);
// Function: ~FileBuffer
@ -51,18 +58,20 @@ public:
// Loads a file into the FileBuffer.
//
// Parameters:
// filename - Name of file to load.
// filename - Name of file to load. (See notes on how FileBuffer handles
// paths at top of page)
void open(const std::string& filename);
// Function: close
// Frees memory occupied by loaded data.
// Closes the file, all future read attempts will fail until <open> is
// called agian.
void close();
// Group: Accessors
public:
// Function: getData
// Loads an amount of data, returns a pointer to the loaded data.
// Reads data from file into a <ubyte>-vector.
// If the requested amount of data wasn't available, returns only
// what could be loaded. If amount is 0 (default), returns entire buffer.
//
@ -88,7 +97,7 @@ public:
uint getSize() const;
// Function: isEOF
// Checks if internal cursor is at end of file.
// Checks if internal cursor has reached end of file.
//
// Returns:
// True iff eof, false otherwise.

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: RandGen.hpp,v 1.5 2005/07/18 06:18:51 cozman Exp $
// $Id: RandGen.hpp,v 1.6 2005/10/30 21:08:57 cozman Exp $
#ifndef PHOTON_UTIL_RANDGEN_HPP
#define PHOTON_UTIL_RANDGEN_HPP
@ -17,7 +17,8 @@ namespace util
// Class: RandGen
// Psuedorandom number generator class which uses Mersenne Twister.
// MT19937 is described at <http://www.math.keio.ac.jp/matumoto/emt.html>.
// MT19937 is described at
// <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html>.
class RandGen
{
// Group: (Con/De)structors

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Singleton.hpp,v 1.8 2005/07/18 06:18:51 cozman Exp $
// $Id: Singleton.hpp,v 1.9 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_SINGLETON_HPP
#define PHOTON_UTIL_SINGLETON_HPP
@ -44,19 +44,19 @@ template<class T>
class Singleton : public boost::noncopyable
{
public:
// Function: initialize
// Initialize the instance of the singleton, can be done explicitly if
// order of construction matters. Will be done on first call to
// getInstance otherwise.
static void initialize();
// Function: destroy
// Destroy the instance of the singleton, can be done explicitly if order
// of destruction matters. Will be done automatically if not done.
// Destroy the instance of the singleton, must be done for every singleton
// created.
//
// Throws:
// <PreconditionException> if called for uninitialized singleton
static void destroy();
// Function: getInstance
// Get a reference to the instance of the derived class.
//
// Throws:
// <PreconditionException> if called for uninitialized singleton
static T& getInstance();
protected:
@ -70,22 +70,6 @@ private:
// template implementation
template<class T>
Singleton<T>::Singleton()
{
if(instance_ != 0)
{
throw PreconditionException("Attempt to double-initialize singleton.");
}
instance_ = static_cast<T*>(this); // cast self to type of T*
}
template<class T>
Singleton<T>::~Singleton()
{
}
template<class T>
void Singleton<T>::destroy()
{
@ -112,6 +96,22 @@ T& Singleton<T>::getInstance()
return *instance_; //return dereferenced instance
}
template<class T>
Singleton<T>::Singleton()
{
if(instance_ != 0)
{
throw PreconditionException("Attempt to double-initialize singleton.");
}
instance_ = static_cast<T*>(this); // cast self to type of T*
}
template<class T>
Singleton<T>::~Singleton()
{
}
template<class T>
T* Singleton<T>::instance_(0);

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Task.hpp,v 1.1 2005/08/17 06:35:56 cozman Exp $
// $Id: Task.hpp,v 1.2 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_TASK_HPP
#define PHOTON_UTIL_TASK_HPP
@ -21,15 +21,18 @@ namespace util
// Title: Task
// Group: Task-Related
// Two helper types related to the <Task> class.
// Enum: PriorityLevel
// Enumeration defining priority of a Task.
//
// Values:
// PRI_LOWEST - Lowest priority available.
// PRI_LOW - Lower-than-usual priority.
// PRI_NORMAL - Normal priority, suitable for most tasks.
// PRI_HIGH - Lower-than-usual priority.
// PRI_HIGHEST - Highest priority available.
// PRI_HIGH - Lower-than-usual priority.
// PRI_NORMAL - Normal priority, suitable for most tasks.
// PRI_LOW - Lower-than-usual priority.
// PRI_LOWEST - Lowest priority available.
enum PriorityLevel
{
PRI_HIGHEST,
@ -39,6 +42,12 @@ enum PriorityLevel
PRI_LOWEST
};
// Type: TaskPtr
// Pointer to a task, used since Task is abstract and will always be accessed
// via a pointer.
class Task;
typedef shared_ptr<Task> TaskPtr;
// Class: Task
// Abstract class for tasks, which are runnable classes for use with
// <TaskManager>.
@ -53,9 +62,9 @@ public:
//
// Parameters:
// name - Name for task, must be unique!
// priority - Optional argument for desired priority for the Task,
// controls order in which tasks are run by the <TaskManager>.
// Default Priority is PRI_NORMAL
// priority - Optional <PriorityLevel> argument for desired priority for
// the Task, controls order in which tasks are run by the
// <TaskManager>. Default Priority is PRI_NORMAL.
Task(const std::string& name, PriorityLevel priority=PRI_NORMAL);
// Function: ~Task
@ -86,8 +95,8 @@ public:
// task is paused.
//
// Note:
// Children of onPause should call Task::onPause to let the task know it's
// been paused.
// Derived tasks with overloaded onPause methods should call Task::onPause
// to let the task know it's been paused.
virtual void onPause();
// Function: onUnpause
@ -95,8 +104,8 @@ public:
// task is unpaused.
//
// Note:
// Children of onUnpause should call Task::onUnpause to let the task know
// it's been paused.
// Derived tasks with overloaded onUnpaus methods should call
// Task::onUnpause to let the task know it's been paused.
virtual void onUnpause();
// Function: kill
@ -142,11 +151,6 @@ private:
bool paused_; // if false task won't be executed
};
// Type: TaskPtr
// Pointer to a task, used since Task is abstract and will always be accessed
// via a pointer.
typedef shared_ptr<Task> TaskPtr;
}
}

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: TaskManager.hpp,v 1.1 2005/08/17 06:35:56 cozman Exp $
// $Id: TaskManager.hpp,v 1.2 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_TASKMANAGER_HPP
#define PHOTON_UTIL_TASKMANAGER_HPP
@ -25,8 +25,8 @@ namespace util
// handles adding, deleting, pausing, and unpausing tasks.
//
// To use TaskManager:
// - (1) Add any tasks (should be derived from <Task>)
// - (2) Call step() every frame when task should update.
// - Add any tasks (should be derived from <Task>)
// - Call step() every frame when task should update.
class TaskManager
{
@ -49,8 +49,7 @@ public:
// tasks have the same priority, they are run in the order they were added.
//
// Parameters:
// timeDelta - The time elapsed between frames, possibly fixed via
// <Application::setFixedUpdateStep>.
// timeDelta - The time elapsed between frames.
void step(scalar timeDelta);
// Group: Task Management

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Timer.hpp,v 1.4 2005/08/08 07:27:50 cozman Exp $
// $Id: Timer.hpp,v 1.5 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_TIMER_HPP
#define PHOTON_UTIL_TIMER_HPP
@ -18,7 +18,7 @@ namespace util
// Class: Timer
// Class capable of keeping track of time.
// Time is returned in double format, in seconds.
// Time is kept in double format, representing seconds.
class Timer
{
@ -30,7 +30,7 @@ public:
//
// Parameters:
// appTimeLinked - Option only available on creation of timer. When true
// timer will pause when the <Application::timer> is paused.
// timer will pause when the Application timer is paused.
// [default: true]
Timer(bool appTimeLinked=true);
@ -57,16 +57,10 @@ public:
public:
// Function: getTime
// Get time in seconds. (ie. A value of .001 means 1 millisecond.)
//
// Returns:
// Time on timer, in seconds.
double getTime() const;
// Function: isPaused
// Check paused/unpaused status of timer.
//
// Returns:
// True if timer is paused, false if timer is running.
bool isPaused() const;
private:

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: VersionInfo.hpp,v 1.7 2005/07/18 06:18:51 cozman Exp $
// $Id: VersionInfo.hpp,v 1.8 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_VERSIONINFO_HPP
#define PHOTON_UTIL_VERSIONINFO_HPP
@ -20,7 +20,7 @@ namespace util
// Class: VersionInfo
// Class which stores version information, such as release numbers.
// Format is majorRelease.Minor.Release [ExtraInfo].
// Format is Major.Minor.Patch [ExtraInfo].
//
// Operators:
// - VersionInfo < VersionInfo
@ -35,12 +35,12 @@ public:
// Group: Variables
// Variable: majorRelease
// major release version number, should be changed when major changes take
// Major release version number, should be changed when major changes take
// place.
unsigned int majorRelease;
// Variable: minor
// minor release version number, should be changed when key features are
// Minor release version number, should be changed when key features are
// added/removed/changed.
unsigned int minorRelease;
@ -54,7 +54,7 @@ public:
std::string extra;
// Group: (Con/De)structors
public:
// Function: VersionInfo
// Default constructor.
VersionInfo();
@ -63,7 +63,7 @@ public:
// Initializing constructor.
//
// Parameters:
// maj - majorRelease version number.
// maj - Major version number.
// min - Minor version number.
// pat - Patch number.
// ext - Extra info string. [default: ""]

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: filesys.hpp,v 1.4 2005/07/20 07:30:13 cozman Exp $
// $Id: filesys.hpp,v 1.5 2005/11/13 07:59:48 cozman Exp $
#ifndef PHOTON_UTIL_FILESYS_FILESYS_HPP
#define PHOTON_UTIL_FILESYS_FILESYS_HPP
@ -18,6 +18,34 @@
#include <vector>
// Title: filesys::
// The util::filesys:: namespace is a group of functions all related to dealing
// with the filesystem. Photon uses PhysFS (http://physfs.icculus.org) to
// provide this functionality.
//
// The Search Path:
// The search path is an important concept in Photon, due to the nature of
// PhysFS when a file is referenced Photon attempts to resolve it by checking
// for it within the search path. By default the search path only includes
// the directory where the application resides. Nothing which is not within
// this directory or a directory within it can be accessed.
//
// It is possible to add other directories to the search path using
// <addToSearchPath>. Keep in mind that the search path is a list of
// directories which will be searched in order for any requested files.
// In other words if you wish to store your game media in a format like:
// | game/
// | bin/
// | images/
// | audio/
// | user-audio/
// |
//
// You will need to add images/ and audio/ to the search path since they
// do not reside within bin (where the game is stored). Also assuming
// users are allowed to place custom audio files within user-audio/ you must
// also add it to the path. If you wish for files within it to override
// existing audio files, it should preceed audio/ in the search path, otherwise
// it should come be placed in the search path after audio/.
namespace photon
{
@ -30,21 +58,24 @@ namespace filesys
// Function: getCDDirs
// Gets a listing of the CD directories on a system (not supported on all
// systems)
// systems) On Windows it would return something like D:/ or E:/, whereas on
// Linux it would return something like /media/cdrom0.
//
// Returns:
// A vector of strings containing the path to the CD directories.
std::vector<std::string> getCDDirs();
// Function: getBaseDir
// Get the path to the directory that the application is running in.
// Get the path of the directory that the application is running in.
//
// Returns:
// Path to directory that application is running from.
std::string getBaseDir();
// Function: getUserDir
// Get the path to the directory that the OS specifies for the user's home.
// Get the path of the directory that the OS specifies for the user's home.
// On Windows would resemble C:/Documents and Settings/User, on Linux something
// like /home/user/
//
// Returns:
// Path to user's home directory.
@ -69,8 +100,7 @@ void addToSearchPath(const std::string& dir, bool append=true);
// Removes a directory from the search path, if it exists on the path.
//
// Parameters:
// dir - Directory to remove from the search path, if it doesn't exist
// nothing happens.
// dir - Directory to remove from the search path. Ignored if nonexistant.
//
// See Also:
// <addToSearchPath>
@ -91,7 +121,8 @@ std::vector<std::string> getSearchPath();
// Group: Manipulation /////////////////////////////////////////////////////////
// Function: setWriteDir
// Sets the writing directory, used by <mkdir> and <remove>.
// Sets the writing directory, used by <mkdir> and <remove>. Unlike search
// path only one writable directory can be set at once.
//
// Parameters:
// dir - Directory to make writeable

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Color.hpp,v 1.1 2005/03/02 08:40:11 cozman Exp $
// $Id: Color.hpp,v 1.2 2005/11/13 07:59:49 cozman Exp $
#ifndef PHOTON_VIDEO_COLOR_HPP
#define PHOTON_VIDEO_COLOR_HPP
@ -23,6 +23,8 @@ namespace video
// Class for storing components of a color.
//
// Operators:
// - Color = Color
// - Color == Color
// - ostream& << Color
class Color
{
@ -65,7 +67,7 @@ public:
// Group: Utility
public:
// Functions: setColor
// Function: setColor
// Creates color, component by component.
//
// Parameters:
@ -75,7 +77,7 @@ public:
// a - Value for alpha component. [default: 255]
void setColor(ubyte r, ubyte g, ubyte b, ubyte a=255);
// Functions: makeGLColor
// Function: makeGLColor
// Makes the Color the current openGL color. (glColor4ub)
void makeGLColor() const;

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Font.hpp,v 1.7 2005/07/18 07:19:48 cozman Exp $
// $Id: Font.hpp,v 1.9 2005/11/13 07:59:49 cozman Exp $
#ifndef PHOTON_VIDEO_FONT_HPP
#define PHOTON_VIDEO_FONT_HPP
@ -23,16 +23,19 @@ class StreamFlusher { };
std::ostream& operator<<(std::ostream& os, const StreamFlusher& rhs);
// Class: Font
// Simple OO wrapper around a TrueType font that can be drawn to textures and
// rendered via OpenGL.
// Simple wrapper object around a TrueType font that can be drawn to textures
// and rendered via OpenGL.
//
// Since Font is a child of <ResourceManaged>, all memory management is
// taken care of.
//
// Font is a resource managed class, and therefore all resources should
// be registered using <Font::addResource> and then loaded by their assigned
// name via <Font::open> or the appropriate constructor.
//
// Operators:
// - Font = Font
// - bool : True if font is loaded, false if not.
// - ostream& << Font
class Font : public ResourceManaged<FontResourceManager>
{
// Group: (Con/De)structors
@ -98,24 +101,73 @@ public:
// Group: Drawing
public:
// Function: drawText
// Draw text to screen at a specific position, using an printf-style
// format string.
//
// Parameters:
// x - X position to start drawing text at
// y - Y position to start drawing text at.
// str - printf-style format string
// ... - optional variable arguments referenced in str
void drawText(scalar x, scalar y, const char *str, ...) const;
// Function: drawText
// Draw text to screen at a specific position.
//
// Parameters:
// x - X position to start drawing text at
// y - Y position to start drawing text at.
// str - Text to draw at specified posiiton.
void drawText(scalar x, scalar y, const std::string& str) const;
// Function: beginDraw
// Begin drawing of text using C++ style output streams.
//
// Parameters:
// x - X position to start drawing text at
// y - Y position to start drawing text at.
//
// Returns:
// std::ostream reference, anything written to the stream before
// <endDraw> will be drawn starting at the specified position.
std::ostream& beginDraw(scalar x, scalar y);
// Function: endDraw
// End drawing of text started with <beginDraw>.
// Should be passed to the open beginDraw stream, flushing and writing the
// stream to the display.
StreamFlusher endDraw();
// Group: Font Metrics
public:
// Function: calcStringWidth
// Calculate the width of a string when drawn in the current font.
//
// Parameters:
// str - String to calculate the width of.
//
// Returns:
// Width of string (in pixels) when drawn in current font.
uint calcStringWidth(const std::string& str) const;
// Function: getHeight
// Get height of the font, which is essentially equal to the height of the
// tallest character plus a font-specified spacing.
//
// Returns:
// Height of the loaded font.
uint getHeight() const;
// Group: Resource Creation
public:
// Function: addResource
// Define a new named resource.
// (Ex. Image::addResource("monkey","images/monkey.png") would
// make it so that any attempts to load "monkey" would load the image
// images/monkey.png)
// (Ex. Font::addResource("sans","freesans.ttf") would
// make it so that any attempts to load "sans" would load the font
// freesans.ttf)
//
// Parameters:
// name - Name to give to resource.
@ -125,10 +177,10 @@ public:
// Function: addResource
// Define a new unaliased resource. (name == path).
// (Ex. Image::addResource("images/monkey.png") is essentially the same as
// Image::addResource("images/monkey.png","images/monkey.png")
// (Ex. Font::addResource("freesans.ttf") is essentially the same as
// Font::addResource("freesans.ttf","freesans.ttf")
//
// Parameters:.
// Parameters:
// path - Path of resource data file.
static void addResource(const std::string& path, uint size);

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Image.hpp,v 1.2 2005/07/18 07:19:48 cozman Exp $
// $Id: Image.hpp,v 1.3 2005/11/13 07:59:49 cozman Exp $
#ifndef PHOTON_VIDEO_IMAGE_HPP
#define PHOTON_VIDEO_IMAGE_HPP
@ -21,17 +21,15 @@ namespace video
// Image is a class which is used to store a single image, for use in 2D games.
//
// Image is derived from <Texture>, which is a resource managed class.
// <Texture> is a simple OO wrapper around the concept of a texture in OpenGL.
// An Image simply adds the ability to draw to a quad, as well as some rotation
// per-vertex tinting, and several other bonuses.
// An Image simply adds the ability to draw to a quad, as well as some scaling,
// rotation, per-vertex tinting, and several other bonuses.
//
// Since Image is a child of <ResourceManaged>, all memory management is taken
// care of.
//
// Operators:
// - Texture = Texture
// - operator bool
// - ostream& << Texture
// - Image = Image
// - bool : True if texture is loaded, false if not.
class Image : public Texture
{
@ -67,7 +65,7 @@ public:
// Opens an image file, currently supported image types are BMP, GIF, JPEG,
// PCX, PNG, and TGA. (Images can be any dimensions)
//
// Loading is done via <a href="http://corona.sf.net">Corona</a>.
// Loading is done via Corona (<http://corona.sf.net>)
//
// Parameters:
// name - Name of the Image <Resource> to open.

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Pen.hpp,v 1.3 2005/07/20 03:58:54 cozman Exp $
// $Id: Pen.hpp,v 1.5 2005/11/13 07:59:49 cozman Exp $
#ifndef PHOTON_VIDEO_PEN_HPP
#define PHOTON_VIDEO_PEN_HPP
@ -25,7 +25,8 @@ namespace video
// Class which is used for drawing primitives.
//
// Each instance of pen has a color, and the various members simply draw
// primitives in that color.
// primitives in that color. Since it is possible to change the color
// associated with a pen, there is often no need for multiple instances of Pen.
class Pen
{
@ -134,6 +135,9 @@ public:
// data members
private:
Color color_;
// 30 seems to be an even tradeoff between speed and roundness
static const int CIRCLE_RESOLUTION = 30;
};
}

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Texture.hpp,v 1.4 2005/07/04 03:06:48 cozman Exp $
// $Id: Texture.hpp,v 1.5 2005/11/13 07:59:49 cozman Exp $
#ifndef PHOTON_VIDEO_TEXTURE_HPP
#define PHOTON_VIDEO_TEXTURE_HPP
@ -19,10 +19,12 @@ namespace video
{
// Class: Texture
// Simple OO wrapper around the concept of a texture in openGL.
// Simple OO wrapper around the concept of a texture in OpenGL.
//
// Since Texture is a child of <ResourceManaged>, all memory management is
// taken care of.
//
// Texture loading is done via Corona (<http://corona.sf.net>)
//
// Children:
// <Image>
@ -30,7 +32,6 @@ namespace video
// Operators:
// - Texture = Texture
// - bool : True if texture is loaded, false if not.
// - ostream& << Texture
class Texture : public ResourceManaged<TextureResourceManager>
{
@ -65,7 +66,7 @@ public:
// Opens an image file, currently supported image types are BMP, GIF, JPEG,
// PCX, PNG, and TGA.
//
// Loading is done via <a href="http://corona.sf.net">Corona</a>.
// Loading is done via Corona (<http://corona.sf.net>)
//
// Parameters:
// name - Name of the Texture <Resource> to open.
@ -102,7 +103,7 @@ public:
// Function: addResource
// Define a new named resource.
// (Ex. Image::addResource("monkey","images/monkey.png") would
// (Ex. Texture::addResource("monkey","images/monkey.png") would
// make it so that any attempts to load "monkey" would load the image
// images/monkey.png)
//
@ -113,10 +114,10 @@ public:
// Function: addResource
// Define a new unaliased resource. (name == path).
// (Ex. Image::addResource("images/monkey.png") is essentially the same as
// Image::addResource("images/monkey.png","images/monkey.png")
// (Ex. Texture::addResource("images/monkey.png") is essentially the same
// as Texture::addResource("images/monkey.png","images/monkey.png")
//
// Parameters:.
// Parameters:
// path - Path of resource data file.
static void addResource(const std::string& path);

View File

@ -24,58 +24,70 @@ Footer: Documentation for <a href="http://photon.sourceforge.net">photon</a>. Co
# time it is run. When working with groups, just deal with the braces and
# forget about the indentation and comments.
#
# You can use this file on other computers even if they use different
# directories. As long as the command line points to the same source files,
# Natural Docs will be able to correct the locations automatically.
#
# --------------------------------------------------------------------------
Group: photon:: {
File: Photon Documentation (/home/james/src/photon/ndoc/pages/index.txt)
File: Application (Application.hpp)
File: Basic Types (types.hpp)
File: Exception/Error Types (exceptions.hpp)
File: Log (Log.hpp)
File: Logging Utilities (LogSink.hpp)
File: PhotonMain (entrypoint.hpp)
File: ResourceManaged (ResourceManaged.hpp)
File: ResourceManager (ResourceManager.hpp)
File: State (State.hpp)
File: Task (Task.hpp)
File: TaskManager (Kernel.hpp)
Group: photon:: Library Documentation {
File: Application (/home/james/src/photon/include/Application.hpp)
File: Basic Types (/home/james/src/photon/include/types.hpp)
File: Exception/Error Types (/home/james/src/photon/include/exceptions.hpp)
File: Log (/home/james/src/photon/include/Log.hpp)
File: Logging Utilities (/home/james/src/photon/include/LogSink.hpp)
File: PhotonMain (/home/james/src/photon/include/entrypoint.hpp)
File: ResourceManaged (/home/james/src/photon/include/ResourceManaged.hpp)
File: ResourceManager (/home/james/src/photon/include/ResourceManager.hpp)
File: State (/home/james/src/photon/include/State.hpp)
Group: Audio:: {
File: AudioCore (audio/AudioCore.hpp)
File: Source (audio/Source.hpp)
File: AudioCore (/home/james/src/photon/include/audio/AudioCore.hpp)
File: Source (/home/james/src/photon/include/audio/Source.hpp)
} # Group: Audio::
Group: Math:: {
File: Circle (math/Circle.hpp)
File: Math Utilities (math/math.hpp)
File: Rect (math/Rect.hpp)
File: Vector2 (math/Vector2.hpp)
File: Circle (/home/james/src/photon/include/math/Circle.hpp)
File: Math Utilities (/home/james/src/photon/include/math/math.hpp)
File: Rect (/home/james/src/photon/include/math/Rect.hpp)
File: Vector2 (/home/james/src/photon/include/math/Vector2.hpp)
} # Group: Math::
Group: Util:: {
File: ConfigFile (util/ConfigFile.hpp)
File: FileBuffer (util/FileBuffer.hpp)
File: filesys:: (util/filesys/filesys.hpp)
File: RandGen (util/RandGen.hpp)
File: Singleton (util/Singleton.hpp)
File: Timer (util/Timer.hpp)
File: VersionInfo (util/VersionInfo.hpp)
File: ConfigFile (/home/james/src/photon/include/util/ConfigFile.hpp)
File: FileBuffer (/home/james/src/photon/include/util/FileBuffer.hpp)
File: filesys:: (/home/james/src/photon/include/util/filesys/filesys.hpp)
File: RandGen (/home/james/src/photon/include/util/RandGen.hpp)
File: Singleton (/home/james/src/photon/include/util/Singleton.hpp)
File: Task (/home/james/src/photon/include/util/Task.hpp)
File: TaskManager (/home/james/src/photon/include/util/TaskManager.hpp)
File: Timer (/home/james/src/photon/include/util/Timer.hpp)
File: VersionInfo (/home/james/src/photon/include/util/VersionInfo.hpp)
} # Group: Util::
Group: Video:: {
File: Color (video/Color.hpp)
File: Font (video/Font.hpp)
File: Image (video/Image.hpp)
File: Pen (video/Pen.hpp)
File: Texture (video/Texture.hpp)
File: Color (/home/james/src/photon/include/video/Color.hpp)
File: Font (/home/james/src/photon/include/video/Font.hpp)
File: Image (/home/james/src/photon/include/video/Image.hpp)
File: Pen (/home/james/src/photon/include/video/Pen.hpp)
File: Texture (/home/james/src/photon/include/video/Texture.hpp)
} # Group: Video::
} # Group: photon::
} # Group: photon:: Library Documentation
Group: Tutorials {
File: Photon Tutorials (/home/james/src/photon/ndoc/tutorials/index.txt)
File: 01 - Getting Started (no auto-title, /home/james/src/photon/ndoc/tutorials/tutorial01.txt)
} # Group: Tutorials
Group: Index {
@ -85,5 +97,12 @@ Group: Index {
Function Index: Functions
Type Index: Types
Variable Index: Variables
File Index: Files
} # Group: Index
##### Do not change or remove these lines. #####
Data: 1(D3333RuEG3lpEG636H93IRutu\38\9oNfG)
Data: 1(h3333RuEG3lpEG636H93IRutu\3\fu93Ip`G6)
Data: 1(T3333RuEG3lpEG636H93IRutu\3\fu93tNtuH8po6)

30
ndoc/pages/index.txt Normal file
View File

@ -0,0 +1,30 @@
Document: Photon Documentation
Introduction:
This is the photon developer documentation, generated via NaturalDocs
(http://naturaldocs.org) from comments embedded directly in the code. If you're
writing something with public documentation I'd highly recommend it, since as
you can see it's output looks signifigantly better than some of those other
documentation generators ;).
How To Use The Docs:
In the left pane the public namespaces are listed, click on a namespace name
to expand or collapse it. Clicking on a class/topic name will show the
documentation for that class or topic.
The Tutorials:
Because just diving right into the documentation can be daunting, there are also
official tutorials alongside the documentation. The <Photon Tutorials> section
has more detail.
Helping Out:
If you see anything that is incorrect, incomplete, or is just poorly described .
and could use clarification, please be sure to let me know (cozman@users.sf.net).
I want this documentation to be as helpful as possible to both new and
experienced users of photon, so feel free to contact me with quesions,
criticisms, or suggestions of any kind.
If you're interested in helping out, but don't feel like you could contribute
useful code someone to help keep the documentation current would be appreciated.
If interested in helping out in any way, I'd love to hear from you.

10
ndoc/tutorials/index.txt Normal file
View File

@ -0,0 +1,10 @@
Document: Photon Tutorials
Welcome to the offical Photon tutorials, they are part of the NaturalDoc documentation
so that they are easy to write and cross-reference with the docs. The tutorials
are a work in progress, and if you'd like to contribute it would be greatly
appreciated as they take up time that could be used working on Photon.
- <Tutorial 01 - Getting Started> - Tutorial on basic setup of a
Photon application.
- Tutorial 02 - Coming Soon

View File

@ -0,0 +1,259 @@
Document: Tutorial 01 - Getting Started
Group: Introduction
Topic: Before We Start
This tutorial serves as an introduction to using Photon with C++. It is written
so that those with a moderate amount of C++ experience can follow it and be able
to get started with Photon. This tutorial does *NOT* aim to teach
C++, Game Programming, or how to use every arcane feature available in Photon.
After reading this tutorial, the basic structure of a Photon application should
be understood, and by reading the available <Photon Documentation>
one should be able to start with Photon without much difficulty.
In addition to having C++ experience, it is assumed that the reader of this
tutorial has already set up Photon and all dependency libraries. For help doing
this look at the page <http://photon.sourceforge.net/index.php/getting-photon>.
You can also ask for help on the Photon mailing lists (<http://lists.sourceforge.net/lists/listinfo/photon-users>).
Topic: Getting Started
Perhaps the best way to get started it to show what an extremely simple Photon
application looks like.
(code)
#include <photon.hpp>
using namespace photon;
class SomeState : public State
{
public:
void render()
{
// do any rendering in here
}
void update()
{
// do any updating of logic in here
}
};
int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,DISP_WINDOWED);
app.setState<SomeState>();
app.run();
return 0;
}
(end)
Perhaps you can follow the example above fairly well, if so you
probably won't have a tough time picking up Photon as you go. For
those who aren't so sure as to what is going on, fear not, by the end of the
tutorial everything you see will have been addressed. Even if you don't know
what it means, the fact that the above application is all it takes to get
an empty window should indicate Photon really isn't too difficult to use.
The entrypoint function in any Photon application is a function called
<PhotonMain>. In order to be as simple to use as possible, Photon
takes care of it's own initialization by defining a main() function that
does all of the work for you. In other libraries you often would write a main
function and fill it with copy & pasted initialization code that doesn't change
from one project to the next, when using Photon you simply create a function
called <PhotonMain> and everything is taken care of.
As the entrypoint, <PhotonMain> is generally where you'll create the display and
set the initial <State>. The state system will be covered in more detail in a
short while.
One thing you'll notice is that <PhotonMain> takes something called a <StrVec>,
which is simply a typedef for std::vector<std::string>. Just like a standard
main() function, it also returns an integer return code which is interpreted
by the operating system as success or failure.
Group: Digging In: Application and the State system
Topic: Application
All Photon applications use <Application>. Generally Photon applications will
contain code similar to the above example : a display will be created, the state
system will be
initialized, and finally the run method of <Application> will be called. We
will now cover exactly what all of this means.
The first thing you may notice is that <Application> is declared as a reference
and accessed in a funny sort of way. <Application> is a special kind of class
known as a singleton due to the fact that in any photon application there can
only be one instance. The single instance of Application is
created before any of the code you write is executed, so there is no need to
ever create it. What this means for you is that you cannot write code like:
| Application app;
or
| Application* appPtr = new Application();
Instead <Application> must always be used via a reference. A reference can
be obtained via Application::getInstance(), which can be called any number of
times, always returning the single instance of <Application>. This means that
the following two pieces of code produce identical results:
(code)
// Sample 1 : Too Much Typing :(
Application::getInstance().createDisplay(800,600,32,0,0,DISP_FULLSCREEN);
Application::getInstance().setState<SomeState>();
Application::getInstance().run();
(end)
(code)
// Sample 2 : Preferred
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,DISP_FULLSCREEN);
app.setState<SomeState>();
app.run();
(end)
<Application> is a fairly important class, it provides the means for managing
the display, input, timer, task and state system. For simple 2D applications
the only thing that needs to be done to configure the display is a single call
to <Application::createDisplay> (width, height, depth, 0, 0, displayMode, title).
The input, timing, and task systems will be addressed in future tutorials, or
check them out in <Application's> docs. What about the state system? Well that
brings us to our next topic...
Topic: The State System
<States> are probably the most important entities in Photon. A good portion of
your application's code with be within classes which derive from <State>. Photon
uses the idea that generally a game or application can be derived into a set of
states each of which have their own characteristics and behavior. If you've
ever written a game before you've likely encountered this concept, it is often
solved using a switch statement or something similar. An example of states in
a simple game might be a menu state, a play state, and an options screen state.
Complex games could define a much larger number of states, and it is certainly
possible to only use one state in a photon application.
Photon's state system is designed to be simple yet powerful, and this tutorial
will only cover the basics of using <States>, however with the available
documentation it isn't hard to do more advanced things with states, a topic that
a future tutorial will cover.
Creating States:
<State> is a simple class with a set of virtual functions. In order to define
the behavior of a given state in your application, simply derive from <State>
overloading as few or as many of <State's> functions as you desire. The only
function that must be overloaded is <State::render>, although generally
<State::update> will be overloaded as well. <State> also has other functions
available allowing for special behavior when a state is paused/resumed or global
input handlers for a state.
The <State::update> method and <State::render> update method are called
regularly in the update and render portions of the <Application's> state machine
which is the next topic we'll address.
Running States:
Once the <Application::run> method is called, it does not return until all
<States> exit. Therefore before it is called it is required that at least one
<State>-derived class is made active using either <Application::setState> or
<Application::pushState>. You'll notice from the <Getting Started> example that
these functions both have an odd syntax, they take
a template argument which should be the name of the <State>-derived class, but
they take no formal parameters. The reason for this is an issue of
implementation, and is basically a way of overcoming one of C++'s limitations
(namely that types are not first class entities).
Group: Wrapping Up
Topic: Review
Let's take a look at what we've covered in this tutorial. First let's revisit
the example from earlier and see what it all meant.
(code)
#include <photon.hpp>
using namespace photon;
// State-derived class used for application
class SomeState : public State
{
public:
void render()
{
// do any rendering in here
}
void update()
{
// do any updating of logic in here
}
};
// the Photon entrypoint, present for all Photon applications
int PhotonMain(const StrVec& args)
{
// obtain a reference to the Application singleton
Application& app(Application::getInstance());
// create the display, in this case a 800x600 window with 32 bit depth
app.createDisplay(800,600,32,0,0,DISP_WINDOWED);
// set the application state to SomeState (a State-derived class)
app.setState<SomeState>();
// run the application until the state quits or an exit request is received
app.run();
// return 0, just like in a normal application
return 0;
}
(end)
Hopefully you have a better understanding of what's going on now. The other
tutorials will start assuming a basic understanding of the structure of a Photon
application.
Topic: Topics Covered
PhotonMain - The entrypoint for all photon applications. (see <PhotonMain>)
Application - Important singleton class used in all Photon applications.
(see <Application>)
Application::createDisplay - Function used to initialize the display.
Application::setState - Function used to set active state.
Application::run - Function called to start processing of active state.
State - Base class for Photon application states, which are vital to
using Photon. (see <State>)
Group: Building a Photon application
Topic: Compilation
Once you know how to write a basic photon application, you'll need to know how
to compile it in your compiler/build environment of choice. Since I cannot possibly cover
the full range of development environments, I'll speak in general terms and assume
you are familiar with the environment you are using. If you need extra help either
obtain help from a site related to your environment or ask on the Photon mailing
lists.
Things to do when compiling a photon application:
- When compiling make sure all includes are in the include path of your compiler.
- When linking make sure all libraries are in the library path of your compiler.
- Ensure that you link against photon and all dependency libraries (photon,
GLFW, OpenAL, OpenGL, GLU, PhysFS, Corona, and Freetype).
- If you are using OpenAL, be sure to define PHOTON_USE_OPENAL
If you are using a command line compiler (like g++) it will resemble
| g++ -DPHOTON_USE_OPENAL -c -o test.o test.cpp
| g++ -o test test.o -lphoton -lglfw -lopenal -lGL -lGLU -lphysfs -lcorona -lfreetype
If you are using an IDE (like Dev-C++, MS Visual C++, or Code::Blocks) you'll
generally only need to specify the libraries you wish to link against. Again,
if you need specific help try asking for help on the Photon mailing lists
(<http://lists.sourceforge.net/lists/listinfo/photon-users>).
Written for Photon 0.1.0 by James:
$Id: tutorial01.txt,v 1.3 2005/11/15 02:59:08 cozman Exp $

284
photon.mm
View File

@ -1,194 +1,136 @@
<map version="0.7.1">
<node ID="_Freemind_Link_1676542623" TEXT="Photon">
<map version="0.8.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1129352407401" ID="_Freemind_Link_1676542623" MODIFIED="1129352407401" TEXT="Photon">
<cloud/>
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_682620075" TEXT="0.1 Series" POSITION="right">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_" TEXT="0.0.2">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_71129066" TEXT="Features" FOLDED="true">
<icon BUILTIN="button_ok"/>
<node ID="_Freemind_Link_424443985" TEXT="variable timeStep config">
<icon BUILTIN="button_ok"/>
<node ID="_Freemind_Link_1489086385" TEXT="average of X frames">
<icon BUILTIN="button_ok"/>
</node>
<node ID="_Freemind_Link_576151122" TEXT="fixed timeStep">
<icon BUILTIN="button_ok"/>
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407402" ID="_Freemind_Link_682620075" MODIFIED="1129352407402" POSITION="right" TEXT="0.1 Series">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407402" ID="_Freemind_Link_115594103" MODIFIED="1130559303873" TEXT="0.1.0" VSHIFT="-14">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407404" ID="_Freemind_Link_1084322991" MODIFIED="1129352407404" TEXT="Publicity">
<node CREATED="1133401622902" ID="Freemind_Link_658038500" MODIFIED="1133401625693" TEXT="Dr. Spin 0.1"/>
</node>
</node>
<node ID="_Freemind_Link_1902843385" TEXT="depthBuffer enable/disable">
<icon BUILTIN="button_ok"/>
</node>
<node ID="_Freemind_Link_1912839994" TEXT="dual Kernels (TaskManager)">
<icon BUILTIN="button_ok"/>
<node CREATED="1129352407405" HGAP="65" ID="_Freemind_Link_1151493849" MODIFIED="1130559300141" TEXT="0.1.x" VSHIFT="38">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407407" ID="_Freemind_Link_650619873" MODIFIED="1129352407407" TEXT="Features">
<node CREATED="1129352407407" FOLDED="true" ID="_Freemind_Link_1825420810" MODIFIED="1129352407407" TEXT="Music">
<node CREATED="1129352407407" ID="_Freemind_Link_1677795490" MODIFIED="1129352407407" TEXT="ogg"/>
<node CREATED="1129352407407" ID="_Freemind_Link_510415734" MODIFIED="1129352407407" TEXT="wav"/>
</node>
</node>
<node ID="_Freemind_Link_1999404091" TEXT="Improvements" FOLDED="true">
<icon BUILTIN="button_ok"/>
<node ID="_Freemind_Link_878549222" TEXT="drop alut dependency">
<icon BUILTIN="button_ok"/>
<node CREATED="1129352407407" ID="_Freemind_Link_1634165944" MODIFIED="1129352407407" TEXT="Improvements">
<node CREATED="1129352407407" ID="Freemind_Link_442862681" MODIFIED="1129352407407" TEXT="vc7">
<node CREATED="1129352407407" ID="Freemind_Link_1309064355" MODIFIED="1129352407407" TEXT="photon-0.1.x-win32-msvc"/>
</node>
<node ID="_Freemind_Link_1174215789" TEXT="bugfixes" FOLDED="true">
<icon BUILTIN="button_ok"/>
<node ID="_Freemind_Link_51999594" TEXT="fullscreen X11">
<icon BUILTIN="button_ok"/>
<node CREATED="1130644868777" ID="Freemind_Link_1077081589" MODIFIED="1130644894214" TEXT="allow compilation without PhysFS?"/>
</node>
<node ID="_Freemind_Link_469175607" TEXT="input listener bug(s)">
<icon BUILTIN="button_ok"/>
</node>
<node ID="_Freemind_Link_789850536" TEXT="pause on lost focus">
<icon BUILTIN="button_ok"/>
<node CREATED="1129352407407" ID="_Freemind_Link_172144087" MODIFIED="1129352407407" TEXT="Publicity"/>
</node>
</node>
<node ID="_Freemind_Link_858443899" TEXT="IDE support" FOLDED="true">
<node CREATED="1129352407407" ID="_Freemind_Link_486829238" MODIFIED="1130559294471" POSITION="right" TEXT="0.2 Release" VSHIFT="107">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407407" FOLDED="true" ID="_Freemind_Link_103747781" MODIFIED="1130472449741" TEXT="Features">
<font NAME="SansSerif" SIZE="12"/>
<icon BUILTIN="button_ok"/>
<node ID="_Freemind_Link_1591642442" TEXT="Dev-C++">
<icon BUILTIN="button_ok"/>
<node COLOR="#000000" CREATED="1129352407408" ID="_Freemind_Link_420721466" MODIFIED="1129352407408" TEXT="XML/XSLT sink"/>
<node CREATED="1129352407409" ID="_Freemind_Link_1298931281" MODIFIED="1129352407409" TEXT="XML resource files"/>
<node CREATED="1129352407409" FOLDED="true" ID="_Freemind_Link_1070201117" MODIFIED="1129352407409" TEXT="Transitions">
<node CREATED="1129352407410" ID="_Freemind_Link_664044389" MODIFIED="1129352407410" TEXT="investigate what other libs do"/>
<node CREATED="1129352407411" ID="_Freemind_Link_1667343634" MODIFIED="1129352407411" TEXT="render to texture?"/>
<node CREATED="1129352407411" ID="_Freemind_Link_518905568" MODIFIED="1129352407411" TEXT="pixel shaders?"/>
</node>
<node ID="_Freemind_Link_1446425822" TEXT="Code::Blocks">
<icon BUILTIN="button_ok"/>
</node>
<node ID="_Freemind_Link_1481289143" TEXT="Visual C++">
<icon BUILTIN="clanbomber"/>
<node TEXT="unstable"/>
</node>
<node ID="_Freemind_Link_1628154157" TEXT="Eclipse/CDT">
<icon BUILTIN="button_cancel"/>
</node>
</node>
<node ID="_Freemind_Link_1906242625" TEXT="State/Task/Kernel demo">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node ID="_Freemind_Link_1112766084" TEXT="Publicity">
<node ID="_Freemind_Link_1943285529" TEXT="precompiled versions">
<node ID="_Freemind_Link_586970647" TEXT="gcc3 Linux">
<node ID="_Freemind_Link_1651083711" TEXT="photon-0.0.2-linux-gcc"/>
</node>
<node ID="_Freemind_Link_1983304402" TEXT="gcc3 MingW">
<node ID="_Freemind_Link_952617031" TEXT="photon-0.0.2-win32-mingw"/>
</node>
<node ID="_Freemind_Link_198870490" TEXT="photon-0.0.2-src"/>
</node>
</node>
</node>
<node ID="_Freemind_Link_115594103" TEXT="0.1" FOLDED="true">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_1755478147" TEXT="Features"/>
<node ID="_Freemind_Link_589338965" TEXT="Improvements">
<node ID="_Freemind_Link_1716705807" TEXT="clean up naturaldocs">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node ID="_Freemind_Link_1084322991" TEXT="Publicity">
<node ID="_Freemind_Link_1156475066" TEXT="update site with more info (distribution .txt files)"/>
<node ID="_Freemind_Link_482028560" TEXT="Tutorials" FOLDED="true">
<node ID="_Freemind_Link_772709351" TEXT="Wikitorials?"/>
</node>
<node ID="_Freemind_Link_1870184326" TEXT="example game" FOLDED="true">
<node ID="_Freemind_Link_597173063" COLOR="#000000" TEXT="Asteroids"/>
<node ID="_Freemind_Link_719722821" TEXT="Lunar Lander"/>
<node ID="_Freemind_Link_173048174" TEXT="Missile Command"/>
<node ID="_Freemind_Link_1447936394" COLOR="#010101" TEXT="Frogger"/>
</node>
</node>
</node>
<node ID="_Freemind_Link_1151493849" TEXT="0.1.x">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_650619873" TEXT="Features">
<node ID="_Freemind_Link_1825420810" TEXT="Music" FOLDED="true">
<node ID="_Freemind_Link_1677795490" TEXT="ogg"/>
<node ID="_Freemind_Link_510415734" TEXT="wav"/>
</node>
</node>
<node ID="_Freemind_Link_1634165944" TEXT="Improvements">
<node ID="Freemind_Link_442862681" TEXT="vc7">
<node ID="Freemind_Link_1309064355" TEXT="photon-0.1.x-win32-msvc"/>
</node>
</node>
<node ID="_Freemind_Link_172144087" TEXT="Publicity"/>
</node>
</node>
<node ID="_Freemind_Link_486829238" TEXT="0.2 Release" FOLDED="true" POSITION="right">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_103747781" TEXT="Features" FOLDED="true">
<font NAME="SansSerif" SIZE="12"/>
<node ID="_Freemind_Link_420721466" COLOR="#000000" TEXT="XML/XSLT sink"/>
<node ID="_Freemind_Link_1298931281" TEXT="XML resource files"/>
<node ID="_Freemind_Link_1070201117" TEXT="Transitions" FOLDED="true">
<node ID="_Freemind_Link_664044389" TEXT="investigate what other libs do"/>
<node ID="_Freemind_Link_1667343634" TEXT="render to texture?"/>
<node ID="_Freemind_Link_518905568" TEXT="pixel shaders?"/>
</node>
<node ID="_Freemind_Link_1339011485" TEXT="Tilemap System"/>
<node ID="_Freemind_Link_1497432478" TEXT="Particle System"/>
<node ID="_Freemind_Link_216021234" TEXT="Sprite System">
<node CREATED="1129352407411" ID="_Freemind_Link_1339011485" MODIFIED="1129352407411" TEXT="Tilemap System"/>
<node CREATED="1129352407411" ID="_Freemind_Link_1497432478" MODIFIED="1129352407411" TEXT="Particle System"/>
<node CREATED="1129352407411" ID="_Freemind_Link_216021234" MODIFIED="1129352407411" TEXT="Sprite System">
<font NAME="SansSerif" SIZE="12"/>
</node>
<node ID="_Freemind_Link_639177837" TEXT="interpolation/Extrapolation in calls to State::render"/>
<node CREATED="1129352407411" ID="_Freemind_Link_639177837" MODIFIED="1129352407411" TEXT="interpolation/Extrapolation in calls to State::render"/>
</node>
<node ID="_Freemind_Link_903043501" TEXT="Improvements" FOLDED="true">
<node ID="_Freemind_Link_1362733907" TEXT="investigate dropping Corona"/>
<node CREATED="1129352407411" FOLDED="true" ID="_Freemind_Link_903043501" MODIFIED="1129352407411" TEXT="Improvements">
<node CREATED="1129352407411" ID="_Freemind_Link_1362733907" MODIFIED="1129352407411" TEXT="investigate dropping Corona"/>
</node>
<node ID="_Freemind_Link_1821669119" TEXT="Publicity" FOLDED="true">
<node ID="_Freemind_Link_654490435" TEXT="Second Example Game" FOLDED="true">
<node ID="_Freemind_Link_1191623789" TEXT="Public Project?"/>
<node CREATED="1129352407411" FOLDED="true" ID="_Freemind_Link_1821669119" MODIFIED="1129352407411" TEXT="Publicity">
<node CREATED="1129352407411" FOLDED="true" ID="_Freemind_Link_654490435" MODIFIED="1129352407411" TEXT="Second Example Game">
<node CREATED="1129352407411" ID="_Freemind_Link_1191623789" MODIFIED="1129352407411" TEXT="Public Project?"/>
</node>
</node>
</node>
<node ID="_Freemind_Link_1111954089" TEXT="Future..." FOLDED="true" POSITION="right">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node ID="_Freemind_Link_1066996987" TEXT="Features" FOLDED="true">
<font NAME="SansSerif" SIZE="12"/>
<node ID="_Freemind_Link_539015028" TEXT="physics:: (similar to math::)"/>
<node ID="_Freemind_Link_1107695046" TEXT="gui::" FOLDED="true">
<node ID="_Freemind_Link_548983970" TEXT="skinnable XML based"/>
</node>
<node ID="_Freemind_Link_304523376" TEXT="network::" FOLDED="true">
<node ID="_Freemind_Link_717482997" TEXT="wrap enet?"/>
</node>
<node ID="_Freemind_Link_1766405270" TEXT="scripting" FOLDED="true">
<node ID="_Freemind_Link_918658782" TEXT="lua"/>
<node ID="_Freemind_Link_1079584283" TEXT="python"/>
<node ID="_Freemind_Link_512949260" TEXT="angelscript"/>
<node ID="_Freemind_Link_1813241804" TEXT="custom"/>
<node ID="_Freemind_Link_1220379011" TEXT="other"/>
</node>
</node>
<node ID="_Freemind_Link_1155128082" TEXT="Improvements" FOLDED="true">
<node ID="_Freemind_Link_1067043723" TEXT="allow for alternate backends " FOLDED="true">
<node ID="_Freemind_Link_1997175841" TEXT="audiere for audio" FOLDED="true">
<node ID="_Freemind_Link_1142976123" TEXT="is there a point?">
<node ID="_Freemind_Link_396200365" TEXT="compatibility?"/>
</node>
</node>
<node ID="_Freemind_Link_961284194" TEXT="SDL backend">
<icon BUILTIN="help"/>
</node>
</node>
<node ID="_Freemind_Link_1036629371" TEXT="other languages" FOLDED="true">
<node ID="_Freemind_Link_21483700" TEXT="python interface">
<icon BUILTIN="help"/>
</node>
<node ID="_Freemind_Link_1083759822" TEXT="java interface">
<icon BUILTIN="help"/>
</node>
</node>
</node>
<node ID="_Freemind_Link_1364557080" TEXT="Publicity" FOLDED="true">
<node ID="_Freemind_Link_1945740551" TEXT="Prepackaged Versions"/>
<node ID="_Freemind_Link_836096408" TEXT="Dependencies"/>
<node ID="_Freemind_Link_1316865000" TEXT="Wiki"/>
<node ID="_Freemind_Link_959094471" TEXT="Contest"/>
</node>
</node>
<node ID="_Freemind_Link_438641521" COLOR="#147f1e" TEXT="Version: $Id: photon.mm,v 1.29 2005/08/18 07:05:34 cozman Exp $" POSITION="left">
<node COLOR="#147f1e" CREATED="1129352407415" ID="_Freemind_Link_438641521" MODIFIED="1129352407415" POSITION="left" TEXT="Version: $Id: photon.mm,v 1.34 2006/03/07 23:28:09 cozman Exp $">
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
</node>
<node ID="_Freemind_Link_853483912" TEXT="Current Problems" POSITION="left">
<font NAME="SansSerif" BOLD="true" SIZE="12"/>
<node CREATED="1133401600459" ID="Freemind_Link_201004580" MODIFIED="1133401605896" POSITION="left" TEXT="Projects">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1133401288927" ID="_" LINK="../drspin/DrSpin.mm" MODIFIED="1133401520418" TEXT="Dr Spin"/>
</node>
<node CREATED="1129352407415" ID="_Freemind_Link_853483912" MODIFIED="1129352407415" POSITION="left" TEXT="Current Problems">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
</node>
<node CREATED="1129352407411" ID="_Freemind_Link_1111954089" MODIFIED="1130559286266" POSITION="left" TEXT="Future..." VSHIFT="-1">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407411" FOLDED="true" ID="_Freemind_Link_1066996987" MODIFIED="1129352407411" TEXT="Features">
<font NAME="SansSerif" SIZE="12"/>
<node CREATED="1129352407411" ID="_Freemind_Link_539015028" MODIFIED="1129352407411" TEXT="physics:: (similar to math::)"/>
<node CREATED="1129352407412" FOLDED="true" ID="_Freemind_Link_1107695046" MODIFIED="1129352407412" TEXT="gui::">
<node CREATED="1129352407412" ID="_Freemind_Link_548983970" MODIFIED="1129352407412" TEXT="skinnable XML based"/>
</node>
<node CREATED="1129352407412" FOLDED="true" ID="_Freemind_Link_304523376" MODIFIED="1129352407412" TEXT="network::">
<node CREATED="1129352407412" ID="_Freemind_Link_717482997" MODIFIED="1129352407412" TEXT="wrap enet?"/>
</node>
<node CREATED="1129352407412" FOLDED="true" ID="_Freemind_Link_1766405270" MODIFIED="1141774045790" TEXT="scripting">
<icon BUILTIN="help"/>
<node CREATED="1129352407412" ID="_Freemind_Link_918658782" MODIFIED="1129352407412" TEXT="lua"/>
<node CREATED="1129352407412" ID="_Freemind_Link_1079584283" MODIFIED="1129352407412" TEXT="python"/>
<node CREATED="1129352407413" ID="_Freemind_Link_512949260" MODIFIED="1129352407413" TEXT="angelscript"/>
<node CREATED="1129352407413" ID="_Freemind_Link_1813241804" MODIFIED="1129352407413" TEXT="custom"/>
<node CREATED="1129352407413" ID="_Freemind_Link_1220379011" MODIFIED="1129352407413" TEXT="other"/>
</node>
</node>
<node CREATED="1129352407413" ID="_Freemind_Link_1155128082" MODIFIED="1129352407413" TEXT="Improvements">
<node CREATED="1129352407413" FOLDED="true" ID="_Freemind_Link_1067043723" MODIFIED="1141773979456" TEXT="allow for alternate backends">
<icon BUILTIN="help"/>
<node CREATED="1129352407413" FOLDED="true" ID="_Freemind_Link_1997175841" MODIFIED="1129352407413" TEXT="audiere for audio">
<node CREATED="1129352407414" ID="_Freemind_Link_1142976123" MODIFIED="1129352407414" TEXT="is there a point?">
<node CREATED="1129352407414" ID="_Freemind_Link_396200365" MODIFIED="1129352407414" TEXT="compatibility?"/>
</node>
</node>
<node CREATED="1129352407414" ID="_Freemind_Link_961284194" MODIFIED="1129352407414" TEXT="SDL backend">
<icon BUILTIN="help"/>
</node>
<node CREATED="1141773911841" FOLDED="true" ID="Freemind_Link_373492192" MODIFIED="1141773966402" TEXT="is feature consistency realistic?">
<node CREATED="1141773921761" ID="Freemind_Link_515087403" MODIFIED="1141773961618" TEXT="without feature consistency alternate backends &#xa;makes the code worse (too complex) without real gain "/>
</node>
</node>
<node CREATED="1129352407414" FOLDED="true" ID="_Freemind_Link_1036629371" MODIFIED="1129352407414" TEXT="other languages">
<node CREATED="1129352407414" ID="_Freemind_Link_21483700" MODIFIED="1141773889502" TEXT="python interface">
<node CREATED="1130472430178" FOLDED="true" ID="Freemind_Link_1181436549" MODIFIED="1130472451458" TEXT="hotyth">
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
<node CREATED="1130472573323" ID="Freemind_Link_577743930" MODIFIED="1130472686339" TEXT="potentially the justification for photon altogether">
<node CREATED="1130472687051" FOLDED="true" ID="Freemind_Link_1124537894" MODIFIED="1130472780347" TEXT="potentially much faster than PyGame">
<node CREATED="1130472717147" ID="Freemind_Link_1689800437" MODIFIED="1130472725955" TEXT="look into using Psyco"/>
<node CREATED="1130472785878" ID="Freemind_Link_464299414" MODIFIED="1130472790515" TEXT="already using OpenGL-based backend"/>
</node>
<node CREATED="1130472695759" ID="Freemind_Link_284363350" MODIFIED="1130472714269" TEXT="more game-oriented"/>
<node CREATED="1141773852825" ID="Freemind_Link_787719405" MODIFIED="1141773862551" TEXT="a 2nd real choice for python game devs"/>
</node>
<node CREATED="1141773829602" ID="Freemind_Link_1489817655" MODIFIED="1141773839377" TEXT="using SWIG (planning in progress)"/>
</node>
</node>
<node CREATED="1129352407414" FOLDED="true" ID="_Freemind_Link_1083759822" MODIFIED="1129352407414" TEXT="java interface">
<icon BUILTIN="help"/>
<node CREATED="1141773866877" ID="Freemind_Link_162384371" MODIFIED="1141773879159" TEXT="if using SWIG trivial(?) to implement"/>
</node>
</node>
</node>
<node CREATED="1129352407415" FOLDED="true" ID="_Freemind_Link_1364557080" MODIFIED="1129352407415" TEXT="Publicity">
<node CREATED="1129352407415" FOLDED="true" ID="_Freemind_Link_1945740551" MODIFIED="1129352407415" TEXT="Prepackaged Versions">
<node CREATED="1130472887914" ID="Freemind_Link_1188152165" MODIFIED="1130472889315" TEXT="deb"/>
<node CREATED="1130472893474" ID="Freemind_Link_1518311946" MODIFIED="1130472894690" TEXT="rpm"/>
<node CREATED="1130472896908" ID="Freemind_Link_1315075072" MODIFIED="1130472904857" TEXT="Dev-C++ .devpak"/>
</node>
<node CREATED="1129352407415" ID="_Freemind_Link_836096408" MODIFIED="1129352407415" TEXT="Dependencies"/>
<node CREATED="1129352407415" ID="_Freemind_Link_1316865000" MODIFIED="1129352407415" TEXT="Wiki"/>
<node CREATED="1129352407415" ID="_Freemind_Link_959094471" MODIFIED="1129352407415" TEXT="Contest"/>
</node>
</node>
</node>
</map>

View File

@ -7,7 +7,7 @@
# James Turk (jpt2433@rit.edu)
#
# Version:
# $Id: release.sh,v 1.3 2005/08/19 05:34:58 cozman Exp $
# $Id: release.sh,v 1.5 2005/08/19 05:42:51 cozman Exp $
major=0
minor=0
@ -65,12 +65,13 @@ elif [[ "${1}" = "release" ]]; then
echo "Tagging current CVS as ${cvsTag}"
cvs rtag ${cvsTag} photon
check_errs $? "Tagging photon in CVS failed"
echo "Attempting to export ${cvsTag} tagged copy of photon"
cd .. # go up a directory before attempting second checkout
cvs -z3 -d:ext:cozman@cvs.sourceforge.net:/cvsroot/photon export -r ${cvsTag} -d ${dirName} photon
check_errs $? "${cvsTag} export failed"
cd photon
cd ${dirName}
check_errs $? "No photon directory?! Cannot proceed."
scons docs

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Application.cpp,v 1.29 2005/08/18 07:05:35 cozman Exp $
// $Id: Application.cpp,v 1.32 2007/05/13 15:18:37 cozman Exp $
#include "Application.hpp"
@ -62,6 +62,18 @@ Application::~Application()
void Application::run()
{
if(quit_)
{
throw PreconditionException("Call to Application::run prior to creation"
" of display.");
}
if(stateStack_.empty())
{
throw PreconditionException("Call to Application::run with no state"
" active.");
}
while(!quit_)
{
update();
@ -106,7 +118,11 @@ void Application::update()
{
frameIndex = 0;
}
elapsedTime_ = frameTimes_[frameIndex] = curTime-lastUpdate_;
elapsedTime_ = curTime-lastUpdate_;
if(frameTimes_.size() > 0) {
frameTimes_[frameIndex] = elapsedTime_;
}
lastUpdate_ = curTime;
@ -173,12 +189,12 @@ bool Application::isActive()
void Application::createDisplay(uint width, uint height,
uint redBits, uint greenBits, uint blueBits,
uint alphaBits, uint depthBits, uint stencilBits,
bool fullscreen, const std::string &title)
DisplayMode mode, const std::string &title)
{
GLboolean status;
status = glfwOpenWindow(width, height, redBits, greenBits,
blueBits, alphaBits, depthBits, stencilBits,
fullscreen ? GLFW_FULLSCREEN : GLFW_WINDOW);
status = glfwOpenWindow(width, height, redBits, greenBits, blueBits,
alphaBits, depthBits, stencilBits,
mode == DISP_FULLSCREEN ? GLFW_FULLSCREEN : GLFW_WINDOW);
if(status == GL_FALSE)
{
throw APIError("Failed to create display.");
@ -204,7 +220,7 @@ void Application::createDisplay(uint width, uint height,
}
void Application::createDisplay(uint width, uint height, uint bpp,
uint depthBits, uint stencilBits, bool fullscreen,
uint depthBits, uint stencilBits, DisplayMode mode,
const std::string &title)
{
// call main version of createDisplay with individual values for rgba bits
@ -212,19 +228,19 @@ void Application::createDisplay(uint width, uint height, uint bpp,
{
case 8:
createDisplay(width, height, 3, 3, 2, 0, depthBits, stencilBits,
fullscreen, title);
mode, title);
break;
case 16:
createDisplay(width, height, 5, 6, 5, 0, depthBits, stencilBits,
fullscreen, title);
mode, title);
break;
case 24:
createDisplay(width, height, 8, 8, 8, 0, depthBits, stencilBits,
fullscreen, title);
mode, title);
break;
case 32:
createDisplay(width, height, 8, 8, 8, 8, depthBits, stencilBits,
fullscreen, title);
mode, title);
break;
default:
throw ArgumentException("bpp argument of createDisplay must be "
@ -471,7 +487,7 @@ void Application::initAudioCore(const std::string& deviceName)
// create AudioCore, avoid double initializaiton
if(audioCore_.get() == 0)
{
audioCore_.reset(new audio::AudioCore(deviceName));
audioCore_.reset(new audio::OALAudioCore(deviceName));
}
else
{

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: AudioCore.cpp,v 1.13 2005/08/08 21:39:41 cozman Exp $
// $Id: AudioCore.cpp,v 1.15 2005/10/28 22:13:03 cozman Exp $
#ifdef PHOTON_USE_OPENAL
@ -19,8 +19,9 @@ namespace photon
namespace audio
{
//AudioCore::AudioCore()
AudioCore::AudioCore(const std::string& deviceName)
OALAudioCore::OALAudioCore(const std::string& deviceName) :
AudioCore(deviceName)
{
//util::VersionInfo oalReq(0,0,7); // requires OpenAL 1.0 (TODO: check?)
//util::ensureVersion("OpenAL", initOpenAL(), oalReq);
@ -28,7 +29,7 @@ AudioCore::AudioCore(const std::string& deviceName)
initOpenAL(deviceName); // don't check version for now
}
AudioCore::~AudioCore()
OALAudioCore::~OALAudioCore()
{
// retrieve both the context and device
ALCcontext* context( alcGetCurrentContext() );
@ -42,7 +43,7 @@ AudioCore::~AudioCore()
alcMakeContextCurrent(0);
}
std::string AudioCore::getAudioDeviceName() const
std::string OALAudioCore::getAudioDeviceName() const
{
ALCdevice* device (alcGetContextsDevice( alcGetCurrentContext() ));
std::string name ( reinterpret_cast<const char*>(
@ -51,7 +52,7 @@ std::string AudioCore::getAudioDeviceName() const
return name;
}
std::string AudioCore::checkOpenALError()
std::string OALAudioCore::checkOpenALError()
{
ALenum errCode = alGetError(); // fetch error code
std::string err;
@ -85,7 +86,7 @@ std::string AudioCore::checkOpenALError()
return err;
}
void AudioCore::throwOpenALError(const std::string& func)
void OALAudioCore::throwOpenALError(const std::string& func)
{
std::string err( checkOpenALError() );
if(err.length()) // throw exception if non-empty string
@ -94,18 +95,18 @@ void AudioCore::throwOpenALError(const std::string& func)
}
}
util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
util::VersionInfo OALAudioCore::initOpenAL(const std::string& deviceName)
{
ALCdevice* device(0);
ALCcontext* context(0);
std::stringstream ss; // stream for parsing version
std::string junks; // junk string for parsing
char junkc; // junk character for parsing
uint major,minor,patch; // version numbers
uint major,minor; // version numbers
std::string extra; // extra string for OpenAL extra info
// obtain default device if no deviceName is set, otherwise use deviceName
device = alcOpenDevice(deviceName.empty() ? 0 :
reinterpret_cast<const ALubyte*>(deviceName.c_str()) );
reinterpret_cast<const ALchar*>(deviceName.c_str()) );
if(device == 0)
{
@ -131,17 +132,13 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
alListenerfv(AL_VELOCITY, posvel);
alListenerfv(AL_ORIENTATION, ori);
// OpenAL needs a standard version string format badly
// format is major.minor extra-info
ss << alGetString(AL_VERSION);
#if defined(linux)
ss >> major >> junkc >> minor >> junkc >> patch;
#else
ss >> junks >> major >> junkc >> minor; // format is "OpenAL 1.0"
#endif
ss >> major >> junkc >> minor >> extra;
throwOpenALError("AudioCore::initOpenAL");
throwOpenALError("OALAudioCore::initOpenAL");
return util::VersionInfo(major,minor,patch);
return util::VersionInfo(major,minor,0,extra);
}
}

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: SampleResourceManager.cpp,v 1.4 2005/08/10 05:36:30 cozman Exp $
// $Id: SampleResourceManager.cpp,v 1.5 2005/10/28 22:13:03 cozman Exp $
#ifdef PHOTON_USE_OPENAL
@ -46,14 +46,14 @@ void SampleResourceManager::loadResourceData(SampleResource &res,
alGenBuffers(1, &res.bufferID); // create OpenAL buffer
AudioCore::throwOpenALError("alGenBuffers");
OALAudioCore::throwOpenALError("alGenBuffers");
// load WAV and pass it into OpenAL buffer
loadWAVMemory(&filedata[0], format, data, size, freq);
alBufferData(res.bufferID, format, (ALvoid*)data, size, freq);
freeWAVMemory(data);
AudioCore::throwOpenALError("alBufferData");
OALAudioCore::throwOpenALError("alBufferData");
}
void SampleResourceManager::freeResourceData(SampleResource& res)

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: RandGen.cpp,v 1.5 2005/03/03 09:25:47 cozman Exp $
// $Id: RandGen.cpp,v 1.6 2005/10/30 21:08:57 cozman Exp $
// The source in this file is based on MT19937, with much of the source
// replicated from mt19937ar.c, because of this the original license
@ -51,8 +51,8 @@
//
//
//Any feedback is very welcome.
//http://www.math.keio.ac.jp/matumoto/emt.html
//email: matumoto@math.keio.ac.jp
//http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
//m-mat @ math.sci.hiroshima-u.ac.jp
#include "util/RandGen.hpp"
#include <ctime>

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Pen.cpp,v 1.5 2005/07/20 03:58:54 cozman Exp $
// $Id: Pen.cpp,v 1.6 2005/08/23 21:55:03 cozman Exp $
#include "video/Pen.hpp"
@ -125,39 +125,21 @@ void Pen::fillRect(const math::Rect &rect) const
void Pen::drawCircle(const math::Circle &circle) const
{
//written from Bresenham's circle algorithm
double cx(circle.getCenter().x);
double cy(circle.getCenter().y);
double d(3-(2*circle.getRadius()));
double x(0);
double y(circle.getRadius());
scalar radius(circle.getRadius());
scalar cx(circle.getCenter().x);
scalar cy(circle.getCenter().y);
scalar angle(0);
const scalar angleStep(2*math::PI/CIRCLE_RESOLUTION);
glBindTexture(GL_TEXTURE_2D,0);
glPushAttrib(GL_CURRENT_BIT);
color_.makeGLColor();
glBegin(GL_POINTS); // draw points, creating a circle
while(y > x)
glBegin(GL_LINE_LOOP);
for(int i=0; i<CIRCLE_RESOLUTION; ++i)
{
glVertex2d(cx+x,cy+y);
glVertex2d(cx+x,cy-y);
glVertex2d(cx-x,cy+y);
glVertex2d(cx-x,cy-y);
glVertex2d(cx+y,cy+x);
glVertex2d(cx+y,cy-x);
glVertex2d(cx-y,cy+x);
glVertex2d(cx-y,cy-x);
if(d < 0)
{
d += x*4 + 6;
}
else
{
d += (x-y)*4 + 10;
--y;
}
++x;
glVertex2f(cx+radius*std::cos(angle), cy+radius*std::sin(angle));
angle += angleStep;
}
glEnd();
glPopAttrib();
@ -165,39 +147,21 @@ void Pen::drawCircle(const math::Circle &circle) const
void Pen::fillCircle(const math::Circle &circle) const
{
//written from Bresenham's circle algorithm
double cx(circle.getCenter().x);
double cy(circle.getCenter().y);
double d(3-(2*circle.getRadius()));
double x(0);
double y(circle.getRadius());
scalar radius(circle.getRadius());
scalar cx(circle.getCenter().x);
scalar cy(circle.getCenter().y);
scalar angle(0);
const scalar angleStep(2*math::PI/CIRCLE_RESOLUTION);
glBindTexture(GL_TEXTURE_2D,0);
glPushAttrib(GL_CURRENT_BIT);
color_.makeGLColor();
glBegin(GL_LINES); // draw lines instead of points, filling the circle
while(y > x)
glBegin(GL_POLYGON);
for(int i=0; i<CIRCLE_RESOLUTION; ++i)
{
glVertex2d(cx+x,cy+y);
glVertex2d(cx+x,cy-y);
glVertex2d(cx-x,cy-y);
glVertex2d(cx-x,cy+y);
glVertex2d(cx+y,cy+x);
glVertex2d(cx-y,cy+x);
glVertex2d(cx-y,cy-x);
glVertex2d(cx+y,cy-x);
if(d < 0)
{
d += x*4 + 6;
}
else
{
d += (x-y)*4 + 10;
--y;
}
++x;
glVertex2f(cx+radius*std::cos(angle), cy+radius*std::sin(angle));
angle += angleStep;
}
glEnd();
glPopAttrib();

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Audio_test.cpp,v 1.17 2005/08/18 05:59:56 cozman Exp $
// $Id: Audio_test.cpp,v 1.18 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -186,7 +186,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
app.initAudioCore(); // initialize audio core
// be sure to add FPSDisplayTask

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Font_test.cpp,v 1.13 2005/08/17 06:35:56 cozman Exp $
// $Id: Font_test.cpp,v 1.14 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -51,7 +51,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
// be sure to add FPSDisplayTask
//TaskManager::getInstance().addTask(util::TaskPtr(new FPSDisplayTask()));

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Image_test.cpp,v 1.13 2005/08/17 06:35:56 cozman Exp $
// $Id: Image_test.cpp,v 1.14 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -62,7 +62,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
// be sure to add FPSDisplayTask
app.getUpdateTaskManager().addTask(util::TaskPtr(new FPSDisplayTask()));

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Input_test.cpp,v 1.12 2005/08/17 06:35:56 cozman Exp $
// $Id: Input_test.cpp,v 1.13 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -121,7 +121,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
// be sure to add FPSDisplayTask
app.getUpdateTaskManager().addTask(util::TaskPtr(new FPSDisplayTask()));

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Pen_test.cpp,v 1.10 2005/08/17 06:35:56 cozman Exp $
// $Id: Pen_test.cpp,v 1.11 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -75,7 +75,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
// be sure to add FPSDisplayTask
app.getUpdateTaskManager().addTask(util::TaskPtr(new FPSDisplayTask()));

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: State_test.cpp,v 1.4 2005/08/16 06:32:39 cozman Exp $
// $Id: State_test.cpp,v 1.5 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -314,7 +314,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
app.setFixedUpdateStep(true, .01);
// add archives to search path

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Texture_test.cpp,v 1.11 2005/08/17 06:35:56 cozman Exp $
// $Id: Texture_test.cpp,v 1.12 2005/11/15 02:59:08 cozman Exp $
#include "photon.hpp"
using namespace photon;
@ -75,7 +75,7 @@ int PhotonMain(const StrVec& args)
{
Application& app(Application::getInstance());
app.createDisplay(800,600,32,0,0,false); // create window
app.createDisplay(800,600,32,0,0,DISP_WINDOWED); // create window
// be sure to add FPSDisplayTask
app.getUpdateTaskManager().addTask(util::TaskPtr(new FPSDisplayTask()));

View File

@ -1,11 +1,11 @@
[]
[]
#config1.ini
[sec2]
[sec2]
fancy = 0
fancy2 = "james"
[sec]
int=3
float=3
string=three
[sec]
int=3
float=3
string=three

View File

@ -1,9 +1,9 @@
[]
[]
#config2.ini
[sec]
[sec]
var = 0
hex = 0xff
[sec2]
[sec2]
var = 2