post-florida update
This commit is contained in:
parent
766db32ed9
commit
84e61a622d
@ -5,14 +5,13 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: AppCore.hpp,v 1.8 2005/07/19 05:45:22 cozman Exp $
|
// $Id: AppCore.hpp,v 1.9 2005/08/02 23:07:51 cozman Exp $
|
||||||
|
|
||||||
#ifndef PHOTON_APPCORE_HPP
|
#ifndef PHOTON_APPCORE_HPP
|
||||||
#define PHOTON_APPCORE_HPP
|
#define PHOTON_APPCORE_HPP
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "util/VersionInfo.hpp"
|
#include "util/VersionInfo.hpp"
|
||||||
#include "util/Singleton.hpp"
|
|
||||||
#include "Task.hpp"
|
#include "Task.hpp"
|
||||||
#include "InputListener.hpp"
|
#include "InputListener.hpp"
|
||||||
|
|
||||||
@ -22,21 +21,22 @@ namespace photon
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Class: AppCore
|
// Class: AppCore
|
||||||
// Photon's <Singleton> core for application behavior. Defines the interface
|
// Photon's core for application behavior. Defines the interface through which
|
||||||
// through which all "application" related functions are performed.
|
// all "application" related functions are performed. This means input,
|
||||||
|
// display creation, etc.
|
||||||
//
|
//
|
||||||
// AppCore is the Core that essentially represents the window management,
|
// AppCore is the Core that essentially represents the window management,
|
||||||
// input, and timing systems.
|
// input, and timing systems.
|
||||||
//
|
class AppCore
|
||||||
// Parent:
|
|
||||||
// <Singleton>
|
|
||||||
class AppCore : public util::Singleton<AppCore>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppCore();
|
AppCore();
|
||||||
~AppCore();
|
~AppCore();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
// Group: Video
|
// Group: Video
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Application.hpp,v 1.9 2005/07/19 01:31:37 cozman Exp $
|
// $Id: Application.hpp,v 1.10 2005/08/02 23:07:51 cozman Exp $
|
||||||
|
|
||||||
#ifndef PHOTON_APPLICATION_HPP
|
#ifndef PHOTON_APPLICATION_HPP
|
||||||
#define PHOTON_APPLICATION_HPP
|
#define PHOTON_APPLICATION_HPP
|
||||||
@ -18,6 +18,10 @@
|
|||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "util/VersionInfo.hpp"
|
#include "util/VersionInfo.hpp"
|
||||||
#include "Task.hpp"
|
#include "Task.hpp"
|
||||||
|
#include "Kernel.hpp"
|
||||||
|
#include "AppCore.hpp"
|
||||||
|
#include "video/VideoCore.hpp"
|
||||||
|
#include "audio/AudioCore.hpp"
|
||||||
|
|
||||||
namespace photon
|
namespace photon
|
||||||
{
|
{
|
||||||
@ -56,6 +60,15 @@ public:
|
|||||||
// <ENTRYPOINT>
|
// <ENTRYPOINT>
|
||||||
virtual int main(const StrVec& args)=0;
|
virtual int main(const StrVec& args)=0;
|
||||||
|
|
||||||
|
// Group: Core Access
|
||||||
|
public:
|
||||||
|
static Kernel& getKernel();
|
||||||
|
static AppCore& getAppCore();
|
||||||
|
static video::VideoCore& getVideoCore();
|
||||||
|
static audio::AudioCore& getAudioCore();
|
||||||
|
static void initVideoCore(uint width, uint height);
|
||||||
|
static void initAudioCore(const std::string& deviceName);
|
||||||
|
|
||||||
// behind the scenes
|
// behind the scenes
|
||||||
public:
|
public:
|
||||||
static void setInitOptions(const char* arg0);
|
static void setInitOptions(const char* arg0);
|
||||||
@ -68,6 +81,12 @@ private:
|
|||||||
// version number for photon
|
// version number for photon
|
||||||
util::VersionInfo photonVer_;
|
util::VersionInfo photonVer_;
|
||||||
|
|
||||||
|
// Cores and Kernel
|
||||||
|
static Kernel kernel_;
|
||||||
|
static AppCore appCore_;
|
||||||
|
static std::auto_ptr<video::VideoCore> videoCore_;
|
||||||
|
static std::auto_ptr<audio::AudioCore> audioCore_;
|
||||||
|
|
||||||
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: Kernel.hpp,v 1.1 2005/03/15 19:22:07 cozman Exp $
|
// $Id: Kernel.hpp,v 1.2 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#ifndef PHOTON_KERNEL_HPP
|
#ifndef PHOTON_KERNEL_HPP
|
||||||
#define PHOTON_KERNEL_HPP
|
#define PHOTON_KERNEL_HPP
|
||||||
@ -13,21 +13,20 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "util/Singleton.hpp"
|
|
||||||
#include "Task.hpp"
|
#include "Task.hpp"
|
||||||
|
|
||||||
namespace photon
|
namespace photon
|
||||||
{
|
{
|
||||||
|
|
||||||
// Class: Kernel
|
// Class: Kernel
|
||||||
// Singleton Kernel class, maintains a list of <Tasks> and manages their
|
// Kernel class, maintains a list of <Tasks> and manages their status,
|
||||||
// status, including adding, deleting, pausing, and unpausing tasks.
|
// handles adding, deleting, pausing, and unpausing tasks.
|
||||||
//
|
//
|
||||||
// To use Kernel:
|
// To use Kernel:
|
||||||
// - (1) Add any tasks (should be derived from <Task>)
|
// - (1) Add any tasks (should be derived from <Task>)
|
||||||
// - (2) call <Kernel::run>
|
// - (2) call <Kernel::run>
|
||||||
// - (3) in order to avoid running forever, all tasks should eventually die
|
// - (3) in order to avoid running forever, all tasks should eventually die
|
||||||
class Kernel : public util::Singleton<Kernel>
|
class Kernel
|
||||||
{
|
{
|
||||||
|
|
||||||
// Group: (Con/De)structors
|
// Group: (Con/De)structors
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Log.hpp,v 1.7 2005/07/19 01:31:37 cozman Exp $
|
// $Id: Log.hpp,v 1.8 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#ifndef PHOTON_LOG_HPP
|
#ifndef PHOTON_LOG_HPP
|
||||||
#define PHOTON_LOG_HPP
|
#define PHOTON_LOG_HPP
|
||||||
@ -14,7 +14,6 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "util/Singleton.hpp"
|
|
||||||
#include "LogSink.hpp"
|
#include "LogSink.hpp"
|
||||||
|
|
||||||
namespace photon
|
namespace photon
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: AudioCore.hpp,v 1.9 2005/07/19 05:56:08 cozman Exp $
|
// $Id: AudioCore.hpp,v 1.10 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#ifdef PHOTON_USE_OPENAL
|
#ifdef PHOTON_USE_OPENAL
|
||||||
|
|
||||||
@ -24,18 +24,16 @@ namespace audio
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Class: AudioCore
|
// Class: AudioCore
|
||||||
// Photon's <Singleton> core for audio manipulation/control. Defines the
|
// Photon's core for audio manipulation/control. Defines the interface through
|
||||||
// interface through which all audio related functions are performed.
|
// which all audio related functions are performed.
|
||||||
//
|
class AudioCore
|
||||||
// Parent:
|
|
||||||
// <Singleton>
|
|
||||||
class AudioCore : public util::Singleton<AudioCore>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// Group: (Con/De)structors
|
// Group: (Con/De)structors
|
||||||
public:
|
public:
|
||||||
// Function: AudioCore
|
// Function: AudioCore
|
||||||
// Initialize underlying APIs and setup <Task> internals.
|
// Initialize underlying APIs and setup <Task> internals.
|
||||||
|
//AudioCore();
|
||||||
AudioCore(const std::string& deviceName);
|
AudioCore(const std::string& deviceName);
|
||||||
|
|
||||||
// Function: ~AudioCore
|
// Function: ~AudioCore
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: VideoCore.hpp,v 1.4 2005/07/20 06:12:54 cozman Exp $
|
// $Id: VideoCore.hpp,v 1.5 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#ifndef PHOTON_VIDEO_VIDEOCORE_HPP
|
#ifndef PHOTON_VIDEO_VIDEOCORE_HPP
|
||||||
#define PHOTON_VIDEO_VIDEOCORE_HPP
|
#define PHOTON_VIDEO_VIDEOCORE_HPP
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "util/Singleton.hpp"
|
|
||||||
#include "Task.hpp"
|
#include "Task.hpp"
|
||||||
|
|
||||||
namespace photon
|
namespace photon
|
||||||
@ -20,24 +19,25 @@ namespace video
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Class: VideoCore
|
// Class: VideoCore
|
||||||
// Photon's <Singleton> core for graphics behavior. Defines the interface
|
// Photon's core for graphics behavior. Defines the interface through which
|
||||||
// through which all graphics related functions are performed.
|
// all graphics related functions are performed.
|
||||||
//
|
//
|
||||||
// VideoCore is the Core that interfaces with the actual drawing/updating of
|
// VideoCore is the Core that interfaces with the actual drawing/updating of
|
||||||
// the display.
|
// the display.
|
||||||
//
|
//
|
||||||
// See Also:
|
// See Also:
|
||||||
// <AppCore>
|
// <AppCore>
|
||||||
//
|
class VideoCore
|
||||||
// Parent:
|
|
||||||
// <Singleton>
|
|
||||||
class VideoCore : public util::Singleton<VideoCore>
|
|
||||||
{
|
{
|
||||||
// Group: (Con/De)structors
|
// Group: (Con/De)structors
|
||||||
public:
|
public:
|
||||||
// Function: VideoCore
|
// Function: VideoCore
|
||||||
// Initialize underlying APIs and setup <Task> internals.
|
// Initialize underlying APIs and setup <Task> internals.
|
||||||
VideoCore();
|
//
|
||||||
|
// Parameters:
|
||||||
|
// width - Width of display.
|
||||||
|
// height - height of display
|
||||||
|
VideoCore(uint width, uint height);
|
||||||
|
|
||||||
// Function: ~VideoCore
|
// Function: ~VideoCore
|
||||||
// Shutdown underlying APIs.
|
// Shutdown underlying APIs.
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node ID="Freemind_Link_700471537" TEXT="dependencies / licensing clarification"/>
|
<node ID="Freemind_Link_700471537" TEXT="dependencies / licensing clarification">
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
|
</node>
|
||||||
<node ID="Freemind_Link_1153941464" TEXT="test compilation on fresh systems">
|
<node ID="Freemind_Link_1153941464" TEXT="test compilation on fresh systems">
|
||||||
<node ID="Freemind_Link_1403005191" TEXT="test compilation on clean linux system"/>
|
<node ID="Freemind_Link_1403005191" TEXT="test compilation on clean linux system"/>
|
||||||
<node ID="Freemind_Link_617919930" TEXT="test compilation on windows system">
|
<node ID="Freemind_Link_617919930" TEXT="test compilation on windows system">
|
||||||
@ -159,7 +161,7 @@
|
|||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node COLOR="#147f1e" ID="Freemind_Link_438641521" POSITION="left" TEXT="Version: $Id: photon.mm,v 1.22 2005/07/20 07:30:13 cozman Exp $">
|
<node COLOR="#147f1e" ID="Freemind_Link_438641521" POSITION="left" TEXT="Version: $Id: photon.mm,v 1.23 2005/08/02 23:07:51 cozman Exp $">
|
||||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
@ -5,13 +5,14 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: AppCore.cpp,v 1.13 2005/07/20 06:12:54 cozman Exp $
|
// $Id: AppCore.cpp,v 1.14 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#include "AppCore.hpp"
|
#include "AppCore.hpp"
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include "GL/glfw.h" //This file depends on glfw
|
#include "GL/glfw.h" //This file depends on glfw
|
||||||
|
|
||||||
|
#include "Application.hpp"
|
||||||
#include "Kernel.hpp"
|
#include "Kernel.hpp"
|
||||||
#include "exceptions.hpp"
|
#include "exceptions.hpp"
|
||||||
#include "video/VideoCore.hpp"
|
#include "video/VideoCore.hpp"
|
||||||
@ -26,19 +27,24 @@ std::vector<KeyCode> AppCore::pressedKeys_;
|
|||||||
AppCore::AppCore() :
|
AppCore::AppCore() :
|
||||||
dispWidth_(0), dispHeight_(0),
|
dispWidth_(0), dispHeight_(0),
|
||||||
task_(new UpdateTask())
|
task_(new UpdateTask())
|
||||||
|
{ }
|
||||||
|
|
||||||
|
AppCore::~AppCore()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppCore::init()
|
||||||
{
|
{
|
||||||
util::VersionInfo glfwReq(2,4,2); // requires GLFW 2.4.2
|
util::VersionInfo glfwReq(2,4,2); // requires GLFW 2.4.2
|
||||||
util::ensureVersion("GLFW", initGLFW(), glfwReq);
|
util::ensureVersion("GLFW", initGLFW(), glfwReq);
|
||||||
|
|
||||||
Kernel::getInstance().addTask(task_); // add updater task
|
Application::getKernel().addTask(task_); // add updater task
|
||||||
}
|
}
|
||||||
|
|
||||||
AppCore::~AppCore()
|
void AppCore::shutdown()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(dispWidth_ && dispHeight_)
|
if(dispWidth_ && dispHeight_)
|
||||||
{
|
{
|
||||||
video::VideoCore::destroy(); // destroy videocore
|
|
||||||
glfwCloseWindow(); //close GLFW window
|
glfwCloseWindow(); //close GLFW window
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,10 +72,9 @@ void AppCore::createDisplay(uint width, uint height,
|
|||||||
glfwSetMousePosCallback(AppCore::mouseMoveCallback);
|
glfwSetMousePosCallback(AppCore::mouseMoveCallback);
|
||||||
//glfwSetMouseWheelCallback(AppCore::mouseWheelCallback);
|
//glfwSetMouseWheelCallback(AppCore::mouseWheelCallback);
|
||||||
|
|
||||||
|
Application::initVideoCore(width, height);
|
||||||
dispWidth_ = width;
|
dispWidth_ = width;
|
||||||
dispHeight_ = height;
|
dispHeight_ = height;
|
||||||
new video::VideoCore; // _MUST_ create the VideoCore after the window!
|
|
||||||
video::VideoCore::getInstance().setDisplaySize(width,height);
|
|
||||||
|
|
||||||
glfwSetWindowTitle(title.c_str()); // title is set separately
|
glfwSetWindowTitle(title.c_str()); // title is set separately
|
||||||
}
|
}
|
||||||
@ -314,7 +319,7 @@ void AppCore::UpdateTask::update()
|
|||||||
( (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT)) &&
|
( (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT)) &&
|
||||||
(glfwGetKey(GLFW_KEY_F4) || glfwGetKey('X')) ) )
|
(glfwGetKey(GLFW_KEY_F4) || glfwGetKey('X')) ) )
|
||||||
{
|
{
|
||||||
Kernel::getInstance().killAllTasks();
|
Application::getKernel().killAllTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold active-state
|
// hold active-state
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Application.cpp,v 1.13 2005/07/19 18:35:20 cozman Exp $
|
// $Id: Application.cpp,v 1.14 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
|
||||||
@ -25,25 +25,84 @@
|
|||||||
namespace photon
|
namespace photon
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Kernel Application::kernel_;
|
||||||
|
AppCore Application::appCore_;
|
||||||
|
std::auto_ptr<video::VideoCore> Application::videoCore_;
|
||||||
|
std::auto_ptr<audio::AudioCore> Application::audioCore_;
|
||||||
|
std::string Application::arg0_;
|
||||||
|
|
||||||
Application::Application() :
|
Application::Application() :
|
||||||
photonVer_(0,0,1) // this is the current version
|
photonVer_(0,0,1) // this is the current version
|
||||||
{
|
{
|
||||||
util::VersionInfo physfsReq(1,0,0); // requires PhysFS 1.0.0
|
util::VersionInfo physfsReq(1,0,0); // requires PhysFS 1.0.0
|
||||||
|
|
||||||
// create the singletons
|
|
||||||
new Kernel;
|
|
||||||
new AppCore;
|
|
||||||
|
|
||||||
util::ensureVersion("PhysFS", initPhysFS(), physfsReq);
|
util::ensureVersion("PhysFS", initPhysFS(), physfsReq);
|
||||||
|
|
||||||
|
appCore_.init(); // init appcore
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
PHYSFS_deinit(); //shutdown PhysFS
|
appCore_.shutdown(); // shutdown appcore
|
||||||
|
|
||||||
// destroy the singletons
|
PHYSFS_deinit(); // shutdown PhysFS
|
||||||
AppCore::destroy();
|
}
|
||||||
Kernel::destroy();
|
|
||||||
|
Kernel& Application::getKernel()
|
||||||
|
{
|
||||||
|
return kernel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppCore& Application::getAppCore()
|
||||||
|
{
|
||||||
|
return appCore_;
|
||||||
|
}
|
||||||
|
|
||||||
|
video::VideoCore& Application::getVideoCore()
|
||||||
|
{
|
||||||
|
// return VideoCore if it has been created
|
||||||
|
if(videoCore_.get() == 0)
|
||||||
|
{
|
||||||
|
throw PreconditionException("call to Application::getVideoCore() before"
|
||||||
|
" Application::initAudioDevice");
|
||||||
|
}
|
||||||
|
return *videoCore_;
|
||||||
|
}
|
||||||
|
|
||||||
|
audio::AudioCore& Application::getAudioCore()
|
||||||
|
{
|
||||||
|
// return AudioCore if it has been created
|
||||||
|
if(audioCore_.get() == 0)
|
||||||
|
{
|
||||||
|
throw PreconditionException("call to Application::getAudioCore() before"
|
||||||
|
" Application::initAudioDevice");
|
||||||
|
}
|
||||||
|
return *audioCore_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::initVideoCore(uint width, uint height)
|
||||||
|
{
|
||||||
|
// create VideoCore, avoid double initializaiton
|
||||||
|
if(videoCore_.get() == 0)
|
||||||
|
{
|
||||||
|
videoCore_.reset(new video::VideoCore(width, height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw PreconditionException("Attempt to double initialize VideoCore");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::initAudioCore(const std::string& deviceName)
|
||||||
|
{
|
||||||
|
// create AudioCore, avoid double initializaiton
|
||||||
|
if(audioCore_.get() == 0)
|
||||||
|
{
|
||||||
|
audioCore_.reset(new audio::AudioCore(deviceName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw PreconditionException("Attempt to double initialize AudioCore");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setInitOptions(const char* arg0)
|
void Application::setInitOptions(const char* arg0)
|
||||||
@ -60,6 +119,4 @@ util::VersionInfo Application::initPhysFS()
|
|||||||
return util::VersionInfo(ver.major, ver.minor, ver.patch);
|
return util::VersionInfo(ver.major, ver.minor, ver.patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Application::arg0_;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: AudioCore.cpp,v 1.10 2005/07/19 18:35:20 cozman Exp $
|
// $Id: AudioCore.cpp,v 1.11 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#ifdef PHOTON_USE_OPENAL
|
#ifdef PHOTON_USE_OPENAL
|
||||||
|
|
||||||
@ -19,6 +19,7 @@ namespace photon
|
|||||||
namespace audio
|
namespace audio
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//AudioCore::AudioCore()
|
||||||
AudioCore::AudioCore(const std::string& deviceName)
|
AudioCore::AudioCore(const std::string& deviceName)
|
||||||
{
|
{
|
||||||
//util::VersionInfo oalReq(0,0,7); // requires OpenAL 1.0 (TODO: check?)
|
//util::VersionInfo oalReq(0,0,7); // requires OpenAL 1.0 (TODO: check?)
|
||||||
@ -147,7 +148,7 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
|
|||||||
|
|
||||||
void AudioCore::initAudioDevice(const std::string& deviceName)
|
void AudioCore::initAudioDevice(const std::string& deviceName)
|
||||||
{
|
{
|
||||||
new AudioCore(deviceName);
|
// new AudioCore(deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,9 +5,10 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Timer.cpp,v 1.3 2005/07/18 06:18:50 cozman Exp $
|
// $Id: Timer.cpp,v 1.4 2005/08/02 23:07:52 cozman Exp $
|
||||||
|
|
||||||
#include "util/Timer.hpp"
|
#include "util/Timer.hpp"
|
||||||
|
#include "Application.hpp"
|
||||||
|
|
||||||
namespace photon
|
namespace photon
|
||||||
{
|
{
|
||||||
@ -15,7 +16,7 @@ namespace util
|
|||||||
{
|
{
|
||||||
|
|
||||||
Timer::Timer(bool appTimeLinked) :
|
Timer::Timer(bool appTimeLinked) :
|
||||||
appCore_(AppCore::getInstance()),
|
appCore_(Application::getAppCore()),
|
||||||
appTimeLinked_(appTimeLinked)
|
appTimeLinked_(appTimeLinked)
|
||||||
{
|
{
|
||||||
reset(); //initializes other members
|
reset(); //initializes other members
|
||||||
|
@ -5,35 +5,36 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: VideoCore.cpp,v 1.8 2005/07/20 06:12:54 cozman Exp $
|
// $Id: VideoCore.cpp,v 1.9 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "video/VideoCore.hpp"
|
#include "video/VideoCore.hpp"
|
||||||
|
|
||||||
|
#include "Application.hpp"
|
||||||
#include "Kernel.hpp"
|
#include "Kernel.hpp"
|
||||||
#include "exceptions.hpp"
|
#include "exceptions.hpp"
|
||||||
|
|
||||||
#include "GL/gl.h"
|
#include "GL/gl.h"
|
||||||
#include "GL/glu.h"
|
#include "GL/glu.h"
|
||||||
#include <iostream>
|
|
||||||
namespace photon
|
namespace photon
|
||||||
{
|
{
|
||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
VideoCore::VideoCore() :
|
VideoCore::VideoCore(uint width, uint height) :
|
||||||
displayWidth_(0), displayHeight_(0),
|
displayWidth_(width), displayHeight_(height),
|
||||||
viewportWidth_(0), viewportHeight_(0)
|
viewportWidth_(0), viewportHeight_(0)
|
||||||
{
|
{
|
||||||
initOpenGL();
|
initOpenGL();
|
||||||
|
setOrthoView();
|
||||||
|
|
||||||
//add updater task
|
//add updater task
|
||||||
Kernel::getInstance().addTask(shared_ptr<Task>(new UpdateTask()));
|
Application::getKernel().addTask(shared_ptr<Task>(new UpdateTask()));
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCore::~VideoCore()
|
VideoCore::~VideoCore()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
void VideoCore::setOrthoView(int x, int y, int viewWidth, int viewHeight,
|
void VideoCore::setOrthoView(int x, int y, int viewWidth, int viewHeight,
|
||||||
scalar orthoWidth, scalar orthoHeight)
|
scalar orthoWidth, scalar orthoHeight)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Audio_test.cpp,v 1.7 2005/07/20 07:30:13 cozman Exp $
|
// $Id: Audio_test.cpp,v 1.8 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -23,7 +23,7 @@ class MainTask : public Task , public InputListener
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600); // setup view
|
video.setOrthoView(800,600); // setup view
|
||||||
|
|
||||||
@ -197,19 +197,16 @@ public:
|
|||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
// create window
|
// create window
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
// create sound device
|
// create sound device
|
||||||
AudioCore::initAudioDevice("OSS");
|
Application::initAudioCore("OSS");
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
// add the main task to the Kernel
|
// add the main task to the Kernel
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
// run Kernel until task finishes
|
// run Kernel until task finishes
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
// destroy AudioCore, shuts down audio system
|
|
||||||
AudioCore::destroy();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class FPSDisplayTask : public photon::Task
|
|||||||
public:
|
public:
|
||||||
FPSDisplayTask() :
|
FPSDisplayTask() :
|
||||||
Task("FPSDisplayTask", 1000000), // extremely low priority
|
Task("FPSDisplayTask", 1000000), // extremely low priority
|
||||||
app(photon::AppCore::getInstance()),
|
app(photon::Application::getAppCore()),
|
||||||
lastUpdate(0)
|
lastUpdate(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Font_test.cpp,v 1.8 2005/07/20 07:30:13 cozman Exp $
|
// $Id: Font_test.cpp,v 1.9 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -17,8 +17,8 @@ class MainTask : public Task
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
app(AppCore::getInstance()),
|
app(Application::getAppCore()),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600);
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
@ -59,13 +59,13 @@ public:
|
|||||||
|
|
||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Image_test.cpp,v 1.7 2005/07/20 06:12:13 cozman Exp $
|
// $Id: Image_test.cpp,v 1.8 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -17,8 +17,8 @@ class MainTask : public Task
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
app(AppCore::getInstance()),
|
app(Application::getAppCore()),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600);
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
@ -68,13 +68,13 @@ public:
|
|||||||
|
|
||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Input_test.cpp,v 1.5 2005/07/20 07:30:13 cozman Exp $
|
// $Id: Input_test.cpp,v 1.6 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -17,8 +17,8 @@ class MainTask : public Task, public InputListener
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
app(AppCore::getInstance()),
|
app(Application::getAppCore()),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600);
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
@ -123,13 +123,13 @@ public:
|
|||||||
|
|
||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Pen_test.cpp,v 1.5 2005/07/20 06:12:13 cozman Exp $
|
// $Id: Pen_test.cpp,v 1.6 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -17,8 +17,8 @@ class MainTask : public Task
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
app(AppCore::getInstance()),
|
app(Application::getAppCore()),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600);
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
@ -83,13 +83,13 @@ public:
|
|||||||
|
|
||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Texture_test.cpp,v 1.6 2005/07/20 06:12:13 cozman Exp $
|
// $Id: Texture_test.cpp,v 1.7 2005/08/02 23:07:53 cozman Exp $
|
||||||
|
|
||||||
#include "photon.hpp"
|
#include "photon.hpp"
|
||||||
using namespace photon;
|
using namespace photon;
|
||||||
@ -17,8 +17,8 @@ class MainTask : public Task
|
|||||||
public:
|
public:
|
||||||
MainTask() :
|
MainTask() :
|
||||||
Task("MainTask"),
|
Task("MainTask"),
|
||||||
app(AppCore::getInstance()),
|
app(Application::getAppCore()),
|
||||||
video(video::VideoCore::getInstance())
|
video(Application::getVideoCore())
|
||||||
{
|
{
|
||||||
video.setOrthoView(800,600);
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
@ -83,13 +83,13 @@ public:
|
|||||||
|
|
||||||
int main(const StrVec& args)
|
int main(const StrVec& args)
|
||||||
{
|
{
|
||||||
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
Application::getAppCore().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
// be sure to add FPSDisplayTask
|
// be sure to add FPSDisplayTask
|
||||||
Kernel::getInstance().addTask(TaskPtr(new FPSDisplayTask()));
|
Application::getKernel().addTask(TaskPtr(new FPSDisplayTask()));
|
||||||
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
Application::getKernel().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
Kernel::getInstance().run();
|
Application::getKernel().run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user