From 2d6fba178441ff300809a58feba07461dc88606a Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 8 Aug 2005 07:00:46 +0000 Subject: [PATCH] AppCore integrated into Application --- include/AppCore.hpp | 1 - include/Application.hpp | 84 ++++++++++++++++------------------------- src/AppCore.cpp | 1 - src/Application.cpp | 14 +++---- src/audio/AudioCore.cpp | 8 +--- 5 files changed, 40 insertions(+), 68 deletions(-) delete mode 100644 include/AppCore.hpp delete mode 100644 src/AppCore.cpp diff --git a/include/AppCore.hpp b/include/AppCore.hpp deleted file mode 100644 index 8b13789..0000000 --- a/include/AppCore.hpp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/include/Application.hpp b/include/Application.hpp index 26a88d0..551fdf1 100644 --- a/include/Application.hpp +++ b/include/Application.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // 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 #define PHOTON_APPLICATION_HPP @@ -60,9 +60,8 @@ public: // Default destructor, shuts down dependencies. virtual ~Application(); -// Group: Video +// Group: Window public: - // Function: createDisplay // This function attempts to create a display with the given parameters. // @@ -96,10 +95,38 @@ public: void createDisplay(uint width, uint height, uint bpp, uint depthBits, uint stencilBits, bool fullscreen, 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 public: - // Function: keyPressed // Check if a given key is currently pressed. // @@ -151,7 +178,6 @@ public: // Group: Input Listeners public: - // Function: addInputListener // Registers an to listen for any input events so that it // is notified when they occur. @@ -183,33 +209,7 @@ public: // Time, represented as a floating-point number in seconds, application has // been running. 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 // Finds the amount of time passed between frames, useful for time-based // movement. @@ -224,7 +224,7 @@ public: // Returns: // Current frames per second. double getFramerate(); - + // Group: State Management public: // Function: setCurrentState @@ -241,23 +241,6 @@ public: audio::AudioCore& getAudioCore(); void initVideoCore(uint width, uint height); 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 private: @@ -289,7 +272,6 @@ private: scalar pausedTime_; scalar secPerFrame_; scalar lastUpdate_; - bool quitRequested_; }; // StateUpdate @@ -333,7 +315,7 @@ private: shared_ptr stateUpdate_; shared_ptr stateRender_; - // input monitoring variables + // input system variables static std::vector listeners_; static std::vector pressedKeys_; diff --git a/src/AppCore.cpp b/src/AppCore.cpp deleted file mode 100644 index 8b13789..0000000 --- a/src/AppCore.cpp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Application.cpp b/src/Application.cpp index 5472b2a..28dc52a 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // 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" @@ -322,11 +322,6 @@ bool Application::isActive() return updateTask_->active_; } -bool Application::isRunning() -{ - return !updateTask_->quitRequested_; -} - double Application::getElapsedTime() { return updateTask_->secPerFrame_; @@ -347,6 +342,8 @@ uint Application::getDisplayHeight() return dispHeight_; } +// API initialization + util::VersionInfo Application::initPhysFS(const std::string& arg0) { PHYSFS_Version ver; @@ -367,13 +364,14 @@ util::VersionInfo Application::initGLFW() return util::VersionInfo(maj,min,patch); } +// Application's Tasks + Application::UpdateTask::UpdateTask() : Task("Application::UpdateTask", PRI_APP_UPDATE), mouseX_(0), mouseY_(0), active_(false), timerPaused_(false), unpauseOnActive_(false), lastPause_(0), pausedTime_(0), - secPerFrame_(0), lastUpdate_(0), - quitRequested_(false) + secPerFrame_(0), lastUpdate_(0) { } diff --git a/src/audio/AudioCore.cpp b/src/audio/AudioCore.cpp index 7885529..51f5eae 100644 --- a/src/audio/AudioCore.cpp +++ b/src/audio/AudioCore.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // 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 @@ -146,12 +146,6 @@ util::VersionInfo AudioCore::initOpenAL(const std::string& deviceName) return util::VersionInfo(major,minor,patch); } -void AudioCore::initAudioDevice(const std::string& deviceName) -{ - // new AudioCore(deviceName); -} - - } }