AppCore integrated into Application

This commit is contained in:
James Turk 2005-08-08 07:00:46 +00:00
parent 407ec539e6
commit 2d6fba1784
5 changed files with 40 additions and 68 deletions

View File

@ -1 +0,0 @@

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Application.hpp,v 1.12 2005/08/08 06:50:18 cozman Exp $ // $Id: Application.hpp,v 1.13 2005/08/08 07:00:46 cozman Exp $
#ifndef PHOTON_APPLICATION_HPP #ifndef PHOTON_APPLICATION_HPP
#define PHOTON_APPLICATION_HPP #define PHOTON_APPLICATION_HPP
@ -60,9 +60,8 @@ public:
// Default destructor, shuts down dependencies. // Default destructor, shuts down dependencies.
virtual ~Application(); virtual ~Application();
// Group: Video // Group: Window
public: public:
// Function: createDisplay // Function: createDisplay
// This function attempts to create a display with the given parameters. // This function attempts to create a display with the given parameters.
// //
@ -96,10 +95,38 @@ public:
void createDisplay(uint width, uint height, uint bpp, void createDisplay(uint width, uint height, uint bpp,
uint depthBits, uint stencilBits, bool fullscreen, uint depthBits, uint stencilBits, bool fullscreen,
const std::string& title="Photon App"); const std::string& title="Photon App");
// 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: getDisplayWidth
// Get the width of the display.
//
// Returns:
// Width of display in pixels.
uint getDisplayWidth();
// Function: getDisplayHeight
// Get the height of the display.
//
// Returns:
// Height of display in pixels.
uint getDisplayHeight();
// 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();
// Group: Input // Group: Input
public: public:
// Function: keyPressed // Function: keyPressed
// Check if a given key is currently pressed. // Check if a given key is currently pressed.
// //
@ -151,7 +178,6 @@ public:
// Group: Input Listeners // Group: Input Listeners
public: public:
// Function: addInputListener // Function: addInputListener
// Registers an <InputListener> to listen for any input events so that it // Registers an <InputListener> to listen for any input events so that it
// is notified when they occur. // is notified when they occur.
@ -183,33 +209,7 @@ public:
// Time, represented as a floating-point number in seconds, application has // Time, represented as a floating-point number in seconds, application has
// been running. // been running.
scalar getTime(); scalar getTime();
// Group: General
public:
// 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: 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: isRunning
// Checks if application is running, which means that no quit has been
// requested.
//
// Returns:
// True if application is running, false otherwise.
bool isRunning();
// Function: getElapsedTime // Function: getElapsedTime
// Finds the amount of time passed between frames, useful for time-based // Finds the amount of time passed between frames, useful for time-based
// movement. // movement.
@ -224,7 +224,7 @@ public:
// Returns: // Returns:
// Current frames per second. // Current frames per second.
double getFramerate(); double getFramerate();
// Group: State Management // Group: State Management
public: public:
// Function: setCurrentState // Function: setCurrentState
@ -241,23 +241,6 @@ public:
audio::AudioCore& getAudioCore(); audio::AudioCore& getAudioCore();
void initVideoCore(uint width, uint height); void initVideoCore(uint width, uint height);
void initAudioCore(const std::string& deviceName); void initAudioCore(const std::string& deviceName);
// Group: Accessors
public:
// Function: getDisplayWidth
// Get the width of the display.
//
// Returns:
// Width of display in pixels.
uint getDisplayWidth();
// Function: getDisplayHeight
// Get the height of the display.
//
// Returns:
// Height of display in pixels.
uint getDisplayHeight();
// Group: API Initialization // Group: API Initialization
private: private:
@ -289,7 +272,6 @@ private:
scalar pausedTime_; scalar pausedTime_;
scalar secPerFrame_; scalar secPerFrame_;
scalar lastUpdate_; scalar lastUpdate_;
bool quitRequested_;
}; };
// StateUpdate // StateUpdate
@ -333,7 +315,7 @@ private:
shared_ptr<StateUpdate> stateUpdate_; shared_ptr<StateUpdate> stateUpdate_;
shared_ptr<StateRender> stateRender_; shared_ptr<StateRender> stateRender_;
// input monitoring variables // input system variables
static std::vector<InputListener*> listeners_; static std::vector<InputListener*> listeners_;
static std::vector<KeyCode> pressedKeys_; static std::vector<KeyCode> pressedKeys_;

View File

@ -1 +0,0 @@

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Application.cpp,v 1.16 2005/08/08 06:50:18 cozman Exp $ // $Id: Application.cpp,v 1.17 2005/08/08 07:00:46 cozman Exp $
#include "Application.hpp" #include "Application.hpp"
@ -322,11 +322,6 @@ bool Application::isActive()
return updateTask_->active_; return updateTask_->active_;
} }
bool Application::isRunning()
{
return !updateTask_->quitRequested_;
}
double Application::getElapsedTime() double Application::getElapsedTime()
{ {
return updateTask_->secPerFrame_; return updateTask_->secPerFrame_;
@ -347,6 +342,8 @@ uint Application::getDisplayHeight()
return dispHeight_; return dispHeight_;
} }
// API initialization
util::VersionInfo Application::initPhysFS(const std::string& arg0) util::VersionInfo Application::initPhysFS(const std::string& arg0)
{ {
PHYSFS_Version ver; PHYSFS_Version ver;
@ -367,13 +364,14 @@ util::VersionInfo Application::initGLFW()
return util::VersionInfo(maj,min,patch); return util::VersionInfo(maj,min,patch);
} }
// Application's Tasks
Application::UpdateTask::UpdateTask() : Application::UpdateTask::UpdateTask() :
Task("Application::UpdateTask", PRI_APP_UPDATE), Task("Application::UpdateTask", PRI_APP_UPDATE),
mouseX_(0), mouseY_(0), mouseX_(0), mouseY_(0),
active_(false), timerPaused_(false), active_(false), timerPaused_(false),
unpauseOnActive_(false), lastPause_(0), pausedTime_(0), unpauseOnActive_(false), lastPause_(0), pausedTime_(0),
secPerFrame_(0), lastUpdate_(0), secPerFrame_(0), lastUpdate_(0)
quitRequested_(false)
{ {
} }

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: AudioCore.cpp,v 1.11 2005/08/02 23:07:52 cozman Exp $ // $Id: AudioCore.cpp,v 1.12 2005/08/08 07:00:46 cozman Exp $
#ifdef PHOTON_USE_OPENAL #ifdef PHOTON_USE_OPENAL
@ -146,12 +146,6 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName)
return util::VersionInfo(major,minor,patch); return util::VersionInfo(major,minor,patch);
} }
void AudioCore::initAudioDevice(const std::string& deviceName)
{
// new AudioCore(deviceName);
}
} }
} }