nova compatible
This commit is contained in:
parent
f2a650852d
commit
38eaf40d6f
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// 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
|
#ifndef PHOTON_APPCORE_HPP
|
||||||
#define PHOTON_APPCORE_HPP
|
#define PHOTON_APPCORE_HPP
|
||||||
@ -18,6 +18,15 @@
|
|||||||
namespace photon
|
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>
|
class AppCore : public util::Singleton<AppCore>
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -110,7 +119,7 @@ public:
|
|||||||
// Group: Timing
|
// Group: Timing
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Function:
|
// Function: getTime
|
||||||
// Get time, in seconds, that application has been running.
|
// Get time, in seconds, that application has been running.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
@ -118,10 +127,69 @@ public:
|
|||||||
// been running.
|
// been running.
|
||||||
scalar getTime();
|
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:
|
private:
|
||||||
util::VersionInfo initGLFW();
|
util::VersionInfo initGLFW();
|
||||||
|
|
||||||
|
|
||||||
// Singleton-required code
|
// Singleton-required code
|
||||||
private:
|
private:
|
||||||
AppCore();
|
AppCore();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// 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
|
#ifndef PHOTON_APPLICATION_HPP
|
||||||
#define PHOTON_APPLICATION_HPP
|
#define PHOTON_APPLICATION_HPP
|
||||||
@ -13,6 +13,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/utility.hpp>
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "util/VersionInfo.hpp"
|
#include "util/VersionInfo.hpp"
|
||||||
|
|
||||||
@ -24,7 +26,7 @@ namespace photon
|
|||||||
// implementations of Application.
|
// implementations of Application.
|
||||||
//
|
//
|
||||||
// Derived classes are made entrypoint via <ENTRYPOINT>.
|
// Derived classes are made entrypoint via <ENTRYPOINT>.
|
||||||
class Application
|
class Application : public boost::noncopyable
|
||||||
{
|
{
|
||||||
|
|
||||||
// Group: (Con/De)structors
|
// Group: (Con/De)structors
|
||||||
@ -52,6 +54,14 @@ public:
|
|||||||
// <ENTRYPOINT>
|
// <ENTRYPOINT>
|
||||||
virtual int main(StrVec args)=0;
|
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
|
// Group: API Initialization
|
||||||
private:
|
private:
|
||||||
// Function: initPhysFS
|
// Function: initPhysFS
|
||||||
@ -64,14 +74,6 @@ private:
|
|||||||
// <VersionInfo> with PhysFS version.
|
// <VersionInfo> with PhysFS version.
|
||||||
util::VersionInfo initPhysFS(const char* arg0);
|
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
|
// Data Members
|
||||||
private:
|
private:
|
||||||
scalar secPerFrame_;
|
scalar secPerFrame_;
|
||||||
@ -80,13 +82,10 @@ private:
|
|||||||
bool unpauseOnActive_;
|
bool unpauseOnActive_;
|
||||||
bool quitRequested_;
|
bool quitRequested_;
|
||||||
|
|
||||||
// Variable: photonVer_
|
// version number for photon
|
||||||
// Contains version identifier for photon.
|
|
||||||
util::VersionInfo photonVer_;
|
util::VersionInfo photonVer_;
|
||||||
|
|
||||||
// Variable: arg0_
|
// arg0 from command line
|
||||||
// Contains 0th argument from command line, obtained via <setInitOptions>
|
|
||||||
// and used by PhysFS initialization.
|
|
||||||
static std::string arg0_;
|
static std::string arg0_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// 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
|
#ifndef PHOTON_LOG_HPP
|
||||||
#define PHOTON_LOG_HPP
|
#define PHOTON_LOG_HPP
|
||||||
@ -21,8 +21,11 @@ namespace photon
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Class: Log
|
// Class: Log
|
||||||
// Log class for photon, Log passes all messages to any attached <LogSinks>,
|
// <Singleton> log class for photon, Log passes all messages to any attached
|
||||||
// which can then take care of any output which is desired.
|
// <LogSinks>, which can then take care of any output which is desired.
|
||||||
|
//
|
||||||
|
// Parent:
|
||||||
|
// <Singleton>
|
||||||
class Log : public util::Singleton<Log>
|
class Log : public util::Singleton<Log>
|
||||||
{
|
{
|
||||||
// Group: Sink Maintenance
|
// Group: Sink Maintenance
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// 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
|
#ifndef PHOTON_EXCEPTIONS_HPP
|
||||||
#define PHOTON_EXCEPTIONS_HPP
|
#define PHOTON_EXCEPTIONS_HPP
|
||||||
@ -29,6 +29,9 @@ namespace photon
|
|||||||
// Error are available for non-specific exceptions. All exceptions have the
|
// Error are available for non-specific exceptions. All exceptions have the
|
||||||
// same interface as Throwable.
|
// same interface as Throwable.
|
||||||
//
|
//
|
||||||
|
// Operators:
|
||||||
|
// ostream& << Throwable - All exceptions defined here can be output via '<<'
|
||||||
|
//
|
||||||
// Children:
|
// Children:
|
||||||
// <Exception> - Base class for all non-fatal exceptions.
|
// <Exception> - Base class for all non-fatal exceptions.
|
||||||
// <Error> - Base class for all potentially fatal exceptions.
|
// <Error> - Base class for all potentially fatal exceptions.
|
||||||
@ -48,6 +51,12 @@ public:
|
|||||||
uint line=0) throw();
|
uint line=0) throw();
|
||||||
virtual ~Throwable() throw()=0;
|
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();
|
std::string virtual what() const throw();
|
||||||
friend std::ostream& operator<<(std::ostream& os, const Throwable& rhs);
|
friend std::ostream& operator<<(std::ostream& os, const Throwable& rhs);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// 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
|
#ifndef PHOTON_TYPES_HPP
|
||||||
#define PHOTON_TYPES_HPP
|
#define PHOTON_TYPES_HPP
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace photon {
|
namespace photon {
|
||||||
|
|
||||||
// Group: Types
|
// Group: Basic Types
|
||||||
|
|
||||||
// Type: ubyte
|
// Type: ubyte
|
||||||
// Unsigned byte, alias for unsigned char.
|
// Unsigned byte, alias for unsigned char.
|
||||||
@ -33,6 +33,8 @@ typedef unsigned int uint;
|
|||||||
// Scalar value, used throughout photon. (double or float)
|
// Scalar value, used throughout photon. (double or float)
|
||||||
typedef double scalar;
|
typedef double scalar;
|
||||||
|
|
||||||
|
// Group: STL/Boost Types
|
||||||
|
|
||||||
// Type: StrVec
|
// Type: StrVec
|
||||||
// Typedef for vector of strings, which is used all throughout photon.
|
// Typedef for vector of strings, which is used all throughout photon.
|
||||||
typedef std::vector<std::string> StrVec;
|
typedef std::vector<std::string> StrVec;
|
||||||
@ -41,6 +43,7 @@ typedef std::vector<std::string> StrVec;
|
|||||||
// Shared pointer type. (uses the boost implementation)
|
// Shared pointer type. (uses the boost implementation)
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
|
|
||||||
|
// Group: Enums
|
||||||
|
|
||||||
// Enum: KeyCode
|
// Enum: KeyCode
|
||||||
// Enumeration defining keys, used in <AppCore::keyPressed>.
|
// Enumeration defining keys, used in <AppCore::keyPressed>.
|
||||||
@ -163,8 +166,8 @@ using boost::shared_ptr;
|
|||||||
// KEY_NUM_8 - Numpad 8 key
|
// KEY_NUM_8 - Numpad 8 key
|
||||||
// KEY_NUM_9 - Numpad 9 key
|
// KEY_NUM_9 - Numpad 9 key
|
||||||
|
|
||||||
// Enum: KeyCode
|
// Enum: MouseButton
|
||||||
// Enumeration defining keys, used in <AppCore::keyPressed>.
|
// Enumeration defining buttons, used in <AppCore::mouseButtonPressed>.
|
||||||
//
|
//
|
||||||
// MB_LEFT - Left mouse button.
|
// MB_LEFT - Left mouse button.
|
||||||
// MB_MIDDLE - Middle mouse button.
|
// MB_MIDDLE - Middle mouse button.
|
||||||
|
Loading…
Reference in New Issue
Block a user