nova compatiblity
This commit is contained in:
parent
38eaf40d6f
commit
8c75d02356
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: AudioCore.hpp,v 1.1 2005/02/27 05:55:18 cozman Exp $
|
||||
// $Id: AudioCore.hpp,v 1.2 2005/03/01 07:51:23 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_AUDIO_AUDIOCORE_HPP
|
||||
#define PHOTON_AUDIO_AUDIOCORE_HPP
|
||||
@ -21,18 +21,44 @@ namespace photon
|
||||
namespace audio
|
||||
{
|
||||
|
||||
// Class: AudioCore
|
||||
// Photon's <Singleton> core for audio manipulation/control. Defines the
|
||||
// interface through which all audio related functions are performed.
|
||||
//
|
||||
// Parent:
|
||||
// <Singleton>
|
||||
class AudioCore : public util::Singleton<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: Initialization
|
||||
public:
|
||||
// Function: setDesiredDevice
|
||||
// Set the name of the desired audio device to use. Static function of
|
||||
// AudioCore, must be called before AudioCore::initialize() or not at all.
|
||||
//
|
||||
// If called, the initialization of the audio library will attempt to
|
||||
// use the specified audio device, otherwise the default device will be
|
||||
// used.
|
||||
//
|
||||
// Parameters:
|
||||
// name - Name of audio device to use.
|
||||
static void setDesiredDevice(const std::string& name);
|
||||
|
||||
// OpenAL specifics
|
||||
private:
|
||||
util::VersionInfo initOpenAL();
|
||||
static std::string checkOpenALError();
|
||||
|
||||
public:
|
||||
static void setDesiredDevice(const std::string& name);
|
||||
|
||||
// data members
|
||||
private:
|
||||
static std::string deviceName_;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: Vector2.hpp,v 1.1 2005/02/27 09:00:13 cozman Exp $
|
||||
// $Id: Vector2.hpp,v 1.2 2005/03/01 07:51:23 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_MATH_VECTOR2_HPP
|
||||
#define PHOTON_MATH_VECTOR2_HPP
|
||||
@ -207,8 +207,11 @@ public:
|
||||
|
||||
Vector2 operator*(scalar lhs, const Vector2 &rhs);
|
||||
|
||||
// Group: External Utilities
|
||||
|
||||
// Function: magnitude
|
||||
// Find length of a vector.
|
||||
// Same as a call to v.getMagnitude() but provided for convinience.
|
||||
//
|
||||
// Parameters:
|
||||
// v - Vector to calculate magnitude of
|
||||
@ -217,6 +220,8 @@ Vector2 operator*(scalar lhs, const Vector2 &rhs);
|
||||
// Length of the vector.
|
||||
scalar magnitude(const Vector2 &v);
|
||||
|
||||
// Group: Aliases
|
||||
|
||||
// Typedef: Point2
|
||||
// Alias for Vector2 type.
|
||||
typedef Vector2 Point2;
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: math.hpp,v 1.1 2005/02/27 09:00:13 cozman Exp $
|
||||
// $Id: math.hpp,v 1.2 2005/03/01 07:51:23 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_MATH_MATH_HPP
|
||||
#define PHOTON_MATH_MATH_HPP
|
||||
@ -21,6 +21,10 @@ namespace math
|
||||
|
||||
class Vector2;
|
||||
|
||||
// Title: Math Utilities
|
||||
|
||||
// Group: Generic
|
||||
|
||||
// Function: clamp
|
||||
// Clamp a value between two boundaries.
|
||||
//
|
||||
@ -57,6 +61,8 @@ bool scalarCompare(scalar val1, scalar val2, scalar epsilon=0.000001);
|
||||
// Scalar distance between the two points.
|
||||
scalar distance(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Group: Degrees/Radians
|
||||
|
||||
// Function: degToRad
|
||||
// Convert degrees to radians.
|
||||
//
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: Singleton.hpp,v 1.3 2005/02/27 07:43:37 cozman Exp $
|
||||
// $Id: Singleton.hpp,v 1.4 2005/03/01 07:51:23 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_UTIL_SINGLETON_HPP
|
||||
#define PHOTON_UTIL_SINGLETON_HPP
|
||||
@ -18,14 +18,52 @@ namespace photon
|
||||
namespace util
|
||||
{
|
||||
|
||||
// Class: Singleton
|
||||
// Template class for singleton pattern. Is non-copyable to enforce
|
||||
// correct behavior.
|
||||
//
|
||||
// Defining a Singleton:
|
||||
// (code)
|
||||
// YourClass : public Singleton<Class>
|
||||
// {
|
||||
// // class specific data
|
||||
//
|
||||
// // Singleton-required code
|
||||
// private:
|
||||
// // Singleton-required code
|
||||
// YourClass();
|
||||
// ~YourClass();
|
||||
//
|
||||
// friend class util::Singleton<YourClass>;
|
||||
// friend class std::auto_ptr<YourClass>;
|
||||
// };
|
||||
// (end)
|
||||
//
|
||||
// Using The Singleton:
|
||||
// (code)
|
||||
// YourClass::initialize();
|
||||
// YourClass& yc(YourClass::getInstance());
|
||||
//
|
||||
// // use yc
|
||||
//
|
||||
// YourClass::destroy(); //optional
|
||||
// (end)
|
||||
template<class T>
|
||||
class Singleton : public boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
// Function: initialize
|
||||
// Initialize the instance of the singleton, must be done explicitly.
|
||||
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.
|
||||
static void destroy();
|
||||
|
||||
// Function: getInstance
|
||||
// Get a reference to the instance of the derived class.
|
||||
static T& getInstance();
|
||||
|
||||
protected:
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: VersionInfo.hpp,v 1.3 2005/02/27 05:50:39 cozman Exp $
|
||||
// $Id: VersionInfo.hpp,v 1.4 2005/03/01 07:51:24 cozman Exp $
|
||||
|
||||
#ifndef PHOTON_UTIL_VERSIONINFO_HPP
|
||||
#define PHOTON_UTIL_VERSIONINFO_HPP
|
||||
@ -78,6 +78,8 @@ public:
|
||||
friend std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs);
|
||||
};
|
||||
|
||||
// Section: VersionInfo Utilities
|
||||
|
||||
// Function: ensureVersion
|
||||
// Checks a version of a library against the required version, throws
|
||||
// an APIError if the version is not met.
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: AppCore.cpp,v 1.1 2005/02/27 07:43:37 cozman Exp $
|
||||
// $Id: AppCore.cpp,v 1.2 2005/03/01 07:52:20 cozman Exp $
|
||||
|
||||
#include "AppCore.hpp"
|
||||
|
||||
@ -95,7 +95,71 @@ int AppCore::getMouseWheelPos()
|
||||
|
||||
scalar AppCore::getTime()
|
||||
{
|
||||
return glfwGetTime();
|
||||
return glfwGetTime() - pausedTime_;
|
||||
}
|
||||
|
||||
void AppCore::update()
|
||||
{
|
||||
scalar curTime = getTime();
|
||||
|
||||
// keep track of time between frames
|
||||
secPerFrame_ = curTime-lastUpdate_;
|
||||
lastUpdate_ = curTime;
|
||||
|
||||
// quit on window closing or Alt-F4/Alt-X
|
||||
if(!glfwGetWindowParam(GLFW_OPENED) ||
|
||||
( (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT)) &&
|
||||
(glfwGetKey(GLFW_KEY_F4) || glfwGetKey('X')) ) )
|
||||
{
|
||||
quitRequested_ = true;
|
||||
}
|
||||
|
||||
// hold active-state
|
||||
active_ = (glfwGetWindowParam(GLFW_ACTIVE) == GL_TRUE);
|
||||
|
||||
// automatically pause/unpause app timer on focus
|
||||
if(!active_ && !timerPaused_)
|
||||
{
|
||||
timerPaused_ = true;
|
||||
lastPause_ = curTime;
|
||||
unpauseOnActive_ = true;
|
||||
}
|
||||
else if(active_ && unpauseOnActive_)
|
||||
{
|
||||
timerPaused_ = true;
|
||||
pausedTime_ += curTime - lastPause_;
|
||||
unpauseOnActive_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void AppCore::setTitle(const std::string& title)
|
||||
{
|
||||
glfwSetWindowTitle(title.c_str());
|
||||
}
|
||||
|
||||
void AppCore::requestQuit()
|
||||
{
|
||||
quitRequested_ = true;
|
||||
}
|
||||
|
||||
bool AppCore::quitRequested()
|
||||
{
|
||||
return quitRequested_;
|
||||
}
|
||||
|
||||
bool AppCore::isActive()
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
double AppCore::getElapsedTime()
|
||||
{
|
||||
return secPerFrame_;
|
||||
}
|
||||
|
||||
double AppCore::getFramerate()
|
||||
{
|
||||
return 1/secPerFrame_;
|
||||
}
|
||||
|
||||
util::VersionInfo AppCore::initGLFW()
|
||||
@ -109,7 +173,10 @@ util::VersionInfo AppCore::initGLFW()
|
||||
return util::VersionInfo(maj,min,patch);
|
||||
}
|
||||
|
||||
AppCore::AppCore()
|
||||
AppCore::AppCore() :
|
||||
quitRequested_(true), active_(false), timerPaused_(false),
|
||||
unpauseOnActive_(false), lastPause_(0), pausedTime_(0),
|
||||
secPerFrame_(0), lastUpdate_(0)
|
||||
{
|
||||
util::VersionInfo glfwReq(2,4,2); // requires GLFW 2.4.2
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// James Turk (jpt2433@rit.edu)
|
||||
//
|
||||
// Version:
|
||||
// $Id: Log.cpp,v 1.6 2005/02/27 05:53:01 cozman Exp $
|
||||
// $Id: Log.cpp,v 1.7 2005/03/01 07:52:20 cozman Exp $
|
||||
|
||||
#include "Log.hpp"
|
||||
|
||||
@ -22,7 +22,7 @@ Log::Log()
|
||||
Log::~Log()
|
||||
{
|
||||
flush();
|
||||
removeSinks();
|
||||
removeSinks();;
|
||||
}
|
||||
|
||||
void Log::addSink(LogSinkPtr sink)
|
||||
|
Loading…
Reference in New Issue
Block a user