nova compatible

This commit is contained in:
James Turk 2005-03-01 07:51:04 +00:00
parent f2a650852d
commit 38eaf40d6f
5 changed files with 110 additions and 28 deletions

View File

@ -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 <Singleton> 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:
// <Singleton>
class AppCore : public util::Singleton<AppCore>
{
@ -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/<getFramerate>())
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:

View File

@ -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 <vector>
#include <string>
#include <boost/utility.hpp>
#include "types.hpp"
#include "util/VersionInfo.hpp"
@ -24,7 +26,7 @@ namespace photon
// implementations of Application.
//
// Derived classes are made entrypoint via <ENTRYPOINT>.
class Application
class Application : public boost::noncopyable
{
// Group: (Con/De)structors
@ -52,6 +54,14 @@ public:
// <ENTRYPOINT>
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:
// <VersionInfo> 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 <setInitOptions>
// and used by PhysFS initialization.
// arg0 from command line
static std::string arg0_;
};

View File

@ -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 <LogSinks>,
// which can then take care of any output which is desired.
// <Singleton> log class for photon, Log passes all messages to any attached
// <LogSinks>, which can then take care of any output which is desired.
//
// Parent:
// <Singleton>
class Log : public util::Singleton<Log>
{
// Group: Sink Maintenance

View File

@ -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:
// <Exception> - Base class for all non-fatal exceptions.
// <Error> - 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);

View File

@ -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<std::string> StrVec;
@ -41,6 +43,7 @@ typedef std::vector<std::string> StrVec;
// Shared pointer type. (uses the boost implementation)
using boost::shared_ptr;
// Group: Enums
// Enum: KeyCode
// Enumeration defining keys, used in <AppCore::keyPressed>.
@ -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 <AppCore::keyPressed>.
// Enum: MouseButton
// Enumeration defining buttons, used in <AppCore::mouseButtonPressed>.
//
// MB_LEFT - Left mouse button.
// MB_MIDDLE - Middle mouse button.