diff --git a/include/AppCore.hpp b/include/AppCore.hpp index ba037df..9804517 100644 --- a/include/AppCore.hpp +++ b/include/AppCore.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: AppCore.hpp,v 1.1 2005/02/27 07:43:37 cozman Exp $ +// $Id: AppCore.hpp,v 1.2 2005/03/01 07:51:04 cozman Exp $ #ifndef PHOTON_APPCORE_HPP #define PHOTON_APPCORE_HPP @@ -18,6 +18,15 @@ namespace photon { +// Class: AppCore +// Photon's core for application behavior. Defines the interface +// through which all "application" related functions are performed. +// +// AppCore is the Core that essentially represents the window management, +// input, and timing systems. +// +// Parent: +// class AppCore : public util::Singleton { @@ -61,7 +70,7 @@ public: // Function: updateDisplay // Updates the display, usually involves flipping the front/back buffers. void updateDisplay(); - + // Group: Input public: @@ -110,17 +119,76 @@ public: // Group: Timing public: - // Function: + // Function: getTime // Get time, in seconds, that application has been running. // // Returns: // Time, represented as a floating-point number in seconds, application has // been running. scalar getTime(); - + +// Group: Application +public: + // Function: update + // Updates the + void update(); + + // Function: setTitle + // Sets title of application that shows up in title bar. + // + // Parameters: + // title - New title of application. + void setTitle(const std::string& title); + + // Function: requestQuit + // Sets the internal quit flag to true. + void requestQuit(); + + // Function: quitRequested + // Checks the internal quit flag, if a quit has been requested, + // the application should comply. + // + // Returns: + // State of internal quit flag, if true application should quit ASAP. + bool quitRequested(); + + // Function: isActive + // Checks if application is active, which on most systems simply means it + // has focus. + // + // Returns: + // True if application is active, false otherwise. + bool isActive(); + + // Function: getElapsedTime + // Finds the amount of time passed between frames, useful for time-based + // movement. + // + // Returns: + // Time between current frame and last frame. (1/()) + double getElapsedTime(); + + // Function: getFramerate + // Gets number of frames per second the application is currently being run at. + // + // Returns: + // Current frames per second. + double getFramerate(); + +// data members +private: + bool quitRequested_; + bool active_; + bool timerPaused_; + bool unpauseOnActive_; + scalar lastPause_; + scalar pausedTime_; + scalar secPerFrame_; + scalar lastUpdate_; + +// API initialization private: util::VersionInfo initGLFW(); - // Singleton-required code private: diff --git a/include/Application.hpp b/include/Application.hpp index 72353c1..e10f2c3 100644 --- a/include/Application.hpp +++ b/include/Application.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Application.hpp,v 1.4 2005/02/27 07:43:37 cozman Exp $ +// $Id: Application.hpp,v 1.5 2005/03/01 07:51:04 cozman Exp $ #ifndef PHOTON_APPLICATION_HPP #define PHOTON_APPLICATION_HPP @@ -13,6 +13,8 @@ #include #include +#include + #include "types.hpp" #include "util/VersionInfo.hpp" @@ -24,7 +26,7 @@ namespace photon // implementations of Application. // // Derived classes are made entrypoint via . -class Application +class Application : public boost::noncopyable { // Group: (Con/De)structors @@ -52,6 +54,14 @@ public: // virtual int main(StrVec args)=0; +// Behind the scenes +public: + // Function: setInitOptions(const char* arg0) + // Internal use function, used to set initialization options. + // (params not documented since function signature is subject to change and + // should not be relied on by user-level code) + static void setInitOptions(const char* appPath); + // Group: API Initialization private: // Function: initPhysFS @@ -64,14 +74,6 @@ private: // with PhysFS version. util::VersionInfo initPhysFS(const char* arg0); -// Behind the scenes -public: - // Function: setInitOptions(const char* arg0) - // Internal use function, used to set initialization options. - // (params not documented since function signature is subject to change and - // should not be relied on by user-level code) - static void setInitOptions(const char* appPath); - // Data Members private: scalar secPerFrame_; @@ -80,13 +82,10 @@ private: bool unpauseOnActive_; bool quitRequested_; - // Variable: photonVer_ - // Contains version identifier for photon. + // version number for photon util::VersionInfo photonVer_; - // Variable: arg0_ - // Contains 0th argument from command line, obtained via - // and used by PhysFS initialization. + // arg0 from command line static std::string arg0_; }; diff --git a/include/Log.hpp b/include/Log.hpp index 7c3ba22..115a407 100644 --- a/include/Log.hpp +++ b/include/Log.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Log.hpp,v 1.3 2005/02/27 05:53:01 cozman Exp $ +// $Id: Log.hpp,v 1.4 2005/03/01 07:51:04 cozman Exp $ #ifndef PHOTON_LOG_HPP #define PHOTON_LOG_HPP @@ -21,8 +21,11 @@ namespace photon { // Class: Log -// Log class for photon, Log passes all messages to any attached , -// which can then take care of any output which is desired. +// log class for photon, Log passes all messages to any attached +// , which can then take care of any output which is desired. +// +// Parent: +// class Log : public util::Singleton { // Group: Sink Maintenance diff --git a/include/exceptions.hpp b/include/exceptions.hpp index b83243c..0448d21 100644 --- a/include/exceptions.hpp +++ b/include/exceptions.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: exceptions.hpp,v 1.3 2005/02/27 05:51:59 cozman Exp $ +// $Id: exceptions.hpp,v 1.4 2005/03/01 07:51:04 cozman Exp $ #ifndef PHOTON_EXCEPTIONS_HPP #define PHOTON_EXCEPTIONS_HPP @@ -29,6 +29,9 @@ namespace photon // Error are available for non-specific exceptions. All exceptions have the // same interface as Throwable. // +// Operators: +// ostream& << Throwable - All exceptions defined here can be output via '<<' +// // Children: // - Base class for all non-fatal exceptions. // - Base class for all potentially fatal exceptions. @@ -48,6 +51,12 @@ public: uint line=0) throw(); virtual ~Throwable() throw()=0; + // Function: what + // Similar to the std::exception family, all photon exceptions (the + // Throwable family) define what() that returns a description of the + // exception. + // + // Returns: std::string describing the error std::string virtual what() const throw(); friend std::ostream& operator<<(std::ostream& os, const Throwable& rhs); diff --git a/include/types.hpp b/include/types.hpp index 4cc9bbc..cedb2a2 100644 --- a/include/types.hpp +++ b/include/types.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: types.hpp,v 1.3 2005/02/27 07:43:37 cozman Exp $ +// $Id: types.hpp,v 1.4 2005/03/01 07:51:04 cozman Exp $ #ifndef PHOTON_TYPES_HPP #define PHOTON_TYPES_HPP @@ -19,7 +19,7 @@ namespace photon { -// Group: Types +// Group: Basic Types // Type: ubyte // Unsigned byte, alias for unsigned char. @@ -33,6 +33,8 @@ typedef unsigned int uint; // Scalar value, used throughout photon. (double or float) typedef double scalar; +// Group: STL/Boost Types + // Type: StrVec // Typedef for vector of strings, which is used all throughout photon. typedef std::vector StrVec; @@ -41,6 +43,7 @@ typedef std::vector StrVec; // Shared pointer type. (uses the boost implementation) using boost::shared_ptr; +// Group: Enums // Enum: KeyCode // Enumeration defining keys, used in . @@ -163,8 +166,8 @@ using boost::shared_ptr; // KEY_NUM_8 - Numpad 8 key // KEY_NUM_9 - Numpad 9 key -// Enum: KeyCode -// Enumeration defining keys, used in . +// Enum: MouseButton +// Enumeration defining buttons, used in . // // MB_LEFT - Left mouse button. // MB_MIDDLE - Middle mouse button.