From 272ca38146277825ef066fbdb596b68b249565f0 Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 20 Jul 2005 07:30:13 +0000 Subject: [PATCH] final push to 0.1 release --- include/util/filesys/filesys.hpp | 6 +-- photon.mm | 87 ++++++++++++++++++++++---------- test/Audio_test.cpp | 22 ++++---- test/FPSDisplayTask.hpp | 4 +- test/Font_test.cpp | 9 ++-- test/Input_test.cpp | 7 ++- 6 files changed, 91 insertions(+), 44 deletions(-) diff --git a/include/util/filesys/filesys.hpp b/include/util/filesys/filesys.hpp index d567e8c..0bea672 100644 --- a/include/util/filesys/filesys.hpp +++ b/include/util/filesys/filesys.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: filesys.hpp,v 1.3 2005/03/02 08:39:03 cozman Exp $ +// $Id: filesys.hpp,v 1.4 2005/07/20 07:30:13 cozman Exp $ #ifndef PHOTON_UTIL_FILESYS_FILESYS_HPP #define PHOTON_UTIL_FILESYS_FILESYS_HPP @@ -57,13 +57,13 @@ std::string getUserDir(); // // Parameters: // dir - Directory to add to the search path -// append - if true, directory will be added to end of path +// append - optional: if true, directory will be added to end of path (default) // if false, directory will be added to front of path // // See Also: // // -void addToSearchPath(const std::string& dir, bool append); +void addToSearchPath(const std::string& dir, bool append=true); // Function: removeFromSearchPath // Removes a directory from the search path, if it exists on the path. diff --git a/photon.mm b/photon.mm index 5a3c3ef..e0a43e3 100644 --- a/photon.mm +++ b/photon.mm @@ -6,7 +6,7 @@ - + @@ -16,39 +16,26 @@ - - - - - - - - - + + + + + + + - - - - + + - - - - - - - - - - - + + @@ -64,12 +51,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -124,7 +159,7 @@ - + diff --git a/test/Audio_test.cpp b/test/Audio_test.cpp index c10fbdd..a901723 100644 --- a/test/Audio_test.cpp +++ b/test/Audio_test.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Audio_test.cpp,v 1.6 2005/07/20 06:12:13 cozman Exp $ +// $Id: Audio_test.cpp,v 1.7 2005/07/20 07:30:13 cozman Exp $ #include "photon.hpp" using namespace photon; @@ -27,17 +27,21 @@ public: { video.setOrthoView(800,600); // setup view + // add archives to search path + util::filesys::addToSearchPath("data/fonts.zip"); + util::filesys::addToSearchPath("data/wavdata.zip"); + // load a font - video::Font::addResource("font","data/FreeMono.ttf",20); + video::Font::addResource("font","FreeMono.ttf",20); font.open("font"); - + // load the 6 sound effects - Sample::addResource("chimes","data/chimes.wav"); - Sample::addResource("ocean","data/ocean.wav"); - Sample::addResource("rain","data/rain.wav"); - Sample::addResource("stream","data/stream.wav"); - Sample::addResource("thunder","data/thunder.wav"); - Sample::addResource("waterdrop","data/waterdrop.wav"); + Sample::addResource("chimes","chimes.wav"); + Sample::addResource("ocean","ocean.wav"); + Sample::addResource("rain","rain.wav"); + Sample::addResource("stream","stream.wav"); + Sample::addResource("thunder","thunder.wav"); + Sample::addResource("waterdrop","waterdrop.wav"); // open the sounds chimes.open("chimes"); diff --git a/test/FPSDisplayTask.hpp b/test/FPSDisplayTask.hpp index e1eb04e..9065785 100644 --- a/test/FPSDisplayTask.hpp +++ b/test/FPSDisplayTask.hpp @@ -4,7 +4,9 @@ #include "photon.hpp" #include -// used to measure FPS and display it in the title bar +// Used to measure FPS and display it in the title bar. Pretty good example +// of when to use a Task, logic is entirely separate from rest of application +// and should be executed regularly. class FPSDisplayTask : public photon::Task { public: diff --git a/test/Font_test.cpp b/test/Font_test.cpp index 9db55ac..802b1ea 100644 --- a/test/Font_test.cpp +++ b/test/Font_test.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Font_test.cpp,v 1.7 2005/07/20 06:12:13 cozman Exp $ +// $Id: Font_test.cpp,v 1.8 2005/07/20 07:30:13 cozman Exp $ #include "photon.hpp" using namespace photon; @@ -22,9 +22,12 @@ public: { video.setOrthoView(800,600); + // add archive to search path + util::filesys::addToSearchPath("data/fonts.zip"); + // show two different fonts - video::Font::addResource("font1","data/FreeMono.ttf",32); - video::Font::addResource("font2","data/FreeSerif.ttf",18); + video::Font::addResource("font1","FreeMono.ttf",32); + video::Font::addResource("font2","FreeSerif.ttf",18); font.open("font1"); font2.open("font2"); diff --git a/test/Input_test.cpp b/test/Input_test.cpp index 6b4194c..c3dd9bb 100644 --- a/test/Input_test.cpp +++ b/test/Input_test.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Input_test.cpp,v 1.4 2005/07/20 06:12:13 cozman Exp $ +// $Id: Input_test.cpp,v 1.5 2005/07/20 07:30:13 cozman Exp $ #include "photon.hpp" using namespace photon; @@ -21,8 +21,11 @@ public: video(video::VideoCore::getInstance()) { video.setOrthoView(800,600); + + // add archives to search path + util::filesys::addToSearchPath("data/fonts.zip"); - video::Font::addResource("font","data/FreeMono.ttf",20); + video::Font::addResource("font","FreeMono.ttf",20); font.open("font"); }