From a295f8def17036c8071b56e181364f99a377cae7 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 11 Jan 2010 23:52:21 -0700 Subject: [PATCH 01/16] dispatch class not a singleton, engine is static --- src/ErrorHandler.cc | 38 ++++++++--------- src/ErrorHandler.hh | 4 +- src/GameLayer.cc | 28 ++++++------- src/GameLayer.hh | 33 ++++----------- src/GameState.hh | 65 +++++++++++++++++++++++++++++ src/Hud.cc | 4 +- src/Hud.hh | 8 ++-- src/MainLayer.cc | 51 +++++++++++++--------- src/MainLayer.hh | 8 ++-- src/Moof/Dispatch.cc | 7 ---- src/Moof/Dispatch.hh | 3 -- src/Moof/Engine.cc | 38 ++++++++++------- src/Moof/Engine.hh | 12 +++--- src/Moof/{Exception.hh => Error.hh} | 56 ++++++++++++++----------- src/Moof/Layer.hh | 14 +++---- src/Moof/Line.hh | 1 + src/Moof/Sound.cc | 6 +-- src/Moof/Sound.hh | 1 - src/Moof/Texture.cc | 7 ++-- src/Moof/Transition.hh | 20 ++++----- src/Moof/Video.cc | 7 +--- src/Scene.cc | 1 - src/TitleLayer.cc | 12 +++--- src/TitleLayer.hh | 8 ++-- 24 files changed, 243 insertions(+), 189 deletions(-) create mode 100644 src/GameState.hh rename src/Moof/{Exception.hh => Error.hh} (73%) diff --git a/src/ErrorHandler.cc b/src/ErrorHandler.cc index 9c4452c..07bd6d7 100644 --- a/src/ErrorHandler.cc +++ b/src/ErrorHandler.cc @@ -31,59 +31,59 @@ #include "ErrorHandler.hh" -std::string getErrorString(const Mf::Exception& e) +std::string getErrorString(const Mf::Error& error) { std::string str; - switch(e.code()) + switch(error.code()) { - case Mf::ErrorCode::ALC_INIT: + case Mf::Error::ALC_INIT: str += "An error occurred during OpenAL initialization: "; - str += e.what(); + str += error.what(); return str; - case Mf::ErrorCode::FASTEVENTS_INIT: - case Mf::ErrorCode::SDL_INIT: + case Mf::Error::FASTEVENTS_INIT: + case Mf::Error::SDL_INIT: str += "An error occurred during SDL initialization: "; - str += e.what(); + str += error.what(); return str; - case Mf::ErrorCode::FILE_NOT_FOUND: + case Mf::Error::FILE_NOT_FOUND: str += "A required file ("; - str += e.what(); + str += error.what(); str += ") could not be found."; return str; - case Mf::ErrorCode::RESOURCE_NOT_FOUND: + case Mf::Error::RESOURCE_NOT_FOUND: str += "A required resource ("; - str += e.what(); + str += error.what(); str += ") could not be found."; return str; - case Mf::ErrorCode::SCRIPT_ERROR: + case Mf::Error::SCRIPT_ERROR: str += "An error occurred in a script: "; - str == e.what(); + str == error.what(); return str; - case Mf::ErrorCode::SDL_VIDEOMODE: + case Mf::Error::SDL_VIDEOMODE: str += "An error occurred while trying to set up the video mode."; return str; - case Mf::ErrorCode::UNKNOWN_AUDIO_FORMAT: + case Mf::Error::UNKNOWN_AUDIO_FORMAT: str += "An error occurred while trying to load an audio file, "; - str += e.what(); + str += error.what(); str += "."; return str; - case Mf::ErrorCode::UNKNOWN_IMAGE_FORMAT: + case Mf::Error::UNKNOWN_IMAGE_FORMAT: str += "An error occurred while trying to load an image file, "; - str += e.what(); + str += error.what(); str += "."; return str; } std::ostringstream stream; - stream << "An unknown error (code " << e.code() << ") occurred."; + stream << "An unknown error (code " << error.code() << ") occurred."; return stream.str(); } diff --git a/src/ErrorHandler.hh b/src/ErrorHandler.hh index 2b13b1d..8132ac4 100644 --- a/src/ErrorHandler.hh +++ b/src/ErrorHandler.hh @@ -29,10 +29,10 @@ #ifndef _ERRORHANDLER_HH_ #define _ERRORHANDLER_HH_ -#include +#include -std::string getErrorString(const Mf::Exception& e); +std::string getErrorString(const Mf::Error& error); #endif // _ERRORHANDLER_HH_ diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 0ed249c..7a8e98c 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -27,7 +27,7 @@ *******************************************************************************/ #include -#include +#include #include #include #include @@ -35,7 +35,6 @@ #include #include "GameLayer.hh" -#include "Hud.hh" #if HAVE_CONFIG_H #include "config.h" @@ -50,7 +49,7 @@ void GameLayer::loadSceneLoader() std::string loaderPath = Scene::getPath("loader"); if (loaderPath == "") { - throw Mf::Exception(Mf::ErrorCode::RESOURCE_NOT_FOUND, "loader"); + throw Mf::Error(Mf::Error::RESOURCE_NOT_FOUND, "loader"); } Mf::Script::Result status = mState.script.doFile(loaderPath); @@ -59,14 +58,14 @@ void GameLayer::loadSceneLoader() std::string str; mState.script[-1].get(str); - throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, str); + throw Mf::Error(Mf::Error::SCRIPT_ERROR, str); } mState.script.getGlobalTable().pushField("scenes"); mState.script.getTop().get(mState.sceneList); if (mState.sceneList.size() == 0) { - throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, + throw Mf::Error(Mf::Error::SCRIPT_ERROR, "no variable `scenes' within loader"); } } @@ -84,7 +83,7 @@ void GameLayer::advanceScene() std::string str; mState.script[-1].get(str); - throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, str); + throw Mf::Error(Mf::Error::SCRIPT_ERROR, str); } mState.script.getGlobalTable().pushField("Event"); @@ -103,6 +102,7 @@ void GameLayer::advanceScene() GameLayer::GameLayer() : + mHud(Hud::alloc(mState)), mMusic("NightFusionIntro"), mPunchSound("Thump") { @@ -131,9 +131,9 @@ GameLayer::GameLayer() : } -void GameLayer::pushed(Mf::Engine& engine) +void GameLayer::pushedOntoEngine() { - engine.push(Hud::alloc(mState)); + Mf::engine.push(mHud); mRay.direction.set(1.0, 0.0); @@ -147,7 +147,7 @@ void GameLayer::pushed(Mf::Engine& engine) } -void GameLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) +void GameLayer::update(Mf::Scalar t, Mf::Scalar dt) { mState.camera.update(t, dt); mState.heroine->update(t, dt); @@ -200,7 +200,7 @@ void GameLayer::rayTimer() } -void GameLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const +void GameLayer::draw(Mf::Scalar alpha) const { mState.camera.uploadToGL(alpha); @@ -219,7 +219,7 @@ void GameLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const mSphere.draw(); } -bool GameLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) +bool GameLayer::handleEvent(const Mf::Event& event) { switch (event.type) { @@ -259,12 +259,12 @@ bool GameLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - engine.pop(this); + Mf::engine.pop(this); return true; } else if (event.key.keysym.sym == SDLK_h) { - engine.push(Hud::alloc(mState)); + Mf::engine.push(mHud); return true; } return mState.heroine->handleEvent(event); @@ -285,7 +285,7 @@ bool GameLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) void GameLayer::setProjection() { - Mf::VideoP video = Mf::Engine::getInstance().getVideo(); + Mf::VideoP video = Mf::engine.getVideo(); setProjection(video->getWidth(), video->getHeight()); } diff --git a/src/GameLayer.hh b/src/GameLayer.hh index 73b6a23..5361361 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -40,11 +40,8 @@ #include -#include -#include #include #include -#include #include #include @@ -53,9 +50,8 @@ #include #include -#include "Character.hh" -#include "Heroine.hh" -#include "Scene.hh" +#include "Hud.hh" +#include "GameState.hh" class GameLayer; @@ -72,24 +68,11 @@ public: return GameLayerP(new GameLayer); } - void pushed(Mf::Engine& engine); + void pushedOntoEngine(); - void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Engine& engine, Mf::Scalar alpha) const; - bool handleEvent(Mf::Engine& engine, const Mf::Event& event); - - struct State - { - Mf::Script script; - std::vector sceneList; - - HeroineP heroine; - SceneP scene; - - Mf::PolynomialInterpolator<5> interp; - - Mf::Camera camera; - }; + void update(Mf::Scalar t, Mf::Scalar dt); + void draw(Mf::Scalar alpha) const; + bool handleEvent(const Mf::Event& event); private: @@ -101,9 +84,11 @@ private: void setProjection(); void setProjection(Mf::Scalar width, Mf::Scalar height); - State mState; + GameState mState; Mf::Timer mThinkTimer; + HudP mHud; + Mf::SoundStream mMusic; Mf::Sound mPunchSound; diff --git a/src/GameState.hh b/src/GameState.hh new file mode 100644 index 0000000..f69a6b0 --- /dev/null +++ b/src/GameState.hh @@ -0,0 +1,65 @@ + +/******************************************************************************* + + Copyright (c) 2009, Charles McGarvey + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#ifndef _GAMESTATE_HH_ +#define _GAMESTATE_HH_ + +/** + * @file GameState.hh + * The data. + */ + +#include + +#include +#include +#include + +#include "Character.hh" +#include "Heroine.hh" +#include "Scene.hh" + + +struct GameState +{ + Mf::Script script; + std::vector sceneList; + + HeroineP heroine; + SceneP scene; + + Mf::PolynomialInterpolator<5> interp; + + Mf::Camera camera; +}; + + +#endif // _GAMESTATE_HH_ + +/** vim: set ts=4 sw=4 tw=80: *************************************************/ + diff --git a/src/Hud.cc b/src/Hud.cc index 3a178f6..d77bf57 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -118,13 +118,13 @@ void ProgressBar::draw(Mf::Scalar alpha) const } -Hud::Hud(GameLayer::State& state) : +Hud::Hud(GameState& state) : mState(state), mBar1(Tilemap("StatusBars"), 0), mBar2(Tilemap("StatusBars"), 2), mFont("Font") { - Mf::VideoP video = Mf::Engine::getInstance().getVideo(); + Mf::VideoP video = Mf::engine.getVideo(); resize(video->getWidth(), video->getHeight()); } diff --git a/src/Hud.hh b/src/Hud.hh index d3675a4..016767a 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -39,7 +39,7 @@ #include #include -#include "GameLayer.hh" +#include "GameState.hh" #include "Tilemap.hh" @@ -77,9 +77,9 @@ class Hud : public Mf::Layer { public: - Hud(GameLayer::State& state); + Hud(GameState& state); - static HudP alloc(GameLayer::State& state) + static HudP alloc(GameState& state) { return HudP(new Hud(state)); } @@ -106,7 +106,7 @@ public: private: - GameLayer::State& mState; + GameState& mState; ProgressBar mBar1; ProgressBar mBar2; diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 4037736..568f0cd 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -52,12 +52,12 @@ MainLayer::MainLayer() { - mDispatchHandler = Mf::Engine::getInstance().addHandler("video.newcontext", + mDispatchHandler = Mf::engine.addHandler("video.newcontext", boost::bind(&MainLayer::contextRecreated, this)); setupGL(); } -void MainLayer::pushed(Mf::Engine& engine) +void MainLayer::pushedOntoEngine() { //Mf::Scalar coeff[] = {0.0, 1.0}; //Mf::Lerp interp(coeff, 0.25); @@ -67,21 +67,21 @@ void MainLayer::pushed(Mf::Engine& engine) //Mf::Transition::alloc(gameLayer, Mf::LayerP(), interp); //engine->push(transition); //engine->push(GameLayer::alloc()); - engine.push(TitleLayer::alloc()); + Mf::engine.push(TitleLayer::alloc()); } -void MainLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) +void MainLayer::update(Mf::Scalar t, Mf::Scalar dt) { - if (engine.getSize() == 1) + if (Mf::engine.getSize() == 1) { // this is the only layer left on the stack - //engine.push(TitleLayer::alloc()); - engine.clear(); + //Mf::engine.push(TitleLayer::alloc()); + Mf::engine.clear(); } } -void MainLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const +void MainLayer::draw(Mf::Scalar alpha) const { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -92,22 +92,22 @@ void MainLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const glLoadIdentity(); } -bool MainLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) +bool MainLayer::handleEvent(const Mf::Event& event) { switch (event.type) { case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - engine.clear(); + Mf::engine.clear(); } else if (event.key.keysym.sym == SDLK_f) { - engine.getVideo()->toggleFull(); + Mf::engine.getVideo()->toggleFull(); } else if (event.key.keysym.sym == SDLK_l) { - Mf::VideoP video = engine.getVideo(); + Mf::VideoP video = Mf::engine.getVideo(); video->toggleCursorGrab(); video->toggleCursorVisible(); } @@ -118,7 +118,7 @@ bool MainLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) break; case SDL_QUIT: - engine.clear(); + Mf::engine.clear(); break; } @@ -271,6 +271,20 @@ int main(int argc, char* argv[]) atexit(goodbye); + // make sure the engine started up okay + if (Mf::engine.getError().isError()) + { + Mf::ModalDialog dialog; + dialog.title = PACKAGE_STRING; + dialog.text1 = "Fatal Error"; + dialog.text2 = getErrorString(Mf::engine.getError()); + dialog.type = Mf::ModalDialog::CRITICAL; + dialog.run(); + + return 1; + } + + #if YOINK_LOGLEVEL >= 3 Mf::Log::setLevel(Mf::Log::INFO); #elif YOINK_LOGLEVEL >= 2 @@ -325,18 +339,17 @@ int main(int argc, char* argv[]) try { - Mf::Engine& app = Mf::Engine::getInstance(); - app.setVideo(Mf::Video::alloc(PACKAGE_STRING, iconFile)); - app.push(MainLayer::alloc()); + Mf::engine.setVideo(Mf::Video::alloc(PACKAGE_STRING, iconFile)); + Mf::engine.push(MainLayer::alloc()); - app.run(); + Mf::engine.run(); } - catch (const Mf::Exception& e) + catch (const Mf::Error& error) { Mf::ModalDialog dialog; dialog.title = PACKAGE_STRING; dialog.text1 = "Unhandled Exception"; - dialog.text2 = getErrorString(e); + dialog.text2 = getErrorString(error); dialog.type = Mf::ModalDialog::CRITICAL; dialog.run(); diff --git a/src/MainLayer.hh b/src/MainLayer.hh index 731adef..4f0fc77 100644 --- a/src/MainLayer.hh +++ b/src/MainLayer.hh @@ -59,11 +59,11 @@ public: return MainLayerP(new MainLayer); } - void pushed(Mf::Engine& engine); + void pushedOntoEngine(); - void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Engine& engine, Mf::Scalar alpha) const; - bool handleEvent(Mf::Engine& engine, const Mf::Event& event); + void update(Mf::Scalar t, Mf::Scalar dt); + void draw(Mf::Scalar alpha) const; + bool handleEvent(const Mf::Event& event); private: diff --git a/src/Moof/Dispatch.cc b/src/Moof/Dispatch.cc index 8ad29fd..b05ff9c 100644 --- a/src/Moof/Dispatch.cc +++ b/src/Moof/Dispatch.cc @@ -122,13 +122,6 @@ Dispatch::Dispatch() : mImpl(new Dispatch::Impl) {} -Dispatch& Dispatch::getInstance() -{ - static Dispatch dispatch; - return dispatch; -} - - Dispatch::Handler Dispatch::addHandler(const std::string& event, const Function& callback) { diff --git a/src/Moof/Dispatch.hh b/src/Moof/Dispatch.hh index 4483f99..031f77d 100644 --- a/src/Moof/Dispatch.hh +++ b/src/Moof/Dispatch.hh @@ -109,9 +109,6 @@ public: Dispatch(); - // create and/or get a global instance - static Dispatch& getInstance(); - Handler addHandler(const std::string& event, const Function& callback); Handler addHandler(const std::string& event, const Function& callback, Handler handler); diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index 56e98b9..50711c7 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -39,7 +39,6 @@ #include "Engine.hh" #include "Event.hh" -#include "Exception.hh" #include "Log.hh" #include "Math.hh" #include "Settings.hh" @@ -53,8 +52,8 @@ class Engine::Impl { public: - Impl(Engine& engine) : - mInterface(engine), + Impl() : + mError(Error::NONE), mTimestep(0.01), mPrintFps(false) { @@ -67,7 +66,8 @@ public: #endif { const char* error = SDL_GetError(); - throw Exception(ErrorCode::SDL_INIT, error); + mError.init(Error::SDL_INIT, error); + //throw Exception(Error::SDL_INIT, error); } else { @@ -80,7 +80,8 @@ public: if (FE_Init() != 0) { const char* error = FE_GetError(); - throw Exception(ErrorCode::FASTEVENTS_INIT, error); + mError.init(Error::FASTEVENTS_INIT, error); + //throw Exception(Error::FASTEVENTS_INIT, error); } mAlDevice = alcOpenDevice(0); @@ -255,7 +256,7 @@ public: { for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) { - (*mStackIt)->update(mInterface, t, dt); + (*mStackIt)->update(t, dt); } } @@ -265,7 +266,7 @@ public: std::list::reverse_iterator it; for (it = mStack.rbegin(); it != mStack.rend(); ++it) { - (*it)->draw(mInterface, alpha); + (*it)->draw(alpha); } } @@ -273,7 +274,7 @@ public: { for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) { - if ((*mStackIt)->handleEvent(mInterface, event)) break; + if ((*mStackIt)->handleEvent(event)) break; } } @@ -284,7 +285,7 @@ public: mStack.push_front(layer); logInfo << "stack: " << mStack.size() << " [pushed " << layer.get() << "]" << std::endl; - layer->pushed(mInterface); + layer->pushedOntoEngine(); } LayerP pop() @@ -296,7 +297,7 @@ public: mStack.pop_front(); logInfo << "stack: " << mStack.size() << " [popped " << layer.get() << "]" << std::endl; - layer->popped(mInterface); + layer->poppedFromEngine(); if (fixIt) mStackIt = --mStack.begin(); @@ -323,7 +324,7 @@ public: for (it = layers.begin(); it != layers.end(); ++it) { - (*it)->popped(mInterface); + (*it)->poppedFromEngine(); logInfo << "stack: " << mStack.size() << " [popped " << (*it).get() << "]" << std::endl; } @@ -356,7 +357,8 @@ public: } - Engine& mInterface; + Error mError; + VideoP mVideo; Dispatch mDispatch; @@ -376,12 +378,13 @@ public: Engine::Engine() : // pass through - mImpl(new Engine::Impl(*this)) {} + mImpl(new Engine::Impl) {} + -Engine& Engine::getInstance() +const Error& Engine::getError() const { - static Engine engine; - return engine; + // pass through + return mImpl->mError; } @@ -483,6 +486,9 @@ void Engine::dispatch(const std::string& event, } +Engine engine; + + } // namespace Mf /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Engine.hh b/src/Moof/Engine.hh index c5e9986..07e982a 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Engine.hh @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -42,7 +43,7 @@ namespace Mf { /** * The engine is essentially a stack of layers. While running, it updates each * layer from the bottom up every timestep. It also draws each layer from the - * bottom up, adhering to the maximum frame-rate. Events are send to each layer + * bottom up, adhering to the maximum frame-rate. Events are sent to each layer * from the top down until a layer signals the event was handled. The engine is * also responsible for firing timers on time. The engine will continue running * as long as there are layers on the stack. @@ -52,10 +53,10 @@ class Engine { public: + Engine(); ~Engine() {} - // get global instance - static Engine& getInstance(); + const Error& getError() const; // setting the video is required before you can run the engine and should // probably be done before adding any layers @@ -90,13 +91,14 @@ public: private: - Engine(); // use getInstance() to access the engine - class Impl; boost::shared_ptr mImpl; }; +extern Engine engine; + + } // namespace Mf #endif // _MOOF_ENGINE_HH_ diff --git a/src/Moof/Exception.hh b/src/Moof/Error.hh similarity index 73% rename from src/Moof/Exception.hh rename to src/Moof/Error.hh index 8300746..6dab32f 100644 --- a/src/Moof/Exception.hh +++ b/src/Moof/Error.hh @@ -26,30 +26,47 @@ *******************************************************************************/ -#ifndef _MOOF_EXCEPTION_HH_ -#define _MOOF_EXCEPTION_HH_ +#ifndef _MOOF_ERROR_HH_ +#define _MOOF_ERROR_HH_ -#include +#include // strncpy #include #include -#include - namespace Mf { -class Exception : public std::exception +class Error : public std::exception { public: - explicit Exception(unsigned code, const std::string& what = "") + enum Code + { + NONE = 0, + ALC_INIT, // description + FASTEVENTS_INIT, // description + FILE_NOT_FOUND, // path of missing file + RESOURCE_NOT_FOUND, // name of missing resource + SCRIPT_ERROR, // description + SDL_INIT, // description + SDL_VIDEOMODE, // - + UNKNOWN_AUDIO_FORMAT, // name of resource + UNKNOWN_IMAGE_FORMAT, // name of resource + }; + + explicit Error(unsigned code, const std::string& what = "") + { + init(code, what); + } + virtual ~Error() throw() {} + + void init(unsigned code, const std::string& what = "") { mWhat[sizeof(mWhat)-1] = '\0'; strncpy(mWhat, what.c_str(), sizeof(mWhat)-1); mCode = code; } - virtual ~Exception() throw() {} virtual void raise() { @@ -66,32 +83,21 @@ public: return mWhat; } + bool isError() const throw() + { + return mCode != NONE; + } + private: unsigned mCode; char mWhat[1024]; }; -namespace ErrorCode { -enum Code -{ - NONE = 0, - ALC_INIT, // description - FASTEVENTS_INIT, // description - FILE_NOT_FOUND, // path of missing file - RESOURCE_NOT_FOUND, // name of missing resource - SCRIPT_ERROR, // description - SDL_INIT, // description - SDL_VIDEOMODE, // - - UNKNOWN_AUDIO_FORMAT, // name of resource - UNKNOWN_IMAGE_FORMAT, // name of resource -}; -} // namespace ErrorCode - } // namespace Mf -#endif // _MOOF_EXCEPTION_HH_ +#endif // _MOOF_ERROR_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Layer.hh b/src/Moof/Layer.hh index 9ba4288..01a4145 100644 --- a/src/Moof/Layer.hh +++ b/src/Moof/Layer.hh @@ -38,22 +38,18 @@ namespace Mf { -// forward declaration -class Engine; - - class Layer { public: virtual ~Layer() {} - virtual void pushed(Engine& engine) {} - virtual void popped(Engine& engine) {} + virtual void pushedOntoEngine() {} + virtual void poppedFromEngine() {} - virtual void update(Engine& engine, Scalar t, Scalar dt) {} - virtual void draw(Engine& engine, Scalar alpha) const {} - virtual bool handleEvent(Engine& engine, const Event& event) + virtual void update(Scalar t, Scalar dt) {} + virtual void draw(Scalar alpha) const {} + virtual bool handleEvent(const Event& event) { return false; } diff --git a/src/Moof/Line.hh b/src/Moof/Line.hh index a88405e..0747e28 100644 --- a/src/Moof/Line.hh +++ b/src/Moof/Line.hh @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index b91158a..f9bdfd7 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -36,7 +36,6 @@ #include #include "Engine.hh" -#include "Exception.hh" #include "Library.hh" #include "Log.hh" #include "Sound.hh" @@ -99,7 +98,7 @@ public: { logWarning << "error while loading sound " << getName() << std::endl; - throw Exception(ErrorCode::UNKNOWN_AUDIO_FORMAT, getName()); + throw Error(Error::UNKNOWN_AUDIO_FORMAT, getName()); } vorbis_info* vorbisInfo = ov_info(&mOggStream, -1); @@ -207,9 +206,6 @@ public: void init() { - // make sure the engine is initialized - Engine::getInstance(); - mIsLoaded = false; mIsPlaying = false; mIsLooping = false; diff --git a/src/Moof/Sound.hh b/src/Moof/Sound.hh index 6e5f78a..14cd790 100644 --- a/src/Moof/Sound.hh +++ b/src/Moof/Sound.hh @@ -36,7 +36,6 @@ #include -#include #include #include diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 22d3f15..6769d88 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -33,7 +33,7 @@ #include "Dispatch.hh" #include "Engine.hh" -#include "Exception.hh" +#include "Error.hh" #include "Image.hh" #include "Library.hh" #include "Log.hh" @@ -121,8 +121,7 @@ public: mWrapT(GL_CLAMP), mObject(0) { - // make sure the engine is initialized - Engine& engine = Engine::getInstance(); + // make sure we have a video VideoP video = engine.getVideo(); ASSERT(video && "cannot load textures without a current video context"); @@ -220,7 +219,7 @@ public: if (!mImage.isValid()) { logWarning << "texture not found: " << getName() << std::endl; - throw Exception(ErrorCode::RESOURCE_NOT_FOUND, getName()); + throw Error(Error::RESOURCE_NOT_FOUND, getName()); } mImage.flip(); diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh index 5f8a248..f200729 100644 --- a/src/Moof/Transition.hh +++ b/src/Moof/Transition.hh @@ -66,17 +66,17 @@ public: } - void popped(Engine& engine) + void poppedFromEngine() { if (mTo) engine.push(mTo); } - void update(Engine& engine, Scalar t, Scalar dt) + void update(Scalar t, Scalar dt) { mInterp.update(t, dt); - if (mFrom) mFrom->update(engine, t, dt); - if (mTo) mTo->update(engine, t, dt); + if (mFrom) mFrom->update(t, dt); + if (mTo) mTo->update(t, dt); if (mInterp.isDone()) { @@ -118,7 +118,7 @@ public: glPopMatrix(); } - void draw(Engine& engine, Scalar alpha) const + void draw(Scalar alpha) const { Scalar a = mInterp.getState(alpha); logInfo << "transition state: " << a << std::endl; @@ -130,7 +130,7 @@ public: glPushMatrix(); glLoadIdentity(); glRotate(180.0 * a, 0.0, 1.0, 0.0); - mFrom->draw(engine, alpha); + mFrom->draw(alpha); glPopMatrix(); } //drawFade(a); @@ -140,21 +140,21 @@ public: glPushMatrix(); glLoadIdentity(); glRotate(180.0 * (1.0 - a), 0.0, 1.0, 0.0); - mTo->draw(engine, alpha); + mTo->draw(alpha); glPopMatrix(); } //drawFade(1.0 - a); } - bool handleEvent(Engine& engine, const Event& event) + bool handleEvent(const Event& event) { if (mTo) { - return mTo->handleEvent(engine, event); + return mTo->handleEvent(event); } else if (mFrom) { - return mFrom->handleEvent(engine, event); + return mFrom->handleEvent(event); } return false; } diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index e4579fb..8dab056 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -28,7 +28,7 @@ #include "Dispatch.hh" #include "Engine.hh" -#include "Exception.hh" +#include "Error.hh" #include "Image.hh" #include "Log.hh" #include "Settings.hh" @@ -64,9 +64,6 @@ Video::Video(const std::string& caption, const std::string& icon) void Video::init(const Attributes& attribs) { - // make sure the engine is initialized before setting up the video - Engine::getInstance(); - mContext = 0; mFlags = 0; mAttribs = attribs; @@ -140,7 +137,7 @@ void Video::setVideoMode(const long mode[3]) logInfo("video context recreated"); #endif } - else throw Exception(ErrorCode::SDL_VIDEOMODE); + else throw Error(Error::SDL_VIDEOMODE); } } diff --git a/src/Scene.cc b/src/Scene.cc index 43bdf02..175f216 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/src/TitleLayer.cc b/src/TitleLayer.cc index f5e4ef0..ed8f4c1 100644 --- a/src/TitleLayer.cc +++ b/src/TitleLayer.cc @@ -34,7 +34,7 @@ #include "TitleLayer.hh" -void TitleLayer::pushed(Mf::Engine& engine) +void TitleLayer::pushedOntoEngine() { Mf::Scalar coeff[] = {0.0, 1.0}; mFadeIn.init(coeff, 0.1); @@ -42,18 +42,18 @@ void TitleLayer::pushed(Mf::Engine& engine) mGameLayer = GameLayer::alloc(); } -void TitleLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) +void TitleLayer::update(Mf::Scalar t, Mf::Scalar dt) { if (!mFadeIn.isDone()) mFadeIn.update(t, dt); } -void TitleLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const +void TitleLayer::draw(Mf::Scalar alpha) const { glClearColor(0.0, 0.0, mFadeIn.getState(alpha), 1.0); glClear(GL_COLOR_BUFFER_BIT); } -bool TitleLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) +bool TitleLayer::handleEvent(const Mf::Event& event) { switch (event.type) { @@ -63,7 +63,7 @@ bool TitleLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) //break; //} - Mf::LayerP titleLayer = engine.pop(this); + Mf::LayerP titleLayer = Mf::engine.pop(this); //engine.pushLayer(GameLayer::alloc()); Mf::Scalar coeff[] = {0.0, 0.75, 0.99, 1.0}; @@ -72,7 +72,7 @@ bool TitleLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) //Mf::LayerP mGameLayer = GameLayer::alloc(); Mf::Transition >::Ptr transition = Mf::Transition >::alloc(mGameLayer, titleLayer, interp); - engine.push(transition); + Mf::engine.push(transition); return true; } diff --git a/src/TitleLayer.hh b/src/TitleLayer.hh index a781c93..20f42a7 100644 --- a/src/TitleLayer.hh +++ b/src/TitleLayer.hh @@ -48,11 +48,11 @@ public: return TitleLayerP(new TitleLayer); } - void pushed(Mf::Engine& engine); + void pushedOntoEngine(); - void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Engine& engine, Mf::Scalar alpha) const; - bool handleEvent(Mf::Engine& engine, const Mf::Event& event); + void update(Mf::Scalar t, Mf::Scalar dt); + void draw(Mf::Scalar alpha) const; + bool handleEvent(const Mf::Event& event); private: -- 2.44.0 From 4f62ce947db282f0bbf4d49b3aafb83d7cf51adc Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 13 Jan 2010 16:36:57 -0700 Subject: [PATCH 02/16] finally fixed broken main loop --- data/scenes/Classic.lua | 2 +- data/yoinkrc | 72 +++++++++-------- doc/yoink.6.in | 20 ++--- src/Character.cc | 8 +- src/ErrorHandler.cc | 5 ++ src/GameLayer.cc | 12 +-- src/Heroine.cc | 2 +- src/MainLayer.cc | 21 +++-- src/Moof/Engine.cc | 168 ++++++++++++++++------------------------ src/Moof/Engine.hh | 13 ++-- src/Moof/Error.hh | 4 +- src/Moof/Log.cc | 2 +- src/Moof/Settings.hh | 6 +- src/Moof/Timer.cc | 5 ++ src/Moof/Timer.hh | 1 + src/Moof/Video.cc | 34 ++++++-- 16 files changed, 192 insertions(+), 183 deletions(-) diff --git a/data/scenes/Classic.lua b/data/scenes/Classic.lua index 5709632..2ec9e02 100644 --- a/data/scenes/Classic.lua +++ b/data/scenes/Classic.lua @@ -757,7 +757,7 @@ DrawTilemap({ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ResetTransform() -Translate(-0.32, -0.28, -27) +Translate(-0.3, -0.3, -35) Scale(105, 52, 1) SetTexture("BackgroundFar") DrawTile() diff --git a/data/yoinkrc b/data/yoinkrc index 79fa707..d7f97cc 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -7,63 +7,67 @@ print "loading default settings..." -- Set the level of detail to use when drawing scenes. This can be 1, 2 or -- 3, where 1 shows the least amount of detail and 3 draws the scene with --- the most detail. +-- the most detail. Lower levels of detail may improve performance on +-- slower machines. detail = 3 --- Set the number of times each second the physics state will be updated. A --- value of 100 or higher is ideal for accurate physics approximations. Values --- that are much lower cause the CPU to do less work, but accuracy will suffer. --- Errors could be introduced in the game with extremely low values. +-- Set the number of times each second the physics state will be updated. +-- The quality of the physics simulation will increase as you increase this +-- value, but the processor will be taxed more. Errors could be introduced +-- in the game with extremely low values. timestep = 80 --- Set the maximum number of frames that can be drawn per second. A value --- of 50 is pretty good. If your computer is really old, you can get away --- with decreasing this value and still have reasonably smooth animation. --- You can set this to a very high number to effectively render as many --- frames as is possible, but the actual rate could be limited by vertical --- display synchronization, depending on the X11 driver and settings used. --- You should not set this option higher than the point where the vertical --- synchronization effectively limits the draw rate or else the game may --- not be able to update the physics on schedule which could actually --- significantly lower the quality of the animation. +-- Set the target number of frames that should be drawn per second. The +-- smoothness of the animation increases as you increase this value. You +-- probably want to set this somewhere in the 25-85 range, depending on how +-- much work you want your computer to do. For example, if you're on +-- battery power, you might prefer 25 which is still reasonably smooth and +-- will decrease battery drain significantly. You can also set this to a +-- very high number to effectively draw as many frames as possible, but +-- your actual framerate might be limited by the refresh rate of your +-- display--use the swapcontrol setting to enable or disable this behavior. +-- You can determine your actual framerate with the showfps option. -maxfps = timestep / 2 +framerate = 50 --- Set whether or not to print the current actual framerate to the console. +-- Set this to print the current actual framerate to the console each +-- second. -printfps = false +showfps = true --- Set whether or not the game will run in full-screen mode. If false, the --- game will run in a window. +-- Set this to run the game in full-screen mode. The default behavior is +-- to run the game in a window. -fullscreen = false +fullscreen = true --- If the game is running in a window, set whether or not the window will --- be resizable. +-- If the game is running in a window, set this to also make the window +-- resizable. This has no effective if the fullscreen option is true. resizable = true --- Set the resolution or size of the window. The value is an array with --- three number elements representing the width, height, and bits per pixel --- that make up the video mode. A typical value is 800,600 for a size of --- 800x600 pixels with millions of colors (the third number is optional). +-- Set the screen resolution or size of the window. The value is an array +-- with three number elements representing the width, height, and bits per +-- pixel that make up the video mode. If the fullscreen option is set, the +-- default behavior is to pick a native resolution. Otherwise, the game +-- window will default to 800x600. -videomode = {800, 600} +--videomode = {800, 600} --- Set whether or not the cursor will be visible when you mouse over the --- display of the game. +-- Set this to make the cursor remain visible as you mouse over the view of +-- the game. showcursor = true --- Set whether or not the drawing should use two buffers. This results in --- a higher quality animation. You should usually leave this as true. +-- Set this to use double-buffering to improve animation quality. You +-- should usually leave this as true. doublebuffer = true --- Set whether or not to sync with the display in order to reduce --- distortion. +-- Set this to sync with the refresh rate of your display. Your framerate +-- will be limited to the refresh rate, but you may experience fewer ugly +-- "artifacts" caused by the game animation. swapcontrol = true diff --git a/doc/yoink.6.in b/doc/yoink.6.in index fd00dad..ce90f1d 100644 --- a/doc/yoink.6.in +++ b/doc/yoink.6.in @@ -104,12 +104,7 @@ If true, double-buffering will be used to help minimize distortion and artifacts caused by the animation of the game. Otherwise, a single buffer will be used. The default value is true. .TP -.B fullscreen -If true, the window will capture the display and render the game in full -screen splendor. A value of false means the game will run in a window. -The default value is false. -.TP -.B maxfps +.B framerate The maximum number of frames to be drawn per second. If your computer is really old, you can get away with decreasing this value and still have reasonably smooth animation. You can set this to a very high number to @@ -121,9 +116,14 @@ the game may not be able to update the physics on schedule which could actually significantly lower the quality of the animation. The default value is 40. .TP -.B printfps +.B fullscreen +If true, the window will capture the display and render the game in full +screen splendor. A value of false means the game will run in a window. +The default value is false. +.TP +.B showfps If true, the current number of frames being drawn per second will be -printed to the console. The default value is false. +printed to the console every second. The default value is false. .TP .B resizable If true, the window will be resizable by the window manager. This option @@ -150,7 +150,7 @@ need to. .SH EXAMPLES Here are some examples of typical usage: .TP -$ yoink maxfps=60 +$ yoink framerate=60 Cap the allowable frame-rate to 60Hz. .TP $ yoink fullscreen=true @@ -201,7 +201,7 @@ Use the \fBdetail\fP option. The game world may look sparse or incomplete, but that's probably better than choppy animation. .TP 3. Decrease the timestep. -You can set the \fBtimestep\fP to be as low as the your \fBmaxfps\fP +You can set the \fBtimestep\fP to be as low as the your \fBframerate\fP option. Remember the trade-off here is decreased simulation accuracy. .PP If you are having audio problems, you may need to upgrade OpenAL. Some diff --git a/src/Character.cc b/src/Character.cc index 52a13e6..9da4344 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -43,7 +43,7 @@ public: { Mf::Vector2 x = state.position - location; Mf::Scalar mag = x.length(); - Mf::Scalar d = 50.0; + Mf::Scalar d = 0.0; // spring: //mState.force += -15.0 * x - 1.5 * mState.velocity; @@ -79,7 +79,7 @@ private: Character::Character(const std::string& name) : - tilemap("Particles"), + tilemap(name), animation(name) { mState.init(); @@ -89,9 +89,9 @@ Character::Character(const std::string& name) : // forces mState.force = Mf::Vector2(0.0, 0.0); - //mState.forces.push_back(SpringForce(Mf::Vector2(500.0, 200.0))); + //mState.forces.push_back(SpringForce(Mf::Vector2(20.0, 4.0))); mState.forces.push_back(ResistanceForce(2.0)); - //mState.forces.push_back(Mf::LinearState<2>::GravityForce(-400.0)); + //mState.forces.push_back(Mf::LinearState<2>::GravityForce(-9.8)); // starting position mState.position = Mf::Vector2(5.0, 5.0); diff --git a/src/ErrorHandler.cc b/src/ErrorHandler.cc index 07bd6d7..8d0a8d9 100644 --- a/src/ErrorHandler.cc +++ b/src/ErrorHandler.cc @@ -54,6 +54,11 @@ std::string getErrorString(const Mf::Error& error) str += ") could not be found."; return str; + case Mf::Error::OPENAL_INIT: + str += "The audio library returned an error: "; + str += error.what(); + return str; + case Mf::Error::RESOURCE_NOT_FOUND: str += "A required resource ("; str += error.what(); diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 7a8e98c..46c3263 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -122,7 +122,7 @@ GameLayer::GameLayer() : 0.1, Mf::Timer::REPEAT); mState.heroine = Heroine::alloc(); - mState.heroine->animation.startSequence("GreenDiamond"); + mState.heroine->animation.startSequence("FlyDiagonallyUp"); Mf::Scalar a[6] = {0.0, 1.5, -0.5, 3.0, -2.0, 1.0}; mState.interp.init(a, 5.0, Mf::Interpolator::OSCILLATE); @@ -155,7 +155,7 @@ void GameLayer::update(Mf::Scalar t, Mf::Scalar dt) mState.scene->checkForCollision(*mState.heroine); mState.camera.setPosition(Mf::Vector3(-mState.heroine->getState().position[0], - -mState.heroine->getState().position[1], -6)); + -mState.heroine->getState().position[1], -8)); //mState.camera.lookAt(Mf::promote(mState.heroine->getState().position)); mRay.point = mState.heroine->getState().position; @@ -193,9 +193,9 @@ void GameLayer::rayTimer() { hits.front().normal.normalize(); mRay.solve(point, hits.front().distance); - Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; - Mf::logInfo << " P = " << point << std::endl; - Mf::logInfo << " n = " << hits.front().normal << std::endl; + //Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; + //Mf::logInfo << " P = " << point << std::endl; + //Mf::logInfo << " n = " << hits.front().normal << std::endl; } } @@ -291,7 +291,7 @@ void GameLayer::setProjection() void GameLayer::setProjection(Mf::Scalar width, Mf::Scalar height) { - mState.camera.setProjection(cml::rad(60.0), width / height, 1.0, 200.0); + mState.camera.setProjection(cml::rad(45.0), width / height, 1.0, 200.0); } diff --git a/src/Heroine.cc b/src/Heroine.cc index 5df1031..a70b798 100644 --- a/src/Heroine.cc +++ b/src/Heroine.cc @@ -33,7 +33,7 @@ Heroine::Heroine() : - Character("Effects") {} + Character("Heroine") {} void Heroine::update(Mf::Scalar t, Mf::Scalar dt) diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 568f0cd..5f097ea 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -142,11 +142,13 @@ void MainLayer::setupGL() glClearColor(0.0, 0.0, 0.0, 1.0); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(60.0, 1.33333, 1.0, 2500.0); + //glMatrixMode(GL_PROJECTION); + //glLoadIdentity(); + //Mf::Scalar ratio = Mf::engine.getVideo()->getWidth() / + //Mf::engine.getVideo()->getHeight(); + //gluPerspective(60.0, ratio, 1.0, 250.0); - glMatrixMode(GL_MODELVIEW); + //glMatrixMode(GL_MODELVIEW); } void MainLayer::contextRecreated() @@ -272,16 +274,18 @@ int main(int argc, char* argv[]) // make sure the engine started up okay - if (Mf::engine.getError().isError()) + const Mf::Error& error = Mf::engine.getError(); + if (error.isError()) { Mf::ModalDialog dialog; dialog.title = PACKAGE_STRING; - dialog.text1 = "Fatal Error"; - dialog.text2 = getErrorString(Mf::engine.getError()); + dialog.text1 = "Uh oh!"; + dialog.text2 = getErrorString(error); dialog.type = Mf::ModalDialog::CRITICAL; dialog.run(); - return 1; + // openal errors are not fatal + if (error.code() != Mf::Error::OPENAL_INIT) return 1; } @@ -333,6 +337,7 @@ int main(int argc, char* argv[]) Mf::Settings& settings = Mf::Settings::getInstance(); settings.loadFromFile(configFiles); settings.parseArgs(argc, argv); + Mf::engine.initWithSettings(settings); std::string iconFile = Mf::Resource::getPath(PACKAGE".png"); diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index 50711c7..5d703da 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -55,10 +55,9 @@ public: Impl() : mError(Error::NONE), mTimestep(0.01), - mPrintFps(false) + mFramerate(0.02), + mShowFps(false) { - // first, initialize the libraries - #if defined(_WIN32) || defined(__WIN32__) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) #else @@ -67,21 +66,21 @@ public: { const char* error = SDL_GetError(); mError.init(Error::SDL_INIT, error); - //throw Exception(Error::SDL_INIT, error); + return; // fatal } else { - char vdName[128]; - SDL_VideoDriverName(vdName, sizeof(vdName)); + char name[128]; + SDL_VideoDriverName(name, sizeof(name)); logInfo << "initialized SDL; using video driver `" - << vdName << "'" << std::endl; + << name << "'" << std::endl; } if (FE_Init() != 0) { const char* error = FE_GetError(); mError.init(Error::FASTEVENTS_INIT, error); - //throw Exception(Error::FASTEVENTS_INIT, error); + return; // fatal } mAlDevice = alcOpenDevice(0); @@ -89,8 +88,7 @@ public: if (!mAlDevice || !mAlContext) { const char* error = alcGetString(mAlDevice,alcGetError(mAlDevice)); - logError << "error while creating audio context: " - << error << std::endl; + mError.init(Error::OPENAL_INIT, error); } else { @@ -99,11 +97,10 @@ public: << alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) << "'" << std::endl; } + } - // now load the settings the engine needs - - Settings& settings = Settings::getInstance(); - + bool initWithSettings(const Settings& settings) + { unsigned randomSeed; if (settings.get("rngseed", randomSeed)) srand(randomSeed); else srand(time(0)); @@ -112,12 +109,15 @@ public: settings.get("timestep", timestep); mTimestep = 1.0 / timestep; - Scalar maxFps = 40.0; - settings.get("maxfps", maxFps); - mMaxFps = 1.0 / maxFps; + Scalar framerate = 40.0; + settings.get("framerate", framerate); + mFramerate = 1.0 / framerate; capFps(); - settings.get("printfps", mPrintFps); + mShowFps = false; + settings.get("showfps", mShowFps); + + return true; } ~Impl() @@ -143,81 +143,55 @@ public: void run() { - Scalar ticksNow = Timer::getTicks(); - - Scalar nextStep = ticksNow; - Scalar nextDraw = ticksNow; - Scalar nextFpsUpdate = ticksNow + 1.0; - Scalar totalTime = 0.0; - Scalar deltaTime = 0.0; - Scalar accumulator = mTimestep; + Scalar ticks = Timer::getTicks(); + + Scalar nextUpdate = ticks; + Scalar nextDraw = ticks; + Scalar nextSecond = ticks + SCALAR(1.0); mFps = 0; - int frameAccum = 0; + int frames = 0; + + const int MAX_FRAMESKIP = 15; + const Scalar inverseTimestep = SCALAR(1.0) / mTimestep; do { - Scalar newTicks = Timer::getTicks(); - deltaTime = newTicks - ticksNow; - ticksNow = newTicks; - - // don't slow the animation until 4Hz, which is unplayable anyway - if (deltaTime >= 0.25) deltaTime = 0.25; - accumulator += deltaTime; - - Timer::fireIfExpired(ticksNow); + Timer::fireIfExpired(); dispatchEvents(); - while (accumulator >= mTimestep) + int i = 0; + while (nextUpdate < Timer::getTicks() && i < MAX_FRAMESKIP) { - update(totalTime, mTimestep); - totalTime += mTimestep; - accumulator -= mTimestep; + update(totalTime, mTimestep); - nextStep += mTimestep; - } - if (ticksNow >= nextStep) - { - nextStep = ticksNow + mTimestep; + nextUpdate += mTimestep; + ++i; } - if (ticksNow >= nextDraw) + if (nextDraw < (ticks = Timer::getTicks())) { - frameAccum++; + ++frames; + draw((ticks + mTimestep - nextUpdate) * inverseTimestep); + mVideo->swap(); - if (ticksNow >= nextFpsUpdate) // determine the actual fps - { - mFps = frameAccum; - frameAccum = 0; + nextDraw += mFramerate; - nextFpsUpdate += 1.0; - if (ticksNow >= nextFpsUpdate) - { - nextFpsUpdate = ticksNow + 1.0; - } - - if (mPrintFps) - { - logInfo << mFps << " fps" << std::endl; - } - } + if (mShowFps && nextSecond < ticks) + { + mFps = frames; + frames = 0; - draw(accumulator / mTimestep); - mVideo->swap(); + logInfo << mFps << " fps" << std::endl; - nextDraw += mMaxFps; - if (ticksNow >= nextDraw) - { - // we missed some scheduled draws, so reset the schedule - nextDraw = ticksNow + mMaxFps; + nextSecond += SCALAR(1.0); } } // be a good citizen and give back what you don't need - Timer::sleep(std::min(std::min(nextStep, nextDraw), - Timer::getNextFire()), Timer::ACTUAL); + Timer::sleep(0.0); } while (!mStack.empty()); @@ -348,12 +322,12 @@ public: void capFps() { - if (mMaxFps < mTimestep) - { - logWarning << "capping maximum fps to timestep (" - << mTimestep << ")" << std::endl; - mMaxFps = mTimestep; - } + //if (mFramerate < mTimestep) + //{ + //logWarning << "capping maximum fps to timestep (" + //<< mTimestep << ")" << std::endl; + //mFramerate = mTimestep; + //} } @@ -369,10 +343,10 @@ public: std::list::iterator mStackIt; Scalar mTimestep; - Scalar mMaxFps; + Scalar mFramerate; int mFps; - bool mPrintFps; + bool mShowFps; }; @@ -381,46 +355,34 @@ Engine::Engine() : mImpl(new Engine::Impl) {} -const Error& Engine::getError() const +bool Engine::initWithSettings(const Settings& settings) { // pass through - return mImpl->mError; + return mImpl->initWithSettings(settings); } - -void Engine::setVideo(VideoP video) +const Error& Engine::getError() const { // pass through - mImpl->mVideo = video; -} - -VideoP Engine::getVideo() const -{ - return mImpl->mVideo; -} - - -void Engine::setTimestep(int ts) -{ - mImpl->mTimestep = 1.0 / Scalar(ts); - mImpl->capFps(); + return mImpl->mError; } -int Engine::getTimestep() const +void Engine::clearError() { - return int(1.0 / mImpl->mTimestep); + // pass through + mImpl->mError.init(Error::NONE); } -void Engine::setMaxFps(int maxFps) +void Engine::setVideo(VideoP video) { - mImpl->mMaxFps = 1.0 / Scalar(maxFps); - mImpl->capFps(); + // pass through + mImpl->mVideo = video; } -int Engine::getMaxFps() const +VideoP Engine::getVideo() const { - return int(1.0 / mImpl->mMaxFps); + return mImpl->mVideo; } diff --git a/src/Moof/Engine.hh b/src/Moof/Engine.hh index 07e982a..28d7fa0 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Engine.hh @@ -40,6 +40,9 @@ namespace Mf { +class Settings; + + /** * The engine is essentially a stack of layers. While running, it updates each * layer from the bottom up every timestep. It also draws each layer from the @@ -55,20 +58,18 @@ public: Engine(); ~Engine() {} + + // loads settings: rngseed, timestep, framerate, showfps + bool initWithSettings(const Settings& settings); const Error& getError() const; + void clearError(); // setting the video is required before you can run the engine and should // probably be done before adding any layers void setVideo(VideoP video); VideoP getVideo() const; - void setTimestep(int ts); - int getTimestep() const; - - void setMaxFps(int maxFps); // draw rate is always capped at the timestep - int getMaxFps() const; - int getFps() const; void push(LayerP layer); // push a layer onto the top diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh index 6dab32f..86b8a12 100644 --- a/src/Moof/Error.hh +++ b/src/Moof/Error.hh @@ -43,9 +43,11 @@ public: enum Code { - NONE = 0, + UNINITIALIZED = -1, // - + NONE = 0, // - ALC_INIT, // description FASTEVENTS_INIT, // description + OPENAL_INIT, // description FILE_NOT_FOUND, // path of missing file RESOURCE_NOT_FOUND, // name of missing resource SCRIPT_ERROR, // description diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc index 9809771..3094642 100644 --- a/src/Moof/Log.cc +++ b/src/Moof/Log.cc @@ -35,7 +35,7 @@ namespace Mf { -Log::Level Log::gLevel = Log::WARNING; +Log::Level Log::gLevel = Log::INFO; void Log::setLevel(Level level) diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index d31b57d..6cd8629 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -72,18 +72,18 @@ public: void save() const; template - bool get(const std::string& key, T& value); + bool get(const std::string& key, T& value) const; private: - Script mScript; + mutable Script mScript; std::string mUserFile; }; template -bool Settings::get(const std::string& key, T& value) +bool Settings::get(const std::string& key, T& value) const { Script::Slot top = mScript[-1]; Script::Slot globals = mScript.getGlobalTable(); diff --git a/src/Moof/Timer.cc b/src/Moof/Timer.cc index b428f0a..69d2405 100644 --- a/src/Moof/Timer.cc +++ b/src/Moof/Timer.cc @@ -152,6 +152,11 @@ bool Timer::isRepeating() const } +void Timer::fireIfExpired() +{ + fireIfExpired(getTicks()); +} + void Timer::fireIfExpired(Scalar t) { std::map::iterator it; diff --git a/src/Moof/Timer.hh b/src/Moof/Timer.hh index b657a5f..246b4b1 100644 --- a/src/Moof/Timer.hh +++ b/src/Moof/Timer.hh @@ -110,6 +110,7 @@ public: return gNextFire; } + static void fireIfExpired(); static void fireIfExpired(Scalar t); private: diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 8dab056..ba375e1 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -355,6 +355,11 @@ Video::Attributes::Attributes() } settings.get("icon", icon); + settings.get("fullscreen", fullscreen); + settings.get("resizable", resizable); + settings.get("showcursor", cursorVisible); + settings.get("grab", cursorGrab); + std::vector dimensions; settings.get("videomode", dimensions); if (dimensions.size() > 1) @@ -362,12 +367,31 @@ Video::Attributes::Attributes() mode[0] = dimensions[0]; mode[1] = dimensions[1]; } - if (dimensions.size() > 2) mode[2] = dimensions[2]; + else if (fullscreen) + { + SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); - settings.get("fullscreen", fullscreen); - settings.get("resizable", resizable); - settings.get("showcursor", cursorVisible); - settings.get("grab", cursorGrab); + if (modes == (SDL_Rect**)0) + { + Mf::logError("no native video mode"); + } + else if (modes == (SDL_Rect**)-1) + { + Mf::logWarning("any resolution allowed; choosing default 800x600"); + mode[0] = 800; + mode[1] = 600; + } + else + { + while (*(modes + 1)) ++modes; // skip to the last + + mode[0] = (*modes)->w; + mode[1] = (*modes)->h; + Mf::logInfo << "choosing native resolution " + << mode[0] << "x" << mode[1] << std::endl; + } + } + if (dimensions.size() > 2) mode[2] = dimensions[2]; } -- 2.44.0 From be9ebc1104574e5e81e19c5caba0c23b54df826d Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 13 Jan 2010 20:24:07 -0700 Subject: [PATCH 03/16] moved log level from configure to setting --- configure.ac | 10 ---------- data/yoinkrc | 15 ++++++++++++--- src/MainLayer.cc | 19 +++++-------------- src/Moof/Video.cc | 2 +- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index 054c4ac..b52ea76 100644 --- a/configure.ac +++ b/configure.ac @@ -99,12 +99,6 @@ AC_ARG_ENABLE([qt4], [qt4=$enableval], [qt4=no]) -AC_ARG_WITH([log-level], - [AS_HELP_STRING([--with-log-level=NUM], - [0, none... 1, errors... 4, everything (default: 3)])], - [log_level=$withval], - [log_level=3]) - if test x$debug = xyes then @@ -151,9 +145,6 @@ then [Define to 1 if you want to use QT4 info/error dialogs.]) fi -AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level], - [Define to detail level of logging.]) - if test "x$prefix" = xNONE then @@ -371,7 +362,6 @@ echo "" echo " Target: $target" echo " Prefix: $prefix" echo " Data Directory: $DATADIR" -echo " Log Level: $log_level" echo " Debug: $debug" echo " Double Precision: $double_precision" echo " Profile: $profile" diff --git a/data/yoinkrc b/data/yoinkrc index d7f97cc..36b6e58 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -35,12 +35,12 @@ framerate = 50 -- Set this to print the current actual framerate to the console each -- second. -showfps = true +showfps = false -- Set this to run the game in full-screen mode. The default behavior is -- to run the game in a window. -fullscreen = true +fullscreen = false -- If the game is running in a window, set this to also make the window -- resizable. This has no effective if the fullscreen option is true. @@ -53,7 +53,7 @@ resizable = true -- default behavior is to pick a native resolution. Otherwise, the game -- window will default to 800x600. ---videomode = {800, 600} +videomode = {800, 600} -- Set this to make the cursor remain visible as you mouse over the view of -- the game. @@ -71,3 +71,12 @@ doublebuffer = true swapcontrol = true +-- Set the level of log detail that will be printed to the console. +-- Possible values are: +-- 0 print nothing +-- 1 errors only +-- 2 include warnings +-- 3 print everything, including debug messages + +loglevel = 2 + diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 5f097ea..ad2dbbc 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -289,17 +289,6 @@ int main(int argc, char* argv[]) } -#if YOINK_LOGLEVEL >= 3 - Mf::Log::setLevel(Mf::Log::INFO); -#elif YOINK_LOGLEVEL >= 2 - Mf::Log::setLevel(Mf::Log::WARNING); -#elif YOINK_LOGLEVEL >= 1 - Mf::Log::setLevel(Mf::Log::ERROR); -#elif YOINK_LOGLEVEL - Mf::Log::setLevel(Mf::Log::NONE); -#endif - - // Add search paths; they should be searched in this order: // 1. YOINK_DATADIR (environment) // 2. YOINK_DATADIR (configure) @@ -319,9 +308,7 @@ int main(int argc, char* argv[]) // 3. $HOME/.yoinkrc // 4. YOINKRC (environment) - std::string configFiles; - - configFiles += Mf::Resource::getPath("yoinkrc"); + std::string configFiles = Mf::Resource::getPath("yoinkrc"); #if !defined(_WIN32) && !defined(__WIN32__) configFiles += ":/etc/yoinkrc"; #endif @@ -337,6 +324,10 @@ int main(int argc, char* argv[]) Mf::Settings& settings = Mf::Settings::getInstance(); settings.loadFromFile(configFiles); settings.parseArgs(argc, argv); + + Mf::Log::Level logLevel; + if (settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel); + Mf::engine.initWithSettings(settings); std::string iconFile = Mf::Resource::getPath(PACKAGE".png"); diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index ba375e1..544e172 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -132,7 +132,7 @@ void Video::setVideoMode(const long mode[3]) // on win32, creating a new context via SDL_SetVideoMode will wipe // out the GL state, so we gotta notify everyone to reload their // state after the change - Engine::getInstance().dispatch("video.newcontext"); + engine.dispatch("video.newcontext"); logInfo("video context recreated"); #endif -- 2.44.0 From 987971a961454d97082c6448fdc0bbeb540281bb Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 16 Jan 2010 12:06:37 -0700 Subject: [PATCH 04/16] refactoring needed for win32 crash --- doc/yoink.6.in | 38 +++-- src/GameLayer.cc | 14 +- src/Hud.cc | 14 +- src/Hud.hh | 6 +- src/{MainLayer.cc => Main.cc} | 190 +++++++++++----------- src/{MainLayer.hh => Main.hh} | 33 ++-- src/Makefile.am | 8 +- src/Moof/{Engine.cc => Core.cc} | 270 ++++++++++++++++++-------------- src/Moof/{Engine.hh => Core.hh} | 52 +++--- src/Moof/Error.hh | 6 + src/Moof/Image.cc | 4 + src/Moof/Layer.hh | 4 +- src/Moof/Log.cc | 4 +- src/Moof/Resource.cc | 37 +++-- src/Moof/Resource.hh | 5 +- src/Moof/Settings.cc | 53 ++++--- src/Moof/Settings.hh | 12 +- src/Moof/Sound.cc | 7 +- src/Moof/Texture.cc | 10 +- src/Moof/Transition.hh | 8 +- src/Moof/Video.cc | 15 +- src/Moof/Video.hh | 9 ++ src/Scene.cc | 2 +- src/TitleLayer.cc | 10 +- src/TitleLayer.hh | 2 +- win32/mkpackage.sh.in | 6 +- 26 files changed, 449 insertions(+), 370 deletions(-) rename src/{MainLayer.cc => Main.cc} (75%) rename src/{MainLayer.hh => Main.hh} (82%) rename src/Moof/{Engine.cc => Core.cc} (81%) rename src/Moof/{Engine.hh => Core.hh} (78%) diff --git a/doc/yoink.6.in b/doc/yoink.6.in index ce90f1d..7e100d3 100644 --- a/doc/yoink.6.in +++ b/doc/yoink.6.in @@ -105,16 +105,12 @@ artifacts caused by the animation of the game. Otherwise, a single buffer will be used. The default value is true. .TP .B framerate -The maximum number of frames to be drawn per second. If your computer is +The target number of frames to be drawn per second. If your computer is really old, you can get away with decreasing this value and still have reasonably smooth animation. You can set this to a very high number to effectively render as many frames as is possible, but the actual rate could be limited by vertical display synchronization, depending on the X11 driver -and settings used. You should not set this option higher than the point -where the vertical synchronization effectively limits the draw rate or else -the game may not be able to update the physics on schedule which could -actually significantly lower the quality of the animation. The default -value is 40. +and settings used. The default value is 50. .TP .B fullscreen If true, the window will capture the display and render the game in full @@ -150,20 +146,17 @@ need to. .SH EXAMPLES Here are some examples of typical usage: .TP -$ yoink framerate=60 -Cap the allowable frame-rate to 60Hz. +$ yoink detail=2 +Set the level of detail to 2 so that less stuff is drawn to the screen. .TP -$ yoink fullscreen=true -Run \fByoink\fP in full-screen mode. -.TP -$ yoink videomode=\\{1024,768\\} -Run \fByoink\fP with a resolution of 1024x768. Notice the escapes for the -curly braces so the shell doesn't parse them. +$ yoink fullscreen=true videomode=\\{1024,768\\} +Run \fByoink\fP at full screen with a resolution of 1024x768. Notice the +escapes for the curly braces so the shell doesn't parse them. .SH ENVIRONMENT \fByoink\fP responds to some variables in the environment: .TP .I HOME -If set to a path of a valid directory (presumably a user's home directory), +If set to a path of a valid directory (presumably your home directory), \fByoink\fP will look for a file at \fI$HOME/.yoinkrc\fP and load it as a config file. .TP @@ -198,11 +191,16 @@ This can speed up a software renderer considerably. .TP 2. Decrease the level of rendering detail. Use the \fBdetail\fP option. The game world may look sparse or incomplete, -but that's probably better than choppy animation. -.TP -3. Decrease the timestep. -You can set the \fBtimestep\fP to be as low as the your \fBframerate\fP -option. Remember the trade-off here is decreased simulation accuracy. +but that's probably better than choppy animation if you can avoid it. +.TP +3. Decrease the framerate and/or timestep. +If your machine can't meet the target framerate, your actual framerate will +probably vary. You will have a better visual experience if you can reduce +the \fBframerate\fP to a point such that the actual framerate is basically +constant. A constant 20fps or 30fps will look better than a sporadic +40-60fps. You can also decrease the \fBtimestep\fP at the expense of +decreased simulation accuracy. You'll have to experiment with this value +to find out acceptable levels. .PP If you are having audio problems, you may need to upgrade OpenAL. Some systems still provide an old, busted version of OpenAL which may result in diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 46c3263..493aa6c 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -26,7 +26,7 @@ *******************************************************************************/ -#include +#include #include #include #include @@ -110,7 +110,7 @@ GameLayer::GameLayer() : mMusic.enqueue("NightFusionLoop"); bool isMute = false; - Mf::Settings::getInstance().get("nomusic", isMute); + Mf::settings.get("nomusic", isMute); if (!isMute) mMusic.play(); //mMusic.setPosition(Mf::Vector3(10.0, 5.0, 0.0)); @@ -133,7 +133,7 @@ GameLayer::GameLayer() : void GameLayer::pushedOntoEngine() { - Mf::engine.push(mHud); + Mf::core.push(mHud); mRay.direction.set(1.0, 0.0); @@ -259,12 +259,12 @@ bool GameLayer::handleEvent(const Mf::Event& event) case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - Mf::engine.pop(this); + Mf::core.pop(this); return true; } else if (event.key.keysym.sym == SDLK_h) { - Mf::engine.push(mHud); + Mf::core.push(mHud); return true; } return mState.heroine->handleEvent(event); @@ -285,8 +285,8 @@ bool GameLayer::handleEvent(const Mf::Event& event) void GameLayer::setProjection() { - Mf::VideoP video = Mf::engine.getVideo(); - setProjection(video->getWidth(), video->getHeight()); + ASSERT(Mf::video && "no current video context from which to get dimensions"); + setProjection(Mf::video->getWidth(), Mf::video->getHeight()); } void GameLayer::setProjection(Mf::Scalar width, Mf::Scalar height) diff --git a/src/Hud.cc b/src/Hud.cc index d77bf57..1fdf39b 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -26,7 +26,7 @@ *******************************************************************************/ -#include +#include #include #include @@ -124,8 +124,8 @@ Hud::Hud(GameState& state) : mBar2(Tilemap("StatusBars"), 2), mFont("Font") { - Mf::VideoP video = Mf::engine.getVideo(); - resize(video->getWidth(), video->getHeight()); + ASSERT(Mf::video && "no current video context from which to get dimensions"); + resize(Mf::video->getWidth(), Mf::video->getHeight()); } @@ -147,14 +147,14 @@ void Hud::resize(int width, int height) } -void Hud::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) +void Hud::update(Mf::Scalar t, Mf::Scalar dt) { mState.interp.update(t, dt); setBar1Progress(mState.interp.getState(dt)); setBar2Progress(1.0 - mState.interp.getState(dt)); } -void Hud::draw(Mf::Engine& engine, Mf::Scalar alpha) const +void Hud::draw(Mf::Scalar alpha) const { glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -180,7 +180,7 @@ void Hud::draw(Mf::Engine& engine, Mf::Scalar alpha) const glPopMatrix(); } -bool Hud::handleEvent(Mf::Engine& engine, const Mf::Event& event) +bool Hud::handleEvent(const Mf::Event& event) { switch (event.type) { @@ -188,7 +188,7 @@ bool Hud::handleEvent(Mf::Engine& engine, const Mf::Event& event) if (event.key.keysym.sym == SDLK_h) { // don't want the hud anymore - engine.pop(this); + Mf::core.pop(this); return true; } break; diff --git a/src/Hud.hh b/src/Hud.hh index 016767a..75ced92 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -100,9 +100,9 @@ public: void resize(int width, int height); - void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Engine& engine, Mf::Scalar alpha = 0.0) const; - bool handleEvent(Mf::Engine& engine, const Mf::Event& event); + void update(Mf::Scalar t, Mf::Scalar dt); + void draw(Mf::Scalar alpha = 0.0) const; + bool handleEvent(const Mf::Event& event); private: diff --git a/src/MainLayer.cc b/src/Main.cc similarity index 75% rename from src/MainLayer.cc rename to src/Main.cc index ad2dbbc..2cd0f0c 100644 --- a/src/MainLayer.cc +++ b/src/Main.cc @@ -41,7 +41,7 @@ #include "ErrorHandler.hh" #include "GameLayer.hh" -#include "MainLayer.hh" +#include "Main.hh" #include "TitleLayer.hh" #if HAVE_CONFIG_H @@ -50,14 +50,14 @@ #include "version.h" -MainLayer::MainLayer() +Main::Main() { - mDispatchHandler = Mf::engine.addHandler("video.newcontext", - boost::bind(&MainLayer::contextRecreated, this)); + mDispatchHandler = Mf::core.addHandler("video.newcontext", + boost::bind(&Main::contextRecreated)); setupGL(); } -void MainLayer::pushedOntoEngine() +void Main::addedToCore() { //Mf::Scalar coeff[] = {0.0, 1.0}; //Mf::Lerp interp(coeff, 0.25); @@ -65,23 +65,23 @@ void MainLayer::pushedOntoEngine() //Mf::LayerP gameLayer = GameLayer::alloc(); //Mf::Transition::Ptr transition = //Mf::Transition::alloc(gameLayer, Mf::LayerP(), interp); - //engine->push(transition); - //engine->push(GameLayer::alloc()); - Mf::engine.push(TitleLayer::alloc()); + //core.push(transition); + //core.push(GameLayer::alloc()); + Mf::core.push(TitleLayer::alloc()); } -void MainLayer::update(Mf::Scalar t, Mf::Scalar dt) +void Main::update(Mf::Scalar t, Mf::Scalar dt) { - if (Mf::engine.getSize() == 1) + if (Mf::core.getSize() == 1) { // this is the only layer left on the stack - //Mf::engine.push(TitleLayer::alloc()); - Mf::engine.clear(); + //Mf::core.push(TitleLayer::alloc()); + Mf::core.clear(); } } -void MainLayer::draw(Mf::Scalar alpha) const +void Main::draw(Mf::Scalar alpha) const { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -92,24 +92,23 @@ void MainLayer::draw(Mf::Scalar alpha) const glLoadIdentity(); } -bool MainLayer::handleEvent(const Mf::Event& event) +bool Main::handleEvent(const Mf::Event& event) { switch (event.type) { case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - Mf::engine.clear(); + Mf::core.clear(); } else if (event.key.keysym.sym == SDLK_f) { - Mf::engine.getVideo()->toggleFull(); + Mf::video->toggleFull(); } else if (event.key.keysym.sym == SDLK_l) { - Mf::VideoP video = Mf::engine.getVideo(); - video->toggleCursorGrab(); - video->toggleCursorVisible(); + Mf::video->toggleCursorGrab(); + Mf::video->toggleCursorVisible(); } break; @@ -118,7 +117,7 @@ bool MainLayer::handleEvent(const Mf::Event& event) break; case SDL_QUIT: - Mf::engine.clear(); + Mf::core.clear(); break; } @@ -126,7 +125,52 @@ bool MainLayer::handleEvent(const Mf::Event& event) } -void MainLayer::setupGL() +std::string Main::getSearchPath() +{ + // Add search paths; they should be searched in this order: + // 1. YOINK_DATADIR (environment) + // 2. YOINK_DATADIR (configure) + + std::string path; + + char* dataDir = getenv("YOINK_DATADIR"); + if (dataDir) + { + path += dataDir; + path += ":"; + } + path += YOINK_DATADIR; + + return path; +} + +std::string Main::getConfigPath() +{ + // Build the list of config files to search for, in this order: + // 1. YOINK_DATADIR/yoinkrc + // 2. /etc/yoinkrc (not for Windows) + // 3. $HOME/.yoinkrc + // 4. YOINKRC (environment) + + std::string path = Mf::Resource::getPath("yoinkrc"); + +#if !defined(_WIN32) && !defined(__WIN32__) + path += ":/etc/yoinkrc"; +#endif + path += ":$HOME/.yoinkrc"; + + char* configFile = getenv("YOINKRC"); + if (configFile) + { + path += ":"; + path += configFile; + } + + return path; +} + + +void Main::setupGL() { glEnable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); @@ -144,14 +188,14 @@ void MainLayer::setupGL() //glMatrixMode(GL_PROJECTION); //glLoadIdentity(); - //Mf::Scalar ratio = Mf::engine.getVideo()->getWidth() / - //Mf::engine.getVideo()->getHeight(); + //Mf::Scalar ratio = Mf::core.getVideo()->getWidth() / + //Mf::core.getVideo()->getHeight(); //gluPerspective(60.0, ratio, 1.0, 250.0); //glMatrixMode(GL_MODELVIEW); } -void MainLayer::contextRecreated() +void Main::contextRecreated() { // whenever the context is destroyed and a new one created, it probably // won't contain our state so we need to set that up again @@ -160,7 +204,7 @@ void MainLayer::contextRecreated() -void printUsage() +void Main::printUsage() { std::cout << "Usage: "PACKAGE" [-h|--help] [-i|--info] [OPTION=VALUE]..." << std::endl @@ -175,13 +219,13 @@ void printUsage() << " the level of detail of game scenes" << std::endl << " fullscreen=true|false" << std::endl << " if true, uses the entire display" << std::endl - << " maxfps=num" << std::endl - << " the maximum number of frames per second" << std::endl + << " framerate=num" << std::endl + << " the target number of frames per second" << std::endl << std::endl << "See documentation for more options." << std::endl; } -void printInfo(int argc, char* argv[]) +void Main::printInfo(int argc, char* argv[]) { std::string assets; std::string datadir; @@ -241,12 +285,20 @@ void printInfo(int argc, char* argv[]) << "YOINK_DATADIR: " << datadir << std::endl; } + +void hello() +{ + std::cout << std::endl << PACKAGE_STRING << std::endl + << "Compiled " << __TIME__ " " __DATE__ << std::endl + << "Send patches and bug reports to <" + PACKAGE_BUGREPORT << ">." << std::endl << std::endl; +} + void goodbye() { std::cout << std::endl << "Goodbye..." << std::endl << std::endl; } - int main(int argc, char* argv[]) { if (argc > 1) @@ -254,91 +306,33 @@ int main(int argc, char* argv[]) std::string arg(argv[1]); if (arg == "-h" || arg == "--help") { - printUsage(); + Main::printUsage(); return 0; } else if (arg == "-i" || arg == "--info") { - printInfo(argc, argv); + Main::printInfo(argc, argv); return 0; } } - - std::cout << std::endl << PACKAGE_STRING << std::endl - << "Compiled " << __TIME__ " " __DATE__ << std::endl - << "Send patches and bug reports to <" - PACKAGE_BUGREPORT << ">." << std::endl << std::endl; - + hello(); atexit(goodbye); + Mf::Resource::addSearchPaths(Main::getSearchPath()); - // make sure the engine started up okay - const Mf::Error& error = Mf::engine.getError(); - if (error.isError()) - { - Mf::ModalDialog dialog; - dialog.title = PACKAGE_STRING; - dialog.text1 = "Uh oh!"; - dialog.text2 = getErrorString(error); - dialog.type = Mf::ModalDialog::CRITICAL; - dialog.run(); - - // openal errors are not fatal - if (error.code() != Mf::Error::OPENAL_INIT) return 1; - } - - - // Add search paths; they should be searched in this order: - // 1. YOINK_DATADIR (environment) - // 2. YOINK_DATADIR (configure) - - char* dataDir = getenv("YOINK_DATADIR"); - if (dataDir) - { - Mf::Resource::addSearchPath(dataDir); - } - - Mf::Resource::addSearchPath(YOINK_DATADIR); - - - // Build the list of config files to search for, in this order: - // 1. YOINK_DATADIR/yoinkrc - // 2. /etc/yoinkrc (not for Windows) - // 3. $HOME/.yoinkrc - // 4. YOINKRC (environment) - - std::string configFiles = Mf::Resource::getPath("yoinkrc"); -#if !defined(_WIN32) && !defined(__WIN32__) - configFiles += ":/etc/yoinkrc"; -#endif - configFiles += ":$HOME/.yoinkrc"; - - char* configFile = getenv("YOINKRC"); - if (configFile) - { - configFiles += ":"; - configFiles += configFile; - } - - Mf::Settings& settings = Mf::Settings::getInstance(); - settings.loadFromFile(configFiles); - settings.parseArgs(argc, argv); + Mf::settings.loadFromFiles(Main::getConfigPath()); + Mf::settings.parseArgs(argc, argv); Mf::Log::Level logLevel; - if (settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel); - - Mf::engine.initWithSettings(settings); - - std::string iconFile = Mf::Resource::getPath(PACKAGE".png"); - + if (Mf::settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel); try { - Mf::engine.setVideo(Mf::Video::alloc(PACKAGE_STRING, iconFile)); - Mf::engine.push(MainLayer::alloc()); - - Mf::engine.run(); + Mf::Video video(PACKAGE_STRING, Mf::Resource::getPath(PACKAGE".png")); + MainP app = Main::alloc(); + Mf::core.push(app); + Mf::core.run(); } catch (const Mf::Error& error) { diff --git a/src/MainLayer.hh b/src/Main.hh similarity index 82% rename from src/MainLayer.hh rename to src/Main.hh index 4f0fc77..1e9ecc9 100644 --- a/src/MainLayer.hh +++ b/src/Main.hh @@ -26,11 +26,11 @@ *******************************************************************************/ -#ifndef _MAINLAYER_HH_ -#define _MAINLAYER_HH_ +#ifndef _YOINKAPP_HH_ +#define _YOINKAPP_HH_ /** - * @file MainLayer.hh + * @file Main.hh * This is where all the fun begins. */ @@ -40,44 +40,49 @@ #include #include -#include #include #include -class MainLayer; -typedef boost::shared_ptr MainLayerP; +class Main; +typedef boost::shared_ptr
MainP; -class MainLayer : public Mf::Layer +class Main : public Mf::Layer { public: - MainLayer(); + Main(); - static MainLayerP alloc() + static MainP alloc() { - return MainLayerP(new MainLayer); + return MainP(new Main); } - void pushedOntoEngine(); + void addedToCore(); void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha) const; bool handleEvent(const Mf::Event& event); + static std::string getSearchPath(); + static std::string getConfigPath(); + + static void printUsage(); + static void printInfo(int argc, char* argv[]); + private: /** * Set OpenGL to a state we can know and depend on. */ - void setupGL(); - void contextRecreated(); + static void setupGL(); + static void contextRecreated(); Mf::Dispatch::Handler mDispatchHandler; }; -#endif // _MAINLAYER_HH_ +#endif // _YOINKAPP_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Makefile.am b/src/Makefile.am index ee59088..ede2a88 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,12 +18,12 @@ libmoof_a_SOURCES = \ Moof/Camera.hh \ Moof/ConvertUTF.c \ Moof/ConvertUTF.h \ + Moof/Core.cc \ + Moof/Core.hh \ Moof/Cullable.hh \ Moof/Dispatch.cc \ Moof/Dispatch.hh \ Moof/Drawable.hh \ - Moof/Engine.cc \ - Moof/Engine.hh \ Moof/Entity.hh \ Moof/Event.hh \ Moof/Exception.hh \ @@ -96,8 +96,8 @@ yoink_SOURCES = \ Heroine.hh \ Hud.cc \ Hud.hh \ - MainLayer.cc \ - MainLayer.hh \ + Main.cc \ + Main.hh \ Scene.cc \ Scene.hh \ Tilemap.cc \ diff --git a/src/Moof/Engine.cc b/src/Moof/Core.cc similarity index 81% rename from src/Moof/Engine.cc rename to src/Moof/Core.cc index 5d703da..cc86a91 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Core.cc @@ -36,19 +36,20 @@ #include #include "fastevents.h" - -#include "Engine.hh" +#include "Core.hh" #include "Event.hh" #include "Log.hh" #include "Math.hh" +#include "ModalDialog.hh" #include "Settings.hh" #include "Timer.hh" +#include "Video.hh" namespace Mf { -class Engine::Impl +class Core::Impl { public: @@ -56,50 +57,9 @@ public: mError(Error::NONE), mTimestep(0.01), mFramerate(0.02), - mShowFps(false) - { -#if defined(_WIN32) || defined(__WIN32__) - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) -#else - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0) -#endif - { - const char* error = SDL_GetError(); - mError.init(Error::SDL_INIT, error); - return; // fatal - } - else - { - char name[128]; - SDL_VideoDriverName(name, sizeof(name)); - logInfo << "initialized SDL; using video driver `" - << name << "'" << std::endl; - } - - if (FE_Init() != 0) - { - const char* error = FE_GetError(); - mError.init(Error::FASTEVENTS_INIT, error); - return; // fatal - } - - mAlDevice = alcOpenDevice(0); - mAlContext = alcCreateContext(mAlDevice, 0); - if (!mAlDevice || !mAlContext) - { - const char* error = alcGetString(mAlDevice,alcGetError(mAlDevice)); - mError.init(Error::OPENAL_INIT, error); - } - else - { - alcMakeContextCurrent(mAlContext); - logInfo << "opened sound device `" - << alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) - << "'" << std::endl; - } - } + mShowFps(false) {} - bool initWithSettings(const Settings& settings) + void init() { unsigned randomSeed; if (settings.get("rngseed", randomSeed)) srand(randomSeed); @@ -112,25 +72,9 @@ public: Scalar framerate = 40.0; settings.get("framerate", framerate); mFramerate = 1.0 / framerate; - capFps(); mShowFps = false; settings.get("showfps", mShowFps); - - return true; - } - - ~Impl() - { - // the video object must be destroyed before we can shutdown SDL - mVideo.reset(); - - alcMakeContextCurrent(0); - alcDestroyContext(mAlContext); - alcCloseDevice(mAlDevice); - - FE_Quit(); - SDL_Quit(); } @@ -143,6 +87,8 @@ public: void run() { + init(); + Scalar totalTime = 0.0; Scalar ticks = Timer::getTicks(); @@ -156,6 +102,8 @@ public: const int MAX_FRAMESKIP = 15; const Scalar inverseTimestep = SCALAR(1.0) / mTimestep; + ASSERT(video && "cannot run core without a current video context"); + do { Timer::fireIfExpired(); @@ -175,7 +123,7 @@ public: { ++frames; draw((ticks + mTimestep - nextUpdate) * inverseTimestep); - mVideo->swap(); + video->swap(); nextDraw += mFramerate; @@ -198,6 +146,7 @@ public: mDispatch.dispatch("engine.stopping"); } + void dispatchEvents() { SDL_Event event; @@ -217,7 +166,7 @@ public: break; case SDL_VIDEORESIZE: - mVideo->resize(event.resize.w, event.resize.h); + video->resize(event.resize.w, event.resize.h); break; } @@ -259,7 +208,7 @@ public: mStack.push_front(layer); logInfo << "stack: " << mStack.size() << " [pushed " << layer.get() << "]" << std::endl; - layer->pushedOntoEngine(); + layer->addedToCore(); } LayerP pop() @@ -271,7 +220,7 @@ public: mStack.pop_front(); logInfo << "stack: " << mStack.size() << " [popped " << layer.get() << "]" << std::endl; - layer->poppedFromEngine(); + layer->removedFromCore(); if (fixIt) mStackIt = --mStack.begin(); @@ -298,7 +247,7 @@ public: for (it = layers.begin(); it != layers.end(); ++it) { - (*it)->poppedFromEngine(); + (*it)->removedFromCore(); logInfo << "stack: " << mStack.size() << " [popped " << (*it).get() << "]" << std::endl; } @@ -320,25 +269,10 @@ public: } - void capFps() - { - //if (mFramerate < mTimestep) - //{ - //logWarning << "capping maximum fps to timestep (" - //<< mTimestep << ")" << std::endl; - //mFramerate = mTimestep; - //} - } - - Error mError; - VideoP mVideo; Dispatch mDispatch; - ALCdevice* mAlDevice; - ALCcontext* mAlContext; - std::list mStack; std::list::iterator mStackIt; @@ -350,105 +284,199 @@ public: }; -Engine::Engine() : +Core::Core() : // pass through - mImpl(new Engine::Impl) {} + mImpl(new Core::Impl) {} -bool Engine::initWithSettings(const Settings& settings) +void Core::init() { // pass through - return mImpl->initWithSettings(settings); -} - -const Error& Engine::getError() const -{ - // pass through - return mImpl->mError; -} - -void Engine::clearError() -{ - // pass through - mImpl->mError.init(Error::NONE); + mImpl->init(); } -void Engine::setVideo(VideoP video) -{ - // pass through - mImpl->mVideo = video; -} - -VideoP Engine::getVideo() const -{ - return mImpl->mVideo; -} - - -int Engine::getFps() const +int Core::getFps() const { return mImpl->mFps; } -void Engine::push(LayerP layer) +void Core::push(LayerP layer) { // pass through mImpl->push(layer); } -LayerP Engine::pop() +LayerP Core::pop() { // pass through return mImpl->pop(); } -LayerP Engine::pop(Layer* layer) +LayerP Core::pop(Layer* layer) { // pass through return mImpl->pop(layer); } -void Engine::clear() +void Core::clear() { // pass through mImpl->clear(); } -int Engine::getSize() const +int Core::getSize() const { return mImpl->mStack.size(); } -void Engine::run() +void Core::run() { // pass through return mImpl->run(); } -Dispatch::Handler Engine::addHandler(const std::string& event, +Dispatch::Handler Core::addHandler(const std::string& event, const Dispatch::Function& callback) { return mImpl->mDispatch.addHandler(event, callback); } -Dispatch::Handler Engine::addHandler(const std::string& event, +Dispatch::Handler Core::addHandler(const std::string& event, const Dispatch::Function& callback, Dispatch::Handler handler) { return mImpl->mDispatch.addHandler(event, callback, handler); } -void Engine::dispatch(const std::string& event, +void Core::dispatch(const std::string& event, const Dispatch::Message* message) { mImpl->mDispatch.dispatch(event, message); } -Engine engine; +Core core; + + +class Backend_; +typedef boost::shared_ptr BackendP; + +class Backend_ +{ +public: + + void init() + { +#if defined(_WIN32) || defined(__WIN32__) + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) +#else + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0) +#endif + { + const char* error = SDL_GetError(); + gError.init(Error::SDL_INIT, error); + return; // fatal + } + else + { + char name[128]; + SDL_VideoDriverName(name, sizeof(name)); + logInfo << "initialized SDL; using video driver `" + << name << "'" << std::endl; + } + + if (FE_Init() != 0) + { + const char* error = FE_GetError(); + gError.init(Error::FASTEVENTS_INIT, error); + return; // fatal + } + + mAlDevice = alcOpenDevice(0); + mAlContext = alcCreateContext(mAlDevice, 0); + if (!mAlDevice || !mAlContext) + { + const char* error = alcGetString(mAlDevice,alcGetError(mAlDevice)); + gError.init(Error::OPENAL_INIT, error); + return; + } + else + { + alcMakeContextCurrent(mAlContext); + logInfo << "opened sound device `" + << alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) + << "'" << std::endl; + } + + gError.init(Error::NONE); + } + + ~Backend_() + { + alcMakeContextCurrent(0); + alcDestroyContext(mAlContext); + alcCloseDevice(mAlDevice); + + FE_Quit(); + SDL_Quit(); + } + + static void retain() + { + if (gRetainCount++ == 0) + { + gInstance = BackendP(new Backend_); + gInstance->init(); + } + } + + static void release() + { + if (--gRetainCount == 0) + { + gInstance.reset(); + gError.reset(); + } + } + + static bool check(Error& error) + { + error = gError; + return error.code() == Error::NONE; + } + +private: + + ALCdevice* mAlDevice; + ALCcontext* mAlContext; + + static Error gError; + static int gRetainCount; + static BackendP gInstance; +}; + +Error Backend_::gError(Error::UNINITIALIZED); +int Backend_::gRetainCount = 0; +BackendP Backend_::gInstance; + + +Backend::Backend() +{ + Backend_::retain(); +} + +Backend::~Backend() +{ + Backend_::release(); +} + +bool Backend::check(Error& error) +{ + return Backend_::check(error); +} } // namespace Mf diff --git a/src/Moof/Engine.hh b/src/Moof/Core.hh similarity index 78% rename from src/Moof/Engine.hh rename to src/Moof/Core.hh index 28d7fa0..fcb0340 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Core.hh @@ -26,56 +26,43 @@ *******************************************************************************/ -#ifndef _MOOF_ENGINE_HH_ -#define _MOOF_ENGINE_HH_ +#ifndef _MOOF_CORE_HH_ +#define _MOOF_CORE_HH_ #include #include #include -#include #include namespace Mf { -class Settings; - - /** - * The engine is essentially a stack of layers. While running, it updates each + * The core is essentially a stack of layers. While running, it updates each * layer from the bottom up every timestep. It also draws each layer from the * bottom up, adhering to the maximum frame-rate. Events are sent to each layer - * from the top down until a layer signals the event was handled. The engine is - * also responsible for firing timers on time. The engine will continue running + * from the top down until a layer signals the event was handled. The core is + * also responsible for firing timers on time. The core will continue running * as long as there are layers on the stack. */ -class Engine +class Core { public: - Engine(); - ~Engine() {} + Core(); // loads settings: rngseed, timestep, framerate, showfps - bool initWithSettings(const Settings& settings); - - const Error& getError() const; - void clearError(); - - // setting the video is required before you can run the engine and should - // probably be done before adding any layers - void setVideo(VideoP video); - VideoP getVideo() const; + void init(); int getFps() const; void push(LayerP layer); // push a layer onto the top LayerP pop(); // pop the top layer LayerP pop(Layer* layer); // pops a specific layer and all layers above it - void clear(); // remove all layers (the engine will stop) + void clear(); // remove all layers (the core will stop) int getSize() const; // get the size of the stack @@ -96,13 +83,30 @@ private: boost::shared_ptr mImpl; }; +extern Core core; + + +/* + * Some classes and subsystems require certain backend libraries to be + * initialized. This is the mechanism to accomplish that. Classes which rely + * on any backend libraries just need to instantiate this class as a member. + * Backend cleanup will occur automagically when there are no more instances. + */ + +class Backend +{ +public: + + Backend(); + ~Backend(); -extern Engine engine; + static bool check(Error& error); +}; } // namespace Mf -#endif // _MOOF_ENGINE_HH_ +#endif // _MOOF_CORE_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh index 86b8a12..05c6377 100644 --- a/src/Moof/Error.hh +++ b/src/Moof/Error.hh @@ -90,6 +90,12 @@ public: return mCode != NONE; } + void reset() throw() + { + mCode = NONE; + mWhat[0] = '\0'; + } + private: unsigned mCode; diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index 31d6b02..ba17769 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -32,6 +32,8 @@ #include #include +#include "Core.hh" +#include "Error.hh" #include "Image.hh" #include "Library.hh" #include "Log.hh" @@ -98,6 +100,8 @@ public: private: + Backend mBackend; + bool init(const std::string& filePath, bool flipped) { logInfo("opening image file..."); diff --git a/src/Moof/Layer.hh b/src/Moof/Layer.hh index 01a4145..31607fb 100644 --- a/src/Moof/Layer.hh +++ b/src/Moof/Layer.hh @@ -44,8 +44,8 @@ public: virtual ~Layer() {} - virtual void pushedOntoEngine() {} - virtual void poppedFromEngine() {} + virtual void addedToCore() {} + virtual void removedFromCore() {} virtual void update(Scalar t, Scalar dt) {} virtual void draw(Scalar alpha) const {} diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc index 3094642..783aec5 100644 --- a/src/Moof/Log.cc +++ b/src/Moof/Log.cc @@ -49,9 +49,9 @@ Log::Level Log::getLevel() } -static std::ofstream nullLog_; - std::ostream& log(std::clog); + +static std::ofstream nullLog_; std::ostream& nullLog(nullLog_); Log logError(Log::ERRORR, " error: "); diff --git a/src/Moof/Resource.cc b/src/Moof/Resource.cc index ff4213e..ec94025 100644 --- a/src/Moof/Resource.cc +++ b/src/Moof/Resource.cc @@ -38,28 +38,43 @@ namespace Mf { // static member -std::vector Resource::searchPaths_; +std::vector Resource::gSearchPaths; -void Resource::addSearchPath(const std::string& directory) +void Resource::addSearchPaths(const std::string& path) { - std::string path(directory); + std::vector paths; + boost::split(paths, path, boost::is_any_of(":")); - ASSERT(path.length() > 0 && "empty search path string"); + addSearchPaths(paths); +} + +void Resource::addSearchPaths(const std::vector& path) +{ + std::vector::const_iterator it; - // add a slash if there isn't one already - if (*path.rbegin() != '/') + for (it = path.begin(); it != path.end(); ++it) { - path += '/'; - } + std::string onePath(*it); + + ASSERT(!onePath.empty() && "empty search path string"); + + // add a slash if there isn't one already + if (*onePath.rbegin() != '/') + { + onePath += '/'; + } #if defined(_WIN32) || defined(__WIN32__) - boost::replace_all(path, "/", "\\"); + boost::replace_all(onePath, "/", "\\"); #endif - searchPaths_.push_back(path); + gSearchPaths.push_back(onePath); + logInfo << "added search path " << onePath << std::endl; + } } + std::string Resource::getPath(const std::string& name) { std::vector::iterator it; @@ -70,7 +85,7 @@ std::string Resource::getPath(const std::string& name) boost::replace_all(path, "/", "\\"); #endif - for (it = searchPaths_.begin(); it != searchPaths_.end(); ++it) + for (it = gSearchPaths.begin(); it != gSearchPaths.end(); ++it) { std::string fullPath(*it); fullPath += path; diff --git a/src/Moof/Resource.hh b/src/Moof/Resource.hh index 39b76a4..671aeb6 100644 --- a/src/Moof/Resource.hh +++ b/src/Moof/Resource.hh @@ -57,7 +57,8 @@ public: * @param directory Path to a directory. */ - static void addSearchPath(const std::string& directory); + static void addSearchPaths(const std::string& path); + static void addSearchPaths(const std::vector& path); /** * Get the path to a resource of a given name. @@ -70,7 +71,7 @@ public: private: - static std::vector searchPaths_; + static std::vector gSearchPaths; }; diff --git a/src/Moof/Settings.cc b/src/Moof/Settings.cc index 9f0538b..5e19ed5 100644 --- a/src/Moof/Settings.cc +++ b/src/Moof/Settings.cc @@ -26,7 +26,6 @@ *******************************************************************************/ -#include #include // getenv #include "Settings.hh" @@ -40,11 +39,11 @@ Settings::~Settings() save(); } -Settings& Settings::getInstance() -{ - static Settings settings; - return settings; -} +//Settings& Settings::getInstance() +//{ + //static Settings settings; + //return settings; +//} void Settings::parseArgs(int argc, char* argv[]) @@ -56,35 +55,42 @@ void Settings::parseArgs(int argc, char* argv[]) } -void Settings::loadFromFile(const std::string& filePath) +void Settings::loadFromFiles(const std::string& path) { std::vector paths; - boost::split(paths, filePath, boost::is_any_of(":")); + boost::split(paths, path, boost::is_any_of(":")); loadFromFiles(paths); } -void Settings::loadFromFiles(const std::vector& filePaths) +void Settings::loadFromFiles(const std::vector& path) { - std::vector::const_iterator it; - - char* home = getenv("HOME"); - - for (it = filePaths.begin(); it != filePaths.end(); ++it) + std::vector copy(path); + std::vector::iterator it; + +#if defined(_WIN32) || defined(__WIN32__) + char* homeDrive = getenv("HOMEDRIVE"); + char* homePath = getenv("HOMEPATH"); + std::string home(homeDrive ? homeDrive : ""); + if (homePath) home += homePath; +#else + char *homePath = getenv("HOME"); + std::string home(homePath ? homePath : ""); +#endif + + for (it = copy.begin(); it != copy.end(); ++it) { - std::string path = *it; - - if (home) + if (!home.empty()) { - boost::replace_all(path, "$HOME", home); + boost::replace_all(*it, "$HOME", home); //Mf::logDebug("Copying global settings..."); - //mUserFile = path; + //mUserFile = *it; //mGlobals.pushCopy(); //mScript.set("globals", Script::REGISTRY); } - if (mScript.doFile(path) != Script::SUCCESS) + if (mScript.doFile(*it) != Script::SUCCESS) { std::string str; mScript[-1].get(str); @@ -101,9 +107,9 @@ void Settings::clear() } -void Settings::saveAs(const std::string& filePath) +void Settings::saveAs(const std::string& path) { - mUserFile = filePath; + mUserFile = path; save(); } @@ -112,6 +118,9 @@ void Settings::save() const } +Settings settings; + + } // namepsace Mf /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index 6cd8629..d4cbb9f 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -58,17 +58,14 @@ public: ~Settings(); - // get global instance - static Settings& getInstance(); - void parseArgs(int argc, char* argv[]); - void loadFromFile(const std::string& filePath); - void loadFromFiles(const std::vector& filePaths); + void loadFromFiles(const std::string& path); + void loadFromFiles(const std::vector& path); void clear(); // remove all settings - void saveAs(const std::string& filePath); + void saveAs(const std::string& path); void save() const; template @@ -113,6 +110,9 @@ bool Settings::get(const std::string& key, T& value) const } +extern Settings settings; + + } // namepsace Mf #endif // _MOOF_SETTINGS_HH_ diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index f9bdfd7..ca3ecfe 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -35,7 +35,8 @@ #include #include -#include "Engine.hh" +#include "Core.hh" +#include "Error.hh" #include "Library.hh" #include "Log.hh" #include "Sound.hh" @@ -65,7 +66,7 @@ public: { public: - Buffer(const std::string& name) : + explicit Buffer(const std::string& name) : Library(name), mBuffer(-1) { @@ -436,6 +437,8 @@ public: std::deque mQueue; Timer mStreamTimer; + + Backend mBackend; }; diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 6769d88..5341af3 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -32,13 +32,14 @@ #include #include "Dispatch.hh" -#include "Engine.hh" +#include "Core.hh" #include "Error.hh" #include "Image.hh" #include "Library.hh" #include "Log.hh" #include "OpenGL.hh" #include "Texture.hh" +#include "Video.hh" namespace Mf { @@ -121,12 +122,11 @@ public: mWrapT(GL_CLAMP), mObject(0) { - // make sure we have a video - VideoP video = engine.getVideo(); - ASSERT(video && "cannot load textures without a current video context"); + // make sure we have a video context + //ASSERT(video && "cannot load textures without a current video context"); // we want to know when the GL context is recreated - mDispatchHandler = engine.addHandler("video.newcontext", + mDispatchHandler = core.addHandler("video.newcontext", boost::bind(&Impl::contextRecreated, this)); loadFromFile(); diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh index f200729..dfc2602 100644 --- a/src/Moof/Transition.hh +++ b/src/Moof/Transition.hh @@ -31,7 +31,7 @@ #include -#include +#include #include #include #include @@ -66,9 +66,9 @@ public: } - void poppedFromEngine() + void removedFromCore() { - if (mTo) engine.push(mTo); + if (mTo) core.push(mTo); } void update(Scalar t, Scalar dt) @@ -81,7 +81,7 @@ public: if (mInterp.isDone()) { // to should /replace/ this - engine.pop(this); + core.pop(this); } } diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 544e172..9e74acb 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -27,7 +27,6 @@ *******************************************************************************/ #include "Dispatch.hh" -#include "Engine.hh" #include "Error.hh" #include "Image.hh" #include "Log.hh" @@ -76,6 +75,8 @@ void Video::init(const Attributes& attribs) setCursorVisible(attribs.cursorVisible); setCursorGrab(attribs.cursorGrab); setVideoMode(attribs.mode); + + video = this; } void Video::recreateContext() @@ -110,6 +111,8 @@ void Video::setOpenGLAttributes() Video::~Video() { SDL_FreeSurface(mContext); + + if (video == this) video = 0; } @@ -132,8 +135,7 @@ void Video::setVideoMode(const long mode[3]) // on win32, creating a new context via SDL_SetVideoMode will wipe // out the GL state, so we gotta notify everyone to reload their // state after the change - engine.dispatch("video.newcontext"); - + core.dispatch("video.newcontext"); logInfo("video context recreated"); #endif } @@ -296,7 +298,7 @@ int Video::getHeight() const Video::Attributes::Attributes() { - // Set some sane GL and window defaults (see SDL_video.c:217) + // set some sane GL and window defaults (see SDL_video.c:217) colorBuffer[0] = 3; colorBuffer[1] = 3; colorBuffer[2] = 2; @@ -322,8 +324,6 @@ Video::Attributes::Attributes() cursorVisible = true; cursorGrab = false; - Settings& settings = Settings::getInstance(); - std::vector colors; settings.get("colorbuffers", colors); if (colors.size() > 0) colorBuffer[0] = colors[0]; @@ -395,6 +395,9 @@ Video::Attributes::Attributes() } +Video* video = 0; + + } // namespace Mf /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Video.hh b/src/Moof/Video.hh index 91eecb7..0199bc5 100644 --- a/src/Moof/Video.hh +++ b/src/Moof/Video.hh @@ -35,6 +35,8 @@ #include +#include + namespace Mf { @@ -72,6 +74,10 @@ public: bool cursorGrab; Attributes(); + + private: + + Backend backend; }; @@ -134,6 +140,9 @@ private: }; +extern Video* video; + + } // namespace Mf #endif // _MOOF_VIDEO_HH_ diff --git a/src/Scene.cc b/src/Scene.cc index 175f216..aa2249c 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -193,7 +193,7 @@ struct Scene::Impl : public Mf::Library boost::bind(&Impl::drawTile, this, _1)); int detail = 3; - Mf::Settings::getInstance().get("detail", detail); + Mf::settings.get("detail", detail); script.push(detail); script.set("detail"); script.push(1); script.set("LOW"); diff --git a/src/TitleLayer.cc b/src/TitleLayer.cc index ed8f4c1..9c60913 100644 --- a/src/TitleLayer.cc +++ b/src/TitleLayer.cc @@ -26,7 +26,7 @@ *******************************************************************************/ -#include +#include #include #include @@ -34,7 +34,7 @@ #include "TitleLayer.hh" -void TitleLayer::pushedOntoEngine() +void TitleLayer::addedToCore() { Mf::Scalar coeff[] = {0.0, 1.0}; mFadeIn.init(coeff, 0.1); @@ -63,8 +63,8 @@ bool TitleLayer::handleEvent(const Mf::Event& event) //break; //} - Mf::LayerP titleLayer = Mf::engine.pop(this); - //engine.pushLayer(GameLayer::alloc()); + Mf::LayerP titleLayer = Mf::core.pop(this); + //core.pushLayer(GameLayer::alloc()); Mf::Scalar coeff[] = {0.0, 0.75, 0.99, 1.0}; Mf::PolynomialInterpolator<3> interp(coeff, 0.1); @@ -72,7 +72,7 @@ bool TitleLayer::handleEvent(const Mf::Event& event) //Mf::LayerP mGameLayer = GameLayer::alloc(); Mf::Transition >::Ptr transition = Mf::Transition >::alloc(mGameLayer, titleLayer, interp); - Mf::engine.push(transition); + Mf::core.push(transition); return true; } diff --git a/src/TitleLayer.hh b/src/TitleLayer.hh index 20f42a7..fe745ee 100644 --- a/src/TitleLayer.hh +++ b/src/TitleLayer.hh @@ -48,7 +48,7 @@ public: return TitleLayerP(new TitleLayer); } - void pushedOntoEngine(); + void addedToCore(); void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha) const; diff --git a/win32/mkpackage.sh.in b/win32/mkpackage.sh.in index d3b28ee..784e0fa 100644 --- a/win32/mkpackage.sh.in +++ b/win32/mkpackage.sh.in @@ -24,12 +24,12 @@ rm -rf "$BUILD_DIR" mkdir -p "$BUILD_DIR" cp -f "$ROOT_DIR/src/yoink.exe" "$BUILD_DIR" -"${STRIP:-strip}" "$BUILD_DIR/yoink.exe" +#"${STRIP:-strip}" "$BUILD_DIR/yoink.exe" for dll in $DLLS do cp -f "@prefix@/bin/$dll.dll" "$BUILD_DIR" - "${STRIP:-strip}" "BUILD_DIR/$dll.dll" + #"${STRIP:-strip}" "BUILD_DIR/$dll.dll" done cd "$ROOT_DIR" @@ -65,5 +65,5 @@ then exit 1 fi -rm -rf "$BUILD_DIR" +#rm -rf "$BUILD_DIR" -- 2.44.0 From 565445cda1dd3e9db8000c4a194831dc296a203d Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 20 Jan 2010 12:49:24 -0700 Subject: [PATCH 05/16] minor build system, doc fixes --- doc/yoink.6.in | 8 ++++---- extra/yoink.ebuild | 2 +- src/Makefile.am | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/yoink.6.in b/doc/yoink.6.in index 7e100d3..d3df203 100644 --- a/doc/yoink.6.in +++ b/doc/yoink.6.in @@ -117,15 +117,15 @@ If true, the window will capture the display and render the game in full screen splendor. A value of false means the game will run in a window. The default value is false. .TP -.B showfps -If true, the current number of frames being drawn per second will be -printed to the console every second. The default value is false. -.TP .B resizable If true, the window will be resizable by the window manager. This option is meaningless if the game is drawing to the full screen. The default option is true. .TP +.B showfps +If true, the current number of frames being drawn per second will be +printed to the console every second. The default value is false. +.TP .B timestep The number of times per second the simulation state will be updated. A value of 100 or higher is ideal for a better physical simulation. Values diff --git a/extra/yoink.ebuild b/extra/yoink.ebuild index 3646f82..a7394b3 100644 --- a/extra/yoink.ebuild +++ b/extra/yoink.ebuild @@ -53,7 +53,7 @@ src_configure() { src_install() { emake DESTDIR="${D}" install || die "emake install failed" - dodoc AUTHORS ChangeLog COPYING README TODO + dodoc AUTHORS COPYING README TODO doman doc/yoink.6 doicon data/yoink.png make_desktop_entry ${PN} Yoink diff --git a/src/Makefile.am b/src/Makefile.am index ede2a88..3c3fc53 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,8 +25,8 @@ libmoof_a_SOURCES = \ Moof/Dispatch.hh \ Moof/Drawable.hh \ Moof/Entity.hh \ + Moof/Error.hh \ Moof/Event.hh \ - Moof/Exception.hh \ Moof/Frustum.cc \ Moof/Frustum.hh \ Moof/Hash.cc \ -- 2.44.0 From 3f6e44698c38b74bb622ad81ea9d2daa636981d2 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 20 Jan 2010 13:09:14 -0700 Subject: [PATCH 06/16] cade lab fixes --- README | 1 + configure.ac | 54 +++++++++++++++++++++++------------------------ src/Moof/Core.cc | 5 +++-- src/Moof/Image.cc | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/README b/README index 6f5e024..3193449 100644 --- a/README +++ b/README @@ -36,6 +36,7 @@ libvorbis Lua OpenAL OpenGL +pkgconfig (build-time dependency) SDL c) License diff --git a/configure.ac b/configure.ac index b52ea76..813b6b5 100644 --- a/configure.ac +++ b/configure.ac @@ -210,6 +210,11 @@ AC_HEADER_STDBOOL AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h]) +##### clock_gettime ##### +AC_SEARCH_LIBS([clock_gettime], [rt], + [AC_DEFINE([HAVE_CLOCK_GETTIME], 1, + [Define to 1 if you have the 'clock_gettime' function.])]) + # # Checks for build dependencies. @@ -237,7 +242,7 @@ AC_CHECK_HEADERS([GL/gl.h GL/glu.h],, if test x$WIN32 = xyes then # autoconf library search macro doesn't find opengl32 on windows because it uses -# different name hashing, but it links fine; assume it's there +# different name hashing or something, but it links fine; assume it's there LIBS="$LIBS -lglu32 -lopengl32" else AC_SEARCH_LIBS([glEnable], [GL MesaGL],, @@ -257,24 +262,6 @@ AC_SEARCH_LIBS([alEnable], [openal OpenAL32],, [missing=yes echo "***** Missing libopenal ($website) *****"]) -##### libpng ##### -website="http://www.libpng.org/pub/png/libpng.html" -AC_CHECK_HEADERS([png.h],, - [missing=yes - echo "***** Missing libpng header ($website) *****"]) -AC_SEARCH_LIBS([png_sig_cmp], [png],, - [missing=yes - echo "***** Missing libpng ($website) *****"]) - -##### libvorbis ##### -website="http://www.xiph.org/downloads/" -AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],, - [missing=yes - echo "***** Missing vorbis headers ($website) *****"]) -AC_SEARCH_LIBS([ov_open], [vorbisfile],, - [missing=yes - echo "***** Missing libvorbisfile ($website) *****"]) - ##### liblua ##### website="http://www.lua.org/" AC_CHECK_HEADERS([lua.h],, @@ -284,9 +271,27 @@ AC_SEARCH_LIBS([lua_load], [lua],, [missing=yes echo "***** Missing liblua ($website) *****"]) +##### libpng ##### +website="http://www.libpng.org/pub/png/libpng.html" +PKG_CHECK_MODULES([PNG], [libpng], + [LIBS="$LIBS $PNG_LIBS" + CFLAGS="$CFLAGS $PNG_CFLAGS" + CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"], + [missing=yes + echo "***** Missing libpng ($website) *****"]) + +##### libvorbis ##### +website="http://www.xiph.org/downloads/" +PKG_CHECK_MODULES([VORBIS], [vorbisfile], + [LIBS="$LIBS $VORBIS_LIBS" + CFLAGS="$CFLAGS $VORBIS_CFLAGS" + CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"], + [missing=yes + echo "***** Missing libvorbisfile ($website) *****"]) + +##### GTK+ 2.0 ##### if test x$gtk = xyes then - ##### GTK+ 2.0 ##### website="http://www.gtk.org/" PKG_CHECK_MODULES([GTK], [gtk+-2.0], [LIBS="$LIBS $GTK_LIBS" @@ -296,9 +301,9 @@ then echo "***** Missing GTK+-2.0 ($website) *****"]) fi +##### QT4 ##### if test x$qt4 = xyes then - ##### QT4 ##### website="http://qt.nokia.com/" PKG_CHECK_MODULES([QT], [QtGui], [LIBS="$LIBS $QT_LIBS" @@ -308,15 +313,10 @@ then echo "***** Missing QT ($website) *****"]) fi -##### librt (optional) ##### -AC_SEARCH_LIBS([clock_gettime], [rt], - [AC_DEFINE([HAVE_CLOCK_GETTIME], 1, - [Define to 1 if you have the 'clock_gettime' function.])]) - if test x$missing == xyes then - AC_MSG_WARN([You may be missing some dependencies--see messages above.]) + AC_MSG_WARN([It looks like you're missing some dependencies--building may fail.]) fi diff --git a/src/Moof/Core.cc b/src/Moof/Core.cc index cc86a91..9002730 100644 --- a/src/Moof/Core.cc +++ b/src/Moof/Core.cc @@ -368,7 +368,9 @@ class Backend_ { public: - void init() + Backend_() : + mAlDevice(0), + mAlContext(0) { #if defined(_WIN32) || defined(__WIN32__) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) @@ -429,7 +431,6 @@ public: if (gRetainCount++ == 0) { gInstance = BackendP(new Backend_); - gInstance->init(); } } diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index ba17769..51e7ad8 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -160,7 +160,7 @@ private: break; case PNG_COLOR_TYPE_GRAY: - if (bpp < 8) png_set_gray_1_2_4_to_8(pngObj); + if (bpp < 8) png_set_expand(pngObj); break; case PNG_COLOR_TYPE_GRAY_ALPHA: -- 2.44.0 From 4f9eb9259092994de9690cf12f11437c35a6791e Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Thu, 21 Jan 2010 16:20:16 -0700 Subject: [PATCH 07/16] cleaned up interpolator classes --- data/yoinkrc | 5 +- src/GameLayer.cc | 4 +- src/GameState.hh | 2 +- src/Main.cc | 4 +- src/Main.hh | 2 +- src/Moof/Interpolator.hh | 259 +++++++++++---------------------------- src/Moof/Log.cc | 2 +- src/Moof/Video.cc | 11 +- src/TitleLayer.cc | 25 ++-- 9 files changed, 97 insertions(+), 217 deletions(-) diff --git a/data/yoinkrc b/data/yoinkrc index 36b6e58..13be9a7 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -50,8 +50,9 @@ resizable = true -- Set the screen resolution or size of the window. The value is an array -- with three number elements representing the width, height, and bits per -- pixel that make up the video mode. If the fullscreen option is set, the --- default behavior is to pick a native resolution. Otherwise, the game --- window will default to 800x600. +-- default behavior is to pick a native resolution. You can use the +-- videomode to override the default resolution. If the fullscreen option +-- is false, videomode will determine the size of the window. videomode = {800, 600} diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 493aa6c..6db27b1 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -124,8 +124,8 @@ GameLayer::GameLayer() : mState.heroine = Heroine::alloc(); mState.heroine->animation.startSequence("FlyDiagonallyUp"); - Mf::Scalar a[6] = {0.0, 1.5, -0.5, 3.0, -2.0, 1.0}; - mState.interp.init(a, 5.0, Mf::Interpolator::OSCILLATE); + mState.interp.init(0.0, 1.0); + mState.interp.reset(4.0, Mf::Interp::OSCILLATE); setProjection(); } diff --git a/src/GameState.hh b/src/GameState.hh index f69a6b0..bc59eaf 100644 --- a/src/GameState.hh +++ b/src/GameState.hh @@ -53,7 +53,7 @@ struct GameState HeroineP heroine; SceneP scene; - Mf::PolynomialInterpolator<5> interp; + Mf::Lerp interp; Mf::Camera camera; }; diff --git a/src/Main.cc b/src/Main.cc index 2cd0f0c..510a9b1 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -53,7 +53,7 @@ Main::Main() { mDispatchHandler = Mf::core.addHandler("video.newcontext", - boost::bind(&Main::contextRecreated)); + boost::bind(&Main::contextCreated)); setupGL(); } @@ -195,7 +195,7 @@ void Main::setupGL() //glMatrixMode(GL_MODELVIEW); } -void Main::contextRecreated() +void Main::contextCreated() { // whenever the context is destroyed and a new one created, it probably // won't contain our state so we need to set that up again diff --git a/src/Main.hh b/src/Main.hh index 1e9ecc9..78d3b71 100644 --- a/src/Main.hh +++ b/src/Main.hh @@ -76,7 +76,7 @@ private: * Set OpenGL to a state we can know and depend on. */ static void setupGL(); - static void contextRecreated(); + static void contextCreated(); Mf::Dispatch::Handler mDispatchHandler; }; diff --git a/src/Moof/Interpolator.hh b/src/Moof/Interpolator.hh index 5c9f097..e49ac69 100644 --- a/src/Moof/Interpolator.hh +++ b/src/Moof/Interpolator.hh @@ -36,51 +36,7 @@ namespace Mf { -// TODO - cleanup these classes - -class Interpolator -{ - void clamp(Scalar& value) - { - if (value > 1.0) - { - switch (mMode) - { - case STOP: - value = 1.0; - mDone = true; - break; - case REPEAT: - value -= 1.0; - break; - case OSCILLATE: - value = 2.0 - value; - mScale *= -1.0; - break; - } - } - else if (value < 0.0) - { - switch (mMode) - { - case STOP: - value = 0.0; - mDone = true; - break; - case REPEAT: - value += 1.0; - break; - case OSCILLATE: - value = -value; - mScale *= -1.0; - break; - } - } - } - -public: - - virtual ~Interpolator() {} +namespace Interp { typedef enum { @@ -89,199 +45,128 @@ public: OSCILLATE = 2 } Mode; - void init(Scalar seconds = 1.0, Mode mode = STOP) +} // namespace Interp + + +template +class Interpolator : public T +{ +public: + + Interpolator(Scalar t = 1.0, Interp::Mode mode = Interp::STOP) { - mScale = 1.0 / seconds; - mAlpha = 0.0; - setMode(mode); + reset(t, mode); } - - void setMode(Mode mode) + void reset(Scalar t = 1.0, Interp::Mode mode = Interp::STOP) { + mAlpha = 0.0; + mScale = 1.0 / t; mMode = mode; - mDone = false; + mIsDone = false; } - void update(Scalar t, Scalar dt) { - if (!mDone) + if (!mIsDone) { + mPrevState = T::getValue(); mAlpha += dt * mScale; - clamp(mAlpha); - calculate(mAlpha); + clamp(); + if (mPrevState == T::calculate(mAlpha)) mIsDone = true; } } - bool isDone() const - { - return mDone; - } - - virtual void calculate(Scalar alpha) = 0; - -private: - - Scalar mAlpha; - Mode mMode; - Scalar mScale; - bool mDone; -}; - -template -class InterpolatorBase : public Interpolator -{ -public: - - virtual ~InterpolatorBase() {} - - void init(Scalar seconds = 1.0, Mode mode = STOP) + typename T::Type getState(Scalar alpha) const { - Interpolator::init(seconds, mode); - - calculate(0.0); // set value - mPrevious = mValue; + return cml::lerp(mPrevState, T::getValue(), alpha); } - void calculate(Scalar alpha) - { - mPrevious = mValue; - calculate(mValue, alpha); - } - - virtual void calculate(T& value, Scalar alpha) = 0; - - const T& getValue() const - { - return mValue; - } - - const T getState(Scalar alpha) const + bool isDone() const { - return cml::lerp(mPrevious, mValue, alpha); + return mIsDone; } private: - T mValue; - T mPrevious; -}; - - -template -class PolynomialInterpolator : public InterpolatorBase -{ -public: - - PolynomialInterpolator() {} - - PolynomialInterpolator(const T coefficients[D+1], - Scalar seconds = 1.0, Interpolator::Mode mode = Interpolator::STOP) - { - init(coefficients, seconds, mode); - } - - void init(const T coefficients[D+1], Scalar seconds = 1.0, - Interpolator::Mode mode = Interpolator::STOP) + void clamp() { - Scalar fac[D+1]; - - fac[0] = 1.0; - fac[1] = 1.0; - - // build an array of the computed factorials we will need - for (int i = 2; i <= D; ++i) + if (mAlpha > 1.0) { - fac[i] = i * fac[i - 1]; - } - - // combine the coefficients for fast updating - for (int i = 0; i <= D; ++i) - { - // n! / (k! * (n - k)!) - mCoefficients[i] = coefficients[i] * fac[D] / (fac[i] * fac[D - i]); + switch (mMode) + { + case Interp::STOP: + mAlpha = SCALAR(1.0); + break; + case Interp::REPEAT: + mAlpha -= SCALAR(1.0); + break; + case Interp::OSCILLATE: + mAlpha = SCALAR(2.0) - mAlpha; + mScale = -mScale; + break; + } } - - InterpolatorBase::init(seconds, mode); - } - - - void calculate(T& value, Scalar alpha) - { - Scalar beta = 1.0 - alpha; - - value = mCoefficients[0] * std::pow(beta, D); - - for (int i = 1; i <= D; ++i) + else if (mAlpha < 0.0) { - value += mCoefficients[i] * std::pow(beta, D - i) * - std::pow(alpha, i); + switch (mMode) + { + case Interp::STOP: + mAlpha = SCALAR(0.0); + break; + case Interp::REPEAT: + mAlpha += SCALAR(1.0); + break; + case Interp::OSCILLATE: + mAlpha = -mAlpha; + mScale = -mScale; + break; + } } } -private: + Scalar mAlpha; + Scalar mScale; + Interp::Mode mMode; + bool mIsDone; - T mCoefficients[D+1]; + typename T::Type mPrevState; }; -// specialized linear interpolator - -template -class PolynomialInterpolator<1,T> : public InterpolatorBase +template +class Linear { public: - PolynomialInterpolator() {} + typedef T Type; - PolynomialInterpolator(const T coefficients[2], Scalar seconds = 1.0, - Interpolator::Mode mode = Interpolator::STOP) - //InterpolatorBase(seconds, mode) + void init(const Type& a, const Type& b) { - init(coefficients, seconds, mode); + mStart = a; + mFinish = b; } - void init(const T coefficients[2], Scalar seconds = 1.0, - Interpolator::Mode mode = Interpolator::STOP) + const Type& calculate(Scalar alpha) { - mA = coefficients[0]; - mB = coefficients[1]; - - InterpolatorBase::init(seconds, mode); + mState = cml::lerp(mStart, mFinish, alpha); + return mState; } - - void calculate(T& value, Scalar alpha) + const Type& getValue() const { - value = cml::lerp(mA, mB, alpha); + return mState; } private: - T mA; - T mB; + Type mState; + Type mStart; + Type mFinish; }; -// Here are some aliases for more common interpolators. Also see the -// interpolation functions in cml for other types of interpolation such as -// slerp and some multi-alpha interpolators. - -typedef PolynomialInterpolator<1> Lerp; // linear -typedef PolynomialInterpolator<1,Vector2> Lerp2; -typedef PolynomialInterpolator<1,Vector3> Lerp3; -typedef PolynomialInterpolator<1,Vector4> Lerp4; - -typedef PolynomialInterpolator<2> Qerp; // quadratic -typedef PolynomialInterpolator<2,Vector2> Qerp2; -typedef PolynomialInterpolator<2,Vector3> Qerp3; -typedef PolynomialInterpolator<2,Vector4> Qerp4; - -typedef PolynomialInterpolator<3> Cerp; // cubic -typedef PolynomialInterpolator<3,Vector2> Cerp2; -typedef PolynomialInterpolator<3,Vector3> Cerp3; -typedef PolynomialInterpolator<3,Vector4> Cerp4; +typedef Interpolator< Linear > Lerp; } // namespace Mf diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc index 783aec5..863ab87 100644 --- a/src/Moof/Log.cc +++ b/src/Moof/Log.cc @@ -40,7 +40,7 @@ Log::Level Log::gLevel = Log::INFO; void Log::setLevel(Level level) { - if (level != 0) gLevel = level; + gLevel = level; } Log::Level Log::getLevel() diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 9e74acb..62addb4 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -131,15 +131,12 @@ void Video::setVideoMode(const long mode[3]) mAttribs.mode[1] = mode[1]; mAttribs.mode[2] = mode[2]; -#if defined(_WIN32) || defined(__WIN32__) - // on win32, creating a new context via SDL_SetVideoMode will wipe - // out the GL state, so we gotta notify everyone to reload their - // state after the change - core.dispatch("video.newcontext"); +#if !defined(linux) && !defined(__linux) && !defined(__linux__) logInfo("video context recreated"); + core.dispatch("video.newcontext"); #endif } - else throw Error(Error::SDL_VIDEOMODE); + else Error(Error::SDL_VIDEOMODE).raise(); } } @@ -383,8 +380,6 @@ Video::Attributes::Attributes() } else { - while (*(modes + 1)) ++modes; // skip to the last - mode[0] = (*modes)->w; mode[1] = (*modes)->h; Mf::logInfo << "choosing native resolution " diff --git a/src/TitleLayer.cc b/src/TitleLayer.cc index 9c60913..afe13e9 100644 --- a/src/TitleLayer.cc +++ b/src/TitleLayer.cc @@ -36,15 +36,15 @@ void TitleLayer::addedToCore() { - Mf::Scalar coeff[] = {0.0, 1.0}; - mFadeIn.init(coeff, 0.1); + mFadeIn.init(0.0, 1.0); + mFadeIn.reset(0.1); mGameLayer = GameLayer::alloc(); } void TitleLayer::update(Mf::Scalar t, Mf::Scalar dt) { - if (!mFadeIn.isDone()) mFadeIn.update(t, dt); + mFadeIn.update(t, dt); } void TitleLayer::draw(Mf::Scalar alpha) const @@ -58,21 +58,20 @@ bool TitleLayer::handleEvent(const Mf::Event& event) switch (event.type) { case SDL_KEYUP: - //if (event.key.keysym.sym == SDLK_ESCAPE) - //{ - //break; - //} + if (event.key.keysym.sym == SDLK_ESCAPE) + { + break; + } Mf::LayerP titleLayer = Mf::core.pop(this); - //core.pushLayer(GameLayer::alloc()); - Mf::Scalar coeff[] = {0.0, 0.75, 0.99, 1.0}; - Mf::PolynomialInterpolator<3> interp(coeff, 0.1); + Mf::Lerp interp(0.1); + interp.init(0.0, 1.0); - //Mf::LayerP mGameLayer = GameLayer::alloc(); - Mf::Transition >::Ptr transition = - Mf::Transition >::alloc(mGameLayer, titleLayer, interp); + Mf::Transition::Ptr transition = + Mf::Transition::alloc(mGameLayer, titleLayer, interp); Mf::core.push(transition); + return true; } -- 2.44.0 From e973a129b5b83b628ba3f09e8c95682fc74080cd Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 23 Jan 2010 18:14:26 -0700 Subject: [PATCH 08/16] library class revamped as manager, goodbye tilemap --- data/scenes/Classic.lua | 11 +- data/textures/AlienWarrior.png | Bin 11985 -> 3694 bytes data/textures/BackgroundFar.png | Bin 7707 -> 7824 bytes data/textures/BackgroundNear.png | Bin 18076 -> 17779 bytes data/textures/BigExplosion.png | Bin 11305 -> 4880 bytes data/textures/Bonuses.png | Bin 9207 -> 1649 bytes data/textures/Building.png | Bin 8781 -> 2517 bytes data/textures/Font.png | Bin 19065 -> 5694 bytes data/textures/Heroine.png | Bin 14129 -> 3967 bytes data/textures/Jetbot.png | Bin 9634 -> 1489 bytes data/textures/Particles.png | Bin 2387 -> 1452 bytes data/textures/RobotTrooper.png | Bin 12162 -> 2688 bytes data/textures/Scenery.png | Bin 6872 -> 1280 bytes data/textures/StatusBars.png | Bin 5267 -> 414 bytes data/textures/TowerBlock1.png | Bin 7866 -> 1373 bytes data/textures/Trees.png | Bin 1128 -> 1247 bytes data/tilemaps/AlienWarrior.lua | 4 - data/tilemaps/BackgroundFar.lua | 6 - data/tilemaps/BackgroundNear.lua | 6 - data/tilemaps/BigExplosion.lua | 6 - data/tilemaps/Bonuses.lua | 6 - data/tilemaps/Building.lua | 6 - data/tilemaps/Font.lua | 4 - data/tilemaps/Heroine.lua | 4 - data/tilemaps/Jetbot.lua | 4 - data/tilemaps/Particles.lua | 6 - data/tilemaps/RobotTrooper.lua | 4 - data/tilemaps/Scenery.lua | 6 - data/tilemaps/StatusBars.lua | 4 - data/tilemaps/TowerBlock1.lua | 6 - data/tilemaps/Trees.lua | 6 - src/Animation.cc | 38 ++---- src/Character.cc | 7 +- src/Character.hh | 4 +- src/Hud.cc | 6 +- src/Hud.hh | 8 +- src/Makefile.am | 4 +- src/Moof/Core.cc | 42 ++----- src/Moof/Core.hh | 3 +- src/Moof/Error.hh | 7 +- src/Moof/Image.cc | 66 ++++++----- src/Moof/Image.hh | 10 +- src/Moof/Library.hh | 121 ------------------- src/Moof/Sound.cc | 85 +++++++++++--- src/Moof/Texture.cc | 196 ++++++++++++++++++++++--------- src/Moof/Texture.hh | 50 +++++++- src/Moof/Video.cc | 45 ++++--- src/Moof/Video.hh | 47 +++----- src/Scene.cc | 26 ++-- src/Tilemap.cc | 189 ----------------------------- src/Tilemap.hh | 110 ----------------- src/TilemapFont.cc | 8 +- src/TilemapFont.hh | 6 +- 53 files changed, 405 insertions(+), 762 deletions(-) delete mode 100644 data/tilemaps/AlienWarrior.lua delete mode 100644 data/tilemaps/BackgroundFar.lua delete mode 100644 data/tilemaps/BackgroundNear.lua delete mode 100644 data/tilemaps/BigExplosion.lua delete mode 100644 data/tilemaps/Bonuses.lua delete mode 100644 data/tilemaps/Building.lua delete mode 100644 data/tilemaps/Font.lua delete mode 100644 data/tilemaps/Heroine.lua delete mode 100644 data/tilemaps/Jetbot.lua delete mode 100644 data/tilemaps/Particles.lua delete mode 100644 data/tilemaps/RobotTrooper.lua delete mode 100644 data/tilemaps/Scenery.lua delete mode 100644 data/tilemaps/StatusBars.lua delete mode 100644 data/tilemaps/TowerBlock1.lua delete mode 100644 data/tilemaps/Trees.lua delete mode 100644 src/Moof/Library.hh delete mode 100644 src/Tilemap.cc delete mode 100644 src/Tilemap.hh diff --git a/data/scenes/Classic.lua b/data/scenes/Classic.lua index 2ec9e02..10ba6a2 100644 --- a/data/scenes/Classic.lua +++ b/data/scenes/Classic.lua @@ -1,10 +1,9 @@ --- Scene: Classic Yoink --- created by Neil Carter --- converted to Lua by Charles McGarvey - -LogInfo("-----", "Scene: Classic", "Created by Neil Carter", - "Converted to Lua by Charles McGarvey", "-----") +LogInfo("-----", + "Scene: Classic", + "Created by Neil Carter", + "Converted to Lua by Charles McGarvey", + "-----") -- Scene API: -- diff --git a/data/textures/AlienWarrior.png b/data/textures/AlienWarrior.png index ece94d08932ef3ffadec3113e823a074e7df9d12..c93ee69e9891c01c1303b4c16a82cb380047b263 100644 GIT binary patch delta 163 zcmcZ@`%Y$p3KwH>kh>GZx^prwCz@&2Gq9I<`ns~;ViaW&wYr?v)5pNT;9KGvQ4*3` zQBqoz>Y108&rp(?lUf{KtYE8P!3ANL0NEy7xtV$KX_+}CsYO7ppQ~e#Yj6lxZeluy upi~*B6$1nBR8JSjkcwMxWACoj+0L8B|L(x%nezR-oD80>elF{r5}E*JZ#NbI delta 8497 zcmai(WmFtN)2MOx;1F0Gg1ZC_P6(1f2oPlPMHhDl4Z$rq1cv~@-6c4S1z!RLcL^F` zflJ zb03`#Zg0V!AgGIz6~x{W&jDhIHi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CrND>EVV8q(9!)hq&T6hOBH|aYp60%a3ZK+5y zT;ld(#d*z-;ZB4&A&`Dyia95N=4?yzaZv1guh-sbuYNQAP;pz-4w}kmA_)@BZA|bS zLP0f0nY8ec@A^QFAwB$RYCW(5+m$(pf%Q-+E}2+Aw$bkIyji($fnR}bL;E0&-Rc}* zETUXeW++&{a_n_Bau4A7hd~(fDe#O!_6Uvw(g-HMhCzsr(u!O!O*qxVZLU4^DQqTG zi?!=>CILs`xH^FN6)Z5(xb0D2N*}r!$Q$l zWegr?;d0MqaG&^eD z6GHZ1#KpULZQ5HGHUEk-dWME*(EOCt}2}!LeDJ@F%%uCB>D9Ox8Esif%uvIYR zg0M@#?A*+}__WNNlGGv~*T>V()iH=GH!&SUth^|(0Ic2F$I&-{3(N(X0Osc0of Hu~`-X;ASpn delta 21 dcmbPWJKJVL9M?@A76CQ>KL!h~Y`nW!764bb2+05d diff --git a/data/textures/BackgroundNear.png b/data/textures/BackgroundNear.png index fd30b7f7a9ef352b9a9c0a1ad14bd1c72bba411e..94e674727402fd7b3e35973b0ccc320dc7afcc32 100644 GIT binary patch delta 152 zcmbQ!%lNsAal<>2dWP&0*NBpk)QXbQqEyekw0wq=%$(HX_+kZH1w$?fy9CV6&CH8W z%giZBEdp|VJpEi9gSc`N(=o)#ixLaK+JjsJTpdHWzKiC3rig-I;mYoPXFKImgb+z#5i7H~-6I=v+2eLYA{GHlF`Zx| z_yB?m@hPnG79v6#U%)-VSXkIh^_%(6%;#0%Zc=!juTJ^e3L5X~N>fJ}rR*L1luS zl4TRuC$7~!yR8~s%k_w+^*RYr{M$(@Qg57fDVLRT34Et?}G4o-- d0}r+x7DN~acI4PwvOh6%LA7!mJ|49$zX0DZj3EF3 diff --git a/data/textures/BigExplosion.png b/data/textures/BigExplosion.png index 6bfc83792b0bf5d78c030219551b28bfa5b1a8e3..58bfe0df355a512a928548a6a83d6fddb4dddcfb 100644 GIT binary patch delta 173 zcmZ1(F+pvD3KwH>kh>GZx^prwCz@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1p?}orDR7Mnj{7lgO58>%*1NE^0JRk^C z)~=QiS`9l_sH>-)s~fE_7Y}rYGWnUN{~sFqd`nNL#q%@p93Or#FE5w}M9VAqFFt|- zZ}LP`pXs;%XkQCARaLO8tCiPtSfEO>2p0degRP$(wFbNWw+*n6jRil%N?3q{lb6Rr qgp-%oT7=V*NBCLr3kV8WTUiPU34$tN4<65Y5tQWAWNW0&L;n}9FX;CG diff --git a/data/textures/Building.png b/data/textures/Building.png index 43a458653a99f05ddd2f5d9c08480d6fdcdde8fd..5cb2a63f4d7c0e118f01ea9bd48d1cf3ec98b763 100644 GIT binary patch delta 173 zcmX@>a#eVO3KwH>kh>GZx^prwCz@&2Gq9I<`ns~;ViaYO5DKo1vSeUj$S!e>C<#fe zC@C#U^~_7lXDG?cNiB{qRkE3q@7nln&gA>fR51KP~^LFvK9GncEu6{1-oD!M75Xe9w3D720V1B(vd3CrS}*>1tNsr zdyx*IN)?2M=Z<^dhj+(#bFBRzbMEn5Ypy-_T3_ZUb+2+9$GzJqgn}IiL;$+BKu|a* z|8YD&4{%?^_oX3H$I6Qh;qGc{?*wN<`XJzJlGgUlAdvUew!gZIV^ula;zOg-LiP|s zIi9#=e|7#-XlDB}JO{K7yg;zBu;ApVdtXIIJzthZuc=boF#msKThc5qpqx&o3)a-wPlub7kbghMS^ zkl^lPvAP_KqD1+Lsi7~U9U~Fx#>((;D(>&`AIlUGNuP>UK8BNoJ2f{-?iCcEyu1pl z0f}R{Oc_`}M&*4m&HFNDjZ9PjuBcic=R6Hljc|T5|BZfxPetts1WlDOA&goKCXb2@ zDHdp17Z#|Frd?!u?_|`Z%|n--5osiC#9;pXG2B>s^1#`7#rl<6*ND$v?rZzSsX6p9 z>$ANVfs2YO*0_nUBO%=rT_Xb>QyVZPpz>4_ZCaAiTFH8Hc0L-#NB)VQ86z0bzpS~s zj~Vc?G3PHx4u(QQTTb8h2TxCLIZpo78!$3=YMhWg?fRL1ug18dN%%wV4_sfa-_biL_4hZt0v_{ER~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!Uqzc_)PbTTr>9vA?VN+O5xl%@j~s z-CaAk4R&!o>U^A)?6+y|=Pqm}ixPU1@48Cv@& z-;v&IU?ClagKnS9vSk*2z--WpgXwv?%h!vZ9_BbRHIg6uiFZD?w0o^u*dHfNeR8y_=EX} zKoPr^dlc_oLG$XK?-Y%_e#8L7e+gpcVPoNC!(shTJo~r&g*n~}aPSD}a`S-rghAZ= z|GJ>}?S(f?)CoBs@K{2XjSnht(8&W5rM5E~ay2UnM8+&n@78(-G{zl_oUi`ku1 zsrkqJk7EenYVBa_|NrATgXy{GKMT_TJbO9V+JY>c-Rv!%dAnG6db(OU{F}9P0`tq} ze+bF{A|9^3o*ZsA9vq%t9u98LxCN?+qyPRRX#SV*bhY*J1uQ&lo=I7|TG~)++PiwW zdfL0XQ44au_u7A({*R{pU)t;6YkGQF{LA`(0pbO{7Y6ZgQ*-nGiw=leSoc1F;2*8> zAMI!1rltmxb+z*T7Z)!j*=H92jSjN@H&JVl+yCPOWMyk3Xk#J7A;4i{&CScf&225n mA;iyT&0%G2DfHgfQqWeAN0_9eq2u4U&y?iUW$UCrg#BNAS=1!} diff --git a/data/textures/Heroine.png b/data/textures/Heroine.png index aff328252d9a81d75ef84b2d774e994caa9c7a46..b08bf9ac34e1162634d947661d59c770a53a70c2 100644 GIT binary patch delta 163 zcmdm(_g`*;3KwH>kh>GZx^prwCz@&2Gq9I<`ns~;ViaYORpZ|mb&`RB!MDUUq9i1> zqNKDa)iWf*WeJY+{APY uL8&rMD+UI>Wu7jMAr-gY#yYOkvF1IS_K#=t3$+D&oD80>elF{r5}E)a-!>=! delta 10383 zcmajFWl&u~^X`iVcMlTWAvha%cMI-pe6w*2Vc{M$1a}QC!QI_0SRg=fx8NM!|E>Gp zx^+&~>8kbA%&gx`_nNAn53~A}qSh&%78k|SS;7Ve1{UVc0$?KO*>4lrnE)CIUu`{i zO>-|wXIH4Tog{9)XfVH)^8*lzwGaB!uAz|NZB#TQ6~p zpYIIojL2um!Mes{xX5qw%i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zSQ$<~q0m;PGaO8WW0CLSG9%_~gD9V_N{iu6Pbt&h@`6{gW8R8KVDtEcR^<%pBYTA> z@nsF%(ITzUrQ1)JumaTv%A@>jHK!m||!bUYZ9 z03p6-j6V>WtHehE&?0)=_S$ym28`pOo_xl`tLKq%7hpFTJ5w(n;! zBoycN5D8o*OeHM!?<4o+Ee;UM?j+Emw^2w0C#d+tF z>!7e)edoY%VQ(7X5yWF5z3r5Sy=Ek6v|1DeQSGHl;TBob(K+=WRYk@%ht|SO2SO&J zWe2;y?jvQRPFFqclzknw9LAk|9nu;zIfuKY2FcP=WvMu1BIRX5C6fgCSqsV0*2ei( zofGrQPIt&Rxg~_jzeuLVZwk1C(goNZYBtg7t<(8i+5tfGCFo@1W#|jly-f;~fUz5# z{)w+*l*E;v>mJ#{Vth`7og-!Eh@ooK&B1>V7RgW;AYvig~8f<%#q;nh3qYteia-NQ9Ec8e14Ht#=yu>rdUd1h_e)-DF%z z0wPt!4H+<0Mo!rRA_r5r0fQ)#Oc)qEk{v=zDm0!yFSvzzB4DPTp>96bI-W>3-#|~4 zF9@o@*9QIb1L^-DHvfx2pia)0=t#&vX^|*bz!MSn|K!b*AXEK!P_!ok0dw~8^Kb?Q z`8o#%qFg*lYj#b#O3_3@xc@BeA0z-35-8*679bOd4)F8?L7>%KaeE{}_&-D-3V{xB z4glOhTCOO#n~L#PHK#pOwHLAP{Gbn3O8qW%RW!dFWG diff --git a/data/textures/TowerBlock1.png b/data/textures/TowerBlock1.png index 67ec31b637cd1c6ae9bcc73865fa6dd2402bb2e6..677aa21ac9accdd6d5c1f6225bf3433e3c88be35 100644 GIT binary patch delta 173 zcmdmGdzWj13KwH>kh>GZx^prwCz@&2Gq9I<`ns~;ViaYOk-4yPlNAF4Lw1R4L`g_$ zMM-H6n7$ qMTrGq1Dt&veFM0_T#y-@V7_lO*Tl`UB}!R189ZJ6T-G@yGywo5n>Qu^ delta 6715 zcmai&2T)W`lfcOcNJf(6oK|+pEFf93AUU(-MS&$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Go2~QDVZ4zx{b8oK0fjm64^~smFR5#_ah{*lO0*@yM){ZXJ*^;9r+nFurU!sg=AeYZg`9aVr)y>$!t?k?1KZJ$|?l z=0vjVo`E-N8Bt2U`@Ycq6wRj@4o~ngp@e@?E7GmY83jOam9$@|yI|`NN`V!F^zwnq zLa2O~X+Q?fKlr%huI0PPyED~v(eSfYJHBW0Wp^J&2?xze?gFeoC_A^H?TPbb_%qAK z8n!x~h}im5o?7v1cEQh^D|qWRIP@gvsBfktfAu!LxU;wZ@T_IQJ}ys&J#%}^avF$$ z%N|1tNa{vS4}zhz?U zVQ=ka53;*g829&I5(E|l2}$TfgrFjlP>AULD-;YKNb`MgUstq$1MK~r9H2T*e)i7B zN=`2JuAWW^R}6@dL;$*M;eRtG|AW~W)hNGb{*~ATK-f7s`2RndQ@Jsv?;~jbX7+M& zaDZAnyTPq7yj`t5JrTA}_q(=><-tbYBh>#vJP^K~AUAstkf)c2lN$y^tmIMD!9BtH zAHoyi;N=Tgd)Q;h+aYZ1S#;nCFN7x?;l?8V1njlN@cy1=`w#7P|Cyd%*7vo4e?Y=e zu;jh4fWc7Vdl3oIB=@|hHU83m)^1u_P$h(|_x-tesVQMt|6LtwcfV0PsM~+%fQsAN zN(u>EgCHP#VS5`81Y#!+vT?X~I7o;&2w7W;h(a7B_}YTk?$^aoQ+}>gr2q^2FJ|oG AivR!s diff --git a/data/textures/Trees.png b/data/textures/Trees.png index f665ff6c444135ee45c422b2b522be5d27f1824f..fc9fc35189de544451170532449a06e610bb2e91 100644 GIT binary patch delta 140 zcmaFCai4QST>ULZQ5GrHo8RVcVPIg$E^&=02}!LeDJ@F%%uCB>D9Ox8Esif%uvIYP zg0M?~Y(uWx%)I!t%$$ #include -#include +#include #include #include @@ -47,7 +47,7 @@ class Animation::Impl { - friend class Animation; +public: /** * Contains "global" animation data for the various animations which get @@ -55,10 +55,9 @@ class Animation::Impl * which wants to use these loaded sequences. */ - class Data : public Mf::Library + class Data : public Mf::Manager { - friend class Impl; - friend class Mf::Library; + public: /** * A frame of an animation sequence. A frame is merely an index which @@ -68,7 +67,7 @@ class Animation::Impl class Frame { - friend class Impl; + public: unsigned mIndex; ///< Frame index. Mf::Scalar mDuration; ///< Frame duration. @@ -98,9 +97,9 @@ class Animation::Impl * that they should be played. */ - struct Sequence + class Sequence { - friend class Impl; + public: std::vector mFrames; ///< List of frames. Mf::Scalar mDelay; ///< Scale frame durations. @@ -161,10 +160,10 @@ class Animation::Impl * individual sequence. */ - void loadFromFile() + void init(const std::string& name) { Mf::Script script; - std::string filePath = Animation::getPath(getName()); + std::string filePath = Animation::getPath(name); script.importBaseLibrary(); importLogFunctions(script); @@ -186,7 +185,7 @@ class Animation::Impl std::string nameStr; name.get(nameStr); - sequences.insert(std::pair(nameStr, + mSequences.insert(std::pair(nameStr, Sequence(script, table))); return 0; @@ -208,18 +207,7 @@ class Animation::Impl } - /** - * Construction is initialization. The animation class data container - * registers itself as a mippleton and then loads the animation data. - */ - - explicit Data(const std::string& name) : - Mf::Library(name) - { - loadFromFile(); - } - - std::map sequences; ///< List of sequences. + std::map mSequences; ///< List of sequences. }; @@ -246,9 +234,9 @@ class Animation::Impl { std::map::iterator it; - it = mData->sequences.find(name); + it = mData->mSequences.find(name); - if (it != mData->sequences.end()) + if (it != mData->mSequences.end()) { mCurrentSequence = &(*it).second; mFrameCounter = 0; diff --git a/src/Character.cc b/src/Character.cc index 9da4344..2290e3c 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -126,11 +126,10 @@ void Character::draw(Mf::Scalar alpha) const //glColor3f(1.0f, 1.0f, 1.0f); tilemap.bind(); - Tilemap::Index frame = animation.getFrame(); + Mf::Texture::TileIndex frame = animation.getFrame(); + Mf::Texture::Orientation orientation = Mf::Texture::NORMAL; - Tilemap::Orientation orientation = Tilemap::NORMAL; - - if (mState.velocity[0] < 0.0) orientation = Tilemap::REVERSE; + if (mState.velocity[0] < 0.0) orientation = Mf::Texture::REVERSE; Mf::Scalar coords[8]; tilemap.getTileCoords(frame, coords, orientation); diff --git a/src/Character.hh b/src/Character.hh index 6507906..82804ba 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -36,9 +36,9 @@ #include #include #include +#include #include "Animation.hh" -#include "Tilemap.hh" @@ -67,7 +67,7 @@ public: //virtual int getOctant(const Mf::Aabb<3>& aabb) const; - Tilemap tilemap; + Mf::Texture tilemap; Animation animation; }; diff --git a/src/Hud.cc b/src/Hud.cc index 1fdf39b..f8f40d9 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -33,7 +33,7 @@ #include "Hud.hh" -ProgressBar::ProgressBar(const Tilemap& tilemap, Tilemap::Index index) : +ProgressBar::ProgressBar(const Mf::Texture& tilemap, Mf::Texture::TileIndex index) : mProgress(0.0), mTilemap(tilemap) { @@ -120,8 +120,8 @@ void ProgressBar::draw(Mf::Scalar alpha) const Hud::Hud(GameState& state) : mState(state), - mBar1(Tilemap("StatusBars"), 0), - mBar2(Tilemap("StatusBars"), 2), + mBar1(Mf::Texture("StatusBars"), 0), + mBar2(Mf::Texture("StatusBars"), 2), mFont("Font") { ASSERT(Mf::video && "no current video context from which to get dimensions"); diff --git a/src/Hud.hh b/src/Hud.hh index 75ced92..2262b06 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -38,9 +38,9 @@ #include #include #include +#include #include "GameState.hh" -#include "Tilemap.hh" // TODO this stuff is still just hacked up @@ -49,7 +49,7 @@ class ProgressBar : public Mf::Drawable { public: - ProgressBar(const Tilemap& tilemap, Tilemap::Index index); + ProgressBar(const Mf::Texture& tilemap, Mf::Texture::TileIndex index); void resize(const Mf::Rectangle& rect); @@ -64,7 +64,7 @@ private: Mf::Vector2 mVertices[8]; Mf::Scalar mWidth; - Tilemap mTilemap; + Mf::Texture mTilemap; Mf::Scalar mTexCoords[8]; Mf::Scalar mMidCoords[2]; }; @@ -112,7 +112,7 @@ private: ProgressBar mBar2; unsigned mNumber; - Tilemap mFont; + Mf::Texture mFont; Mf::Matrix4 mProjection; }; diff --git a/src/Makefile.am b/src/Makefile.am index 3c3fc53..58b3111 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,10 +35,10 @@ libmoof_a_SOURCES = \ Moof/Image.hh \ Moof/Interpolator.hh \ Moof/Layer.hh \ - Moof/Library.hh \ Moof/Line.hh \ Moof/Log.cc \ Moof/Log.hh \ + Moof/Manager.hh \ Moof/Math.hh \ Moof/ModalDialog.hh \ Moof/Octree.hh \ @@ -100,8 +100,6 @@ yoink_SOURCES = \ Main.hh \ Scene.cc \ Scene.hh \ - Tilemap.cc \ - Tilemap.hh \ TilemapFont.cc \ TilemapFont.hh \ TitleLayer.cc \ diff --git a/src/Moof/Core.cc b/src/Moof/Core.cc index 9002730..190f4c8 100644 --- a/src/Moof/Core.cc +++ b/src/Moof/Core.cc @@ -32,7 +32,6 @@ #include #include -#include #include #include "fastevents.h" @@ -368,9 +367,7 @@ class Backend_ { public: - Backend_() : - mAlDevice(0), - mAlContext(0) + Backend_() { #if defined(_WIN32) || defined(__WIN32__) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) @@ -397,31 +394,11 @@ public: return; // fatal } - mAlDevice = alcOpenDevice(0); - mAlContext = alcCreateContext(mAlDevice, 0); - if (!mAlDevice || !mAlContext) - { - const char* error = alcGetString(mAlDevice,alcGetError(mAlDevice)); - gError.init(Error::OPENAL_INIT, error); - return; - } - else - { - alcMakeContextCurrent(mAlContext); - logInfo << "opened sound device `" - << alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) - << "'" << std::endl; - } - gError.init(Error::NONE); } ~Backend_() { - alcMakeContextCurrent(0); - alcDestroyContext(mAlContext); - alcCloseDevice(mAlDevice); - FE_Quit(); SDL_Quit(); } @@ -443,17 +420,13 @@ public: } } - static bool check(Error& error) + static const Error& getError() { - error = gError; - return error.code() == Error::NONE; + return gError; } private: - ALCdevice* mAlDevice; - ALCcontext* mAlContext; - static Error gError; static int gRetainCount; static BackendP gInstance; @@ -474,9 +447,14 @@ Backend::~Backend() Backend_::release(); } -bool Backend::check(Error& error) +bool Backend::isInitialized() +{ + return getError().code() == Error::NONE; +} + +const Error& Backend::getError() { - return Backend_::check(error); + return Backend_::getError(); } diff --git a/src/Moof/Core.hh b/src/Moof/Core.hh index fcb0340..109999a 100644 --- a/src/Moof/Core.hh +++ b/src/Moof/Core.hh @@ -100,7 +100,8 @@ public: Backend(); ~Backend(); - static bool check(Error& error); + static bool isInitialized(); + static const Error& getError(); }; diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh index 05c6377..c452ae6 100644 --- a/src/Moof/Error.hh +++ b/src/Moof/Error.hh @@ -57,7 +57,7 @@ public: UNKNOWN_IMAGE_FORMAT, // name of resource }; - explicit Error(unsigned code, const std::string& what = "") + explicit Error(unsigned code = NONE, const std::string& what = "") { init(code, what); } @@ -70,7 +70,7 @@ public: mCode = code; } - virtual void raise() + virtual void raise() const { throw *this; } @@ -85,8 +85,9 @@ public: return mWhat; } - bool isError() const throw() + operator bool () const { + // resolves to true if error code is not NONE return mCode != NONE; } diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index 51e7ad8..ee44dd7 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -29,30 +29,28 @@ #include // FILE #include // strncmp +#include + #include #include #include "Core.hh" #include "Error.hh" #include "Image.hh" -#include "Library.hh" #include "Log.hh" +#include "Manager.hh" namespace Mf { -class Image::Impl : public Library +class Image::Impl : public Manager { public: - explicit Impl(const std::string& name, bool flipped = false) : - Library(name), + explicit Impl() : mContext(0), - mPixels(0) - { - init(getName(), flipped); - } + mPixels(0) {} ~Impl() { @@ -89,23 +87,12 @@ public: } - SDL_Surface* mContext; - char* mPixels; - - unsigned mDepth; - GLuint mColorMode; - - std::string mComment; - - -private: - - Backend mBackend; - - bool init(const std::string& filePath, bool flipped) + bool init(const std::string& name, bool flipped = false) { - logInfo("opening image file..."); - FILE* fp = fopen(filePath.c_str(), "rb"); + std::string path = Image::getPath(name); + + logInfo << "opening image file " << path << std::endl; + FILE* fp = fopen(path.c_str(), "rb"); if (!fp) return false; png_byte signature[8]; @@ -185,7 +172,7 @@ private: logInfo << "num texts: " << numTexts << std::endl; for (int i = 0; i < numTexts; ++i) { - if (strncmp(texts[i].key, "Comment", 7) == 0) + if (strncmp(texts[i].key, "TextureInfo", 11) == 0) { mComment = texts[i].text; break; @@ -248,6 +235,19 @@ private: return mContext; } + + + SDL_Surface* mContext; + char* mPixels; + + unsigned mDepth; + GLuint mColorMode; + + std::string mComment; + +private: + + Backend mBackend; }; @@ -281,7 +281,7 @@ unsigned Image::getPitch() const return mImpl->mContext->pitch; } -GLuint Image::getColorMode() const +GLuint Image::getMode() const { return mImpl->mColorMode; } @@ -315,11 +315,19 @@ void Image::setAsIcon() const } - std::string Image::getPath(const std::string& name) { - std::string path = Resource::getPath("images/" + name + ".png"); - return path; + if (boost::find_last(name, ".png")) + { + return Resource::getPath(name); + } + else + { + std::string path("images/"); + path += name; + path += ".png"; + return Resource::getPath(path); + } } diff --git a/src/Moof/Image.hh b/src/Moof/Image.hh index 5f7c5a3..e958edc 100644 --- a/src/Moof/Image.hh +++ b/src/Moof/Image.hh @@ -38,10 +38,18 @@ namespace Mf { +class Image; +typedef boost::shared_ptr ImageP; + class Image : public Resource { public: + static ImageP alloc(const std::string& name) + { + return ImageP(new Image(name)); + } + explicit Image(const std::string& name); bool isValid() const; @@ -51,7 +59,7 @@ public: unsigned getDepth() const; unsigned getPitch() const; - GLuint getColorMode() const; + GLuint getMode() const; std::string getComment() const; diff --git a/src/Moof/Library.hh b/src/Moof/Library.hh deleted file mode 100644 index c215567..0000000 --- a/src/Moof/Library.hh +++ /dev/null @@ -1,121 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _MOOF_LIBRARY_HH_ -#define _MOOF_LIBRARY_HH_ - -/** - * @file Library.hh - * A library is a collection of named objects of the same type. Libraries use - * reference counting to automagically delete objects which no longer have any - * interested code. - */ - -#include - -#include - -#include - - -namespace Mf { - - -template -class Library -{ - typedef std::pair PtrValue; - typedef stlplus::hash PtrMap; - - static PtrMap mPtrMap; - std::string mName; - - static T* retain(const std::string& name) - { - typename PtrMap::iterator it = mPtrMap.find(name); - - if (it != mPtrMap.end()) - { - ++((*it).second.first); - return (*it).second.second; - } - else - { - T* newObj(new T(name)); - if (newObj) - { - mPtrMap.insert(std::make_pair(name, std::make_pair(1, newObj))); - } - return newObj; - } - } - - static void release(T* obj) - { - releaseByName(obj->mName); - } - - static void releaseByName(const std::string& name) - { - typename PtrMap::iterator it; - - if ((it = mPtrMap.find(name)) != mPtrMap.end() && - --(*it).second.first == 0) - { - delete (*it).second.second; - mPtrMap.erase((*it).first); - } - } - -public: - - explicit Library(const std::string& name) : - mName(name) {} - - const std::string& getName() const - { - return mName; - } - - static boost::shared_ptr getInstance(const std::string& name) - { - return boost::shared_ptr(retain(name), &release); - } -}; - -template -stlplus::hash< std::string,std::pair,getHash > - Library::mPtrMap; - - -} // namespace Mf - -#endif // _MOOF_LIBRARY_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index ca3ecfe..f8f05ba 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -31,13 +31,15 @@ #include #include +#include + #include +#include #include #include -#include "Core.hh" #include "Error.hh" -#include "Library.hh" +#include "Manager.hh" #include "Log.hh" #include "Sound.hh" #include "Timer.hh" @@ -62,16 +64,14 @@ public: class Buffer; typedef boost::shared_ptr BufferP; - class Buffer : public Library + class Buffer : public Manager { public: - explicit Buffer(const std::string& name) : - Library(name), + Buffer() : mBuffer(-1) { mOggStream.datasource = 0; - openFile(); } ~Buffer() @@ -84,7 +84,7 @@ public: } - void openFile() + void init(const std::string& name) { if (mOggStream.datasource) { @@ -92,14 +92,13 @@ public: mOggStream.datasource = 0; } - std::string filePath = Sound::getPath(getName()); - int result = ov_fopen((char*)filePath.c_str(), &mOggStream); + std::string path = Sound::getPath(name); + int result = ov_fopen((char*)path.c_str(), &mOggStream); if (result < 0) { - logWarning << "error while loading sound " - << getName() << std::endl; - throw Error(Error::UNKNOWN_AUDIO_FORMAT, getName()); + logWarning << "couldn't load sound: " << path << std::endl; + throw Error(Error::UNKNOWN_AUDIO_FORMAT, path); } vorbis_info* vorbisInfo = ov_info(&mOggStream, -1); @@ -110,7 +109,7 @@ public: void loadAll(ALuint source) { - if (!mOggStream.datasource) openFile(); + if (!mOggStream.datasource) init(getName()); if (!mOggStream.datasource) return; char data[BUFFER_SIZE]; @@ -180,7 +179,7 @@ public: void rewind() { - if (!mOggStream.datasource) openFile(); + if (!mOggStream.datasource) init(getName()); else ov_raw_seek(&mOggStream, 0); } @@ -207,6 +206,8 @@ public: void init() { + retainBackend(); + mIsLoaded = false; mIsPlaying = false; mIsLooping = false; @@ -233,6 +234,8 @@ public: alDeleteBuffers(1, &mBuffers.back()); mBuffers.pop_back(); } + + releaseBackend(); } @@ -426,6 +429,39 @@ public: // than a timer, probably as a compile-time option } + static void retainBackend() + { + if (gRetainCount++ == 0) + { + gAlDevice = alcOpenDevice(0); + gAlContext = alcCreateContext(gAlDevice, 0); + if (!gAlDevice || !gAlContext) + { + const char* error = alcGetString(gAlDevice, + alcGetError(gAlDevice)); + logError << "audio subsystem initialization failure: " + << error << std::endl; + } + else + { + alcMakeContextCurrent(gAlContext); + logInfo << "opened sound device `" + << alcGetString(gAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) + << "'" << std::endl; + } + } + } + + static void releaseBackend() + { + if (--gRetainCount == 0) + { + alcMakeContextCurrent(0); + alcDestroyContext(gAlContext); + alcCloseDevice(gAlDevice); + } + } + ALuint mSource; std::list mBuffers; @@ -438,9 +474,15 @@ public: Timer mStreamTimer; - Backend mBackend; + static unsigned gRetainCount; + static ALCdevice* gAlDevice; + static ALCcontext* gAlContext; }; +unsigned Sound::Impl::gRetainCount = 0; +ALCdevice* Sound::Impl::gAlDevice = 0; +ALCcontext* Sound::Impl::gAlContext = 0; + Sound::Sound() : // pass through @@ -550,8 +592,17 @@ void Sound::setListenerOrientation(const Vector3& forward, const Vector3& up) std::string Sound::getPath(const std::string& name) { - std::string path = Resource::getPath("sounds/" + name + ".ogg"); - return path; + if (boost::find_last(name, ".ogg")) + { + return Resource::getPath(name); + } + else + { + std::string path("sounds/"); + path += name; + path += ".ogg"; + return Resource::getPath(path); + } } diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 5341af3..801acba 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -29,15 +29,15 @@ #include // FILE #include // strncmp +#include #include #include "Dispatch.hh" -#include "Core.hh" #include "Error.hh" -#include "Image.hh" -#include "Library.hh" +#include "Manager.hh" #include "Log.hh" #include "OpenGL.hh" +#include "Script.hh" #include "Texture.hh" #include "Video.hh" @@ -50,11 +50,11 @@ namespace Mf { * which is worth having in memory. The image data itself is not worth keeping * in memory if the texture has been loaded to GL, but the name of the resource * is retained so that it can be reloaded if necessary. The implementation is a - * library so that multiple texture objects can share the same internal objects + * manager so that multiple texture objects can share the same internal objects * and avoid having duplicate textures loaded to GL. */ -class Texture::Impl : public Library +class Texture::Impl : public Manager { /** @@ -103,33 +103,40 @@ class Texture::Impl : public Library return value; } + + static void bindScriptConstants(Mf::Script& script) + { + script.push(GL_CLAMP); script.set("CLAMP"); + script.push(GL_REPEAT); script.set("REPEAT"); + script.push(GL_LINEAR); script.set("LINEAR"); + script.push(GL_NEAREST); script.set("NEAREST"); + script.push(GL_LINEAR_MIPMAP_LINEAR); script.set("LINEAR_MIPMAP_LINEAR"); + script.push(GL_LINEAR_MIPMAP_NEAREST); script.set("LINEAR_MIPMAP_NEAREST"); + script.push(GL_NEAREST_MIPMAP_LINEAR); script.set("NEAREST_MIPMAP_LINEAR"); + script.push(GL_NEAREST_MIPMAP_NEAREST); script.set("NEAREST_MIPMAP_NEAREST"); + } + public: /** * Construction is initialization. */ - explicit Impl(const std::string& name) : - Library(name), - //mContext(0), - mImage(Texture::getPath(getName())), - mWidth(0), - mHeight(0), - mMode(0), + Impl() : mMinFilter(GL_NEAREST), mMagFilter(GL_NEAREST), mWrapS(GL_CLAMP), mWrapT(GL_CLAMP), + mTilesS(1), + mTilesT(1), mObject(0) { // make sure we have a video context - //ASSERT(video && "cannot load textures without a current video context"); + ASSERT(video && "cannot load textures without a current video context"); // we want to know when the GL context is recreated mDispatchHandler = core.addHandler("video.newcontext", boost::bind(&Impl::contextRecreated, this)); - - loadFromFile(); } ~Impl() @@ -214,19 +221,55 @@ public: * @return Image data. */ - void loadFromFile() + void init(const std::string& name) { - if (!mImage.isValid()) + std::string path = Texture::getPath(name); + + mImage = Image::alloc(path); + if (!mImage->isValid()) + { + logWarning << "texture not found: " << path << std::endl; + Error(Error::RESOURCE_NOT_FOUND, path).raise(); + } + + mImage->flip(); + + Mf::Script script; + + importLogFunctions(script); + bindScriptConstants(script); + + if (script.doString(mImage->getComment()) != Mf::Script::SUCCESS) { - logWarning << "texture not found: " << getName() << std::endl; - throw Error(Error::RESOURCE_NOT_FOUND, getName()); + std::string str; + script[-1].get(str); + Mf::logWarning(str); } + else + { + Mf::logInfo << "loading tiles from texture " << path << std::endl; + + Mf::Script::Slot globals = script.getGlobalTable(); + Mf::Script::Slot top = script[-1]; - mImage.flip(); + globals.pushField("tiles_s"); + top.get(mTilesS); - mWidth = mImage.getWidth(); - mHeight = mImage.getHeight(); - mMode = mImage.getColorMode(); + globals.pushField("tiles_t"); + top.get(mTilesT); + + globals.pushField("min_filter"); + top.get(mMinFilter); + + globals.pushField("mag_filter"); + top.get(mMagFilter); + + globals.pushField("wrap_s"); + top.get(mWrapS); + + globals.pushField("wrap_t"); + top.get(mWrapT); + } } @@ -243,8 +286,6 @@ public: return; } - //if (!mContext) loadFromFile(); - glGenTextures(1, &mObject); glBindTexture(GL_TEXTURE_2D, mObject); @@ -253,20 +294,17 @@ public: ( GL_TEXTURE_2D, 0, - mMode, + mImage->getMode(), //3, - mWidth, - mHeight, + mImage->getWidth(), + mImage->getHeight(), 0, - mMode, + mImage->getMode(), GL_UNSIGNED_BYTE, - mImage.getPixels() + mImage->getPixels() ); setProperties(); - - //SDL_FreeSurface(mContext); - //mContext = 0; } @@ -326,15 +364,35 @@ public: } - Image mImage; - unsigned mWidth; ///< Horizontal dimension of the image. - unsigned mHeight; ///< Vertical dimension. + bool getTileCoords(Texture::TileIndex index, Scalar coords[8]) const + { + // make sure the index represents a real tile + if (index >= mTilesS * mTilesT) return false; + + Scalar w = 1.0 / Scalar(mTilesS); + Scalar h = 1.0 / Scalar(mTilesT); + + coords[0] = Scalar(index % mTilesS) * w; + coords[1] = (Scalar(mTilesT - 1) - + Scalar(index / mTilesS)) * h; + coords[2] = coords[0] + w; + coords[3] = coords[1]; + coords[4] = coords[2]; + coords[5] = coords[1] + h; + coords[6] = coords[0]; + coords[7] = coords[5]; + + return true; + } + + ImageP mImage; - GLuint mMode; ///< GL_RGB or GL_RGBA. - GLuint mMinFilter; ///< Minifcation filter. + GLuint mMinFilter; ///< Minification filter. GLuint mMagFilter; ///< Magnification filter. GLuint mWrapS; ///< Wrapping behavior horizontally. GLuint mWrapT; ///< Wrapping behavior vertically. + unsigned mTilesS; + unsigned mTilesT; GLuint mObject; ///< GL texture handle. static GLuint gObject; ///< Global GL texture handle. @@ -346,6 +404,7 @@ GLuint Texture::Impl::gObject = 0; Texture::Texture(const std::string& name) : + Image(Texture::getPath(name)), // pass through mImpl(Texture::Impl::getInstance(name)) {} @@ -379,19 +438,6 @@ void Texture::resetBind() } -unsigned Texture::getWidth() const -{ - // pass through - return mImpl->mWidth; -} - -unsigned Texture::getHeight() const -{ - // pass through - return mImpl->mHeight; -} - - void Texture::setMinFilter(GLuint filter) { // pass through @@ -417,10 +463,54 @@ void Texture::setWrapT(GLuint wrap) } +bool Texture::getTileCoords(TileIndex index, Scalar coords[8]) const +{ + // pass through + return mImpl->getTileCoords(index, coords); +} + +bool Texture::getTileCoords(TileIndex index, Scalar coords[8], + Orientation orientation) const +{ + if (getTileCoords(index, coords)) + { + if (orientation & FLIP) + { + // this looks kinda weird, but it's just swapping in a way that + // doesn't require an intermediate variable + coords[1] = coords[5]; + coords[5] = coords[3]; + coords[3] = coords[7]; + coords[7] = coords[5]; + } + if (orientation & REVERSE) + { + coords[0] = coords[2]; + coords[2] = coords[6]; + coords[4] = coords[6]; + coords[6] = coords[0]; + } + + return true; + } + + return false; +} + + std::string Texture::getPath(const std::string& name) { - std::string path = Resource::getPath("textures/" + name + ".png"); - return path; + if (boost::find_last(name, ".png")) + { + return Resource::getPath(name); + } + else + { + std::string path("textures/"); + path += name; + path += ".png"; + return Resource::getPath(path); + } } diff --git a/src/Moof/Texture.hh b/src/Moof/Texture.hh index 4e311ea..41add2b 100644 --- a/src/Moof/Texture.hh +++ b/src/Moof/Texture.hh @@ -36,8 +36,8 @@ #include +#include #include -#include namespace Mf { @@ -47,10 +47,26 @@ class Texture; typedef boost::shared_ptr TextureP; -class Texture : public Resource +class Texture : public Image { public: + /** + * Possible orientations for texture coordinates. + */ + + typedef unsigned TileIndex; + static const TileIndex NO_TILE = -1; + + typedef enum + { + NORMAL = 0, ///< Normal orientation. + FLIP = 1, ///< Flip over a horizontal axis. + REVERSE = 2, ///< Flip over a vertical axis. + FLIP_AND_REVERSE = 3 ///< Flip over both. + } Orientation; + + static TextureP alloc(const std::string& name) { return TextureP(new Texture(name)); @@ -63,14 +79,38 @@ public: static void resetBind(); - unsigned getWidth() const; - unsigned getHeight() const; - void setMinFilter(GLuint filter); void setMagFilter(GLuint filter); void setWrapS(GLuint wrap); void setWrapT(GLuint wrap); + + /** + * Calculate texture coordinates for a tile at a certain index. Tiles are + * indexed start with zero as the to-left tile and moving across, then down. + * @param index The tile index. + * @param coords An array of scalars where the texture coordinates will be + * stored after this call. The first coordinate (u,v) will be in the first + * two places and so on until all four coordinates are stored, therefore + * requiring enough room for an array of eight scalars. The winding of the + * coordinates is always counter-clockwise (the GL default). + * @return True if index is valid, false otherwise. + */ + + bool getTileCoords(TileIndex index, Scalar coords[8]) const; + + + /** + * This version let's you specify an orientation that will be reflected in + * the texture coordinates. This allows you to easily map a texture + * backwards or upside-down. + * @param what The orientation; can be flip, reverse, or flip_and_reverse. + * @return True if index is valid, false otherwise. + */ + + bool getTileCoords(TileIndex index, Scalar coords[8], Orientation what) const; + + static std::string getPath(const std::string& name); private: diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 62addb4..e071609 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -39,42 +39,39 @@ namespace Mf { Video::Video() { - init(mAttribs); + init(); } -Video::Video(const Attributes& attribs) +Video::Video(const Attributes& attribs) : + mAttribs(attribs) { - init(attribs); + init(); } Video::Video(const std::string& caption, const std::string& icon) { - if (mAttribs.caption == "Untitled") - { - mAttribs.caption = caption; - } - if (mAttribs.icon == "") - { - mAttribs.icon = icon; - } + mAttribs.caption = caption; + mAttribs.icon = icon; - init(mAttribs); + init(); } -void Video::init(const Attributes& attribs) +void Video::init() { + Error error = Backend::getError(); + if (error) error.raise(); + mContext = 0; mFlags = 0; - mAttribs = attribs; - setFull(attribs.fullscreen); - setResizable(attribs.resizable); + setFull(mAttribs.fullscreen); + setResizable(mAttribs.resizable); setOpenGLAttributes(); - setCaption(attribs.caption); + setCaption(mAttribs.caption); setIcon(); - setCursorVisible(attribs.cursorVisible); - setCursorGrab(attribs.cursorGrab); - setVideoMode(attribs.mode); + setCursorVisible(mAttribs.cursorVisible); + setCursorGrab(mAttribs.cursorGrab); + setVideoMode(mAttribs.mode); video = this; } @@ -104,7 +101,7 @@ void Video::setOpenGLAttributes() SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, mAttribs.multisampleBuffers); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mAttribs.multisampleSamples); SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, mAttribs.swapControl); - SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, mAttribs.hardwareonly); + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, mAttribs.hardwareOnly); } @@ -312,7 +309,7 @@ Video::Attributes::Attributes() multisampleBuffers = 0; multisampleSamples = 0; swapControl = false; - hardwareonly = false; + hardwareOnly = false; mode[0] = 640; mode[1] = 480; mode[2] = 0; @@ -344,7 +341,7 @@ Video::Attributes::Attributes() settings.get("multiesamplebuffers", multisampleBuffers); settings.get("multiesamplesamples", multisampleSamples); settings.get("swapcontrol", swapControl); - settings.get("hardwareonly", hardwareonly); + settings.get("hardwareonly", hardwareOnly); if (!settings.get("caption", caption)) { @@ -364,7 +361,7 @@ Video::Attributes::Attributes() mode[0] = dimensions[0]; mode[1] = dimensions[1]; } - else if (fullscreen) + else if (fullscreen && Backend::isInitialized()) { SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); diff --git a/src/Moof/Video.hh b/src/Moof/Video.hh index 0199bc5..0cc1a4e 100644 --- a/src/Moof/Video.hh +++ b/src/Moof/Video.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=8 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_VIDEO_HH_ #define _MOOF_VIDEO_HH_ @@ -62,7 +45,7 @@ public: long multisampleBuffers; long multisampleSamples; bool swapControl; - bool hardwareonly; + bool hardwareOnly; // Window attributes std::string caption; @@ -77,11 +60,13 @@ public: private: - Backend backend; + Backend mBackend; + }; - static VideoP alloc(const std::string& caption, const std::string& icon) + static VideoP alloc(const std::string& caption, + const std::string& icon) { return VideoP(new Video(caption, icon)); } @@ -125,7 +110,7 @@ public: private: - void init(const Attributes& attribs); + void init(); void recreateContext(); void setOpenGLAttributes(); @@ -147,5 +132,3 @@ extern Video* video; #endif // _MOOF_VIDEO_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Scene.cc b/src/Scene.cc index aa2249c..45fc3a0 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -31,20 +31,20 @@ #include #include #include -#include +#include #include #include #include //#include #include #include +#include #include "Character.hh" #include "Scene.hh" -#include "Tilemap.hh" -struct Scene::Impl : public Mf::Library +struct Scene::Impl : public Mf::Manager { struct Quad : public Mf::Entity { @@ -57,7 +57,7 @@ struct Scene::Impl : public Mf::Library }; Quad(const Mf::Vector3* vertices[4], const std::string& texture, - Tilemap::Index tileIndex) : + Mf::Texture::TileIndex tileIndex) : mTilemap(texture), mBlending(false), mFog(false), @@ -143,7 +143,7 @@ struct Scene::Impl : public Mf::Library Mf::Vector3 mVertices[4]; Mf::Scalar mTexCoords[8]; - Tilemap mTilemap; + Mf::Texture mTilemap; bool mBlending; bool mFog; @@ -170,8 +170,8 @@ struct Scene::Impl : public Mf::Library }; - explicit Impl(const std::string& name) : - Mf::Library(name) {} + void init(const std::string& name) {} + void importSceneBindings(Mf::Script& script) { @@ -372,7 +372,7 @@ struct Scene::Impl : public Mf::Library table.pushField(i); - Tilemap::Index index; + Mf::Texture::TileIndex index; top.get(index); script.pop(); @@ -380,7 +380,7 @@ struct Scene::Impl : public Mf::Library vertices[h][wPlus1] = Mf::demote(mTransform * Mf::Vector4(wPlus1, h, 0.0, 1.0)); - if (index == Tilemap::NO_TILE) continue; + if (index == Mf::Texture::NO_TILE) continue; const Mf::Vector3* corners[4] = { &vertices[h][w], @@ -425,10 +425,10 @@ struct Scene::Impl : public Mf::Library Mf::Script::Slot param = script[1]; Mf::Script::Slot top = script[-1]; - Tilemap::Index index = 0; - int width = 1; - bool blending = false; - bool fog = false; + Mf::Texture::TileIndex index = 0; + int width = 1; + bool blending = false; + bool fog = false; if (param.isTable()) { diff --git a/src/Tilemap.cc b/src/Tilemap.cc deleted file mode 100644 index dc3785a..0000000 --- a/src/Tilemap.cc +++ /dev/null @@ -1,189 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include -#include -#include - -#include "Tilemap.hh" - - -struct Tilemap::Impl : public Mf::Library -{ - Impl(const std::string& name) : - Mf::Library(name), - mMagFilter(GL_NEAREST), - mMinFilter(GL_NEAREST), - mTilesS(1), - mTilesT(1), - mWrapS(GL_CLAMP), - mWrapT(GL_CLAMP) - { - loadFromFile(); - } - - - static void bindScriptConstants(Mf::Script& script) - { - script.push(GL_CLAMP); script.set("CLAMP"); - script.push(GL_REPEAT); script.set("REPEAT"); - script.push(GL_LINEAR); script.set("LINEAR"); - script.push(GL_NEAREST); script.set("NEAREST"); - script.push(GL_LINEAR_MIPMAP_LINEAR); script.set("LINEAR_MIPMAP_LINEAR"); - script.push(GL_LINEAR_MIPMAP_NEAREST); script.set("LINEAR_MIPMAP_NEAREST"); - script.push(GL_NEAREST_MIPMAP_LINEAR); script.set("NEAREST_MIPMAP_LINEAR"); - script.push(GL_NEAREST_MIPMAP_NEAREST); script.set("NEAREST_MIPMAP_NEAREST"); - } - - void loadFromFile() - { - Mf::Script script; - std::string filePath = Tilemap::getPath(getName()); - - script.importStandardLibraries(); - importLogFunctions(script); - bindScriptConstants(script); - - if (script.doFile(filePath) != Mf::Script::SUCCESS) - { - std::string str; - script[-1].get(str); - Mf::logWarning(str); - return; // TODO needs a better exit strategy - } - - Mf::logInfo << "loading tiles from tilemap " << filePath << std::endl; - - Mf::Script::Slot globals = script.getGlobalTable(); - Mf::Script::Slot top = script[-1]; - - globals.pushField("tiles_s"); - top.get(mTilesS); - - globals.pushField("tiles_t"); - top.get(mTilesT); - - globals.pushField("min_filter"); - top.get(mMinFilter); - - globals.pushField("mag_filter"); - top.get(mMagFilter); - - globals.pushField("wrap_s"); - top.get(mWrapS); - - globals.pushField("wrap_t"); - top.get(mWrapT); - } - - - bool getTileCoords(Tilemap::Index index, Mf::Scalar coords[8]) const - { - // make sure the index represents a real tile - if (index >= mTilesS * mTilesT) return false; - - Mf::Scalar w = 1.0 / Mf::Scalar(mTilesS); - Mf::Scalar h = 1.0 / Mf::Scalar(mTilesT); - - coords[0] = Mf::Scalar(index % mTilesS) * w; - coords[1] = (Mf::Scalar(mTilesT - 1) - - Mf::Scalar(index / mTilesS)) * h; - coords[2] = coords[0] + w; - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = coords[1] + h; - coords[6] = coords[0]; - coords[7] = coords[5]; - - return true; - } - - - GLuint mMagFilter; - GLuint mMinFilter; - unsigned mTilesS; - unsigned mTilesT; - GLuint mWrapS; - GLuint mWrapT; -}; - - -Tilemap::Tilemap(const std::string& name) : - Texture(name), - mImpl(Tilemap::Impl::getInstance(name)) -{ - setMinFilter(mImpl->mMinFilter); - setMagFilter(mImpl->mMagFilter); - setWrapS(mImpl->mWrapS); - setWrapT(mImpl->mWrapT); -} - - -bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8]) const -{ - // pass through - return mImpl->getTileCoords(index, coords); -} - -bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8], - Orientation orientation) const -{ - if (getTileCoords(index, coords)) - { - if (orientation & FLIP) - { - // this looks kinda weird, but it's just swapping in a way that - // doesn't require an intermediate variable - coords[1] = coords[5]; - coords[5] = coords[3]; - coords[3] = coords[7]; - coords[7] = coords[5]; - } - if (orientation & REVERSE) - { - coords[0] = coords[2]; - coords[2] = coords[6]; - coords[4] = coords[6]; - coords[6] = coords[0]; - } - - return true; - } - - return false; -} - - -std::string Tilemap::getPath(const std::string& name) -{ - return Resource::getPath("tilemaps/" + name + ".lua"); -} - - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Tilemap.hh b/src/Tilemap.hh deleted file mode 100644 index 9277387..0000000 --- a/src/Tilemap.hh +++ /dev/null @@ -1,110 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _TILEMAP_HH_ -#define _TILEMAP_HH_ - -/** - * @file Tilemap.hh - * Small subclass to give some basic tile-mapping functionality to textures. - */ - -#include - -#include -#include - - -/** - * A tilemap is a texture which is meant to be divided into smaller sprites. - * This class provides all the functionality of a texture and adds some methods - * to get texture coordinates to individual tiles within the tilemap. For - * simplicity, this class assumes square tiles. - */ - -class Tilemap : public Mf::Texture -{ -public: - - /** - * Possible orientations for texture coordinates. - */ - - typedef unsigned Index; - static const Index NO_TILE = -1; - - typedef enum - { - NORMAL = 0, ///< Normal orientation. - FLIP = 1, ///< Flip over a horizontal axis. - REVERSE = 2, ///< Flip over a vertical axis. - FLIP_AND_REVERSE = 3 ///< Flip over both. - } Orientation; - - - explicit Tilemap(const std::string& name); - - /** - * Calculate texture coordinates for a tile at a certain index. Tiles are - * indexed start with zero as the to-left tile and moving across, then down. - * @param index The tile index. - * @param coords An array of scalars where the texture coordinates will be - * stored after this call. The first coordinate (u,v) will be in the first - * two places and so on until all four coordinates are stored, therefore - * requiring enough room for an array of eight scalars. The winding of the - * coordinates is always counter-clockwise (the GL default). - * @return True if index is valid, false otherwise. - */ - - bool getTileCoords(Index index, Mf::Scalar coords[8]) const; - - - /** - * This version let's you specify an orientation that will be reflected in - * the texture coordinates. This allows you to easily map a texture - * backwards or upside-down. - * @param what The orientation; can be flip, reverse, or flip_and_reverse. - * @return True if index is valid, false otherwise. - */ - - bool getTileCoords(Index index, Mf::Scalar coords[8], Orientation what) const; - - - static std::string getPath(const std::string& name); - -private: - - class Impl; - boost::shared_ptr mImpl; -}; - - -#endif // _TILEMAP_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/TilemapFont.cc b/src/TilemapFont.cc index da0e9a6..48b0fc3 100644 --- a/src/TilemapFont.cc +++ b/src/TilemapFont.cc @@ -32,13 +32,13 @@ TilemapFont::TilemapFont() : - Tilemap("Font") {} + Mf::Texture("Font") {} void TilemapFont::getTileCoords(char symbol, Mf::Scalar coords[8], - Tilemap::Orientation what) + Mf::Texture::Orientation what) { - Tilemap::Index index = 0; + Mf::Texture::TileIndex index = 0; if (symbol >= ' ' && symbol <= '_') { @@ -53,7 +53,7 @@ void TilemapFont::getTileCoords(char symbol, Mf::Scalar coords[8], index = 0; } - Tilemap::getTileCoords(index, coords, what); + Mf::Texture::getTileCoords(index, coords, what); } diff --git a/src/TilemapFont.hh b/src/TilemapFont.hh index 98a3a13..89cb062 100644 --- a/src/TilemapFont.hh +++ b/src/TilemapFont.hh @@ -34,17 +34,17 @@ * Text on the screen. */ -#include "Tilemap.hh" +#include -class TilemapFont : public Tilemap +class TilemapFont : public Mf::Texture { public: TilemapFont(); void getTileCoords(char symbol, Mf::Scalar coords[8], - Tilemap::Orientation what = Tilemap::NORMAL); + Mf::Texture::Orientation what = Mf::Texture::NORMAL); }; -- 2.44.0 From 81ff940d1bea07447f8218ab9a764fbf393431e8 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 23 Jan 2010 18:19:16 -0700 Subject: [PATCH 09/16] included manager class --- src/Moof/Manager.hh | 116 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 src/Moof/Manager.hh diff --git a/src/Moof/Manager.hh b/src/Moof/Manager.hh new file mode 100644 index 0000000..89c2076 --- /dev/null +++ b/src/Moof/Manager.hh @@ -0,0 +1,116 @@ + +/******************************************************************************* + + Copyright (c) 2009, Charles McGarvey + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#ifndef _MOOF_MANAGER_HH_ +#define _MOOF_MANAGER_HH_ + +/** + * @file Manager.hh + * A library is a collection of named objects of the same type. Libraries use + * reference counting to automagically delete objects which no longer have any + * interested code. + */ + +#include + +#include + +#include + + +namespace Mf { + + +template +class Manager +{ +public: + + Manager() : + mRetainCount(1) {} + + const std::string& getName() const + { + return mName; + } + + static boost::shared_ptr getInstance(const std::string& name) + { + return boost::shared_ptr(retain(name), &release); + } + +private: + + typedef stlplus::hash PtrMap; + + static PtrMap mPtrMap; + std::string mName; + unsigned mRetainCount; + + static T* retain(const std::string& name) + { + typename PtrMap::iterator it = mPtrMap.find(name); + + if (it != mPtrMap.end()) + { + ++((*it).second->mRetainCount); + return (*it).second; + } + else + { + T* newObj(new T); + if (newObj) + { + newObj->mName = name; + newObj->init(name); + mPtrMap.insert(std::make_pair(name, newObj)); + } + return newObj; + } + } + + static void release(T* obj) + { + if (--(obj->mRetainCount) == 0) + { + mPtrMap.erase(obj->mName); + delete obj; + } + } +}; + +template +stlplus::hash Manager::mPtrMap; + + +} // namespace Mf + +#endif // _MOOF_MANAGER_HH_ + +/** vim: set ts=4 sw=4 tw=80: *************************************************/ + -- 2.44.0 From 837bae9f2bf7b25e1d3d2625eeaf39c1d2f48827 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 23 Jan 2010 21:51:15 -0700 Subject: [PATCH 10/16] reformatting --- README | 68 ++++++++------ configure.ac | 18 ++-- data/scenes/Classic.lua | 20 ++--- data/yoinkrc | 4 +- doc/yoink.6.in | 26 +----- src/Animation.cc | 175 +++++++++++++++++------------------- src/Animation.hh | 47 +++------- src/Character.cc | 42 +++------ src/Character.hh | 40 +++------ src/ErrorHandler.cc | 40 +++------ src/ErrorHandler.hh | 37 ++------ src/GameLayer.cc | 50 ++++------- src/GameLayer.hh | 41 +++------ src/GameState.hh | 48 ++++------ src/Heroine.cc | 38 ++------ src/Heroine.hh | 37 ++------ src/Hud.cc | 44 +++------ src/Hud.hh | 37 ++------ src/Main.cc | 51 ++++------- src/Main.hh | 45 +++------- src/Makefile.am | 4 +- src/Moof/Aabb.cc | 39 ++------ src/Moof/Aabb.hh | 172 ++++++++++++++++++----------------- src/Moof/Camera.cc | 46 +++------- src/Moof/Camera.hh | 37 ++------ src/Moof/Core.cc | 73 ++++++--------- src/Moof/Core.hh | 67 ++++++-------- src/Moof/Cullable.hh | 37 ++------ src/Moof/Dispatch.cc | 52 ++++------- src/Moof/Dispatch.hh | 39 +++----- src/Moof/Drawable.hh | 37 ++------ src/Moof/Entity.hh | 44 +++------ src/Moof/Error.hh | 37 ++------ src/Moof/Event.hh | 48 ++++------ src/Moof/Frustum.cc | 68 ++++++-------- src/Moof/Frustum.hh | 39 +++----- src/Moof/Hash.cc | 40 +++------ src/Moof/Hash.hh | 40 +++------ src/Moof/Image.cc | 45 +++------- src/Moof/Image.hh | 37 ++------ src/Moof/Interpolator.hh | 37 ++------ src/Moof/Layer.hh | 37 ++------ src/Moof/Line.hh | 39 ++------ src/Moof/Log.cc | 47 ++++------ src/Moof/Log.hh | 47 ++++------ src/Moof/Manager.hh | 43 +++------ src/Moof/Math.hh | 45 +++------- src/Moof/ModalDialog.hh | 42 +++------ src/Moof/Octree.hh | 38 ++------ src/Moof/OpenGL.hh | 49 ++++------ src/Moof/Plane.cc | 37 ++------ src/Moof/Plane.hh | 52 ++++------- src/Moof/Ray.hh | 39 +++----- src/Moof/Rectangle.cc | 37 ++------ src/Moof/Rectangle.hh | 37 ++------ src/Moof/Resource.cc | 37 ++------ src/Moof/Resource.hh | 41 +++------ src/Moof/RigidBody.hh | 56 +++++------- src/Moof/Script.hh | 188 +++++++++++++++++++-------------------- src/Moof/Settings.cc | 46 +++------- src/Moof/Settings.hh | 37 ++------ src/Moof/Shape.hh | 47 +++------- src/Moof/Sound.cc | 62 +++++-------- src/Moof/Sound.hh | 41 +++------ src/Moof/Sphere.cc | 37 ++------ src/Moof/Sphere.hh | 74 ++++++--------- src/Moof/StringTools.cc | 40 +++------ src/Moof/StringTools.hh | 37 ++------ src/Moof/Texture.cc | 125 ++++++++++++-------------- src/Moof/Texture.hh | 65 ++++++-------- src/Moof/Thread.hh | 44 +++------ src/Moof/Timer.cc | 58 +++++------- src/Moof/Timer.hh | 57 +++++------- src/Moof/Transition.hh | 37 ++------ src/Moof/Video.cc | 96 ++++++++++---------- src/Moof/Video.hh | 3 +- src/Scene.cc | 56 +++++------- src/Scene.hh | 37 ++------ src/TilemapFont.cc | 38 ++------ src/TilemapFont.hh | 39 +++----- src/TitleLayer.cc | 41 +++------ src/TitleLayer.hh | 37 ++------ src/Typesetter.cc | 38 ++------ src/Typesetter.hh | 37 ++------ src/version.c | 38 ++------ src/version.h | 37 ++------ src/yoink.rc | 2 +- 87 files changed, 1384 insertions(+), 2779 deletions(-) diff --git a/README b/README index 3193449..bd05038 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ I. Users c) License II. Developers a) Notes regarding the code - b) Porting + b) Sending patches III. Packagers a) The build system b) Targeting Win32 @@ -21,9 +21,9 @@ I. Users a) General information -Yoink is a game originally developed by Neil Carter for Mac OS. You play -the part of a flying alien heroine who must defend her home on Earth from -other airborne alien invaders. +Yoink is a game created by Neil Carter for Mac OS. You play the part of a +flying alien heroine who must defend her home on Earth from other airborne +alien invaders. This version of the game uses all new code and modern frameworks to bring this simple, fast-moving action game to a wider audience. @@ -41,14 +41,14 @@ SDL c) License -The new code is released under the BSD-2 license. The old code and -original resources are provided under the zlib/libpng License. See COPYING -for complete details. The full texts of applicable licenses can be found -in doc/licenses/. +The new code is released under the 2-clause BSD license. The old code and +original resources are provided under the zlib/libpng License. See the +file COPYING for complete details. The full texts of applicable licenses +can be found in doc/licenses/. -II. Developer -------------- +II. Developers +-------------- a) Notes regarding the code @@ -65,9 +65,9 @@ This is the code directly in src/. These classes reside in no namespace. 2. Reusable code. Currently, the code is in src/Moof/, and it is compiled as a convenience -library. These classes and other helper functions reside in the Mf -namespace. Since I wrote this code alongside the Yoink-specific stuff, -there is somewhat of a blurry line between the two categories. +library. These classes and helper functions reside in the Mf namespace. +Since I wrote this code alongside the Yoink-specific stuff, there is +somewhat of a blurry line between the two categories, unfortunately. 3. 3rd-party code. @@ -76,12 +76,23 @@ the explicit dependencies above), the licenses of which are also in the COPYING file. This code resides in various namespaces and in various subdirectories. -b) Porting +b) Sending patches + +I'll gladly entertain patches if you want to fix bugs or whatnot. Just +email me your stuff or tell me where to pull from (git). If you're +interested in that, please observe the following: + +* Stick to the coding style of the source code files you edit. Follow the + general style of method and variable naming, as well as white spacing + formatting. In particular, use literal tabs with an assumed tabstop of + 4 characters. Also, limit line lengths to 75 characters. -Portability is a goal of this project. To this end, Yoink is written in -standard C++ and takes advantage of cross-platform libraries. If code -changes are required to cleanly build Yoink on your platform, please send -back patches. +* For legal reasons, don't include other peoples' code with your patch. + You must also agree to license your changes according to the same terms + and conditions as the files you edit, usually the 2-clause BSD license. + +* If you want to add your contact information to the file AUTHORS, please + just do it in the patch you provide. III. Packagers @@ -90,9 +101,9 @@ III. Packagers a) The build system You can probably tell that the build system of this package is built from -autoconf and automake. It should be fairly sane. If you find any -problems, especially any bugs which complicate packaging on certain -systems, please send back patches. +autoconf and automake. It should be fairly sane. If you find any build +system problems or code which doesn't compile cleanly on your platform, +feel free to send back patches. b) Targeting Win32 @@ -101,10 +112,13 @@ build a win32 binary using a command such as this: ./configure --host=mingw32 --prefix=/usr/mingw32/usr -where mingw32 is the correct name of your toolchain. You can get all the -non-standard dependencies from the git repository at win32/win32-libs.zip. -Just unzip the contents of that archive into your toolchain. If everything -goes smoothly, you should have a yoink.exe appropriate for the win32 -platform. You can then build a complete installer using "make package" if -you have nsis installed. +where mingw32 is the correct name of your toolchain and the prefix points +to the installation of your toolchain. I maintain an archive of most of +the dependencies. The package is in the git repository; just unzip it onto +your toolchain and configure/compile. If everything goes smoothly, you +should have a new, shiny yoink.exe. You can then build a complete +installer using "make package" if you have nsis installed. + +I haven't tried building with cygwin or mingw32 on an actual Windows +machine, let alone VS. You're on your own if you go that route. diff --git a/configure.ac b/configure.ac index 813b6b5..2f2bc1d 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE # # Checks for programs. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AC_PROG_CXX AC_PROG_CC @@ -34,7 +34,7 @@ AC_SUBST(DOXYGEN) # # Configure platform-specific stuff. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ case "${host}" in *mingw32*) @@ -62,7 +62,7 @@ AM_CONDITIONAL([WIN32], test "$WIN32" = "yes") # # Checks for configuration arguments. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AC_ARG_ENABLE([debug], [ --enable-debug include debugging symbols and features], @@ -165,7 +165,7 @@ AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"], # # Split the version number into components. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ VERSION_MAJOR=$(echo $VERSION | cut -d. -f1) VERSION_MINOR=$(echo $VERSION | cut -d. -f2) @@ -191,7 +191,7 @@ fi # # Checks for system functions/headers and compiler characteristics. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AC_C_STRINGIZE AC_C_INLINE @@ -218,7 +218,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt], # # Checks for build dependencies. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##### boost ##### website="http://www.boost.org/" @@ -322,7 +322,7 @@ fi # # Find the game resources to install. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DATA_FILES=$(echo $(cd data && find . -name "*.lua" \ -o -name "*.ogg" \ @@ -333,7 +333,7 @@ AC_SUBST([DATA_FILES]) # # Create the build files. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AC_CONFIG_FILES([Makefile data/Makefile @@ -354,7 +354,7 @@ AC_OUTPUT # # Print a friendly little message. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "" echo " Configuration complete! :-)" diff --git a/data/scenes/Classic.lua b/data/scenes/Classic.lua index 10ba6a2..fb4765f 100644 --- a/data/scenes/Classic.lua +++ b/data/scenes/Classic.lua @@ -25,7 +25,7 @@ SetBounds({-5, 0, -6}, {45, 15, 7}) -- Left end tower block --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Front @@ -89,7 +89,7 @@ DrawTilemap({ 3, 3, 3, 3, 3}) -- Leftmost background tower block --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Front @@ -139,7 +139,7 @@ if detail > LOW then end -- Foreground building with pitched roof --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Left wall @@ -211,7 +211,7 @@ DrawTilemap({ -1, -1, -1}) -- The ground --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Courtyard @@ -284,7 +284,7 @@ if detail > MEDIUM then end -- Background building with pitched roof --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Front wall @@ -360,7 +360,7 @@ if detail > LOW then end -- More ground to the right --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Ground under house @@ -625,7 +625,7 @@ DrawTilemap({ 0, 1, 1, 1, 1, 1, 1, -1, -1, -1}) -- Right foreground tower block --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Front @@ -690,7 +690,7 @@ DrawTilemap({ 3, 3, 3, 3, 3}) -- Right end tower block --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Front @@ -753,7 +753,7 @@ DrawTilemap({ 3, 3, 3, 3, 3}) -- Background --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ResetTransform() Translate(-0.3, -0.3, -35) @@ -768,7 +768,7 @@ DrawTile({ }) -- Trees --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SetTexture("Trees") diff --git a/data/yoinkrc b/data/yoinkrc index 13be9a7..de65603 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -1,6 +1,6 @@ -- Example Yoink Configuration File --- vim: ft=lua ts=4 +-- ex:ft=lua ts=4 sw=4 tw=75 print "loading default settings..." @@ -54,7 +54,7 @@ resizable = true -- videomode to override the default resolution. If the fullscreen option -- is false, videomode will determine the size of the window. -videomode = {800, 600} +--videomode = {800, 600} -- Set this to make the cursor remain visible as you mouse over the view of -- the game. diff --git a/doc/yoink.6.in b/doc/yoink.6.in index d3df203..57af5e9 100644 --- a/doc/yoink.6.in +++ b/doc/yoink.6.in @@ -1,29 +1,9 @@ .\" -.\" Copyright (c) 2009, Charles McGarvey +.\" Copyright (c) 2009-2010, Charles McGarvey .\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions are -.\" met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -.\" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" +.\" Distributable under the terms and conditions of the 2-clause BSD +.\" license; see the file COPYING for a complete text of the license. .\" .TH YOINK 6 "July 24, 2009" .SH NAME diff --git a/src/Animation.cc b/src/Animation.cc index 4779970..2a3d03a 100644 --- a/src/Animation.cc +++ b/src/Animation.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -37,12 +20,12 @@ /** - * The collection of nested animation classes. The animation implementation - * consists of an Impl class which is allocated and initialized with the - * interface object. This class contains the specific fields which are required - * to run a single instance of an animation. The sequence data is loaded in a - * different class which can be shared amongst multiple animation implementation - * instances. + * The collection of nested animation classes. The animation + * implementation consists of an Impl class which is allocated and + * initialized with the interface object. This class contains the specific + * fields which are required to run a single instance of an animation. The + * sequence data is loaded in a different class which can be shared amongst + * multiple animation implementation instances. */ class Animation::Impl @@ -50,9 +33,9 @@ class Animation::Impl public: /** - * Contains "global" animation data for the various animations which get - * loaded. This is a mippleton, so it will be shared amongst any animation - * which wants to use these loaded sequences. + * Contains "global" animation data for the various animations which + * get loaded. This is a mippleton, so it will be shared amongst any + * animation which wants to use these loaded sequences. */ class Data : public Mf::Manager @@ -60,9 +43,10 @@ public: public: /** - * A frame of an animation sequence. A frame is merely an index which - * presumably represents a "slide" or tile which should be displayed, - * and the duration that is how long the slide will be shown. + * A frame of an animation sequence. A frame is merely an index + * which presumably represents a "slide" or tile which should be + * displayed, and the duration that is how long the slide will be + * shown. */ class Frame @@ -73,8 +57,9 @@ public: Mf::Scalar mDuration; ///< Frame duration. /** - * Construction is initialization. The frame data is loaded from a - * frame map which is probably loaded within an animation file. + * Construction is initialization. The frame data is loaded + * from a frame map which is probably loaded within an + * animation file. */ Frame(Mf::Script& script, Mf::Script::Slot table) : @@ -93,24 +78,24 @@ public: /** - * A sequence is just a few attributes and a list of frames in the order - * that they should be played. + * A sequence is just a few attributes and a list of frames in the + * order that they should be played. */ class Sequence { public: - std::vector mFrames; ///< List of frames. - Mf::Scalar mDelay; ///< Scale frame durations. - bool mLoop; ///< Does the sequence repeat? - std::string mNext; ///< Next sequence name. + std::vector mFrames; ///< List of frames. + Mf::Scalar mDelay; ///< Scale frame durations. + bool mLoop; ///< Does the sequence repeat? + std::string mNext; ///< Next sequence name. /** - * Construction is initialization. The constructor loads sequence - * data from the sequence map, presumably loaded from an animation - * file. The rest of the loading takes place in the frame's - * constructor which loads each individual frame. + * Construction is initialization. The constructor loads + * sequence data from the sequence map, presumably loaded from + * an animation file. The rest of the loading takes place in + * the frame's constructor which loads each individual frame. */ Sequence(Mf::Script& script, Mf::Script::Slot table) : @@ -143,8 +128,11 @@ public: script.push(index); frameTable.pushField(); - if (top.isTable()) mFrames.push_back(Frame(script, top)); - else break; + if (top.isTable()) + { + mFrames.push_back(Frame(script, top)); + } + else break; ++index; } @@ -155,9 +143,9 @@ public: /** - * Starts loading a file with animation data. Such a file is formatted - * as a map of named sequences. The sequence constructor loads each - * individual sequence. + * Starts loading a file with animation data. Such a file is + * formatted as a map of named sequences. The sequence + * constructor loads each individual sequence. */ void init(const std::string& name) @@ -185,8 +173,8 @@ public: std::string nameStr; name.get(nameStr); - mSequences.insert(std::pair(nameStr, - Sequence(script, table))); + mSequences.insert(std::make_pair(nameStr, + Sequence(script, table))); return 0; } @@ -195,7 +183,8 @@ public: void importAnimationBindings(Mf::Script& script) { script.importFunction("DefineSequence", - boost::bind(&Data::defineSequence, this, _1)); + boost::bind(&Data::defineSequence, + this, _1)); script.push(1); script.set("ATTACK"); script.push(2); script.set("CHARGE"); @@ -207,7 +196,7 @@ public: } - std::map mSequences; ///< List of sequences. + std::map mSequences; ///< List of sequences. }; @@ -225,9 +214,9 @@ public: /** - * Sets up the animation classes to "play" a named sequence. If another - * sequence was active, it will be replaced. Future updates will progress - * the new sequence. + * Sets up the animation classes to "play" a named sequence. If + * another sequence was active, it will be replaced. Future updates + * will progress the new sequence. */ void startSequence(const std::string& name) @@ -243,7 +232,7 @@ public: mFrameIndex = mCurrentSequence->mFrames[0].mIndex; mTimeAccum = 0.0; mFrameDuration = mCurrentSequence->mDelay * - mCurrentSequence->mFrames[0].mDuration; + mCurrentSequence->mFrames[0].mDuration; } } @@ -251,42 +240,41 @@ public: * Updates or progresses the animation sequence. If the time interval * surpasses the duration of the current frame, a new frame becomes the * current frame. If the last frame of a sequence expires, the active - * sequence will switch automatically to the designated "next" sequence, or - * if none is specified but the sequence is set to loop, the first frame of - * the sequence will become the current frame, and the animation essentially - * starts over again. + * sequence will switch automatically to the designated "next" + * sequence, or if none is specified but the sequence is set to loop, + * the first frame of the sequence will become the current frame, and + * the animation essentially starts over again. */ void update(Mf::Scalar t, Mf::Scalar dt) { - if (mCurrentSequence) - { - mTimeAccum += dt; + if (!mCurrentSequence) return; + + mTimeAccum += dt; - if (mTimeAccum >= mFrameDuration) + if (mTimeAccum >= mFrameDuration) + { + if (++mFrameCounter >= mCurrentSequence->mFrames.size()) { - if (++mFrameCounter >= mCurrentSequence->mFrames.size()) + if (!mCurrentSequence->mNext.empty()) { - if (!mCurrentSequence->mNext.empty()) - { - startSequence(mCurrentSequence->mNext); - } - else if (mCurrentSequence->mLoop) - { - mFrameCounter = 0; - } - else - { - mFrameCounter--; - mCurrentSequence = 0; - } + startSequence(mCurrentSequence->mNext); + } + else if (mCurrentSequence->mLoop) + { + mFrameCounter = 0; + } + else + { + mFrameCounter--; + mCurrentSequence = 0; } - - mFrameIndex = mCurrentSequence->mFrames[mFrameCounter].mIndex; - mTimeAccum = mFrameDuration - mTimeAccum; - mFrameDuration = mCurrentSequence->mDelay * - mCurrentSequence->mFrames[mFrameCounter].mDuration; } + + mFrameIndex = mCurrentSequence->mFrames[mFrameCounter].mIndex; + mTimeAccum = mFrameDuration - mTimeAccum; + mFrameDuration = mCurrentSequence->mDelay * + mCurrentSequence->mFrames[mFrameCounter].mDuration; } } @@ -330,8 +318,8 @@ unsigned Animation::getFrame() const /** - * Specialized search location for animation files. They can be found in the - * "animations" subdirectory of any of the searched directories. + * Specialized search location for animation files. They can be found in + * the "animations" subdirectory of any of the search directories. */ std::string Animation::getPath(const std::string& name) @@ -339,6 +327,3 @@ std::string Animation::getPath(const std::string& name) return Mf::Resource::getPath("animations/" + name + ".lua"); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Animation.hh b/src/Animation.hh index 5cfd260..ac00679 100644 --- a/src/Animation.hh +++ b/src/Animation.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _ANIMATION_HH_ #define _ANIMATION_HH_ @@ -46,11 +29,11 @@ class Animation; typedef boost::shared_ptr AnimationP; /** - * A class to manage frame-based animation. Animation sequences can be loaded - * from file, then named sequences are started. The animation is updated - * periodically (each update cycle), and the correct current frame is - * determined. This class is generic enough that a frame can mean just about - * anything to whatever drawing context is used to render the frame. + * A class to manage frame-based animation. Animation sequences can be + * loaded from file, then named sequences are started. The animation is + * updated periodically (each update cycle), and the correct current frame + * is determined. This class is generic enough that a frame can mean just + * about anything to whatever drawing context is used to render the frame. */ class Animation : public Mf::Resource @@ -79,5 +62,3 @@ public: #endif // _ANIMATION_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Character.cc b/src/Character.cc index 2290e3c..6a7c698 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -47,7 +30,8 @@ public: // spring: //mState.force += -15.0 * x - 1.5 * mState.velocity; - force = SCALAR(-10.0) * (mag - d) * (x / mag) - 2.0 * state.velocity; + force = SCALAR(-10.0) * (mag - d) * (x / mag) - + SCALAR(2.0) * state.velocity; return force; } @@ -119,7 +103,6 @@ void Character::update(Mf::Scalar t, Mf::Scalar dt) void Character::draw(Mf::Scalar alpha) const { - //Mf::Vector2 position = cml::lerp(mPrevState.position, mState.position, alpha); Mf::State2 state = getState(alpha); Mf::Vector2 position = state.position; @@ -275,6 +258,3 @@ void Character::setPosition(Mf::Vector2 position) mState.position = position; } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Character.hh b/src/Character.hh index 82804ba..4140d17 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -1,34 +1,19 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _CHARACTER_HH_ #define _CHARACTER_HH_ +#include + #include #include @@ -41,7 +26,6 @@ #include "Animation.hh" - class Character; typedef boost::shared_ptr CharacterP; @@ -74,5 +58,3 @@ public: #endif // _CHARACTER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/ErrorHandler.cc b/src/ErrorHandler.cc index 8d0a8d9..d027956 100644 --- a/src/ErrorHandler.cc +++ b/src/ErrorHandler.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -71,7 +54,7 @@ std::string getErrorString(const Mf::Error& error) return str; case Mf::Error::SDL_VIDEOMODE: - str += "An error occurred while trying to set up the video mode."; + str += "An error occurred while trying to set up the graphics."; return str; case Mf::Error::UNKNOWN_AUDIO_FORMAT: @@ -92,6 +75,3 @@ std::string getErrorString(const Mf::Error& error) return stream.str(); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/ErrorHandler.hh b/src/ErrorHandler.hh index 8132ac4..d1201e8 100644 --- a/src/ErrorHandler.hh +++ b/src/ErrorHandler.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _ERRORHANDLER_HH_ #define _ERRORHANDLER_HH_ @@ -37,5 +20,3 @@ std::string getErrorString(const Mf::Error& error); #endif // _ERRORHANDLER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 6db27b1..3a0ea09 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -143,7 +126,8 @@ void GameLayer::pushedOntoEngine() mSphere.point.set(22, 5); mSphere.radius = 2; - mRayTimer.init(boost::bind(&GameLayer::rayTimer, this), 1.0, Mf::Timer::REPEAT); + mRayTimer.init(boost::bind(&GameLayer::rayTimer, this), + 1.0, Mf::Timer::REPEAT); } @@ -154,9 +138,9 @@ void GameLayer::update(Mf::Scalar t, Mf::Scalar dt) mState.scene->checkForCollision(*mState.heroine); - mState.camera.setPosition(Mf::Vector3(-mState.heroine->getState().position[0], - -mState.heroine->getState().position[1], -8)); - //mState.camera.lookAt(Mf::promote(mState.heroine->getState().position)); + Mf::Vector3 camPosition(-mState.heroine->getState().position[0], + -mState.heroine->getState().position[1], -8); + mState.camera.setPosition(camPosition); mRay.point = mState.heroine->getState().position; } @@ -285,7 +269,8 @@ bool GameLayer::handleEvent(const Mf::Event& event) void GameLayer::setProjection() { - ASSERT(Mf::video && "no current video context from which to get dimensions"); + ASSERT(Mf::video && + "no current video context from which to get dimensions"); setProjection(Mf::video->getWidth(), Mf::video->getHeight()); } @@ -294,6 +279,3 @@ void GameLayer::setProjection(Mf::Scalar width, Mf::Scalar height) mState.camera.setProjection(cml::rad(45.0), width / height, 1.0, 200.0); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/GameLayer.hh b/src/GameLayer.hh index 5361361..885a49d 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _GAMELAYER_HH_ #define _GAMELAYER_HH_ @@ -44,14 +27,14 @@ #include #include -#include +#include // TODO #include #include #include #include -#include "Hud.hh" #include "GameState.hh" +#include "Hud.hh" class GameLayer; @@ -103,5 +86,3 @@ private: #endif // _GAMELAYER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/GameState.hh b/src/GameState.hh index bc59eaf..9583ff2 100644 --- a/src/GameState.hh +++ b/src/GameState.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _GAMESTATE_HH_ #define _GAMESTATE_HH_ @@ -34,6 +17,9 @@ * The data. */ +#include +#include + #include #include @@ -50,16 +36,14 @@ struct GameState Mf::Script script; std::vector sceneList; - HeroineP heroine; - SceneP scene; + HeroineP heroine; + SceneP scene; - Mf::Lerp interp; + Mf::Lerp interp; - Mf::Camera camera; + Mf::Camera camera; }; #endif // _GAMESTATE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Heroine.cc b/src/Heroine.cc index a70b798..c1c9f07 100644 --- a/src/Heroine.cc +++ b/src/Heroine.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -105,6 +88,3 @@ bool Heroine::handleEvent(const Mf::Event& event) return false; } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Heroine.hh b/src/Heroine.hh index ad8cd9a..8ed8f66 100644 --- a/src/Heroine.hh +++ b/src/Heroine.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _HEROINE_HH_ #define _HEROINE_HH_ @@ -62,5 +45,3 @@ public: #endif // _HEROINE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Hud.cc b/src/Hud.cc index f8f40d9..9e40a60 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -33,7 +16,8 @@ #include "Hud.hh" -ProgressBar::ProgressBar(const Mf::Texture& tilemap, Mf::Texture::TileIndex index) : +ProgressBar::ProgressBar(const Mf::Texture& tilemap, + Mf::Texture::TileIndex index) : mProgress(0.0), mTilemap(tilemap) { @@ -124,7 +108,8 @@ Hud::Hud(GameState& state) : mBar2(Mf::Texture("StatusBars"), 2), mFont("Font") { - ASSERT(Mf::video && "no current video context from which to get dimensions"); + ASSERT(Mf::video && + "no current video context from which to get dimensions"); resize(Mf::video->getWidth(), Mf::video->getHeight()); } @@ -201,6 +186,3 @@ bool Hud::handleEvent(const Mf::Event& event) return false; } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Hud.hh b/src/Hud.hh index 2262b06..30b5a42 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _HUD_HH_ #define _HUD_HH_ @@ -120,5 +103,3 @@ private: #endif // _HUD_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Main.cc b/src/Main.cc index 510a9b1..91a8d08 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include // atexit, getenv #include @@ -206,7 +189,8 @@ void Main::contextCreated() void Main::printUsage() { - std::cout << "Usage: "PACKAGE" [-h|--help] [-i|--info] [OPTION=VALUE]..." + std::cout << "Usage: " + << PACKAGE" [-h|--help] [-i|--info] [OPTION=VALUE]..." << std::endl << "The alien-smashing action game." << std::endl << std::endl @@ -220,7 +204,7 @@ void Main::printUsage() << " fullscreen=true|false" << std::endl << " if true, uses the entire display" << std::endl << " framerate=num" << std::endl - << " the target number of frames per second" << std::endl + << " number of frames to draw per second" << std::endl << std::endl << "See documentation for more options." << std::endl; } @@ -324,12 +308,14 @@ int main(int argc, char* argv[]) Mf::settings.loadFromFiles(Main::getConfigPath()); Mf::settings.parseArgs(argc, argv); - Mf::Log::Level logLevel; - if (Mf::settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel); + Mf::Log::Level logLevel = Mf::Log::INFO; + Mf::settings.get("loglevel", logLevel); + Mf::Log::setLevel(logLevel); try { - Mf::Video video(PACKAGE_STRING, Mf::Resource::getPath(PACKAGE".png")); + Mf::Video video(PACKAGE_STRING, + Mf::Resource::getPath(PACKAGE".png")); MainP app = Main::alloc(); Mf::core.push(app); Mf::core.run(); @@ -349,6 +335,3 @@ int main(int argc, char* argv[]) return 0; } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Main.hh b/src/Main.hh index 78d3b71..91a4b4c 100644 --- a/src/Main.hh +++ b/src/Main.hh @@ -1,33 +1,16 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _YOINKAPP_HH_ -#define _YOINKAPP_HH_ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MAIN_HH_ +#define _MAIN_HH_ /** * @file Main.hh @@ -82,7 +65,5 @@ private: }; -#endif // _YOINKAPP_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ +#endif // _MAIN_HH_ diff --git a/src/Makefile.am b/src/Makefile.am index 58b3111..45ea7cd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ # # libmoof.a -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ noinst_LIBRARIES = libmoof.a @@ -79,7 +79,7 @@ EXTRA_DIST = Moof/cml Moof/stlplus # # yoink -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bin_PROGRAMS = yoink diff --git a/src/Moof/Aabb.cc b/src/Moof/Aabb.cc index 692ec36..4ef1520 100644 --- a/src/Moof/Aabb.cc +++ b/src/Moof/Aabb.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Aabb.hh" #include "Frustum.hh" @@ -84,9 +67,5 @@ void Aabb::getOctant(Aabb& octant, int num) const */ - - } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Aabb.hh b/src/Moof/Aabb.hh index 83926b3..f3e92ab 100644 --- a/src/Moof/Aabb.hh +++ b/src/Moof/Aabb.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_AABB_HH_ #define _MOOF_AABB_HH_ @@ -35,7 +18,7 @@ #include #include -#include +#include // FIXME this file is quite broken #include #include @@ -148,69 +131,86 @@ struct Aabb : public Cullable, public Drawable, public Shape */ -void getCorners(Vector corners[8]) const -{ - corners[0][0] = min[0]; corners[0][1] = min[1]; corners[0][2] = max[2]; - corners[1][0] = max[0]; corners[1][1] = min[1]; corners[1][2] = max[2]; - corners[2][0] = max[0]; corners[2][1] = max[1]; corners[2][2] = max[2]; - corners[3][0] = min[0]; corners[3][1] = max[1]; corners[3][2] = max[2]; - corners[4][0] = min[0]; corners[4][1] = min[1]; corners[4][2] = min[2]; - corners[5][0] = max[0]; corners[5][1] = min[1]; corners[5][2] = min[2]; - corners[6][0] = max[0]; corners[6][1] = max[1]; corners[6][2] = min[2]; - corners[7][0] = min[0]; corners[7][1] = max[1]; corners[7][2] = min[2]; -} - - -void encloseVertices(const Vector vertices[], unsigned count) -{ - min.zero(); - max.zero(); + void getCorners(Vector corners[8]) const + { + corners[0][0] = min[0]; + corners[0][1] = min[1]; + corners[0][2] = max[2]; + corners[1][0] = max[0]; + corners[1][1] = min[1]; + corners[1][2] = max[2]; + corners[2][0] = max[0]; + corners[2][1] = max[1]; + corners[2][2] = max[2]; + corners[3][0] = min[0]; + corners[3][1] = max[1]; + corners[3][2] = max[2]; + corners[4][0] = min[0]; + corners[4][1] = min[1]; + corners[4][2] = min[2]; + corners[5][0] = max[0]; + corners[5][1] = min[1]; + corners[5][2] = min[2]; + corners[6][0] = max[0]; + corners[6][1] = max[1]; + corners[6][2] = min[2]; + corners[7][0] = min[0]; + corners[7][1] = max[1]; + corners[7][2] = min[2]; + } - for (unsigned i = 1; i < count; ++i) + + void encloseVertices(const Vector vertices[], unsigned count) { - min.minimize(vertices[i]); - max.maximize(vertices[i]); + min.zero(); + max.zero(); + + for (unsigned i = 1; i < count; ++i) + { + min.minimize(vertices[i]); + max.maximize(vertices[i]); + } } -} -void draw(Scalar alpha = 0.0) const -{ - Scalar vertices[] = {min[0], min[1], min[2], - min[0], max[1], min[2], - max[0], max[1], min[2], - max[0], min[1], min[2], - min[0], max[1], max[2], - min[0], min[1], max[2], - max[0], min[1], max[2], - max[0], max[1], max[2]}; - - GLubyte indices[] = {0, 1, 2, 3, - 1, 2, 7, 4, - 3, 0, 5, 6, - 2, 3, 6, 7, - 5, 0, 1, 4, - 4, 5, 6, 7}; - - glEnableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glVertexPointer(3, GL_SCALAR, 0, vertices); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - Texture::resetBind(); - - glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE, indices); - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - //glDisableClientState(GL_VERTEX_ARRAY); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); -} - -bool isVisible(const Frustum& frustum) const -{ - return frustum.contains(*this); -} + void draw(Scalar alpha = 0.0) const + { + Scalar vertices[] = {min[0], min[1], min[2], + min[0], max[1], min[2], + max[0], max[1], min[2], + max[0], min[1], min[2], + min[0], max[1], max[2], + min[0], min[1], max[2], + max[0], min[1], max[2], + max[0], max[1], max[2]}; + + GLubyte indices[] = {0, 1, 2, 3, + 1, 2, 7, 4, + 3, 0, 5, 6, + 2, 3, 6, 7, + 5, 0, 1, 4, + 4, 5, 6, 7}; + + glEnableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(3, GL_SCALAR, 0, vertices); + + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + Texture::resetBind(); + + glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE, + indices); + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + //glDisableClientState(GL_VERTEX_ARRAY); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + + bool isVisible(const Frustum& frustum) const + { + return frustum.contains(*this); + } }; @@ -218,5 +218,3 @@ bool isVisible(const Frustum& frustum) const #endif // _MOOF_AABB_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Camera.cc b/src/Moof/Camera.cc index 8f313b7..d7f1fe2 100644 --- a/src/Moof/Camera.cc +++ b/src/Moof/Camera.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Camera.hh" #include "OpenGL.hh" @@ -46,8 +29,9 @@ void Camera::setRotation(const Quaternion& rotation) void Camera::lookAt(const Vector3& point) { // FIXME this doesn't work as expected - cml::quaternion_rotation_aim_at(mState.orientation, mState.position, point, - Vector3(0.0, 1.0, 0.0)); + cml::quaternion_rotation_aim_at(mState.orientation, + mState.position, point, + Vector3(0.0, 1.0, 0.0)); } @@ -57,10 +41,10 @@ void Camera::setProjection(const Matrix4& projection) } void Camera::setProjection(Scalar fovy, Scalar aspect, Scalar abutting, - Scalar distant) + Scalar distant) { cml::matrix_perspective_yfov_RH(mProjection, fovy, aspect, abutting, - distant, cml::z_clip_neg_one); + distant, cml::z_clip_neg_one); } @@ -166,5 +150,3 @@ void Camera::handleEvent(const Event& event) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Camera.hh b/src/Moof/Camera.hh index 8e28f54..bbb493d 100644 --- a/src/Moof/Camera.hh +++ b/src/Moof/Camera.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_CAMERA_HH_ #define _MOOF_CAMERA_HH_ @@ -95,5 +78,3 @@ private: #endif // _MOOF_CAMERA_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Core.cc b/src/Moof/Core.cc index 190f4c8..b9ad92a 100644 --- a/src/Moof/Core.cc +++ b/src/Moof/Core.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include // exit, srand @@ -78,10 +61,10 @@ public: /** - * The main loop. This just calls dispatchEvents(), update(), and draw() - * over and over again. The timing of the update and draw are decoupled. - * The actual frame rate is also calculated here. This function will return - * the exit code used to stop the loop. + * The main loop. This just calls dispatchEvents(), update(), and + * draw() over and over again. The timing of the update and draw are + * decoupled. The actual frame rate is also calculated here. This + * function will return the exit code used to stop the loop. */ void run() @@ -176,7 +159,8 @@ public: void update(Scalar t, Scalar dt) { - for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) + for (mStackIt = mStack.begin(); mStackIt != mStack.end(); + ++mStackIt) { (*mStackIt)->update(t, dt); } @@ -194,7 +178,8 @@ public: void handleEvent(const Event& event) { - for (mStackIt = mStack.begin(); mStackIt != mStack.end(); ++mStackIt) + for (mStackIt = mStack.begin(); mStackIt != mStack.end(); + ++mStackIt) { if ((*mStackIt)->handleEvent(event)) break; } @@ -206,7 +191,7 @@ public: ASSERT(layer && "cannot push null layer"); mStack.push_front(layer); logInfo << "stack: " << mStack.size() - << " [pushed " << layer.get() << "]" << std::endl; + << " [pushed " << layer.get() << "]" << std::endl; layer->addedToCore(); } @@ -218,7 +203,7 @@ public: LayerP layer = mStack.front(); mStack.pop_front(); logInfo << "stack: " << mStack.size() - << " [popped " << layer.get() << "]" << std::endl; + << " [popped " << layer.get() << "]" << std::endl; layer->removedFromCore(); if (fixIt) mStackIt = --mStack.begin(); @@ -248,7 +233,8 @@ public: { (*it)->removedFromCore(); logInfo << "stack: " << mStack.size() - << " [popped " << (*it).get() << "]" << std::endl; + << " [popped " << (*it).get() << "]" + << std::endl; } if (fixIt) mStackIt = --mStack.begin(); @@ -339,19 +325,20 @@ void Core::run() Dispatch::Handler Core::addHandler(const std::string& event, - const Dispatch::Function& callback) + const Dispatch::Function& callback) { return mImpl->mDispatch.addHandler(event, callback); } Dispatch::Handler Core::addHandler(const std::string& event, - const Dispatch::Function& callback, Dispatch::Handler handler) + const Dispatch::Function& callback, + Dispatch::Handler handler) { return mImpl->mDispatch.addHandler(event, callback, handler); } void Core::dispatch(const std::string& event, - const Dispatch::Message* message) + const Dispatch::Message* message) { mImpl->mDispatch.dispatch(event, message); } @@ -384,7 +371,7 @@ public: char name[128]; SDL_VideoDriverName(name, sizeof(name)); logInfo << "initialized SDL; using video driver `" - << name << "'" << std::endl; + << name << "'" << std::endl; } if (FE_Init() != 0) @@ -432,9 +419,9 @@ private: static BackendP gInstance; }; -Error Backend_::gError(Error::UNINITIALIZED); -int Backend_::gRetainCount = 0; -BackendP Backend_::gInstance; +Error Backend_::gError(Error::UNINITIALIZED); +int Backend_::gRetainCount = 0; +BackendP Backend_::gInstance; Backend::Backend() @@ -460,5 +447,3 @@ const Error& Backend::getError() } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Core.hh b/src/Moof/Core.hh index 109999a..eaa98b4 100644 --- a/src/Moof/Core.hh +++ b/src/Moof/Core.hh @@ -1,34 +1,19 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_CORE_HH_ #define _MOOF_CORE_HH_ +#include + #include #include @@ -40,12 +25,12 @@ namespace Mf { /** - * The core is essentially a stack of layers. While running, it updates each - * layer from the bottom up every timestep. It also draws each layer from the - * bottom up, adhering to the maximum frame-rate. Events are sent to each layer - * from the top down until a layer signals the event was handled. The core is - * also responsible for firing timers on time. The core will continue running - * as long as there are layers on the stack. + * The core is essentially a stack of layers. While running, it updates + * each layer from the bottom up every timestep. It also draws each layer + * from the bottom up, adhering to the maximum frame-rate. Events are sent + * to each layer from the top down until a layer signals the event was + * handled. The core is also responsible for firing timers on time. The + * core will continue running as long as there are layers on the stack. */ class Core @@ -61,7 +46,7 @@ public: void push(LayerP layer); // push a layer onto the top LayerP pop(); // pop the top layer - LayerP pop(Layer* layer); // pops a specific layer and all layers above it + LayerP pop(Layer* layer); // pops a specific layer and layers above it void clear(); // remove all layers (the core will stop) int getSize() const; // get the size of the stack @@ -70,12 +55,13 @@ public: void run(); Dispatch::Handler addHandler(const std::string& event, - const Dispatch::Function& callback); + const Dispatch::Function& callback); Dispatch::Handler addHandler(const std::string& event, - const Dispatch::Function& callback, Dispatch::Handler handler); + const Dispatch::Function& callback, + Dispatch::Handler handler); void dispatch(const std::string& event, - const Dispatch::Message* message = 0); + const Dispatch::Message* message = 0); private: @@ -88,9 +74,10 @@ extern Core core; /* * Some classes and subsystems require certain backend libraries to be - * initialized. This is the mechanism to accomplish that. Classes which rely - * on any backend libraries just need to instantiate this class as a member. - * Backend cleanup will occur automagically when there are no more instances. + * initialized. This is the mechanism to accomplish that. Classes which + * rely on any backend libraries just need to instantiate this class as a + * member. Backend cleanup will occur automagically when there are no more + * instances. */ class Backend @@ -109,5 +96,3 @@ public: #endif // _MOOF_CORE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Cullable.hh b/src/Moof/Cullable.hh index 64b43eb..a5ffcc1 100644 --- a/src/Moof/Cullable.hh +++ b/src/Moof/Cullable.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_CULLABLE_HH_ #define _MOOF_CULLABLE_HH_ @@ -56,5 +39,3 @@ public: #endif // _MOOF_CULLABLE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Dispatch.cc b/src/Moof/Dispatch.cc index b05ff9c..52f28f8 100644 --- a/src/Moof/Dispatch.cc +++ b/src/Moof/Dispatch.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -58,10 +41,10 @@ public: inline Handler addHandler(const std::string& event, - const Function& callback, Handler handler) + const Function& callback, Handler handler) { mCallbacks.insert(std::make_pair(event, - std::make_pair(handler.getId(), callback))); + std::make_pair(handler.getId(), callback))); mHandlers.insert(std::make_pair(handler.getId(), event)); return handler; @@ -69,7 +52,8 @@ public: inline void removeHandler(unsigned id) { - std::pair matching(mHandlers.equal_range(id)); + std::pair + matching(mHandlers.equal_range(id)); for (HandlerIter it = matching.first; it != matching.second; ++it) { @@ -94,7 +78,8 @@ public: std::pair callbacks(mCallbacks.equal_range(event)); - for (CallbackIter it = callbacks.first; it != callbacks.second; ++it) + for (CallbackIter it = callbacks.first; it != callbacks.second; + ++it) { Function callback = (*it).second.second; callback(message); @@ -123,13 +108,14 @@ Dispatch::Dispatch() : Dispatch::Handler Dispatch::addHandler(const std::string& event, - const Function& callback) + const Function& callback) { return addHandler(event, callback, mImpl->getNewHandler()); } Dispatch::Handler Dispatch::addHandler(const std::string& event, - const Function& callback, Handler handler) + const Function& callback, + Handler handler) { // pass through return mImpl->addHandler(event, callback, handler); @@ -152,5 +138,3 @@ void Dispatch::dispatch(const std::string& event, const Message* message) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Dispatch.hh b/src/Moof/Dispatch.hh index 031f77d..fd328fe 100644 --- a/src/Moof/Dispatch.hh +++ b/src/Moof/Dispatch.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_DISPATCH_HH_ #define _MOOF_DISPATCH_HH_ @@ -111,7 +94,7 @@ public: Handler addHandler(const std::string& event, const Function& callback); Handler addHandler(const std::string& event, const Function& callback, - Handler handler); + Handler handler); void dispatch(const std::string& event, const Message* message = 0); }; @@ -121,5 +104,3 @@ public: #endif // _MOOF_DISPATCH_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Drawable.hh b/src/Moof/Drawable.hh index 61283fa..40916c0 100644 --- a/src/Moof/Drawable.hh +++ b/src/Moof/Drawable.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_DRAWABLE_HH_ #define _MOOF_DRAWABLE_HH_ @@ -52,5 +35,3 @@ public: #endif // _MOOF_DRAWABLE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Entity.hh b/src/Moof/Entity.hh index ee0f860..4e71466 100644 --- a/src/Moof/Entity.hh +++ b/src/Moof/Entity.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_ENTITY_HH_ #define _MOOF_ENTITY_HH_ @@ -40,9 +23,6 @@ namespace Mf { -class Entity; -typedef boost::shared_ptr EntityP; - class Frustum; @@ -51,6 +31,10 @@ class Frustum; * specified volume (take up space). */ +class Entity; +typedef boost::shared_ptr EntityP; + + class Entity : public Cullable, public Drawable { protected: @@ -88,5 +72,3 @@ public: #endif // _MOOF_ENTITY_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh index c452ae6..78c894f 100644 --- a/src/Moof/Error.hh +++ b/src/Moof/Error.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_ERROR_HH_ #define _MOOF_ERROR_HH_ @@ -108,5 +91,3 @@ private: #endif // _MOOF_ERROR_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Event.hh b/src/Moof/Event.hh index 51d7454..53b86f8 100644 --- a/src/Moof/Event.hh +++ b/src/Moof/Event.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_EVENT_HH_ #define _MOOF_EVENT_HH_ @@ -35,11 +18,12 @@ namespace Mf { -// The event handling in SDL is so big that it would take more time than it's -// worth to add an object-oriented abstraction layer that would completely cover -// what SDL has already layed down. Fortunately, SDL event structures are easy -// to work with, and it is not the purpose of this library to completely hide -// its dependencies and provide full functionality. +// The event handling in SDL is so big that it would take more time than +// it's worth to add an object-oriented abstraction layer that would +// completely cover what SDL has already layed down. Fortunately, SDL +// event structures are easy to work with, and it is not the purpose of +// this library to completely hide its dependencies and provide complete +// abstractions. typedef SDL_Event Event; @@ -48,5 +32,3 @@ typedef SDL_Event Event; #endif // _MOOF_EVENT_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Frustum.cc b/src/Moof/Frustum.cc index 1db6d25..e56fb7b 100644 --- a/src/Moof/Frustum.cc +++ b/src/Moof/Frustum.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -39,23 +22,29 @@ void Frustum::init(const Matrix4& modelview, const Matrix4& projection) Scalar planes[6][4]; cml::extract_frustum_planes(modelview, projection, planes, - cml::z_clip_neg_one); - - mPlanes[0] = Plane(planes[0][0], planes[0][1], planes[0][2], planes[0][3]); - mPlanes[1] = Plane(planes[1][0], planes[1][1], planes[1][2], planes[1][3]); - mPlanes[2] = Plane(planes[2][0], planes[2][1], planes[2][2], planes[2][3]); - mPlanes[3] = Plane(planes[3][0], planes[3][1], planes[3][2], planes[3][3]); - mPlanes[4] = Plane(planes[4][0], planes[4][1], planes[4][2], planes[4][3]); - mPlanes[5] = Plane(planes[5][0], planes[5][1], planes[5][2], planes[5][3]); + cml::z_clip_neg_one); + + mPlanes[0] = Plane(planes[0][0], planes[0][1], + planes[0][2], planes[0][3]); + mPlanes[1] = Plane(planes[1][0], planes[1][1], + planes[1][2], planes[1][3]); + mPlanes[2] = Plane(planes[2][0], planes[2][1], + planes[2][2], planes[2][3]); + mPlanes[3] = Plane(planes[3][0], planes[3][1], + planes[3][2], planes[3][3]); + mPlanes[4] = Plane(planes[4][0], planes[4][1], + planes[4][2], planes[4][3]); + mPlanes[5] = Plane(planes[5][0], planes[5][1], + planes[5][2], planes[5][3]); } void Frustum::init(const Matrix4& modelview, Scalar fovy, Scalar aspect, - Scalar abutting, Scalar distant) + Scalar abutting, Scalar distant) { Matrix4 projection; - cml::matrix_perspective_yfov_RH(projection, fovy, aspect, abutting, distant, - cml::z_clip_neg_one); + cml::matrix_perspective_yfov_RH(projection, fovy, aspect, abutting, + distant, cml::z_clip_neg_one); init(modelview, projection); } @@ -73,8 +62,7 @@ Frustum::Collision Frustum::contains(const Aabb<3>& aabb) const for (int j = 0; j < 8; ++j) { - if (mPlanes[i].intersects(corners[j]) == - Plane::NEGATIVE) + if (mPlanes[i].intersects(corners[j]) == Plane::NEGATIVE) { --nInside; } @@ -105,5 +93,3 @@ Frustum::Collision Frustum::contains(const Sphere<3>& sphere) const } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Frustum.hh b/src/Moof/Frustum.hh index 406e230..6e93cd6 100644 --- a/src/Moof/Frustum.hh +++ b/src/Moof/Frustum.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_FRUSTUM_HH_ #define _MOOF_FRUSTUM_HH_ @@ -64,7 +47,7 @@ public: void init(const Matrix4& modelview, const Matrix4& projection); void init(const Matrix4& modelview, Scalar fovy, Scalar aspect, - Scalar abutting, Scalar distant); + Scalar abutting, Scalar distant); Collision contains(const Aabb<3>& aabb) const; Collision contains(const Sphere<3>& sphere) const; @@ -75,5 +58,3 @@ public: #endif // _MOOF_FRUSTUM_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Hash.cc b/src/Moof/Hash.cc index eb024ad..357b531 100644 --- a/src/Moof/Hash.cc +++ b/src/Moof/Hash.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Hash.hh" @@ -48,7 +31,8 @@ namespace Mf { // 2. It will not produce the same results on little-endian and big-endian // machines. -unsigned getHash::operator()(const void* key, int len, unsigned int seed) const +unsigned getHash::operator()(const void* key, int len, + unsigned int seed) const { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. @@ -102,5 +86,3 @@ unsigned getHash::operator()(const void* key, int len, unsigned int seed) const } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Hash.hh b/src/Moof/Hash.hh index f0fab50..e97ee25 100644 --- a/src/Moof/Hash.hh +++ b/src/Moof/Hash.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_HASH_HH_ #define _MOOF_HASH_HH_ @@ -40,7 +23,8 @@ namespace Mf { struct getHash { // generic hash function - unsigned operator()(const void* key, int len, unsigned seed = -1) const; + unsigned operator()(const void* key, int len, + unsigned seed = -1) const; inline unsigned operator()(const std::string& val) const { @@ -58,5 +42,3 @@ struct getHash #endif // _MOOF_HASH_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index ee44dd7..c5566d5 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -1,38 +1,21 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include // FILE #include // strncmp #include -#include #include +#include #include "Core.hh" #include "Error.hh" @@ -116,7 +99,8 @@ public: logInfo("checking signature..."); bytesRead = fread(signature, 1, sizeof(signature), fp); - logInfo << "reading " << bytesRead << " bytes of signature" << std::endl; + logInfo << "reading " << bytesRead << " bytes of signature" + << std::endl; if (bytesRead < sizeof(signature) || png_sig_cmp(signature, 0, sizeof(signature)) != 0) goto cleanup; @@ -190,7 +174,8 @@ public: { for (int i = 0; i < height; ++i) { - rows[height - 1 - i] = (png_bytep)(mPixels + i * channels * width); + rows[height - 1 - i] = (png_bytep)(mPixels + + i * channels * width); } } else @@ -333,5 +318,3 @@ std::string Image::getPath(const std::string& name) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Image.hh b/src/Moof/Image.hh index e958edc..d923b0c 100644 --- a/src/Moof/Image.hh +++ b/src/Moof/Image.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_IMAGE_HH_ #define _MOOF_IMAGE_HH_ @@ -83,5 +66,3 @@ private: #endif // _MOOF_IMAGE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Interpolator.hh b/src/Moof/Interpolator.hh index e49ac69..d918a8d 100644 --- a/src/Moof/Interpolator.hh +++ b/src/Moof/Interpolator.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_INTERPOLATOR_HH_ #define _MOOF_INTERPOLATOR_HH_ @@ -173,5 +156,3 @@ typedef Interpolator< Linear > Lerp; #endif // _MOOF_INTERPOLATOR_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Layer.hh b/src/Moof/Layer.hh index 31607fb..8bbb94b 100644 --- a/src/Moof/Layer.hh +++ b/src/Moof/Layer.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_LAYER_HH_ #define _MOOF_LAYER_HH_ @@ -62,5 +45,3 @@ typedef boost::shared_ptr LayerP; #endif // _MOOF_LAYER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Line.hh b/src/Moof/Line.hh index 0747e28..7902ea9 100644 --- a/src/Moof/Line.hh +++ b/src/Moof/Line.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_LINE_HH_ #define _MOOF_LINE_HH_ @@ -36,8 +19,6 @@ #include #include -#include - namespace Mf { @@ -130,5 +111,3 @@ struct Polygon : public Shape #endif // _MOOF_LINE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc index 863ab87..8656dc3 100644 --- a/src/Moof/Log.cc +++ b/src/Moof/Log.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -77,10 +60,14 @@ static int logScript_(Script& script, Log::Level level) void importLogFunctions(Script& script) { - script.importFunction("LogError", boost::bind(logScript_, _1, Log::ERRORR)); - script.importFunction("LogWarning", boost::bind(logScript_, _1, Log::WARNING)); - script.importFunction("LogInfo", boost::bind(logScript_, _1, Log::INFO)); - script.importFunction("print", boost::bind(logScript_, _1, Log::INFO)); + script.importFunction("LogError", + boost::bind(logScript_, _1, Log::ERRORR)); + script.importFunction("LogWarning", + boost::bind(logScript_, _1, Log::WARNING)); + script.importFunction("LogInfo", + boost::bind(logScript_, _1, Log::INFO)); + script.importFunction("print", + boost::bind(logScript_, _1, Log::INFO)); } diff --git a/src/Moof/Log.hh b/src/Moof/Log.hh index 96585a1..c773630 100644 --- a/src/Moof/Log.hh +++ b/src/Moof/Log.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_LOG_H_ #define _MOOF_LOG_H_ @@ -32,8 +15,8 @@ /** * @file log.h * Functions related to logging the process. - * The logging functions are logError(), logWarning(), logInfo(), and - * logDebug(), listed from most critical to least critical. + * The logging functions are logError(), logWarning(), and logInfo(), + * listed from most critical to least critical. */ #include // exit @@ -41,7 +24,8 @@ /** - * Macro which tests an assertion and issues an logError() and exits if false. + * Macro which tests an assertion and issues an logError() and exits if + * false. * @param X test to perform */ @@ -50,8 +34,9 @@ #if NDEBUG #define ASSERT(X) #else -#define ASSERT(X) if (!(X)) Mf::logError << \ - "false assertion at " << __FILE__ << ":" << __LINE__ << ", " << #X, exit(1) +#define ASSERT(X) if (!(X)) Mf::logError \ + << "false assertion at " << __FILE__ << ":" << __LINE__ << ", " \ + << #X, exit(1) #endif diff --git a/src/Moof/Manager.hh b/src/Moof/Manager.hh index 89c2076..2773a59 100644 --- a/src/Moof/Manager.hh +++ b/src/Moof/Manager.hh @@ -1,39 +1,22 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_MANAGER_HH_ #define _MOOF_MANAGER_HH_ /** * @file Manager.hh - * A library is a collection of named objects of the same type. Libraries use - * reference counting to automagically delete objects which no longer have any - * interested code. + * A library is a collection of named objects of the same type. Libraries + * use reference counting to automagically delete objects which no longer + * have any interested code. */ #include @@ -112,5 +95,3 @@ stlplus::hash Manager::mPtrMap; #endif // _MOOF_MANAGER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Math.hh b/src/Moof/Math.hh index 45c6e90..4293207 100644 --- a/src/Moof/Math.hh +++ b/src/Moof/Math.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_MATH_HH_ #define _MOOF_MATH_HH_ @@ -157,10 +140,10 @@ inline bool isEqual(Scalar a, Scalar b, Scalar epsilon = EPSILON) -// Here are some generic implementations of a few simple integrators. To use, -// you need one type representing the state and another containing the -// derivatives of the primary state variables. The state class must implement -// these methods: +// Here are some generic implementations of a few simple integrators. To +// use, you need one type representing the state and another containing the +// derivatives of the primary state variables. The state class must +// implement these methods: // // void getDerivative(Derivative_Type& derivative, Scalar absoluteTime); // void step(const Derivative_Type& derivative, Scalar deltaTime); @@ -219,5 +202,3 @@ inline void rk4(S& state, Scalar t, Scalar dt) #endif // _MOOF_MATH_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh index f630cb6..8bb6741 100644 --- a/src/Moof/ModalDialog.hh +++ b/src/Moof/ModalDialog.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_MODALDIALOG_HH_ #define _MOOF_MODALDIALOG_HH_ @@ -135,11 +118,12 @@ struct ModalDialog GTK_DIALOG_DESTROY_WITH_PARENT, iconType, GTK_BUTTONS_CLOSE, "%s", text1.c_str()); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), - "%s", text2.c_str()); + "%s", text2.c_str()); gtk_window_set_title(GTK_WINDOW(dialog), title.c_str()); std::string iconPath = Resource::getPath(PACKAGE".png"); - GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), NULL); + GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), + NULL); gtk_window_set_icon(GTK_WINDOW(dialog), iconPixbuf); gtk_dialog_run(GTK_DIALOG(dialog)); @@ -189,5 +173,3 @@ struct ModalDialog #endif // _MOOF_MODALDIALOG_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Octree.hh b/src/Moof/Octree.hh index 301b420..1559959 100644 --- a/src/Moof/Octree.hh +++ b/src/Moof/Octree.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_OCTREE_HH_ #define _MOOF_OCTREE_HH_ @@ -33,7 +16,6 @@ #include #include - #include #include @@ -369,5 +351,3 @@ public: #endif // _MOOF_OCTREE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/OpenGL.hh b/src/Moof/OpenGL.hh index 1e37b5e..2fc9197 100644 --- a/src/Moof/OpenGL.hh +++ b/src/Moof/OpenGL.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_OPENGL_HH_ #define _MOOF_OPENGL_HH_ @@ -72,20 +55,20 @@ #if USE_DOUBLE_PRECISION -#define OPENGL_GENERIC_FUNC(R, N, L) \ +#define OPENGL_GENERIC_FUNC(R, N, L) \ inline R gl##N(ARGS_##L) { gl##N##d(PASS_##L); }// -#define OPENGL_ORDINAL_FUNC(R, N, K) \ - inline R gl##N(ARGS_##S##K) { gl##N##K##d(PASS_##S##K); } \ +#define OPENGL_ORDINAL_FUNC(R, N, K) \ + inline R gl##N(ARGS_##S##K) { gl##N##K##d(PASS_##S##K); } \ inline R gl##N(ARGS_##P##K) { gl##N##K##d##v(PASS_##P##K); }// #else -#define OPENGL_GENERIC_FUNC(R, N, L) \ +#define OPENGL_GENERIC_FUNC(R, N, L) \ inline R gl##N(ARGS_##L) { gl##N##f(PASS_##L); }// -#define OPENGL_ORDINAL_FUNC(R, N, K) \ - inline R gl##N(ARGS_##S##K) { gl##N##K##f(PASS_##S##K); } \ +#define OPENGL_ORDINAL_FUNC(R, N, K) \ + inline R gl##N(ARGS_##S##K) { gl##N##K##f(PASS_##S##K); } \ inline R gl##N(ARGS_##P##K) { gl##N##K##f##v(PASS_##P##K); }// #endif @@ -124,5 +107,3 @@ inline void glGetScalar(GLenum a, GLscalar* b) { glGetFloatv(a, b); } #endif // _MOOF_OPENGL_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Plane.cc b/src/Moof/Plane.cc index 71ea65e..5c4d9fd 100644 --- a/src/Moof/Plane.cc +++ b/src/Moof/Plane.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Aabb.hh" #include "Plane.hh" @@ -66,5 +49,3 @@ Plane::Halfspace Plane::intersects(const Sphere<3>& sphere) const } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Plane.hh b/src/Moof/Plane.hh index b398917..262a6bd 100644 --- a/src/Moof/Plane.hh +++ b/src/Moof/Plane.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_PLANE_HH_ #define _MOOF_PLANE_HH_ @@ -41,8 +24,8 @@ template class Sphere; /* - * A plane in 3-space defined by the equation Ax + By + Cz = D, where [A, B, C] - * is normal to the plane. + * A plane in 3-space defined by the equation Ax + By + Cz = D, where [A, + * B, C] is normal to the plane. */ struct Plane : public Shape<3> @@ -97,9 +80,10 @@ struct Plane : public Shape<3> } - /* Causes the normal of the plane to become normalized. The scalar may also - * be changed to keep the equation true. Word to the wise: don't normalize - * a plane if the normal is the zero vector. */ + /* Causes the normal of the plane to become normalized. The scalar may + * also be changed to keep the equation true. Word to the wise: don't + * normalize a plane if the normal is the zero vector. + */ void normalize() { Scalar mag = normal.length(); @@ -109,8 +93,8 @@ struct Plane : public Shape<3> } /** - * Determine the shortest distance between a point and the plane. */ - + * Determine the shortest distance between a point and the plane. + */ Scalar getDistanceToPoint(const Vector3& point) const { return cml::dot(point, normal) + d; @@ -134,5 +118,3 @@ struct Plane : public Shape<3> #endif // _MOOF_PLANE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh index 5a693d2..1564087 100644 --- a/src/Moof/Ray.hh +++ b/src/Moof/Ray.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_RAY_HH_ #define _MOOF_RAY_HH_ @@ -70,7 +53,7 @@ struct Ray : public Drawable void draw(Scalar alpha = 0.0) const { Vector end = point + 1000.0 * direction; - // TODO this is kinda cheesy + // FIXME this is kinda cheesy Mf::Texture::resetBind(); glBegin(GL_LINES); @@ -90,5 +73,3 @@ struct Ray : public Drawable #endif // _MOOF_RAY_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Rectangle.cc b/src/Moof/Rectangle.cc index fef6ac4..949c22a 100644 --- a/src/Moof/Rectangle.cc +++ b/src/Moof/Rectangle.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Rectangle.hh" @@ -47,5 +30,3 @@ void Rectangle::getCorners(Vector2 corners[4]) const } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Rectangle.hh b/src/Moof/Rectangle.hh index 634491c..e41b879 100644 --- a/src/Moof/Rectangle.hh +++ b/src/Moof/Rectangle.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_RECTANGLE_HH_ #define _MOOF_RECTANGLE_HH_ @@ -98,5 +81,3 @@ struct Rectangle #endif // _MOOF_RECTANGLE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Resource.cc b/src/Moof/Resource.cc index ec94025..ca127a9 100644 --- a/src/Moof/Resource.cc +++ b/src/Moof/Resource.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -102,5 +85,3 @@ std::string Resource::getPath(const std::string& name) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Resource.hh b/src/Moof/Resource.hh index 671aeb6..8446d08 100644 --- a/src/Moof/Resource.hh +++ b/src/Moof/Resource.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_RESOURCE_HH_ #define _MOOF_RESOURCE_HH_ @@ -62,8 +45,8 @@ public: /** * Get the path to a resource of a given name. - * @param name Name of a resource. The name will be appended to each search - * directory in order. + * @param name Name of a resource. The name will be appended to each + * search directory in order. * @return The first path found which resolves to a file. */ @@ -79,5 +62,3 @@ private: #endif // _MOOF_RESOURCE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/RigidBody.hh b/src/Moof/RigidBody.hh index e7dee38..ad6e33f 100644 --- a/src/Moof/RigidBody.hh +++ b/src/Moof/RigidBody.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_RIGIDBODY_HH_ #define _MOOF_RIGIDBODY_HH_ @@ -44,8 +27,9 @@ namespace Mf { template struct LinearState { - typedef cml::vector< Scalar, cml::fixed > Vector; - typedef boost::function ForceFunction; + typedef cml::vector< Scalar, cml::fixed > Vector; + typedef boost::function + ForceFunction; // primary @@ -257,26 +241,28 @@ inline T interpolate(const T& a, const T& b, Scalar alpha) } template <> -inline State2 interpolate(const State2& a, const State2& b, Scalar alpha) +inline State2 interpolate(const State2& a, const State2& b, + Scalar alpha) { State2 state(b); state.position = interpolate(a.position, b.position, alpha); state.momentum = interpolate(a.momentum, b.momentum, alpha); state.orientation = interpolate(a.orientation, b.orientation, alpha); - state.angularMomentum = interpolate(a.angularMomentum, b.angularMomentum, - alpha); + state.angularMomentum = interpolate(a.angularMomentum, + b.angularMomentum, alpha); return state; } template <> -inline State3 interpolate(const State3& a, const State3& b, Scalar alpha) +inline State3 interpolate(const State3& a, const State3& b, + Scalar alpha) { State3 state(b); state.position = interpolate(a.position, b.position, alpha); state.momentum = interpolate(a.momentum, b.momentum, alpha); state.orientation = cml::slerp(a.orientation, b.orientation, alpha); - state.angularMomentum = interpolate(a.angularMomentum, b.angularMomentum, - alpha); + state.angularMomentum = interpolate(a.angularMomentum, + b.angularMomentum, alpha); return state; } @@ -328,5 +314,3 @@ typedef RigidBody RigidBody3; #endif // _MOOF_RIGIDBODY_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Script.hh b/src/Moof/Script.hh index 9e8827a..9af5440 100644 --- a/src/Moof/Script.hh +++ b/src/Moof/Script.hh @@ -1,41 +1,24 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_SCRIPT_HH_ #define _MOOF_SCRIPT_HH_ /** * @file Script.hh - * A thin wrapper over Lua. This is not meant as a complicated binding package - * between C++ and Lua. It does not try to make the boundary invisible. It - * does not hide the concept of the Lua stack, but rather provides that - * mechanism with a certain level of abstraction while also providing a cleaner, - * more consistent API. + * A thin wrapper over Lua. This is not meant as a complicated binding + * package between C++ and Lua. It does not try to make the boundary + * invisible. It does not hide the concept of the Lua stack, but rather + * provides that mechanism with a certain level of abstraction while also + * providing a cleaner, more consistent API. */ #include @@ -47,7 +30,6 @@ #include #include #include - #include #include @@ -99,40 +81,42 @@ public: }; /** - * This is the most prominent abstraction on top of the standard Lua API. - * A Slot object represents a value on the stack. More specifically, it - * represents a position on the stack. The distinction is only important - * when objects are moved around on the stack or if the Slot represents a - * negative index on the stack (the value of which will change as things are - * pushed onto and popped from the stack). + * This is the most prominent abstraction on top of the standard Lua + * API. A Slot object represents a value on the stack. More + * specifically, it represents a position on the stack. The + * distinction is only important when objects are moved around on the + * stack or if the Slot represents a negative index on the stack (the + * value of which will change as things are pushed onto and popped from + * the stack). */ struct Slot { /** - * You have direct access to the index of the value on the stack being - * represented. + * You have direct access to the index of the value on the stack + * being represented. */ int index; /** - * A default-constructed Slot is invalid until a valid Slot is assigned - * to it. The only method that should be called on such a Slot is - * isValid(), otherwise chaos may ensue. In this case, the Slot will be - * invalid even if index is manually changed to a valid index. You have - * to index the script itself to get a valid Slot. + * A default-constructed Slot is invalid until a valid Slot is + * assigned to it. The only method that should be called on such a + * Slot is isValid(), otherwise chaos may ensue. In this case, the + * Slot will be invalid even if index is manually changed to a + * valid index. You have to index the script itself to get a valid + * Slot. */ Slot(lua_State* s = 0, int i = 0) : index(i), mState(s) {} /** - * A copied value presently points to the same value, except the real - * index is used. That means that if a value that refers to a frame - * referenced from the top of the stack will have its normalized index - * copied into the new value object. + * A copied value presently points to the same value, except the + * real index is used. That means that if a value that refers to a + * frame referenced from the top of the stack will have its + * normalized index copied into the new value object. */ Slot(const Slot& copy) : @@ -141,30 +125,43 @@ public: // check the type of the value - bool isBoolean() const { return (bool)lua_isboolean(mState, index); } - bool isFunction() const { return (bool)lua_isfunction(mState, index); } - bool isNil() const { return (bool)lua_isnil(mState, index); } - bool isNone() const { return (bool)lua_isnone(mState, index); } - bool isValid() const { return mState != 0 && !isNone(); } - bool isNoneOrNil() const { return (bool)lua_isnoneornil(mState, index); } - bool isNumber() const { return (bool)lua_isnumber(mState, index); } - bool isString() const { return (bool)lua_isstring(mState, index); } - bool isTable() const { return (bool)lua_istable(mState, index); } - bool isThread() const { return (bool)lua_isthread(mState, index); } - bool isData() const { return (bool)lua_isuserdata(mState, index); } - bool isLightData() const { return (bool)lua_islightuserdata(mState, index); } + bool isBoolean() const + { return (bool)lua_isboolean(mState, index); } + bool isFunction() const + { return (bool)lua_isfunction(mState, index); } + bool isNil() const + { return (bool)lua_isnil(mState, index); } + bool isNone() const + { return (bool)lua_isnone(mState, index); } + bool isValid() const + { return mState != 0 && !isNone(); } + bool isNoneOrNil() const + { return (bool)lua_isnoneornil(mState, index); } + bool isNumber() const + { return (bool)lua_isnumber(mState, index); } + bool isString() const + { return (bool)lua_isstring(mState, index); } + bool isTable() const + { return (bool)lua_istable(mState, index); } + bool isThread() const + { return (bool)lua_isthread(mState, index); } + bool isData() const + { return (bool)lua_isuserdata(mState, index); } + bool isLightData() const + { return (bool)lua_islightuserdata(mState, index); } /** - * Check the value and throw an error if its the wrong type. There's a - * little caveat: This method never returns because it does a long jump. - * Consequently, constructed C++ objects which exist on the stack - * between the current frame and some lua function will not be - * destructed. That's not a problem for objects that only exist on the - * stack, but any objects that allocate memory on the heap (such as - * containers or strings) will leak. Therefore, you should only call - * this method after cleaning up such objects. The best thing to do for - * defining functions is to simply check all the parameters at the - * get-go before any C++ objects are even constructed. + * Check the value and throw an error if its the wrong type. + * There's a little caveat: This method never returns because it + * does a long jump. Consequently, constructed C++ objects which + * exist on the stack between the current frame and some lua + * function will not be destructed. That's not a problem for + * objects that only exist on the stack, but any objects that + * allocate memory on the heap (such as containers or strings) will + * leak. Therefore, you should only call this method after + * cleaning up such objects. The best thing to do for defining + * functions is to simply check all the parameters at the get-go + * before any C++ objects are even constructed. */ void requireType(Type type) const @@ -243,7 +240,8 @@ public: /** - * Get the length of the value according to the definition given by Lua. + * Get the length of the value according to the definition given by + * Lua. */ size_t getLength() const @@ -259,7 +257,8 @@ public: /** - * Get a pointer value (for userdata, tables, threads, and functions). + * Get a pointer value (for userdata, tables, threads, and + * functions). */ const void* getIdentifier() const @@ -438,8 +437,8 @@ public: } /** - * Inserts the top-most value on the stack at position index, shifting other - * values as needed. + * Inserts the top-most value on the stack at position index, + * shifting other values as needed. */ void insertTopHere() @@ -618,13 +617,14 @@ public: /** - * Throw an error with the value at the top of the stack. This method never - * returns because it does a long jump. Consequently, constructed C++ - * objects which exist on the stack between the current frame and some lua - * function will not be destructed. That's not a problem for objects that - * only exist on the stack, but any objects that allocate memory on the heap - * (such as containers or strings) will leak. Therefore, you should only - * call this method after cleaning up such objects. + * Throw an error with the value at the top of the stack. This method + * never returns because it does a long jump. Consequently, + * constructed C++ objects which exist on the stack between the + * current frame and some lua function will not be destructed. That's + * not a problem for objects that only exist on the stack, but any + * objects that allocate memory on the heap (such as containers or + * strings) will leak. Therefore, you should only call this method + * after cleaning up such objects. */ void throwError() @@ -658,7 +658,8 @@ public: } /** - * Get the size of the stack; this is also the index of the top-most value. + * Get the size of the stack; this is also the index of the top-most + * value. */ int getSize() const @@ -678,11 +679,11 @@ public: /** - * Makes sure there is at least extra more places on the stack. Returns - * false if space couldn't be created. Just like with the regular Lua API, - * you are responsible to make sure the stack is big enough to hold whatever - * you want to push on it. This is usually only an issue if you're pushing - * stuff in a loop. + * Makes sure there is at least extra more places on the stack. + * Returns false if space couldn't be created. Just like with the + * regular Lua API, you are responsible to make sure the stack is big + * enough to hold whatever you want to push on it. This is usually + * only an issue if you're pushing stuff in a loop. */ bool checkStack(int extra) @@ -766,7 +767,8 @@ public: return (Result)luaL_loadfile(mState, filename.c_str()); } - Result pushCode(const std::string& name, const char* buffer, size_t size) + Result pushCode(const std::string& name, const char* buffer, + size_t size) { return (Result)luaL_loadbuffer(mState, buffer, size, name.c_str()); } @@ -784,9 +786,9 @@ public: /** * Call a function on the stack. The correct procedure is to push a - * function onto the stack followed by nargs arguments. This method will - * pop them off upon return, leaving up to nresults return values (default - * is any number of return values, depending on the callee). + * function onto the stack followed by nargs arguments. This method + * will pop them off upon return, leaving up to nresults return values + * (default is any number of return values, depending on the callee). */ Result call(int nargs = 0, int nresults = LUA_MULTRET) @@ -927,5 +929,3 @@ inline std::ostream& operator << (std::ostream& stream, #endif // _MOOF_SCRIPT_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Settings.cc b/src/Moof/Settings.cc index 5e19ed5..94845c2 100644 --- a/src/Moof/Settings.cc +++ b/src/Moof/Settings.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include // getenv @@ -39,12 +22,6 @@ Settings::~Settings() save(); } -//Settings& Settings::getInstance() -//{ - //static Settings settings; - //return settings; -//} - void Settings::parseArgs(int argc, char* argv[]) { @@ -115,13 +92,12 @@ void Settings::saveAs(const std::string& path) void Settings::save() const { + // TODO saving settings not yet implemented } -Settings settings; +Settings settings; // global instance } // namepsace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index d4cbb9f..f7503dd 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_SETTINGS_HH_ #define _MOOF_SETTINGS_HH_ @@ -117,5 +100,3 @@ extern Settings settings; #endif // _MOOF_SETTINGS_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Shape.hh b/src/Moof/Shape.hh index 626ac3a..c972960 100644 --- a/src/Moof/Shape.hh +++ b/src/Moof/Shape.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_SHAPE_HH_ #define _MOOF_SHAPE_HH_ @@ -63,13 +46,13 @@ public: virtual ~Shape() {} /** - * Checks if this shape is intersected by a given ray. If so, returns the - * distance from the start of the ray to the shape and information about the - * intersection via the 2nd parameter. A negative value is returned if - * there is no intersection. + * Checks if this shape is intersected by a given ray. If so, returns + * the distance from the start of the ray to the shape and information + * about the intersection via the 2nd parameter. A negative value is + * returned if there is no intersection. */ virtual bool intersectRay(const Ray& ray, - typename Ray::Intersection& hit) + typename Ray::Intersection& hit) { return SCALAR(-1.0); } @@ -80,5 +63,3 @@ public: #endif // _MOOF_SHAPE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index f8f05ba..c78b35c 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -98,7 +81,7 @@ public: if (result < 0) { logWarning << "couldn't load sound: " << path << std::endl; - throw Error(Error::UNKNOWN_AUDIO_FORMAT, path); + Error(Error::UNKNOWN_AUDIO_FORMAT, path).raise(); } vorbis_info* vorbisInfo = ov_info(&mOggStream, -1); @@ -338,7 +321,8 @@ public: { // nothing more to play, stopping... mIsPlaying = false; - std::remove(mBuffers.begin(), mBuffers.end(), bufferObj); + std::remove(mBuffers.begin(), mBuffers.end(), + bufferObj); } } } @@ -346,8 +330,8 @@ public: ALenum state; alGetSourcei(mSource, AL_SOURCE_STATE, &state); - // restart playing if we're stopped but supposed to be playing... this - // means we didn't queue enough and the audio skipped :-( + // restart playing if we're stopped but supposed to be playing... + // this means we didn't queue enough and the audio skipped :-( if (mIsPlaying && state != AL_PLAYING) { alSourcePlay(mSource); @@ -425,8 +409,8 @@ public: { // don't let the music die! update(); - // TODO - might be nice to also allow using threads for streaming rather - // than a timer, probably as a compile-time option + // TODO - might be nice to also allow using threads for streaming + // rather than a timer, probably as a compile-time option } static void retainBackend() @@ -446,7 +430,8 @@ public: { alcMakeContextCurrent(gAlContext); logInfo << "opened sound device `" - << alcGetString(gAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) + << alcGetString(gAlDevice, + ALC_DEFAULT_DEVICE_SPECIFIER) << "'" << std::endl; } } @@ -563,21 +548,18 @@ void Sound::setLooping(bool looping) void Sound::setListenerPosition(const Vector3& position) { - //alListener3f(AL_POSITION, float(position[0]), float(position[1]), - //float(position[2])); float vec[] = {position[0], position[1], position[2]}; alListenerfv(AL_POSITION, vec); } void Sound::setListenerVelocity(const Vector3& velocity) { - //alListener3f(AL_VELOCITY, float(velocity[0]), float(velocity[1]), - //float(velocity[2])); float vec[] = {velocity[0], velocity[1], velocity[2]}; alListenerfv(AL_VELOCITY, vec); } -void Sound::setListenerOrientation(const Vector3& forward, const Vector3& up) +void Sound::setListenerOrientation(const Vector3& forward, + const Vector3& up) { float vec[6]; vec[0] = float(forward[0]); @@ -606,7 +588,7 @@ std::string Sound::getPath(const std::string& name) } -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void SoundStream::enqueue(const std::string& name) @@ -625,5 +607,3 @@ void SoundStream::play() } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Sound.hh b/src/Moof/Sound.hh index 14cd790..d3cfa89 100644 --- a/src/Moof/Sound.hh +++ b/src/Moof/Sound.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_SOUND_HH_ #define _MOOF_SOUND_HH_ @@ -34,6 +17,8 @@ * Load and play sounds, current supports ogg vorbis. */ +#include + #include #include @@ -83,7 +68,7 @@ public: static void setListenerPosition(const Vector3& position); static void setListenerVelocity(const Vector3& velocity); static void setListenerOrientation(const Vector3& forward, - const Vector3& up); + const Vector3& up); static std::string getPath(const std::string& name); @@ -117,5 +102,3 @@ public: #endif // _MOOF_SOUND_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Sphere.cc b/src/Moof/Sphere.cc index aa2c139..03db012 100644 --- a/src/Moof/Sphere.cc +++ b/src/Moof/Sphere.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Frustum.hh" #include "OpenGL.hh" @@ -63,5 +46,3 @@ bool Sphere::isVisible(const Frustum& frustum) const } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Sphere.hh b/src/Moof/Sphere.hh index f184709..3cd1ec7 100644 --- a/src/Moof/Sphere.hh +++ b/src/Moof/Sphere.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_SPHERE_HH_ #define _MOOF_SPHERE_HH_ @@ -36,6 +19,7 @@ #include #include +// TODO this needs work namespace Mf { @@ -106,30 +90,30 @@ struct Sphere : public Cullable, public Drawable, public Shape //void draw(Scalar alpha = 0.0) const; //bool isVisible(const Frustum& frustum) const; -void encloseVertices(const Vector vertices[], unsigned count) -{ - // TODO -} + void encloseVertices(const Vector vertices[], unsigned count) + { + // TODO + } -void draw(Scalar alpha = 0.0) const; -//{ - //GLUquadricObj* sphereObj = gluNewQuadric(); - //gluQuadricDrawStyle(sphereObj, GLU_LINE); + void draw(Scalar alpha = 0.0) const; + //{ + //GLUquadricObj* sphereObj = gluNewQuadric(); + //gluQuadricDrawStyle(sphereObj, GLU_LINE); - //glPushMatrix(); + //glPushMatrix(); - //glTranslate(point); - //gluSphere(sphereObj, GLdouble(radius), 16, 16); + //glTranslate(point); + //gluSphere(sphereObj, GLdouble(radius), 16, 16); - //glPopMatrix(); + //glPopMatrix(); - //gluDeleteQuadric(sphereObj); -//} + //gluDeleteQuadric(sphereObj); + //} -bool isVisible(const Frustum& frustum) const -{ - return true; -} + bool isVisible(const Frustum& frustum) const + { + return true; + } }; @@ -183,5 +167,3 @@ inline bool checkCollision(const Sphere& a, const Sphere& b) #endif // _MOOF_SPHERE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/StringTools.cc b/src/Moof/StringTools.cc index f4bd967..34d2f61 100644 --- a/src/Moof/StringTools.cc +++ b/src/Moof/StringTools.cc @@ -1,41 +1,25 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include "ConvertUTF.h" - #include "StringTools.hh" namespace Mf { +// TODO this code is ugly + std::wstring multiToWide(const std::string& multiStr) { size_t length = multiStr.length(); @@ -155,5 +139,3 @@ std::string wideToMulti(const std::wstring& wideStr) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/StringTools.hh b/src/Moof/StringTools.hh index 44bd74f..7b69bb0 100644 --- a/src/Moof/StringTools.hh +++ b/src/Moof/StringTools.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_STRINGTOOLS_HH_ #define _MOOF_STRINGTOOLS_HH_ @@ -42,5 +25,3 @@ std::string wideToMulti(const std::wstring& wideStr); #endif // _MOOF_STRINGTOOLS_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 801acba..48e6e1b 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include // FILE #include // strncmp @@ -46,12 +29,13 @@ namespace Mf { /** - * The texture implementation just contains all the information about the image - * which is worth having in memory. The image data itself is not worth keeping - * in memory if the texture has been loaded to GL, but the name of the resource - * is retained so that it can be reloaded if necessary. The implementation is a - * manager so that multiple texture objects can share the same internal objects - * and avoid having duplicate textures loaded to GL. + * The texture implementation just contains all the information about the + * image which is worth having in memory. The image data itself is not + * worth keeping in memory if the texture has been loaded to GL, but the + * name of the resource is retained so that it can be reloaded if + * necessary. The implementation is a manager so that multiple texture + * objects can share the same internal objects and avoid having duplicate + * textures loaded to GL. */ class Texture::Impl : public Manager @@ -76,9 +60,9 @@ class Texture::Impl : public Manager } /** - * If the GL context was recreated, we need to reload the texture. This may - * involve reading it from disk again, but hopefully the OS was smart enough - * to cache it if the client has plenty of RAM. + * If the GL context was recreated, we need to reload the texture. + * This may involve reading it from disk again, but hopefully the OS + * was smart enough to cache it if the client has plenty of RAM. */ void contextRecreated() @@ -88,8 +72,9 @@ class Texture::Impl : public Manager } /** - * This is a helper method used by some of the texture loading code. It - * returns the first power of two which is greater than the input value. + * This is a helper method used by some of the texture loading code. + * It returns the first power of two which is greater than the input + * value. */ static int powerOfTwo(int input) @@ -110,10 +95,14 @@ class Texture::Impl : public Manager script.push(GL_REPEAT); script.set("REPEAT"); script.push(GL_LINEAR); script.set("LINEAR"); script.push(GL_NEAREST); script.set("NEAREST"); - script.push(GL_LINEAR_MIPMAP_LINEAR); script.set("LINEAR_MIPMAP_LINEAR"); - script.push(GL_LINEAR_MIPMAP_NEAREST); script.set("LINEAR_MIPMAP_NEAREST"); - script.push(GL_NEAREST_MIPMAP_LINEAR); script.set("NEAREST_MIPMAP_LINEAR"); - script.push(GL_NEAREST_MIPMAP_NEAREST); script.set("NEAREST_MIPMAP_NEAREST"); + script.push(GL_LINEAR_MIPMAP_LINEAR); + script.set("LINEAR_MIPMAP_LINEAR"); + script.push(GL_LINEAR_MIPMAP_NEAREST); + script.set("LINEAR_MIPMAP_NEAREST"); + script.push(GL_NEAREST_MIPMAP_LINEAR); + script.set("NEAREST_MIPMAP_LINEAR"); + script.push(GL_NEAREST_MIPMAP_NEAREST); + script.set("NEAREST_MIPMAP_NEAREST"); } public: @@ -132,7 +121,8 @@ public: mObject(0) { // make sure we have a video context - ASSERT(video && "cannot load textures without a current video context"); + ASSERT(video && + "cannot load textures without a current video context"); // we want to know when the GL context is recreated mDispatchHandler = core.addHandler("video.newcontext", @@ -146,10 +136,10 @@ public: /** - * Adapted from some public domain code. This stuff is common enough that - * it really should be included in SDL_image... We need this because images - * loaded with SDL_image aren't exactly GL-ready right out of the box. This - * method makes them ready. + * Adapted from some public domain code. This stuff is common enough + * that it really should be included in SDL_image... We need this + * because images loaded with SDL_image aren't exactly GL-ready right + * out of the box. This method makes them ready. */ /* @@ -158,16 +148,17 @@ public: int w = powerOfTwo(surface->w); int h = powerOfTwo(surface->h); - // 2. OpenGL textures make more sense within the coordinate system when - // they are "upside down," so let's flip it. + // 2. OpenGL textures make more sense within the coordinate system + // when they are "upside down," so let's flip it. flipSurface(surface); - // 1. OpenGL images must (generally) have dimensions of a power-of-two. - // If this one doesn't, we can at least be more friendly by expanding - // the dimensions so that they are, though there will be some empty - // space within the range of normal texture coordinates. It's better if - // textures are the right size to begin with. + // 1. OpenGL images must (generally) have dimensions of a + // power-of-two. If this one doesn't, we can at least be more + // friendly by expanding the dimensions so that they are, though + // there will be some empty space within the range of normal + // texture coordinates. It's better if textures are the right size + // to begin with. SDL_Surface* image = SDL_CreateRGBSurface ( @@ -216,8 +207,8 @@ public: */ /** - * Use SDL_image to load images from file. A surface with the image data is - * returned. + * Use SDL_image to load images from file. A surface with the image + * data is returned. * @return Image data. */ @@ -247,7 +238,8 @@ public: } else { - Mf::logInfo << "loading tiles from texture " << path << std::endl; + Mf::logInfo << "loading tiles from texture " << path + << std::endl; Mf::Script::Slot globals = script.getGlobalTable(); Mf::Script::Slot top = script[-1]; @@ -309,8 +301,8 @@ public: /** - * Sets some texture properties such as the filters and external coordinate - * behavior. + * Sets some texture properties such as the filters and external + * coordinate behavior. */ void setProperties() @@ -373,8 +365,7 @@ public: Scalar h = 1.0 / Scalar(mTilesT); coords[0] = Scalar(index % mTilesS) * w; - coords[1] = (Scalar(mTilesT - 1) - - Scalar(index / mTilesS)) * h; + coords[1] = (Scalar(mTilesT - 1) - Scalar(index / mTilesS)) * h; coords[2] = coords[0] + w; coords[3] = coords[1]; coords[4] = coords[2]; @@ -387,15 +378,15 @@ public: ImageP mImage; - GLuint mMinFilter; ///< Minification filter. - GLuint mMagFilter; ///< Magnification filter. - GLuint mWrapS; ///< Wrapping behavior horizontally. - GLuint mWrapT; ///< Wrapping behavior vertically. + GLuint mMinFilter; ///< Minification filter. + GLuint mMagFilter; ///< Magnification filter. + GLuint mWrapS; ///< Wrapping behavior horizontally. + GLuint mWrapT; ///< Wrapping behavior vertically. unsigned mTilesS; unsigned mTilesT; - GLuint mObject; ///< GL texture handle. - static GLuint gObject; ///< Global GL texture handle. + GLuint mObject; ///< GL texture handle. + static GLuint gObject; ///< Global GL texture handle. Dispatch::Handler mDispatchHandler; }; @@ -516,5 +507,3 @@ std::string Texture::getPath(const std::string& name) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Texture.hh b/src/Moof/Texture.hh index 41add2b..27ec414 100644 --- a/src/Moof/Texture.hh +++ b/src/Moof/Texture.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_TEXTURE_HH_ #define _MOOF_TEXTURE_HH_ @@ -34,6 +17,8 @@ * Image-loading and OpenGL texture loading. */ +#include + #include #include @@ -86,14 +71,16 @@ public: /** - * Calculate texture coordinates for a tile at a certain index. Tiles are - * indexed start with zero as the to-left tile and moving across, then down. + * Calculate texture coordinates for a tile at a certain index. Tiles + * are indexed start with zero as the to-left tile and moving across, + * then down. * @param index The tile index. - * @param coords An array of scalars where the texture coordinates will be - * stored after this call. The first coordinate (u,v) will be in the first - * two places and so on until all four coordinates are stored, therefore - * requiring enough room for an array of eight scalars. The winding of the - * coordinates is always counter-clockwise (the GL default). + * @param coords An array of scalars where the texture coordinates will + * be stored after this call. The first coordinate (u,v) will be in + * the first two places and so on until all four coordinates are + * stored, therefore requiring enough room for an array of eight + * scalars. The winding of the coordinates is always counter-clockwise + * (the GL default). * @return True if index is valid, false otherwise. */ @@ -101,14 +88,16 @@ public: /** - * This version let's you specify an orientation that will be reflected in - * the texture coordinates. This allows you to easily map a texture + * This version let's you specify an orientation that will be reflected + * in the texture coordinates. This allows you to easily map a texture * backwards or upside-down. - * @param what The orientation; can be flip, reverse, or flip_and_reverse. + * @param what The orientation; can be flip, reverse, or + * flip_and_reverse. * @return True if index is valid, false otherwise. */ - bool getTileCoords(TileIndex index, Scalar coords[8], Orientation what) const; + bool getTileCoords(TileIndex index, Scalar coords[8], + Orientation what) const; static std::string getPath(const std::string& name); @@ -124,5 +113,3 @@ private: #endif // _MOOF_TEXTURE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Thread.hh b/src/Moof/Thread.hh index 74952fa..52a878a 100644 --- a/src/Moof/Thread.hh +++ b/src/Moof/Thread.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_THREAD_HH_ #define _MOOF_THREAD_HH_ @@ -35,7 +18,6 @@ */ #include - #include @@ -98,7 +80,7 @@ inline unsigned getThreadIdentifier(Thread thread) } -// ============================================================================= +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Mutex { @@ -198,7 +180,8 @@ public: bool wait(Mutex::Lock& lock, unsigned ms) { // TODO for consistency, this function should take seconds - return (SDL_CondWaitTimeout(condition_, lock.mMutex->mMutex, ms) == 0); + return (SDL_CondWaitTimeout(condition_, + lock.mMutex->mMutex, ms) == 0); } bool notify() @@ -301,8 +284,5 @@ private: } // namespace Mf - #endif // _MOOF_THREAD_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Timer.cc b/src/Moof/Timer.cc index 69d2405..3e42818 100644 --- a/src/Moof/Timer.cc +++ b/src/Moof/Timer.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -173,12 +156,12 @@ void Timer::fireIfExpired(Scalar t) #if HAVE_CLOCK_GETTIME -// Since the monotonic clock will provide us with the time since the computer -// started, the number of seconds since that time could easily become so large -// that it cannot be accurately stored in a float (even with as little two days -// uptime), therefore we need to start from a more recent reference (when the -// program starts). Of course this isn't much of an issue if scalar is a -// double-precision number. +// Since the monotonic clock will provide us with the time since the +// computer started, the number of seconds since that time could easily +// become so large that it cannot be accurately stored in a float (even +// with as little two days uptime), therefore we need to start from a more +// recent reference (when the program starts). Of course this isn't much +// of an issue if scalar is a double-precision number. static time_t setReference_() { @@ -202,7 +185,8 @@ Scalar Timer::getTicks() int result = clock_gettime(CLOCK_MONOTONIC, &ts); ASSERT(result == 0 && "cannot access clock"); - return Scalar(ts.tv_sec - reference) + Scalar(ts.tv_nsec) / 1000000000.0; + return Scalar(ts.tv_sec - reference) + + Scalar(ts.tv_nsec) / 1000000000.0; } void Timer::sleep(Scalar seconds, Mode mode) @@ -225,9 +209,9 @@ void Timer::sleep(Scalar seconds, Mode mode) #else // ! HAVE_CLOCK_GETTIME -// If we don't have posix timers, we'll have to use a different timing method. -// SDL only promises centisecond accuracy, but that's better than a kick in the -// butt. +// If we don't have posix timers, we'll have to use a different timing +// method. SDL only promises centisecond accuracy, but that's better than +// a kick in the pants. Scalar Timer::getTicks() { @@ -246,5 +230,3 @@ void Timer::sleep(Scalar seconds, Mode mode) } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Timer.hh b/src/Moof/Timer.hh index 246b4b1..4cc8480 100644 --- a/src/Moof/Timer.hh +++ b/src/Moof/Timer.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_TIMER_HH_ #define _MOOF_TIMER_HH_ @@ -73,7 +56,8 @@ public: invalidate(); } - void init(const Function& function, Scalar seconds, Mode mode = NORMAL); + void init(const Function& function, Scalar seconds, + Mode mode = NORMAL); bool isValid() const; void invalidate(); @@ -86,7 +70,8 @@ public: /** - * Get the number of seconds since a fixed, arbitrary point in the past. + * Get the number of seconds since a fixed, arbitrary point in the + * past. * @return Seconds. */ @@ -94,12 +79,13 @@ public: /** - * Put the thread to sleep for a certain period of time. If absolute is true, - * then it will sleep until seconds after the fixed time in the past. If - * absolute is false, it will sleep for seconds starting now. Unlike system - * sleep functions, this one automatically resumes sleep if sleep was - * interrupted by a signal. Therefore, calling this function is guaranteed to - * sleep for the requested amount of time (and maybe longer). + * Put the thread to sleep for a certain period of time. If absolute + * is true, then it will sleep until seconds after the fixed time in + * the past. If absolute is false, it will sleep for seconds starting + * now. Unlike system sleep functions, this one automatically resumes + * sleep if sleep was interrupted by a signal. Therefore, calling this + * function is guaranteed to sleep for the requested amount of time + * (and maybe longer). */ static void sleep(Scalar seconds, Mode mode = NORMAL); @@ -131,8 +117,5 @@ private: } // namespace Mf - #endif // _MOOF_TIMER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh index dfc2602..d65d82d 100644 --- a/src/Moof/Transition.hh +++ b/src/Moof/Transition.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _MOOF_TRANSITION_HH_ #define _MOOF_TRANSITION_HH_ @@ -165,5 +148,3 @@ public: #endif // _MOOF_TRANSITION_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index e071609..9f62586 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "Dispatch.hh" #include "Error.hh" @@ -85,23 +68,40 @@ void Video::recreateContext() void Video::setOpenGLAttributes() { - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, mAttribs.colorBuffer[0]); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, mAttribs.colorBuffer[1]); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, mAttribs.colorBuffer[2]); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, mAttribs.colorBuffer[3]); - SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, mAttribs.frameBuffer); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, mAttribs.doubleBuffer); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, mAttribs.depthBuffer); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, mAttribs.stencilBuffer); - SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, mAttribs.accumBuffer[0]); - SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, mAttribs.accumBuffer[1]); - SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, mAttribs.accumBuffer[2]); - SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, mAttribs.accumBuffer[3]); - SDL_GL_SetAttribute(SDL_GL_STEREO, mAttribs.stereo); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, mAttribs.multisampleBuffers); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mAttribs.multisampleSamples); - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, mAttribs.swapControl); - SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, mAttribs.hardwareOnly); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, + mAttribs.colorBuffer[0]); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, + mAttribs.colorBuffer[1]); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, + mAttribs.colorBuffer[2]); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, + mAttribs.colorBuffer[3]); + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, + mAttribs.frameBuffer); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, + mAttribs.doubleBuffer); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, + mAttribs.depthBuffer); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, + mAttribs.stencilBuffer); + SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, + mAttribs.accumBuffer[0]); + SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, + mAttribs.accumBuffer[1]); + SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, + mAttribs.accumBuffer[2]); + SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, + mAttribs.accumBuffer[3]); + SDL_GL_SetAttribute(SDL_GL_STEREO, + mAttribs.stereo); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, + mAttribs.multisampleBuffers); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, + mAttribs.multisampleSamples); + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, + mAttribs.swapControl); + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, + mAttribs.hardwareOnly); } @@ -363,7 +363,8 @@ Video::Attributes::Attributes() } else if (fullscreen && Backend::isInitialized()) { - SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); + SDL_Rect** modes = SDL_ListModes(NULL, + SDL_FULLSCREEN | SDL_HWSURFACE); if (modes == (SDL_Rect**)0) { @@ -371,7 +372,8 @@ Video::Attributes::Attributes() } else if (modes == (SDL_Rect**)-1) { - Mf::logWarning("any resolution allowed; choosing default 800x600"); + Mf::logWarning("any resolution allowed; " + "choosing default 800x600"); mode[0] = 800; mode[1] = 600; } @@ -387,10 +389,8 @@ Video::Attributes::Attributes() } -Video* video = 0; +Video* video = 0; // most recently instantiated instance } // namespace Mf -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Video.hh b/src/Moof/Video.hh index 0cc1a4e..9b1a092 100644 --- a/src/Moof/Video.hh +++ b/src/Moof/Video.hh @@ -2,7 +2,7 @@ /*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * -* vi:ts=8 sw=4 tw=75 +* vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. @@ -15,7 +15,6 @@ #include #include - #include #include diff --git a/src/Scene.cc b/src/Scene.cc index 45fc3a0..7b23ab6 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -314,7 +297,8 @@ struct Scene::Impl : public Mf::Manager Mf::Scalar value; script[2].requireNumber().get(value); - cml::matrix_rotate_about_world_axis(mTransform, index, cml::rad(value)); + cml::matrix_rotate_about_world_axis(mTransform, + index, cml::rad(value)); return 0; } @@ -339,15 +323,19 @@ struct Scene::Impl : public Mf::Manager script.pop(); nTiles = table.getLength(); - if (nTiles % width != 0) table.throwError("invalid number of tiles"); + if (nTiles % width != 0) + { + table.throwError("invalid number of tiles"); + } if (width == 0) table.throwError("width field must not be zero"); height = nTiles / width; Mf::Vector3 vertices[height+1][width+1]; - // the indices are stored upside-down in the scene file so that they are - // easier to edit as text, so we'll need to load them last row first + // the indices are stored upside-down in the scene file so that + // they are easier to edit as text, so we'll need to load them last + // row first // do first row and first column of vertices @@ -514,7 +502,8 @@ void Scene::draw(Mf::Scalar alpha) const mImpl->mBounds.draw(); } -void Scene::drawIfVisible(Mf::Scalar alpha, const Mf::Frustum& frustum) const +void Scene::drawIfVisible(Mf::Scalar alpha, + const Mf::Frustum& frustum) const { std::list< boost::shared_ptr >& objects = mImpl->mObjects; std::list< boost::shared_ptr >::const_iterator it; @@ -537,7 +526,7 @@ void Scene::drawIfVisible(Mf::Scalar alpha, const Mf::Frustum& frustum) const bool Scene::castRay(const Mf::Ray<2>& ray, - std::list::Intersection>& hits) const + std::list::Intersection>& hits) const { std::list< Mf::Line<2> >& lines = mImpl->mLines; std::list< Mf::Line<2> >::const_iterator it; @@ -625,6 +614,3 @@ std::string Scene::getPath(const std::string& name) return Mf::Resource::getPath("scenes/" + name + ".lua"); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Scene.hh b/src/Scene.hh index 7558e3a..85a6716 100644 --- a/src/Scene.hh +++ b/src/Scene.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _SCENE_HH_ #define _SCENE_HH_ @@ -77,5 +60,3 @@ public: #endif // _SCENE_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/TilemapFont.cc b/src/TilemapFont.cc index 48b0fc3..14cfa2c 100644 --- a/src/TilemapFont.cc +++ b/src/TilemapFont.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include @@ -56,6 +39,3 @@ void TilemapFont::getTileCoords(char symbol, Mf::Scalar coords[8], Mf::Texture::getTileCoords(index, coords, what); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/TilemapFont.hh b/src/TilemapFont.hh index 89cb062..c0a8ea6 100644 --- a/src/TilemapFont.hh +++ b/src/TilemapFont.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _TILEMAPFONT_HH_ #define _TILEMAPFONT_HH_ @@ -44,11 +27,9 @@ public: TilemapFont(); void getTileCoords(char symbol, Mf::Scalar coords[8], - Mf::Texture::Orientation what = Mf::Texture::NORMAL); + Mf::Texture::Orientation what = Mf::Texture::NORMAL); }; #endif // _TILEMAPFONT_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/TitleLayer.cc b/src/TitleLayer.cc index afe13e9..d31fe87 100644 --- a/src/TitleLayer.cc +++ b/src/TitleLayer.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -69,7 +52,8 @@ bool TitleLayer::handleEvent(const Mf::Event& event) interp.init(0.0, 1.0); Mf::Transition::Ptr transition = - Mf::Transition::alloc(mGameLayer, titleLayer, interp); + Mf::Transition::alloc(mGameLayer, titleLayer, + interp); Mf::core.push(transition); return true; @@ -78,6 +62,3 @@ bool TitleLayer::handleEvent(const Mf::Event& event) return false; } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/TitleLayer.hh b/src/TitleLayer.hh index fe745ee..90041ee 100644 --- a/src/TitleLayer.hh +++ b/src/TitleLayer.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _TITLELAYER_HH_ #define _TITLELAYER_HH_ @@ -63,5 +46,3 @@ private: #endif // _TITLELAYER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Typesetter.cc b/src/Typesetter.cc index 2692919..1b21f76 100644 --- a/src/Typesetter.cc +++ b/src/Typesetter.cc @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include #include @@ -47,6 +30,3 @@ void Typesetter::print(const std::string& format, ...) nPrinted = std::min(nPrinted, (int)sizeof(buffer) - 1); } - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Typesetter.hh b/src/Typesetter.hh index 82d94fa..cbb54eb 100644 --- a/src/Typesetter.hh +++ b/src/Typesetter.hh @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _TYPESETTER_HH_ #define _TYPESETTER_HH_ @@ -54,5 +37,3 @@ private: #endif // _TYPESETTER_HH_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/version.c b/src/version.c index 9e78b78..a69ff33 100644 --- a/src/version.c +++ b/src/version.c @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #include "version.h" @@ -35,6 +18,3 @@ const char* COMPILE_TIME = __DATE__" "__TIME__; const char* COMPILE_TIME = "Unknown"; #endif - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/version.h b/src/version.h index a6e48d5..1a6eafd 100644 --- a/src/version.h +++ b/src/version.h @@ -1,30 +1,13 @@ -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ #ifndef _VERSION_H_ #define _VERSION_H_ @@ -84,5 +67,3 @@ extern const char* COMPILE_TIME; #endif // _VERSION_H_ -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/yoink.rc b/src/yoink.rc index 02ab6e2..8d626fc 100644 --- a/src/yoink.rc +++ b/src/yoink.rc @@ -27,7 +27,7 @@ BEGIN VALUE "FileDescription", "Alien-smashing action game" VALUE "FileVersion", PACKAGE_VERSION VALUE "InternalName", "Yoink" - VALUE "LegalCopyright", "Copyright 2009 Charles McGarvey et al." + VALUE "LegalCopyright", "Copyright 2010 Charles McGarvey et al." VALUE "OriginalFilename", "yoink.exe" VALUE "ProductName", "Yoink" VALUE "ProductVersion", PACKAGE_VERSION -- 2.44.0 From b714ba98cb92a1be42acba91d44fe5bfb0783a3b Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sun, 24 Jan 2010 10:12:52 -0700 Subject: [PATCH 11/16] upgrade libpng to 1.4.0 --- win32/mkpackage.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/mkpackage.sh.in b/win32/mkpackage.sh.in index 784e0fa..4a760d8 100644 --- a/win32/mkpackage.sh.in +++ b/win32/mkpackage.sh.in @@ -17,7 +17,7 @@ STRIP="@STRIP@" UNIX2DOS="$ROOT_DIR/tools/unix2dos" # DLL dependencies -DLLS="libogg-0 libpng-3 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1" +DLLS="libogg-0 libpng14-14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1" # Prepare rm -rf "$BUILD_DIR" -- 2.44.0 From 76b3f4be992514a740ac03cdbdd57844142a0b4c Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Fri, 29 Jan 2010 22:04:31 -0700 Subject: [PATCH 12/16] game loop tweaks; shapes hierarchy defined --- data/yoinkrc | 14 ++-- src/Character.cc | 7 +- src/GameLayer.cc | 21 +++--- src/GameLayer.hh | 8 +-- src/Hud.cc | 12 ++-- src/Hud.hh | 4 +- src/Makefile.am | 3 - src/Moof/Aabb.cc | 71 -------------------- src/Moof/Aabb.hh | 152 +++++++++++++++++++++++++++--------------- src/Moof/Core.cc | 40 +++++------ src/Moof/Frustum.hh | 2 +- src/Moof/Line.hh | 32 ++++++++- src/Moof/OpenGL.hh | 3 + src/Moof/Plane.hh | 2 +- src/Moof/Ray.hh | 10 ++- src/Moof/Rectangle.cc | 32 --------- src/Moof/Rectangle.hh | 83 ----------------------- src/Moof/Shape.hh | 29 ++++---- src/Moof/Sphere.hh | 7 +- src/Scene.cc | 4 +- src/Scene.hh | 2 +- 21 files changed, 222 insertions(+), 316 deletions(-) delete mode 100644 src/Moof/Aabb.cc delete mode 100644 src/Moof/Rectangle.cc delete mode 100644 src/Moof/Rectangle.hh diff --git a/data/yoinkrc b/data/yoinkrc index de65603..bf5bc83 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -56,19 +56,21 @@ resizable = true --videomode = {800, 600} --- Set this to make the cursor remain visible as you mouse over the view of --- the game. +-- Set this to make the cursor remain visible as you mouse over the video +-- output of the game. -showcursor = true +showcursor = false -- Set this to use double-buffering to improve animation quality. You --- should usually leave this as true. +-- really don't want to turn this off. doublebuffer = true -- Set this to sync with the refresh rate of your display. Your framerate --- will be limited to the refresh rate, but you may experience fewer ugly --- "artifacts" caused by the game animation. +-- will be limited to the refresh rate, but you may experience less +-- tearing caused by the display vertical refresh. On the other hand, you +-- might experience worse tearing, depending on your setup. Try it both +-- ways. swapcontrol = true diff --git a/src/Character.cc b/src/Character.cc index 6a7c698..840099c 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -30,8 +30,7 @@ public: // spring: //mState.force += -15.0 * x - 1.5 * mState.velocity; - force = SCALAR(-10.0) * (mag - d) * (x / mag) - - SCALAR(2.0) * state.velocity; + force = SCALAR(-10.0) * (mag - d) * (x / mag);// - SCALAR(2.0) * state.velocity; return force; } @@ -73,8 +72,8 @@ Character::Character(const std::string& name) : // forces mState.force = Mf::Vector2(0.0, 0.0); - //mState.forces.push_back(SpringForce(Mf::Vector2(20.0, 4.0))); - mState.forces.push_back(ResistanceForce(2.0)); + //mState.forces.push_back(SpringForce(Mf::Vector2(5.0, 4.0))); + //mState.forces.push_back(ResistanceForce(2.0)); //mState.forces.push_back(Mf::LinearState<2>::GravityForce(-9.8)); // starting position diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 3a0ea09..331d04f 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -114,7 +114,7 @@ GameLayer::GameLayer() : } -void GameLayer::pushedOntoEngine() +void GameLayer::addedToCore() { Mf::core.push(mHud); @@ -123,8 +123,8 @@ void GameLayer::pushedOntoEngine() mLine.a.set(20, 10); mLine.b.set(19, 14); - mSphere.point.set(22, 5); - mSphere.radius = 2; + mCircle.point.set(22, 5); + mCircle.radius = 2; mRayTimer.init(boost::bind(&GameLayer::rayTimer, this), 1.0, Mf::Timer::REPEAT); @@ -155,8 +155,8 @@ void GameLayer::thinkTimer() void GameLayer::rayTimer() { - Mf::Ray<2>::Intersection meh; - std::list::Intersection> hits; + Mf::Ray2::Contact meh; + std::list hits; Mf::Vector2 point; bool bam = mLine.intersectRay(mRay, meh); @@ -166,7 +166,7 @@ void GameLayer::rayTimer() hits.push_back(meh); } - bam = mSphere.intersectRay(mRay, meh); + bam = mCircle.intersectRay(mRay, meh); if (bam) { meh.normal.normalize(); @@ -177,9 +177,9 @@ void GameLayer::rayTimer() { hits.front().normal.normalize(); mRay.solve(point, hits.front().distance); - //Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; - //Mf::logInfo << " P = " << point << std::endl; - //Mf::logInfo << " n = " << hits.front().normal << std::endl; + Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; + Mf::logInfo << " P = " << point << std::endl; + Mf::logInfo << " n = " << hits.front().normal << std::endl; } } @@ -195,12 +195,11 @@ void GameLayer::draw(Mf::Scalar alpha) const glEnableClientState(GL_TEXTURE_COORD_ARRAY); mState.scene->drawIfVisible(alpha, mState.camera.getFrustum()); - mState.heroine->draw(alpha); mRay.draw(); mLine.draw(); - mSphere.draw(); + mCircle.draw(); } bool GameLayer::handleEvent(const Mf::Event& event) diff --git a/src/GameLayer.hh b/src/GameLayer.hh index 885a49d..c537af6 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -51,7 +51,7 @@ public: return GameLayerP(new GameLayer); } - void pushedOntoEngine(); + void addedToCore(); void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha) const; @@ -75,9 +75,9 @@ private: Mf::SoundStream mMusic; Mf::Sound mPunchSound; - Mf::Ray<2> mRay; - Mf::Line<2> mLine; - Mf::Sphere<2> mSphere; + Mf::Ray2 mRay; + Mf::Line2 mLine; + Mf::Circle mCircle; Mf::Timer mRayTimer; void rayTimer(); diff --git a/src/Hud.cc b/src/Hud.cc index 9e40a60..f4134cf 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -9,7 +9,9 @@ * **************************************************************************/ +#include #include +#include #include #include @@ -30,11 +32,12 @@ ProgressBar::ProgressBar(const Mf::Texture& tilemap, void ProgressBar::resize(const Mf::Rectangle& rect) { + Mf::logInfo << "rect: " << rect.min << ", " << rect.max << std::endl; Mf::Scalar height = rect.max[1] - rect.min[1]; Mf::Scalar halfHeight = height / 2.0; mWidth = rect.max[0] - rect.min[0] - height; - // assert width > 0 + ASSERT(mWidth > 0); mVertices[0] = rect.min; mVertices[1] = Mf::Vector2(rect.min[0] + halfHeight, rect.min[1]); @@ -122,10 +125,8 @@ void Hud::resize(int width, int height) SCALAR(1.0), SCALAR(-1.0), cml::z_clip_neg_one); // position the two progress bars at the top-left of the screen - mBar1.resize(Mf::Rectangle(20, height - 51, - 0.7 * width, height - 3)); - mBar2.resize(Mf::Rectangle(20, height - 28, - 0.7 * width, height - 70)); + mBar1.resize(Mf::Rectangle(20, height - 51, 0.7 * width, height - 3)); + mBar2.resize(Mf::Rectangle(20, height - 28, 0.7 * width, height - 70)); setBar1Progress(0.05); setBar2Progress(0.0); @@ -174,6 +175,7 @@ bool Hud::handleEvent(const Mf::Event& event) { // don't want the hud anymore Mf::core.pop(this); + Mf::logWarning("okay bye bye hud"); return true; } break; diff --git a/src/Hud.hh b/src/Hud.hh index 30b5a42..bc8a313 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -20,12 +20,14 @@ #include #include #include -#include +//#include #include #include "GameState.hh" +class Rectangle; + // TODO this stuff is still just hacked up class ProgressBar : public Mf::Drawable diff --git a/src/Makefile.am b/src/Makefile.am index 45ea7cd..4e8f65d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,6 @@ noinst_LIBRARIES = libmoof.a libmoof_a_SOURCES = \ - Moof/Aabb.cc \ Moof/Aabb.hh \ Moof/Camera.cc \ Moof/Camera.hh \ @@ -46,8 +45,6 @@ libmoof_a_SOURCES = \ Moof/Plane.cc \ Moof/Plane.hh \ Moof/Ray.hh \ - Moof/Rectangle.cc \ - Moof/Rectangle.hh \ Moof/Resource.cc \ Moof/Resource.hh \ Moof/RigidBody.hh \ diff --git a/src/Moof/Aabb.cc b/src/Moof/Aabb.cc deleted file mode 100644 index 4ef1520..0000000 --- a/src/Moof/Aabb.cc +++ /dev/null @@ -1,71 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include "Aabb.hh" -#include "Frustum.hh" -#include "OpenGL.hh" -#include "Texture.hh" - - -namespace Mf { - - - /* -void Aabb::getOctant(Aabb& octant, int num) const -{ - Vector3 mid = getCenter(); - - switch (num) - { - case 0: - octant.init(Vector3(min[0], min[1], mid[2]), - Vector3(mid[0], mid[1], max[2])); - break; - - case 1: - octant.init(Vector3(mid[0], min[1], mid[2]), - Vector3(max[0], mid[1], max[2])); - break; - - case 2: - octant.init(mid, max); - break; - - case 3: - octant.init(Vector3(min[0], mid[1], mid[2]), - Vector3(mid[0], max[1], max[2])); - break; - - case 4: - octant.init(min, mid); - break; - - case 5: - octant.init(Vector3(mid[0], min[1], min[2]), - Vector3(max[0], mid[1], mid[2])); - break; - - case 6: - octant.init(Vector3(mid[0], mid[1], min[2]), - Vector3(max[0], max[1], mid[2])); - break; - - case 7: - octant.init(Vector3(min[0], mid[1], min[2]), - Vector3(mid[0], max[1], mid[2])); - break; - } -} -*/ - - -} // namespace Mf - diff --git a/src/Moof/Aabb.hh b/src/Moof/Aabb.hh index f3e92ab..8fcdbc3 100644 --- a/src/Moof/Aabb.hh +++ b/src/Moof/Aabb.hh @@ -38,6 +38,7 @@ struct Aabb : public Cullable, public Drawable, public Shape Vector min; Vector max; + Aabb() {} Aabb(const Vector& a, const Vector& b) @@ -45,16 +46,48 @@ struct Aabb : public Cullable, public Drawable, public Shape init(a, b); } - Aabb(Scalar ax, Scalar ay, Scalar az, - Scalar bx, Scalar by, Scalar bz) + Aabb(Scalar x1, Scalar y1, Scalar x2, Scalar y2) { - Vector a(ax, ay, az); - Vector b(bx, by, bz); + Vector a(x1, y1); + Vector b(x2, y2); init(a, b); } - void init(const Vector& a, const Vector& b) + Aabb(Scalar x1, Scalar y1, Scalar z1, Scalar x2, Scalar y2, Scalar z2) + { + Vector a(x1, y1, z1); + Vector b(x2, y2, z2); + + init(a, b); + } + + + void init(const Vector2& a, const Vector2& b) + { + if (a[0] < b[0]) + { + min[0] = a[0]; + max[0] = b[0]; + } + else + { + min[0] = b[0]; + max[0] = a[0]; + } + if (a[1] < b[1]) + { + min[1] = a[1]; + max[1] = b[1]; + } + else + { + min[1] = b[1]; + max[1] = a[1]; + } + } + + void init(const Vector3& a, const Vector3& b) { if (a[0] < b[0]) { @@ -88,19 +121,17 @@ struct Aabb : public Cullable, public Drawable, public Shape } } + Vector getCenter() const { - return Vector((min[0] + max[0]) / 2.0, - (min[1] + max[1]) / 2.0, - (min[2] + max[2]) / 2.0); + return (min + max) / 2.0; } - //void getOctant(Aabb& octant, int num) const; Plane getPlaneXY() const { Plane plane; - plane.normal = Vector(0.0, 0.0, 1.0); + plane.normal = Vector3(0.0, 0.0, 1.0); plane.d = cml::dot(-plane.normal, getCenter()); return plane; } @@ -108,7 +139,7 @@ struct Aabb : public Cullable, public Drawable, public Shape Plane getPlaneXZ() const { Plane plane; - plane.normal = Vector(0.0, 1.0, 0.0); + plane.normal = Vector3(0.0, 1.0, 0.0); plane.d = cml::dot(-plane.normal, getCenter()); return plane; } @@ -116,22 +147,21 @@ struct Aabb : public Cullable, public Drawable, public Shape Plane getPlaneYZ() const { Plane plane; - plane.normal = Vector(1.0, 0.0, 0.0); + plane.normal = Vector3(1.0, 0.0, 0.0); plane.d = cml::dot(-plane.normal, getCenter()); return plane; } - /* - void getCorners(Vector3 corners[8]) const; - - void encloseVertices(const Vector3 vertices[], unsigned count); - - void draw(Scalar alpha = 0.0) const; - bool isVisible(const Frustum& frustum) const; - */ + void getCorners(Vector2 corners[4]) const + { + corners[0][0] = min[0]; corners[0][1] = min[1]; + corners[1][0] = max[0]; corners[1][1] = min[1]; + corners[2][0] = max[0]; corners[2][1] = max[1]; + corners[3][0] = min[0]; corners[3][1] = max[1]; + } - void getCorners(Vector corners[8]) const + void getCorners(Vector3 corners[8]) const { corners[0][0] = min[0]; corners[0][1] = min[1]; @@ -175,45 +205,63 @@ struct Aabb : public Cullable, public Drawable, public Shape void draw(Scalar alpha = 0.0) const { - Scalar vertices[] = {min[0], min[1], min[2], - min[0], max[1], min[2], - max[0], max[1], min[2], - max[0], min[1], min[2], - min[0], max[1], max[2], - min[0], min[1], max[2], - max[0], min[1], max[2], - max[0], max[1], max[2]}; - - GLubyte indices[] = {0, 1, 2, 3, - 1, 2, 7, 4, - 3, 0, 5, 6, - 2, 3, 6, 7, - 5, 0, 1, 4, - 4, 5, 6, 7}; - - glEnableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glVertexPointer(3, GL_SCALAR, 0, vertices); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - Texture::resetBind(); - - glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE, - indices); - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - //glDisableClientState(GL_VERTEX_ARRAY); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glRect(min[0], min[1], max[0], max[1]); } bool isVisible(const Frustum& frustum) const { - return frustum.contains(*this); + return true; } }; +template <> +inline void Aabb<3>::draw(Scalar alpha) const +{ + Scalar vertices[] = {min[0], min[1], min[2], + min[0], max[1], min[2], + max[0], max[1], min[2], + max[0], min[1], min[2], + min[0], max[1], max[2], + min[0], min[1], max[2], + max[0], min[1], max[2], + max[0], max[1], max[2]}; + + GLubyte indices[] = {0, 1, 2, 3, + 1, 2, 7, 4, + 3, 0, 5, 6, + 2, 3, 6, 7, + 5, 0, 1, 4, + 4, 5, 6, 7}; + + glEnableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(3, GL_SCALAR, 0, vertices); + + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + Texture::resetBind(); + + glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE, + indices); + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + //glDisableClientState(GL_VERTEX_ARRAY); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); +} + +template <> +inline bool Aabb<3>::isVisible(const Frustum& frustum) const +{ + return frustum.contains(*this); +} + + +typedef Aabb<2> Aabb2; +typedef Aabb2 Rectangle; +typedef Aabb<3> Aabb3; + + } // namespace Mf #endif // _MOOF_AABB_HH_ diff --git a/src/Moof/Core.cc b/src/Moof/Core.cc index b9ad92a..b659f98 100644 --- a/src/Moof/Core.cc +++ b/src/Moof/Core.cc @@ -70,6 +70,7 @@ public: void run() { init(); + ASSERT(video && "cannot run core without a current video context"); Scalar totalTime = 0.0; Scalar ticks = Timer::getTicks(); @@ -79,49 +80,50 @@ public: Scalar nextSecond = ticks + SCALAR(1.0); mFps = 0; - int frames = 0; + int frameCount = 0; - const int MAX_FRAMESKIP = 15; - const Scalar inverseTimestep = SCALAR(1.0) / mTimestep; + const Scalar timestep = mTimestep; + const Scalar framerate = mFramerate; - ASSERT(video && "cannot run core without a current video context"); + const int MAX_FRAMESKIP = 15; + const Scalar inverseTimestep = SCALAR(1.0) / timestep; do { - Timer::fireIfExpired(); - dispatchEvents(); + Timer::fireIfExpired(); // 1. fire timers + dispatchEvents(); // 2. dispatch events int i = 0; while (nextUpdate < Timer::getTicks() && i < MAX_FRAMESKIP) { - totalTime += mTimestep; - update(totalTime, mTimestep); + totalTime += timestep; + update(totalTime, timestep); // 3. update state - nextUpdate += mTimestep; + nextUpdate += timestep; ++i; } if (nextDraw < (ticks = Timer::getTicks())) { - ++frames; - draw((ticks + mTimestep - nextUpdate) * inverseTimestep); - video->swap(); + draw((ticks + timestep - nextUpdate) * inverseTimestep); + video->swap(); // 4. draw state - nextDraw += mFramerate; + nextDraw += framerate; + ++frameCount; - if (mShowFps && nextSecond < ticks) + if (nextSecond < Timer::getTicks()) { - mFps = frames; - frames = 0; + mFps = frameCount; + frameCount = 0; - logInfo << mFps << " fps" << std::endl; + if (mShowFps) logInfo << mFps << " fps" << std::endl; nextSecond += SCALAR(1.0); } } - // be a good citizen and give back what you don't need - Timer::sleep(0.0); + ticks = Timer::getTicks(); // 5. yield timeslice + if (ticks < nextUpdate && ticks < nextDraw) Timer::sleep(0.0); } while (!mStack.empty()); diff --git a/src/Moof/Frustum.hh b/src/Moof/Frustum.hh index 6e93cd6..5710004 100644 --- a/src/Moof/Frustum.hh +++ b/src/Moof/Frustum.hh @@ -44,7 +44,7 @@ public: { init(modelview, fovy, aspect, abutting, distant); } - + void init(const Matrix4& modelview, const Matrix4& projection); void init(const Matrix4& modelview, Scalar fovy, Scalar aspect, Scalar abutting, Scalar distant); diff --git a/src/Moof/Line.hh b/src/Moof/Line.hh index 7902ea9..f8a2b66 100644 --- a/src/Moof/Line.hh +++ b/src/Moof/Line.hh @@ -38,7 +38,7 @@ struct Line : public Drawable, public Shape a(point1), b(point2) {} - bool intersectRay(const Ray<2>& ray, Ray<2>::Intersection& hit) const + bool intersectRay(const Ray<2>& ray, Ray<2>::Contact& hit) const { // solve: Cx + r*Dx = Ax + s(Bx - Ax) // Cy + r*Dy = Ay + s(By - Ay) @@ -79,6 +79,8 @@ struct Line : public Drawable, public Shape hit.distance = -(a[0] * (ray.point[1] - b[1]) + b[0] * (a[1] - ray.point[1]) + ray.point[0] * (b[1] - a[1])) / denom; + + // check if the intersection is behind the ray if (hit.distance < SCALAR(0.0)) return false; Vector normal = cml::perp(a - b); @@ -98,15 +100,41 @@ struct Line : public Drawable, public Shape }; +typedef Line<2> Line2; +typedef Line<3> Line3; + + template -struct Polygon : public Shape +struct Polygon : public Drawable, public Shape { typedef cml::vector< Scalar, cml::fixed > Vector; Vector points[N]; + + Polygon() {} + + bool intersectRay(const Ray& ray, typename Ray::Contact& hit) + { + return false; + } + + void draw(Scalar alpha = 0.0) const + { + Mf::Texture::resetBind(); + glBegin(GL_POLYGON); + for (int i = 0; i < D; ++i) + { + glVertex(points[0]); + } + glEnd(); + } }; +typedef Polygon<2,3> Triangle2; +typedef Polygon<3,3> Triangle3; + + } // namespace Mf #endif // _MOOF_LINE_HH_ diff --git a/src/Moof/OpenGL.hh b/src/Moof/OpenGL.hh index 2fc9197..05d8317 100644 --- a/src/Moof/OpenGL.hh +++ b/src/Moof/OpenGL.hh @@ -97,6 +97,9 @@ OPENGL_ORDINAL_FUNC(void, TexCoord, 2); OPENGL_ORDINAL_FUNC(void, TexCoord, 3); OPENGL_ORDINAL_FUNC(void, TexCoord, 4); +OPENGL_GENERIC_FUNC(void, Rect, S4); +OPENGL_GENERIC_FUNC(void, Rect, V4); + #if USE_DOUBLE_PRECISION inline void glGetScalar(GLenum a, GLscalar* b) { glGetDoublev(a, b); } diff --git a/src/Moof/Plane.hh b/src/Moof/Plane.hh index 262a6bd..108c49f 100644 --- a/src/Moof/Plane.hh +++ b/src/Moof/Plane.hh @@ -49,7 +49,7 @@ struct Plane : public Shape<3> d(scalar) {} - bool intersectRay(const Ray<3>& ray, Ray<3>::Intersection& hit) + bool intersectRay(const Ray<3>& ray, Ray<3>::Contact& hit) { // solve: [(ray.point + t*ray.direction) dot normal] + d = 0 diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh index 1564087..6d4705a 100644 --- a/src/Moof/Ray.hh +++ b/src/Moof/Ray.hh @@ -34,12 +34,12 @@ struct Ray : public Drawable Vector point; Vector direction; - struct Intersection + struct Contact { Scalar distance; // distance from the origin to the nearest point - Vector normal; // surface normal at intersection point + Vector normal; // surface normal at contact point - bool operator < (const Intersection& rhs) + bool operator < (const Contact& rhs) { return distance < rhs.distance; } @@ -69,6 +69,10 @@ struct Ray : public Drawable }; +typedef Ray<2> Ray2; +typedef Ray<3> Ray3; + + } // namespace Mf #endif // _MOOF_RAY_HH_ diff --git a/src/Moof/Rectangle.cc b/src/Moof/Rectangle.cc deleted file mode 100644 index 949c22a..0000000 --- a/src/Moof/Rectangle.cc +++ /dev/null @@ -1,32 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include "Rectangle.hh" - - -namespace Mf { - - -void Rectangle::getCorners(Vector2 corners[4]) const -{ - corners[0][0] = min[0]; corners[0][1] = min[1]; - corners[1][0] = max[0]; corners[1][1] = min[1]; - corners[2][0] = max[0]; corners[2][1] = max[1]; - corners[3][0] = min[0]; corners[3][1] = max[1]; - corners[4][0] = min[0]; corners[4][1] = min[1]; - corners[5][0] = max[0]; corners[5][1] = min[1]; - corners[6][0] = max[0]; corners[6][1] = max[1]; - corners[7][0] = min[0]; corners[7][1] = max[1]; -} - - -} // namespace Mf - diff --git a/src/Moof/Rectangle.hh b/src/Moof/Rectangle.hh deleted file mode 100644 index e41b879..0000000 --- a/src/Moof/Rectangle.hh +++ /dev/null @@ -1,83 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_RECTANGLE_HH_ -#define _MOOF_RECTANGLE_HH_ - -#include - - -namespace Mf { - - -/** - * Axis-aligned Bounding Box - */ - -struct Rectangle -{ - Vector2 min; - Vector2 max; - - - Rectangle() {} - - Rectangle(const Vector2& a, const Vector2& b) - { - init(a, b); - } - - Rectangle(Scalar ax, Scalar ay, Scalar bx, Scalar by) - { - Vector2 a(ax, ay); - Vector2 b(bx, by); - - init(a, b); - } - - void init(const Vector2& a, const Vector2& b) - { - if (a[0] < b[0]) - { - min[0] = a[0]; - max[0] = b[0]; - } - else - { - min[0] = b[0]; - max[0] = a[0]; - } - if (a[1] < b[1]) - { - min[1] = a[1]; - max[1] = b[1]; - } - else - { - min[1] = b[1]; - max[1] = a[1]; - } - } - - Vector2 getCenter() const - { - return Vector2((min[0] + max[0]) / 2.0, - (min[1] + max[1]) / 2.0); - } - - void getCorners(Vector2 corners[4]) const; -}; - - -} // namespace Mf - -#endif // _MOOF_RECTANGLE_HH_ - diff --git a/src/Moof/Shape.hh b/src/Moof/Shape.hh index c972960..c059d46 100644 --- a/src/Moof/Shape.hh +++ b/src/Moof/Shape.hh @@ -19,20 +19,21 @@ // Frustum -// Plane (can construct from Triangle<3>) +// Plane (can construct from Triangle3) // Ray // Shape<> // +- Line<> -// +- Ball<> -// | Circle <- Ball<2> -// | Sphere <- Ball<3> -// +- Box<> -// | Rectangle <- Box<2> -// | Aabb <- Box<3> +// - Line2 Line<2> +// - Line3 Line<3> +// +- Sphere<> +// | Sphere2, Circle Sphere<2> +// | Sphere3 Sphere<3> +// +- Aabb<> +// | Aabb2, Rectangle Aabb<2> +// | Aabb3 Aabb<3> // +- Polygon<> -// | Triangle <- Polygon<3> -// +- Cylinder -// +- Cone +// | Triangle2 Polygon<2,3> +// | Triangle3 Polygon<3,3> namespace Mf { @@ -48,13 +49,13 @@ public: /** * Checks if this shape is intersected by a given ray. If so, returns * the distance from the start of the ray to the shape and information - * about the intersection via the 2nd parameter. A negative value is - * returned if there is no intersection. + * about the contact via the 2nd parameter. A negative value is + * returned if there is no contact. */ virtual bool intersectRay(const Ray& ray, - typename Ray::Intersection& hit) + typename Ray::Contact& hit) { - return SCALAR(-1.0); + return false; } }; diff --git a/src/Moof/Sphere.hh b/src/Moof/Sphere.hh index 3cd1ec7..d42bfd8 100644 --- a/src/Moof/Sphere.hh +++ b/src/Moof/Sphere.hh @@ -61,7 +61,7 @@ struct Sphere : public Cullable, public Drawable, public Shape // a ray inside the sphere will not intersect on its way out - bool intersectRay(const Ray& ray, typename Ray::Intersection& hit) + bool intersectRay(const Ray& ray, typename Ray::Contact& hit) { Vector b = point - ray.point; Scalar z = cml::dot(b, ray.direction); @@ -163,6 +163,11 @@ inline bool checkCollision(const Sphere& a, const Sphere& b) } +typedef Sphere<2> Sphere2; +typedef Sphere2 Circle; +typedef Sphere<3> Sphere3; + + } // namespace Mf #endif // _MOOF_SPHERE_HH_ diff --git a/src/Scene.cc b/src/Scene.cc index 7b23ab6..8b155e7 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -526,14 +526,14 @@ void Scene::drawIfVisible(Mf::Scalar alpha, bool Scene::castRay(const Mf::Ray<2>& ray, - std::list::Intersection>& hits) const + std::list::Contact>& hits) const { std::list< Mf::Line<2> >& lines = mImpl->mLines; std::list< Mf::Line<2> >::const_iterator it; for (it = lines.begin(); it != lines.end(); ++it) { - Mf::Ray<2>::Intersection hit; + Mf::Ray<2>::Contact hit; Mf::Scalar d = (*it).intersectRay(ray, hit); if (d > 0.0) { diff --git a/src/Scene.hh b/src/Scene.hh index 85a6716..07db30d 100644 --- a/src/Scene.hh +++ b/src/Scene.hh @@ -51,7 +51,7 @@ public: Mf::Scalar getZCoord(const Mf::Vector2& position) const; bool castRay(const Mf::Ray<2>& ray, - std::list::Intersection>& hits) const; + std::list::Contact>& hits) const; bool checkForCollision(Character& character); static std::string getPath(const std::string& name); -- 2.44.0 From ed5fcf5f1357fc42749408f705e9ec55531ff006 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 3 Mar 2010 17:21:59 -0700 Subject: [PATCH 13/16] arch linux prefers pkgconfig for finding lua --- configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 2f2bc1d..fa99616 100644 --- a/configure.ac +++ b/configure.ac @@ -264,12 +264,12 @@ AC_SEARCH_LIBS([alEnable], [openal OpenAL32],, ##### liblua ##### website="http://www.lua.org/" -AC_CHECK_HEADERS([lua.h],, - [missing=yes - echo "***** Missing lua headers ($website) *****"]) -AC_SEARCH_LIBS([lua_load], [lua],, - [missing=yes - echo "***** Missing liblua ($website) *****"]) +PKG_CHECK_MODULES([LUA], [lua], + [LIBS="$LIBS $LUA_LIBS" + CFLAGS="$CFLAGS $LUA_CFLAGS" + CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"], + [missing=yes + echo "***** Missing liblua ($website) *****"]) ##### libpng ##### website="http://www.libpng.org/pub/png/libpng.html" -- 2.44.0 From e0c0a3b5e7337cde55e520801d2e59e03dc97d9c Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 1 Mar 2010 00:27:38 -0700 Subject: [PATCH 14/16] destroyed global classes; view hierarchy instead --- configure.ac | 4 +- src/Character.cc | 2 +- src/GameLayer.cc | 61 +++--- src/GameLayer.hh | 11 +- src/Hud.cc | 10 +- src/Hud.hh | 8 +- src/Main.cc | 95 ++++----- src/Main.hh | 21 +- src/Makefile.am | 12 +- src/Moof/Backend.cc | 94 +++++++++ src/Moof/Backend.hh | 46 ++++ src/Moof/Contact.hh | 40 ++++ src/Moof/Core.cc | 451 ---------------------------------------- src/Moof/Core.hh | 98 --------- src/Moof/Dispatch.cc | 85 ++++---- src/Moof/Dispatch.hh | 47 +++-- src/Moof/Image.cc | 2 +- src/Moof/Layer.hh | 47 ----- src/Moof/Line.hh | 136 ++++++++++++ src/Moof/ModalDialog.hh | 15 +- src/Moof/Resource.cc | 4 +- src/Moof/Settings.cc | 5 +- src/Moof/Settings.hh | 8 +- src/Moof/Shape.hh | 6 +- src/Moof/Sphere.hh | 86 ++++---- src/Moof/Texture.cc | 11 +- src/Moof/Transition.hh | 21 +- src/Moof/Video.cc | 105 ++++++---- src/Moof/Video.hh | 53 +++-- src/Moof/View.cc | 411 ++++++++++++++++++++++++++++++++++++ src/Moof/View.hh | 88 ++++++++ src/Scene.cc | 12 +- src/Scene.hh | 6 +- src/TitleLayer.cc | 29 +-- src/TitleLayer.hh | 8 +- 35 files changed, 1214 insertions(+), 924 deletions(-) create mode 100644 src/Moof/Backend.cc create mode 100644 src/Moof/Backend.hh create mode 100644 src/Moof/Contact.hh delete mode 100644 src/Moof/Core.cc delete mode 100644 src/Moof/Core.hh delete mode 100644 src/Moof/Layer.hh create mode 100644 src/Moof/View.cc create mode 100644 src/Moof/View.hh diff --git a/configure.ac b/configure.ac index fa99616..7a01c45 100644 --- a/configure.ac +++ b/configure.ac @@ -102,8 +102,8 @@ AC_ARG_ENABLE([qt4], if test x$debug = xyes then - CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized" - CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized" + CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized" + CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized" else CFLAGS="$CFLAGS -DNDEBUG" CXXFLAGS="$CXXFLAGS -DNDEBUG" diff --git a/src/Character.cc b/src/Character.cc index 840099c..82d5e54 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -73,7 +73,7 @@ Character::Character(const std::string& name) : // forces mState.force = Mf::Vector2(0.0, 0.0); //mState.forces.push_back(SpringForce(Mf::Vector2(5.0, 4.0))); - //mState.forces.push_back(ResistanceForce(2.0)); + mState.forces.push_back(ResistanceForce(2.0)); //mState.forces.push_back(Mf::LinearState<2>::GravityForce(-9.8)); // starting position diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 331d04f..0be8eb7 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -9,7 +9,6 @@ * **************************************************************************/ -#include #include #include #include @@ -53,14 +52,15 @@ void GameLayer::loadSceneLoader() } } -void GameLayer::advanceScene() +void GameLayer::advanceScene(Mf::Settings& settings) { if (mState.sceneList.size() != 0) { mState.scene = Scene::alloc(mState.sceneList[0]); mState.sceneList.erase(mState.sceneList.begin()); - Mf::Script::Result status = mState.scene->load(mState.script); + Mf::Script::Result status = mState.scene->load(settings, + mState.script); if (status != Mf::Script::SUCCESS) { std::string str; @@ -85,22 +85,14 @@ void GameLayer::advanceScene() GameLayer::GameLayer() : - mHud(Hud::alloc(mState)), mMusic("NightFusionIntro"), mPunchSound("Thump") { mMusic.setLooping(true); mMusic.enqueue("NightFusionLoop"); - bool isMute = false; - Mf::settings.get("nomusic", isMute); - if (!isMute) mMusic.play(); - //mMusic.setPosition(Mf::Vector3(10.0, 5.0, 0.0)); - loadSceneLoader(); - advanceScene(); // load the first scene - mThinkTimer.init(boost::bind(&GameLayer::thinkTimer, this), 0.1, Mf::Timer::REPEAT); @@ -109,14 +101,20 @@ GameLayer::GameLayer() : mState.interp.init(0.0, 1.0); mState.interp.reset(4.0, Mf::Interp::OSCILLATE); - - setProjection(); } -void GameLayer::addedToCore() +void GameLayer::didAddToView() { - Mf::core.push(mHud); + bool isMute = false; + settings().get("nomusic", isMute); + if (!isMute) mMusic.play(); + + loadSceneLoader(); + advanceScene(settings()); // load the first scene + + mHud = Hud::alloc(mState); + addChild(mHud); mRay.direction.set(1.0, 0.0); @@ -128,21 +126,25 @@ void GameLayer::addedToCore() mRayTimer.init(boost::bind(&GameLayer::rayTimer, this), 1.0, Mf::Timer::REPEAT); + + setProjection(); } void GameLayer::update(Mf::Scalar t, Mf::Scalar dt) { + if (!mState.scene) return; mState.camera.update(t, dt); mState.heroine->update(t, dt); mState.scene->checkForCollision(*mState.heroine); - Mf::Vector3 camPosition(-mState.heroine->getState().position[0], - -mState.heroine->getState().position[1], -8); - mState.camera.setPosition(camPosition); + Mf::Vector3 cam= -Mf::promote(mState.heroine->getState().position, 8); + mState.camera.setPosition(cam); mRay.point = mState.heroine->getState().position; + + Mf::View::update(t, dt); } void GameLayer::thinkTimer() @@ -162,8 +164,12 @@ void GameLayer::rayTimer() bool bam = mLine.intersectRay(mRay, meh); if (bam) { - meh.normal.normalize(); - hits.push_back(meh); + //meh.normal.normalize(); + //hits.push_back(meh); + mRay.solve(point, meh.distance); + Mf::logInfo << "line: d = " << meh.distance << std::endl; + Mf::logInfo << " P = " << point << std::endl; + Mf::logInfo << " n = " << meh.normal << std::endl; } bam = mCircle.intersectRay(mRay, meh); @@ -186,6 +192,7 @@ void GameLayer::rayTimer() void GameLayer::draw(Mf::Scalar alpha) const { + if (!mState.scene) return; mState.camera.uploadToGL(alpha); // DRAW THE SCENE @@ -200,10 +207,14 @@ void GameLayer::draw(Mf::Scalar alpha) const mRay.draw(); mLine.draw(); mCircle.draw(); + + Mf::View::draw(alpha); } bool GameLayer::handleEvent(const Mf::Event& event) { + if (Mf::View::handleEvent(event)) return true; + switch (event.type) { case SDL_KEYDOWN: @@ -234,7 +245,7 @@ bool GameLayer::handleEvent(const Mf::Event& event) else if (event.key.keysym.sym == SDLK_r) { loadSceneLoader(); - advanceScene(); + advanceScene(settings()); return true; } return mState.heroine->handleEvent(event); @@ -242,12 +253,12 @@ bool GameLayer::handleEvent(const Mf::Event& event) case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { - Mf::core.pop(this); + parent().removeChild(this); return true; } else if (event.key.keysym.sym == SDLK_h) { - Mf::core.push(mHud); + addChild(mHud); return true; } return mState.heroine->handleEvent(event); @@ -268,9 +279,7 @@ bool GameLayer::handleEvent(const Mf::Event& event) void GameLayer::setProjection() { - ASSERT(Mf::video && - "no current video context from which to get dimensions"); - setProjection(Mf::video->getWidth(), Mf::video->getHeight()); + setProjection(video().getWidth(), video().getHeight()); } void GameLayer::setProjection(Mf::Scalar width, Mf::Scalar height) diff --git a/src/GameLayer.hh b/src/GameLayer.hh index c537af6..145cf76 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -23,7 +23,6 @@ #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include "GameState.hh" #include "Hud.hh" @@ -40,18 +40,17 @@ class GameLayer; typedef boost::shared_ptr GameLayerP; -class GameLayer : public Mf::Layer +class GameLayer : public Mf::View { public: - GameLayer(); - static GameLayerP alloc() { return GameLayerP(new GameLayer); } + GameLayer(); - void addedToCore(); + void didAddToView(); void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha) const; @@ -60,7 +59,7 @@ public: private: void loadSceneLoader(); - void advanceScene(); + void advanceScene(Mf::Settings& settings); void thinkTimer(); diff --git a/src/Hud.cc b/src/Hud.cc index f4134cf..28b7c34 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -10,7 +10,6 @@ **************************************************************************/ #include -#include #include #include #include @@ -111,9 +110,9 @@ Hud::Hud(GameState& state) : mBar2(Mf::Texture("StatusBars"), 2), mFont("Font") { - ASSERT(Mf::video && - "no current video context from which to get dimensions"); - resize(Mf::video->getWidth(), Mf::video->getHeight()); + Mf::Video* video = Mf::Video::current(); + ASSERT(video && "a current video context should be set"); + resize(video->getWidth(), video->getHeight()); } @@ -174,7 +173,8 @@ bool Hud::handleEvent(const Mf::Event& event) if (event.key.keysym.sym == SDLK_h) { // don't want the hud anymore - Mf::core.pop(this); + parent().removeChild(this); + Mf::logWarning("okay bye bye hud"); return true; } diff --git a/src/Hud.hh b/src/Hud.hh index bc8a313..0bc0a46 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -18,10 +18,10 @@ */ #include -#include #include //#include #include +#include #include "GameState.hh" @@ -58,16 +58,16 @@ private: class Hud; typedef boost::shared_ptr HudP; -class Hud : public Mf::Layer +class Hud : public Mf::View { public: - Hud(GameState& state); - static HudP alloc(GameState& state) { return HudP(new Hud(state)); } + Hud(GameState& state); + void setBar1Progress(Mf::Scalar progress) { diff --git a/src/Main.cc b/src/Main.cc index 91a8d08..7b31ae4 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -10,6 +10,7 @@ **************************************************************************/ #include // atexit, getenv +#include #include #include #include // access @@ -19,7 +20,6 @@ #include #include #include -#include #include #include "ErrorHandler.hh" @@ -33,35 +33,28 @@ #include "version.h" -Main::Main() +Main::Main(Mf::Settings& settings, Mf::Video& video) : + Mf::View(settings, video) { - mDispatchHandler = Mf::core.addHandler("video.newcontext", - boost::bind(&Main::contextCreated)); + Mf::Dispatch& dispatch = Mf::Dispatch::global(); + mNewContextDispatch = dispatch.addTarget("video.newcontext", + boost::bind(&Main::setupGL)); setupGL(); -} -void Main::addedToCore() -{ - //Mf::Scalar coeff[] = {0.0, 1.0}; - //Mf::Lerp interp(coeff, 0.25); - - //Mf::LayerP gameLayer = GameLayer::alloc(); - //Mf::Transition::Ptr transition = - //Mf::Transition::alloc(gameLayer, Mf::LayerP(), interp); - //core.push(transition); - //core.push(GameLayer::alloc()); - Mf::core.push(TitleLayer::alloc()); + addChild(TitleLayer::alloc()); } void Main::update(Mf::Scalar t, Mf::Scalar dt) { - if (Mf::core.getSize() == 1) + if (children().size() == 0) { - // this is the only layer left on the stack - //Mf::core.push(TitleLayer::alloc()); - Mf::core.clear(); + Mf::logWarning("main view has no children"); + stop(); + return; } + + Mf::View::update(t, dt); } void Main::draw(Mf::Scalar alpha) const @@ -73,25 +66,25 @@ void Main::draw(Mf::Scalar alpha) const glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + + Mf::View::draw(alpha); } bool Main::handleEvent(const Mf::Event& event) { + if (Mf::View::handleEvent(event)) return true; + switch (event.type) { case SDL_KEYUP: - if (event.key.keysym.sym == SDLK_ESCAPE) + if (event.key.keysym.sym == SDLK_f) { - Mf::core.clear(); - } - else if (event.key.keysym.sym == SDLK_f) - { - Mf::video->toggleFull(); + video().toggleFull(); } else if (event.key.keysym.sym == SDLK_l) { - Mf::video->toggleCursorGrab(); - Mf::video->toggleCursorVisible(); + video().toggleCursorGrab(); + video().toggleCursorVisible(); } break; @@ -100,8 +93,8 @@ bool Main::handleEvent(const Mf::Event& event) break; case SDL_QUIT: - Mf::core.clear(); - break; + stop(); + return true; } return false; @@ -137,7 +130,7 @@ std::string Main::getConfigPath() std::string path = Mf::Resource::getPath("yoinkrc"); -#if !defined(_WIN32) && !defined(__WIN32__) +#if !defined(_WIN32) path += ":/etc/yoinkrc"; #endif path += ":$HOME/.yoinkrc"; @@ -178,14 +171,6 @@ void Main::setupGL() //glMatrixMode(GL_MODELVIEW); } -void Main::contextCreated() -{ - // whenever the context is destroyed and a new one created, it probably - // won't contain our state so we need to set that up again - setupGL(); -} - - void Main::printUsage() { @@ -283,6 +268,7 @@ void goodbye() std::cout << std::endl << "Goodbye..." << std::endl << std::endl; } + int main(int argc, char* argv[]) { if (argc > 1) @@ -305,33 +291,32 @@ int main(int argc, char* argv[]) Mf::Resource::addSearchPaths(Main::getSearchPath()); - Mf::settings.loadFromFiles(Main::getConfigPath()); - Mf::settings.parseArgs(argc, argv); + Mf::Settings settings(argc, argv, Main::getConfigPath()); Mf::Log::Level logLevel = Mf::Log::INFO; - Mf::settings.get("loglevel", logLevel); + settings.get("loglevel", logLevel); Mf::Log::setLevel(logLevel); try { - Mf::Video video(PACKAGE_STRING, - Mf::Resource::getPath(PACKAGE".png")); - MainP app = Main::alloc(); - Mf::core.push(app); - Mf::core.run(); + Mf::Video::Attributes attributes(settings); + attributes.caption = PACKAGE_STRING; + attributes.icon = Mf::Resource::getPath(PACKAGE".png"); + + Mf::Video video(attributes); + Main mainView(settings, video); + + mainView.run(); + return 0; } catch (const Mf::Error& error) { - Mf::ModalDialog dialog; - dialog.title = PACKAGE_STRING; - dialog.text1 = "Unhandled Exception"; - dialog.text2 = getErrorString(error); - dialog.type = Mf::ModalDialog::CRITICAL; - dialog.run(); + Mf::ModalDialog dialog(Mf::ModalDialog::CRITICAL, + PACKAGE_STRING, "Unhandled Exception", + getErrorString(error)); + dialog.run(); return 1; } - - return 0; } diff --git a/src/Main.hh b/src/Main.hh index 91a4b4c..a5ce293 100644 --- a/src/Main.hh +++ b/src/Main.hh @@ -23,25 +23,23 @@ #include #include -#include #include +#include +namespace Mf { +class Settings; +class View; +} + class Main; typedef boost::shared_ptr

MainP; -class Main : public Mf::Layer +class Main : public Mf::View { public: - Main(); - - static MainP alloc() - { - return MainP(new Main); - } - - void addedToCore(); + Main(Mf::Settings& settings, Mf::Video& video); void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha) const; @@ -59,9 +57,8 @@ private: * Set OpenGL to a state we can know and depend on. */ static void setupGL(); - static void contextCreated(); - Mf::Dispatch::Handler mDispatchHandler; + Mf::Dispatch::Handle mNewContextDispatch; }; diff --git a/src/Makefile.am b/src/Makefile.am index 4e8f65d..c87c412 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,12 +13,13 @@ noinst_LIBRARIES = libmoof.a libmoof_a_SOURCES = \ Moof/Aabb.hh \ + Moof/Backend.cc \ + Moof/Backend.hh \ Moof/Camera.cc \ Moof/Camera.hh \ + Moof/Contact.hh \ Moof/ConvertUTF.c \ Moof/ConvertUTF.h \ - Moof/Core.cc \ - Moof/Core.hh \ Moof/Cullable.hh \ Moof/Dispatch.cc \ Moof/Dispatch.hh \ @@ -33,7 +34,6 @@ libmoof_a_SOURCES = \ Moof/Image.cc \ Moof/Image.hh \ Moof/Interpolator.hh \ - Moof/Layer.hh \ Moof/Line.hh \ Moof/Log.cc \ Moof/Log.hh \ @@ -62,9 +62,10 @@ libmoof_a_SOURCES = \ Moof/Thread.hh \ Moof/Timer.cc \ Moof/Timer.hh \ - Moof/Transition.hh \ Moof/Video.cc \ Moof/Video.hh \ + Moof/View.cc \ + Moof/View.hh \ Moof/fastevents.c \ Moof/fastevents.h \ $(ENDLIST) @@ -89,6 +90,7 @@ yoink_SOURCES = \ ErrorHandler.hh \ GameLayer.cc \ GameLayer.hh \ + GameState.hh \ Heroine.cc \ Heroine.hh \ Hud.cc \ @@ -123,5 +125,5 @@ run: all $(YOINK_ENVIRONMENT) ./yoink $(YOINK_OPTS) debug: all - $(YOINK_ENVIRONMENT) gdb ./yoink + $(YOINK_ENVIRONMENT) ddd ./yoink diff --git a/src/Moof/Backend.cc b/src/Moof/Backend.cc new file mode 100644 index 0000000..95f4dc3 --- /dev/null +++ b/src/Moof/Backend.cc @@ -0,0 +1,94 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#include +#include "fastevents.h" + +#include "Backend.hh" +#include "Error.hh" +#include "Log.hh" + + +namespace Mf { + + +struct Impl +{ + static Error error; + static int retainCount; +}; + +Error Impl::error(Error::UNINITIALIZED); +int Impl::retainCount = 0; + + +Backend::Backend() +{ + if (Impl::retainCount++ == 0) + { +#if defined(_WIN32) + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) +#else + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0) +#endif + { + const char* error = SDL_GetError(); + Impl::error.init(Error::SDL_INIT, error); + return; // fatal + } + else + { + char name[128]; + SDL_VideoDriverName(name, sizeof(name)); + logInfo << "initialized SDL; using video driver `" + << name << "'" << std::endl; + } + + if (FE_Init() != 0) + { + const char* error = FE_GetError(); + Impl::error.init(Error::FASTEVENTS_INIT, error); + return; // fatal + } + + Impl::error.init(Error::NONE); + } +} + +Backend::Backend(const Backend& backend) +{ + ++Impl::retainCount; +} + +Backend::~Backend() +{ + if (--Impl::retainCount == 0) + { + FE_Quit(); + SDL_Quit(); + + Impl::error.reset(); + } +} + +bool Backend::isInitialized() +{ + return Impl::error.code() == Error::NONE; +} + +const Error& Backend::getError() +{ + return Impl::error; +} + + +} // namespace Mf + diff --git a/src/Moof/Backend.hh b/src/Moof/Backend.hh new file mode 100644 index 0000000..8209b06 --- /dev/null +++ b/src/Moof/Backend.hh @@ -0,0 +1,46 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_BACKEND_HH_ +#define _MOOF_BACKEND_HH_ + + +namespace Mf { + + +class Error; + + +/* + * Some classes and subsystems require certain backend libraries to be + * initialized. This is the mechanism to accomplish that. Classes which + * rely on any backend libraries just need to instantiate this class as a + * member. Backend cleanup will occur automagically when there are no more + * instances. + */ + +class Backend +{ +public: + + Backend(); + Backend(const Backend& backend); + ~Backend(); + + static bool isInitialized(); + static const Error& getError(); +}; + + +} // namespace Mf + +#endif // _MOOF_BACKEND_HH_ + diff --git a/src/Moof/Contact.hh b/src/Moof/Contact.hh new file mode 100644 index 0000000..82e049d --- /dev/null +++ b/src/Moof/Contact.hh @@ -0,0 +1,40 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_CONTACT_HH_ +#define _MOOF_CONTACT_HH_ + +#include + + +namespace Mf { + + +template +struct Contact +{ + typedef cml::vector< Scalar, cml::fixed > Vector; + + Vector point; // point of contact + Scalar distance; // distance of penetration + Vector normal; // normal of surface at point of contact + + bool operator < (const Contact& rhs) + { + return distance < rhs.distance; + } +}; + + +} // namespace Mf + +#endif // _MOOF_CONTACT_HH_ + diff --git a/src/Moof/Core.cc b/src/Moof/Core.cc deleted file mode 100644 index b659f98..0000000 --- a/src/Moof/Core.cc +++ /dev/null @@ -1,451 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include -#include // exit, srand -#include // time -#include -#include - -#include -#include "fastevents.h" - -#include "Core.hh" -#include "Event.hh" -#include "Log.hh" -#include "Math.hh" -#include "ModalDialog.hh" -#include "Settings.hh" -#include "Timer.hh" -#include "Video.hh" - - -namespace Mf { - - -class Core::Impl -{ -public: - - Impl() : - mError(Error::NONE), - mTimestep(0.01), - mFramerate(0.02), - mShowFps(false) {} - - void init() - { - unsigned randomSeed; - if (settings.get("rngseed", randomSeed)) srand(randomSeed); - else srand(time(0)); - - Scalar timestep = 80.0; - settings.get("timestep", timestep); - mTimestep = 1.0 / timestep; - - Scalar framerate = 40.0; - settings.get("framerate", framerate); - mFramerate = 1.0 / framerate; - - mShowFps = false; - settings.get("showfps", mShowFps); - } - - - /** - * The main loop. This just calls dispatchEvents(), update(), and - * draw() over and over again. The timing of the update and draw are - * decoupled. The actual frame rate is also calculated here. This - * function will return the exit code used to stop the loop. - */ - - void run() - { - init(); - ASSERT(video && "cannot run core without a current video context"); - - Scalar totalTime = 0.0; - Scalar ticks = Timer::getTicks(); - - Scalar nextUpdate = ticks; - Scalar nextDraw = ticks; - Scalar nextSecond = ticks + SCALAR(1.0); - - mFps = 0; - int frameCount = 0; - - const Scalar timestep = mTimestep; - const Scalar framerate = mFramerate; - - const int MAX_FRAMESKIP = 15; - const Scalar inverseTimestep = SCALAR(1.0) / timestep; - - do - { - Timer::fireIfExpired(); // 1. fire timers - dispatchEvents(); // 2. dispatch events - - int i = 0; - while (nextUpdate < Timer::getTicks() && i < MAX_FRAMESKIP) - { - totalTime += timestep; - update(totalTime, timestep); // 3. update state - - nextUpdate += timestep; - ++i; - } - - if (nextDraw < (ticks = Timer::getTicks())) - { - draw((ticks + timestep - nextUpdate) * inverseTimestep); - video->swap(); // 4. draw state - - nextDraw += framerate; - ++frameCount; - - if (nextSecond < Timer::getTicks()) - { - mFps = frameCount; - frameCount = 0; - - if (mShowFps) logInfo << mFps << " fps" << std::endl; - - nextSecond += SCALAR(1.0); - } - } - - ticks = Timer::getTicks(); // 5. yield timeslice - if (ticks < nextUpdate && ticks < nextDraw) Timer::sleep(0.0); - } - while (!mStack.empty()); - - mDispatch.dispatch("engine.stopping"); - } - - - void dispatchEvents() - { - SDL_Event event; - - while (FE_PollEvent(&event) == 1) - { - switch (event.type) - { - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_ESCAPE && - (SDL_GetModState() & KMOD_CTRL) ) - { - // emergency escape - logWarning("escape forced"); - exit(1); - } - break; - - case SDL_VIDEORESIZE: - video->resize(event.resize.w, event.resize.h); - break; - } - - handleEvent(event); - } - } - - - void update(Scalar t, Scalar dt) - { - for (mStackIt = mStack.begin(); mStackIt != mStack.end(); - ++mStackIt) - { - (*mStackIt)->update(t, dt); - } - } - - void draw(Scalar alpha) - { - // FIXME - this will crash if the layer being drawn pops itself - std::list::reverse_iterator it; - for (it = mStack.rbegin(); it != mStack.rend(); ++it) - { - (*it)->draw(alpha); - } - } - - void handleEvent(const Event& event) - { - for (mStackIt = mStack.begin(); mStackIt != mStack.end(); - ++mStackIt) - { - if ((*mStackIt)->handleEvent(event)) break; - } - } - - - void push(LayerP layer) - { - ASSERT(layer && "cannot push null layer"); - mStack.push_front(layer); - logInfo << "stack: " << mStack.size() - << " [pushed " << layer.get() << "]" << std::endl; - layer->addedToCore(); - } - - LayerP pop() - { - bool fixIt = false; - if (mStack.begin() == mStackIt) fixIt = true; - - LayerP layer = mStack.front(); - mStack.pop_front(); - logInfo << "stack: " << mStack.size() - << " [popped " << layer.get() << "]" << std::endl; - layer->removedFromCore(); - - if (fixIt) mStackIt = --mStack.begin(); - - return layer; - } - - LayerP pop(Layer* layer) - { - bool fixIt = false; - - std::list layers; - - std::list::iterator it; - for (it = mStack.begin(); it != mStack.end(); ++it) - { - layers.push_back(*it); - - if (it == mStackIt) fixIt = true; - - if ((*it).get() == layer) - { - ++it; - mStack.erase(mStack.begin(), it); - - for (it = layers.begin(); it != layers.end(); ++it) - { - (*it)->removedFromCore(); - logInfo << "stack: " << mStack.size() - << " [popped " << (*it).get() << "]" - << std::endl; - } - - if (fixIt) mStackIt = --mStack.begin(); - - return layers.back(); - } - } - - return LayerP(); - } - - void clear() - { - mStack.clear(); - mStackIt = mStack.begin(); - logInfo("stack: 0 [cleared]"); - } - - - Error mError; - - Dispatch mDispatch; - - std::list mStack; - std::list::iterator mStackIt; - - Scalar mTimestep; - Scalar mFramerate; - - int mFps; - bool mShowFps; -}; - - -Core::Core() : - // pass through - mImpl(new Core::Impl) {} - - -void Core::init() -{ - // pass through - mImpl->init(); -} - - -int Core::getFps() const -{ - return mImpl->mFps; -} - - -void Core::push(LayerP layer) -{ - // pass through - mImpl->push(layer); -} - -LayerP Core::pop() -{ - // pass through - return mImpl->pop(); -} - -LayerP Core::pop(Layer* layer) -{ - // pass through - return mImpl->pop(layer); -} - -void Core::clear() -{ - // pass through - mImpl->clear(); -} - -int Core::getSize() const -{ - return mImpl->mStack.size(); -} - - -void Core::run() -{ - // pass through - return mImpl->run(); -} - - -Dispatch::Handler Core::addHandler(const std::string& event, - const Dispatch::Function& callback) -{ - return mImpl->mDispatch.addHandler(event, callback); -} - -Dispatch::Handler Core::addHandler(const std::string& event, - const Dispatch::Function& callback, - Dispatch::Handler handler) -{ - return mImpl->mDispatch.addHandler(event, callback, handler); -} - -void Core::dispatch(const std::string& event, - const Dispatch::Message* message) -{ - mImpl->mDispatch.dispatch(event, message); -} - - -Core core; - - -class Backend_; -typedef boost::shared_ptr BackendP; - -class Backend_ -{ -public: - - Backend_() - { -#if defined(_WIN32) || defined(__WIN32__) - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) -#else - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0) -#endif - { - const char* error = SDL_GetError(); - gError.init(Error::SDL_INIT, error); - return; // fatal - } - else - { - char name[128]; - SDL_VideoDriverName(name, sizeof(name)); - logInfo << "initialized SDL; using video driver `" - << name << "'" << std::endl; - } - - if (FE_Init() != 0) - { - const char* error = FE_GetError(); - gError.init(Error::FASTEVENTS_INIT, error); - return; // fatal - } - - gError.init(Error::NONE); - } - - ~Backend_() - { - FE_Quit(); - SDL_Quit(); - } - - static void retain() - { - if (gRetainCount++ == 0) - { - gInstance = BackendP(new Backend_); - } - } - - static void release() - { - if (--gRetainCount == 0) - { - gInstance.reset(); - gError.reset(); - } - } - - static const Error& getError() - { - return gError; - } - -private: - - static Error gError; - static int gRetainCount; - static BackendP gInstance; -}; - -Error Backend_::gError(Error::UNINITIALIZED); -int Backend_::gRetainCount = 0; -BackendP Backend_::gInstance; - - -Backend::Backend() -{ - Backend_::retain(); -} - -Backend::~Backend() -{ - Backend_::release(); -} - -bool Backend::isInitialized() -{ - return getError().code() == Error::NONE; -} - -const Error& Backend::getError() -{ - return Backend_::getError(); -} - - -} // namespace Mf - diff --git a/src/Moof/Core.hh b/src/Moof/Core.hh deleted file mode 100644 index eaa98b4..0000000 --- a/src/Moof/Core.hh +++ /dev/null @@ -1,98 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_CORE_HH_ -#define _MOOF_CORE_HH_ - -#include - -#include - -#include -#include -#include - - -namespace Mf { - - -/** - * The core is essentially a stack of layers. While running, it updates - * each layer from the bottom up every timestep. It also draws each layer - * from the bottom up, adhering to the maximum frame-rate. Events are sent - * to each layer from the top down until a layer signals the event was - * handled. The core is also responsible for firing timers on time. The - * core will continue running as long as there are layers on the stack. - */ - -class Core -{ -public: - - Core(); - - // loads settings: rngseed, timestep, framerate, showfps - void init(); - - int getFps() const; - - void push(LayerP layer); // push a layer onto the top - LayerP pop(); // pop the top layer - LayerP pop(Layer* layer); // pops a specific layer and layers above it - void clear(); // remove all layers (the core will stop) - - int getSize() const; // get the size of the stack - - // set this machine in motion - void run(); - - Dispatch::Handler addHandler(const std::string& event, - const Dispatch::Function& callback); - Dispatch::Handler addHandler(const std::string& event, - const Dispatch::Function& callback, - Dispatch::Handler handler); - - void dispatch(const std::string& event, - const Dispatch::Message* message = 0); - -private: - - class Impl; - boost::shared_ptr mImpl; -}; - -extern Core core; - - -/* - * Some classes and subsystems require certain backend libraries to be - * initialized. This is the mechanism to accomplish that. Classes which - * rely on any backend libraries just need to instantiate this class as a - * member. Backend cleanup will occur automagically when there are no more - * instances. - */ - -class Backend -{ -public: - - Backend(); - ~Backend(); - - static bool isInitialized(); - static const Error& getError(); -}; - - -} // namespace Mf - -#endif // _MOOF_CORE_HH_ - diff --git a/src/Moof/Dispatch.cc b/src/Moof/Dispatch.cc index 52f28f8..83fecae 100644 --- a/src/Moof/Dispatch.cc +++ b/src/Moof/Dispatch.cc @@ -21,46 +21,45 @@ class Dispatch::Impl { public: - Impl() : + Impl(Dispatch* dispatch) : + mDispatch(dispatch), mId(0) {} - Dispatch::Handler getNewHandler() + Dispatch::Handle getNewHandle() { ++mId; - //return Dispatch::Handler(this, mId); - Dispatch::Handler handler(this, mId); - return handler; + Dispatch::Handle handle(mDispatch->mImpl, mId); + return handle; } typedef std::pair Callback; typedef std::multimap CallbackLookup; - typedef CallbackLookup::iterator CallbackIter; + typedef CallbackLookup::iterator CallbackIt; - typedef std::multimap HandlerLookup; - typedef HandlerLookup::iterator HandlerIter; + typedef std::multimap HandleLookup; + typedef HandleLookup::iterator HandleIt; - inline Handler addHandler(const std::string& event, - const Function& callback, Handler handler) + inline Handle addTarget(const std::string& event, + const Function& callback, Handle handle) { mCallbacks.insert(std::make_pair(event, - std::make_pair(handler.getId(), callback))); - mHandlers.insert(std::make_pair(handler.getId(), event)); + std::make_pair(handle.getId(), callback))); + mHandles.insert(std::make_pair(handle.getId(), event)); - return handler; + return handle; } - inline void removeHandler(unsigned id) + inline void removeTarget(unsigned id) { - std::pair - matching(mHandlers.equal_range(id)); + std::pair matching(mHandles.equal_range(id)); - for (HandlerIter it = matching.first; it != matching.second; ++it) + for (HandleIt it = matching.first; it != matching.second; ++it) { - CallbackIter first = mCallbacks.find((*it).second); - CallbackIter last = mCallbacks.end(); + CallbackIt first = mCallbacks.find((*it).second); + CallbackIt last = mCallbacks.end(); - for (CallbackIter jt = first; jt != last; ++jt) + for (CallbackIt jt = first; jt != last; ++jt) { if ((*jt).second.first == id) { @@ -70,16 +69,15 @@ public: } } - mHandlers.erase(id); + mHandles.erase(id); } void dispatch(const std::string& event, const Message* message) { - std::pair + std::pair callbacks(mCallbacks.equal_range(event)); - for (CallbackIter it = callbacks.first; it != callbacks.second; - ++it) + for (CallbackIt it = callbacks.first; it != callbacks.second; ++it) { Function callback = (*it).second.second; callback(message); @@ -87,45 +85,49 @@ public: } + Dispatch* mDispatch; + unsigned mId; CallbackLookup mCallbacks; - HandlerLookup mHandlers; + HandleLookup mHandles; }; -Dispatch::Handler::~Handler() +void Dispatch::Handle::clear() { - if (mId) + boost::shared_ptr dispatch; + if (mId && (dispatch = mDispatch.lock())) { - mDispatch->removeHandler(mId); + dispatch->removeTarget(mId); + mId = 0; } } Dispatch::Dispatch() : - mImpl(new Dispatch::Impl) {} + mImpl(new Dispatch::Impl(this)) {} -Dispatch::Handler Dispatch::addHandler(const std::string& event, - const Function& callback) +Dispatch::Handle Dispatch::addTarget(const std::string& event, + const Function& callback) { - return addHandler(event, callback, mImpl->getNewHandler()); + return addTarget(event, callback, mImpl->getNewHandle()); } -Dispatch::Handler Dispatch::addHandler(const std::string& event, - const Function& callback, - Handler handler) +Dispatch::Handle Dispatch::addTarget(const std::string& event, + const Function& callback, + Handle handle) { // pass through - return mImpl->addHandler(event, callback, handler); + return mImpl->addTarget(event, callback, handle); } -void Dispatch::removeHandler(unsigned id) +void Dispatch::removeTarget(unsigned id) { // pass through - return mImpl->removeHandler(id); + return mImpl->removeTarget(id); } @@ -136,5 +138,12 @@ void Dispatch::dispatch(const std::string& event, const Message* message) } +Dispatch& Dispatch::global() +{ + static Dispatch dispatch; + return dispatch; +} + + } // namespace Mf diff --git a/src/Moof/Dispatch.hh b/src/Moof/Dispatch.hh index fd328fe..4911c12 100644 --- a/src/Moof/Dispatch.hh +++ b/src/Moof/Dispatch.hh @@ -17,6 +17,7 @@ #include #include #include +#include namespace Mf { @@ -31,7 +32,7 @@ class Dispatch class Impl; boost::shared_ptr mImpl; - void removeHandler(unsigned id); + void removeTarget(unsigned id); public: @@ -46,32 +47,35 @@ public: }; - class Handler + class Handle { public: - Handler() : - mDispatch(0), + Handle() : mId(0) {} - Handler(Impl* dispatch, unsigned id) : + Handle(boost::weak_ptr dispatch, unsigned id) : mDispatch(dispatch), mId(id) {} - Handler(const Handler& handler) : - mDispatch(handler.mDispatch), - mId(handler.mId) + Handle(const Handle& handle) : + mDispatch(handle.mDispatch), + mId(handle.mId) { - handler.mId = 0; + handle.mId = 0; } - ~Handler(); + ~Handle() + { + clear(); + } - Handler& operator = (const Handler& handler) + Handle& operator = (const Handle& handle) { - mDispatch = handler.mDispatch; - mId = handler.mId; - handler.mId = 0; + clear(); + mDispatch = handle.mDispatch; + mId = handle.mId; + handle.mId = 0; return *this; } @@ -79,12 +83,13 @@ public: { return mId; } + + void clear(); private: - Impl* mDispatch; - mutable unsigned mId; - + boost::weak_ptr mDispatch; + mutable unsigned mId; }; typedef boost::function Function; @@ -92,11 +97,13 @@ public: Dispatch(); - Handler addHandler(const std::string& event, const Function& callback); - Handler addHandler(const std::string& event, const Function& callback, - Handler handler); + Handle addTarget(const std::string& event, const Function& callback); + Handle addTarget(const std::string& event, const Function& callback, + Handle handle); void dispatch(const std::string& event, const Message* message = 0); + + static Dispatch& global(); }; diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc index c5566d5..54e9972 100644 --- a/src/Moof/Image.cc +++ b/src/Moof/Image.cc @@ -17,7 +17,7 @@ #include #include -#include "Core.hh" +#include "Backend.hh" #include "Error.hh" #include "Image.hh" #include "Log.hh" diff --git a/src/Moof/Layer.hh b/src/Moof/Layer.hh deleted file mode 100644 index 8bbb94b..0000000 --- a/src/Moof/Layer.hh +++ /dev/null @@ -1,47 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_LAYER_HH_ -#define _MOOF_LAYER_HH_ - -#include - -#include -#include - - -namespace Mf { - - -class Layer -{ -public: - - virtual ~Layer() {} - - virtual void addedToCore() {} - virtual void removedFromCore() {} - - virtual void update(Scalar t, Scalar dt) {} - virtual void draw(Scalar alpha) const {} - virtual bool handleEvent(const Event& event) - { - return false; - } -}; - -typedef boost::shared_ptr LayerP; - - -} // namespace Mf - -#endif // _MOOF_LAYER_HH_ - diff --git a/src/Moof/Line.hh b/src/Moof/Line.hh index f8a2b66..679e564 100644 --- a/src/Moof/Line.hh +++ b/src/Moof/Line.hh @@ -12,11 +12,14 @@ #ifndef _MOOF_LINE_HH_ #define _MOOF_LINE_HH_ +#include #include +#include #include #include #include #include +#include #include @@ -38,8 +41,131 @@ struct Line : public Drawable, public Shape a(point1), b(point2) {} + + Vector getDirection() const + { + return b - a; + } + + Scalar getLength() const + { + return getDirection().length(); + } + + + bool intersect(const Line& other, Contact& hit) const + { + Scalar d = (other.b[1] - other.a[1]) * (b[0] - a[0]) - + (other.b[0] - other.a[0]) * (b[1] - a[1]); + + if (d == SCALAR(0.0)) return false; // lines are parallel + // ignoring the (somewhat remote) possibility of coincidence + + Scalar m = ((other.b[0] - other.a[0]) * (a[1] - other.a[1]) - + (other.b[1] - other.a[1]) * (a[0] - other.a[0])) / d; + + Scalar n = ((b[0] - a[0]) * (b[1] - other.a[1]) - + (b[1] - a[1]) * (b[0] - other.a[0])) / d; + + if (m < SCALAR(0.0) || m > SCALAR(1.0) || // not intersecting + n < SCALAR(0.0) || n > SCALAR(1.0)) return false; + + Vector2 tangent = b - a; + Vector2 normal = cml::perp(tangent).normalize(); + + if (cml::dot(normal, other.a - other.b) < SCALAR(0.0)) + { + normal = -normal; + } + + hit.point = a + m * tangent; + hit.normal = normal; + hit.distance = (other.b - hit.point).length(); + + return true; + } + + bool intersect(const Sphere& other, Contact& hit) const + { + Vector surface = b - a; + Vector toPoint = other.point - a; + + Scalar surfaceLength = surface.length(); + surface.normalize(); + + Scalar projection = cml::dot(surface, toPoint); + + if (projection < SCALAR(0.0) || projection > surfaceLength) + { + // try endpoints + + if (other.intersect(a, hit)) + { + hit.normal = -hit.normal; + hit.point = a; + return true; + } + else if (other.intersect(b, hit)) + { + hit.normal = -hit.normal; + hit.point = b; + return true; + } + + return false; + } + + Vector point = a + surface * projection; + Vector normal = other.point - point; + + Scalar distance = normal.length(); + + if (distance > other.radius) false; // not intersecting + + normal.normalize(); + + hit.distance = other.radius - distance; + hit.point = point; + hit.normal = normal; + + return true; + } + + bool intersectRay(const Ray<2>& ray, Ray<2>::Contact& hit) const { + Vector2 v1 = a - ray.point; + Scalar a1 = cml::signed_angle_2D(v1, b - ray.point); + + //logWarning << "angle:::::::::: " << a1 << std::endl; + + if (a1 == Constants::pi()) + { + hit.distance = 5.4321; + return true; + } + else if (a1 == SCALAR(0.0)) + { + hit.distance = 99999.0; + return true; + } + + Scalar a2 = cml::signed_angle_2D(v1, ray.direction); + + if (a2 < SCALAR(0.0) || a2 > a1) return false; + + //hit.distance = 1.23456; + //hit.normal = Vector2(0.0, 0.0); + + Vector2 n = (b - a).normalize(); + Scalar z = cml::dot(ray.point - a, n); + Vector2 p = a + n * z; + hit.distance = (ray.point - p).length(); + hit.normal = cml::perp(a - b); + return true; + + + /* // solve: Cx + r*Dx = Ax + s(Bx - Ax) // Cy + r*Dy = Ay + s(By - Ay) // where: 0 <= s <= 1 if intersection @@ -87,8 +213,10 @@ struct Line : public Drawable, public Shape if (cml::dot(a - ray.point, normal) < 0) hit.normal = normal; else hit.normal = -normal; return true; + */ } + void draw(Scalar alpha = 0.0) const { Mf::Texture::resetBind(); @@ -135,6 +263,14 @@ typedef Polygon<2,3> Triangle2; typedef Polygon<3,3> Triangle3; +template +bool intersect(const Line& line, const Sphere& sphere, + Contact& hit) +{ + return false; +} + + } // namespace Mf #endif // _MOOF_LINE_HH_ diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh index 8bb6741..d56d8ea 100644 --- a/src/Moof/ModalDialog.hh +++ b/src/Moof/ModalDialog.hh @@ -18,7 +18,7 @@ #include "../config.h" #endif -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) #include #elif defined(__APPLE__) && defined(__MACH__) #include @@ -57,6 +57,17 @@ struct ModalDialog std::string text2; + + ModalDialog(Type pType = INFO, + const std::string& pTitle = "", + const std::string& pText1 = "", + const std::string& pText2 = "") : + title(pTitle), + type(pType), + text1(pText1), + text2(pText2) {} + + void run() const { switch (type) @@ -75,7 +86,7 @@ struct ModalDialog break; } -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) int iconType; switch (type) diff --git a/src/Moof/Resource.cc b/src/Moof/Resource.cc index ca127a9..b04acd7 100644 --- a/src/Moof/Resource.cc +++ b/src/Moof/Resource.cc @@ -48,7 +48,7 @@ void Resource::addSearchPaths(const std::vector& path) onePath += '/'; } -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) boost::replace_all(onePath, "/", "\\"); #endif @@ -64,7 +64,7 @@ std::string Resource::getPath(const std::string& name) std::string path(name); -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) boost::replace_all(path, "/", "\\"); #endif diff --git a/src/Moof/Settings.cc b/src/Moof/Settings.cc index 94845c2..bc503c5 100644 --- a/src/Moof/Settings.cc +++ b/src/Moof/Settings.cc @@ -45,7 +45,7 @@ void Settings::loadFromFiles(const std::vector& path) std::vector copy(path); std::vector::iterator it; -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) char* homeDrive = getenv("HOMEDRIVE"); char* homePath = getenv("HOMEPATH"); std::string home(homeDrive ? homeDrive : ""); @@ -96,8 +96,5 @@ void Settings::save() const } -Settings settings; // global instance - - } // namepsace Mf diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index f7503dd..42ef70c 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -33,10 +33,13 @@ class Settings { public: - Settings() + Settings(int argc, char* argv[], const std::string& path) { mScript.importBaseLibrary(); importLogFunctions(mScript); + + parseArgs(argc, argv); + loadFromFiles(path); } ~Settings(); @@ -93,9 +96,6 @@ bool Settings::get(const std::string& key, T& value) const } -extern Settings settings; - - } // namepsace Mf #endif // _MOOF_SETTINGS_HH_ diff --git a/src/Moof/Shape.hh b/src/Moof/Shape.hh index c059d46..d21e84d 100644 --- a/src/Moof/Shape.hh +++ b/src/Moof/Shape.hh @@ -53,13 +53,17 @@ public: * returned if there is no contact. */ virtual bool intersectRay(const Ray& ray, - typename Ray::Contact& hit) + typename Ray::Contact& hit) const { return false; } }; +typedef Shape<2> Shape2; +typedef Shape<3> Shape3; + + } // namespace Mf #endif // _MOOF_SHAPE_HH_ diff --git a/src/Moof/Sphere.hh b/src/Moof/Sphere.hh index d42bfd8..f528554 100644 --- a/src/Moof/Sphere.hh +++ b/src/Moof/Sphere.hh @@ -12,6 +12,7 @@ #ifndef _MOOF_SPHERE_HH_ #define _MOOF_SPHERE_HH_ +#include #include #include #include @@ -28,24 +29,22 @@ namespace Mf { * A round object. */ + template struct Sphere : public Cullable, public Drawable, public Shape { typedef cml::vector< Scalar, cml::fixed > Vector; - // (solution - point)^2 - radius^2 = 0 Vector point; Scalar radius; + Sphere() {} Sphere(const Vector& p, Scalar r) : point(p), radius(r) {} - //Sphere(Scalar x, Scalar y, Scalar z, Scalar r) : - //point(x, y, z), - //radius(r) {} void init(const Vector& p, Scalar r) { @@ -59,9 +58,55 @@ struct Sphere : public Cullable, public Drawable, public Shape radius = (o - p).length(); } + //void encloseVertices(const Vector vertices[], unsigned count); + + //void draw(Scalar alpha = 0.0) const; + //bool isVisible(const Frustum& frustum) const; + + void encloseVertices(const Vector vertices[], unsigned count) + { + // TODO + } + + void draw(Scalar alpha = 0.0) const; + + bool isVisible(const Frustum& frustum) const + { + return true; + } + + + bool intersect(const Sphere& sphere, Contact& hit) const + { + Vector n = sphere.point - point; + Scalar distance = n.length(); + Scalar limit = radius + sphere.radius; + + if (distance > limit) return false; + + hit.normal = n.normalize(); + hit.distance = limit - distance; + hit.point = hit.normal * radius; + + return true; + } + + bool intersect(const Vector& point2, Contact& hit) const + { + Vector n = point2 - point; + Scalar distance = n.length(); + + if (distance > radius) return false; + + hit.normal = n.normalize(); + hit.distance = radius - distance; + hit.point = point2; + + return true; + } // a ray inside the sphere will not intersect on its way out - bool intersectRay(const Ray& ray, typename Ray::Contact& hit) + bool intersect(const Ray& ray, typename Ray::Contact& hit) const { Vector b = point - ray.point; Scalar z = cml::dot(b, ray.direction); @@ -83,37 +128,6 @@ struct Sphere : public Cullable, public Drawable, public Shape hit.normal = surfacePoint - point; return true; } - - - //void encloseVertices(const Vector vertices[], unsigned count); - - //void draw(Scalar alpha = 0.0) const; - //bool isVisible(const Frustum& frustum) const; - - void encloseVertices(const Vector vertices[], unsigned count) - { - // TODO - } - - void draw(Scalar alpha = 0.0) const; - //{ - //GLUquadricObj* sphereObj = gluNewQuadric(); - //gluQuadricDrawStyle(sphereObj, GLU_LINE); - - //glPushMatrix(); - - //glTranslate(point); - //gluSphere(sphereObj, GLdouble(radius), 16, 16); - - //glPopMatrix(); - - //gluDeleteQuadric(sphereObj); - //} - - bool isVisible(const Frustum& frustum) const - { - return true; - } }; diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 48e6e1b..7d82e2d 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -121,12 +121,13 @@ public: mObject(0) { // make sure we have a video context - ASSERT(video && - "cannot load textures without a current video context"); + Video* video = Video::current(); + ASSERT(video && "should have a video context set"); // we want to know when the GL context is recreated - mDispatchHandler = core.addHandler("video.newcontext", - boost::bind(&Impl::contextRecreated, this)); + Dispatch& dispatch = Dispatch::global(); + mNewContextDispatch = dispatch.addTarget("video.newcontext", + boost::bind(&Impl::contextRecreated, this)); } ~Impl() @@ -388,7 +389,7 @@ public: GLuint mObject; ///< GL texture handle. static GLuint gObject; ///< Global GL texture handle. - Dispatch::Handler mDispatchHandler; + Dispatch::Handle mNewContextDispatch; }; GLuint Texture::Impl::gObject = 0; diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh index d65d82d..194caf5 100644 --- a/src/Moof/Transition.hh +++ b/src/Moof/Transition.hh @@ -9,6 +9,7 @@ * **************************************************************************/ +#define _MOOF_TRANSITION_HH_ #ifndef _MOOF_TRANSITION_HH_ #define _MOOF_TRANSITION_HH_ @@ -49,17 +50,17 @@ public: } - void removedFromCore() + void removedFromCore(Core& core) { if (mTo) core.push(mTo); } - void update(Scalar t, Scalar dt) + void update(Core& core, Scalar t, Scalar dt) { mInterp.update(t, dt); - if (mFrom) mFrom->update(t, dt); - if (mTo) mTo->update(t, dt); + if (mFrom) mFrom->update(core, t, dt); + if (mTo) mTo->update(core, t, dt); if (mInterp.isDone()) { @@ -101,7 +102,7 @@ public: glPopMatrix(); } - void draw(Scalar alpha) const + void draw(Core& core, Scalar alpha) const { Scalar a = mInterp.getState(alpha); logInfo << "transition state: " << a << std::endl; @@ -113,7 +114,7 @@ public: glPushMatrix(); glLoadIdentity(); glRotate(180.0 * a, 0.0, 1.0, 0.0); - mFrom->draw(alpha); + mFrom->draw(core, alpha); glPopMatrix(); } //drawFade(a); @@ -123,21 +124,21 @@ public: glPushMatrix(); glLoadIdentity(); glRotate(180.0 * (1.0 - a), 0.0, 1.0, 0.0); - mTo->draw(alpha); + mTo->draw(core, alpha); glPopMatrix(); } //drawFade(1.0 - a); } - bool handleEvent(const Event& event) + bool handleEvent(Core& core, const Event& event) { if (mTo) { - return mTo->handleEvent(event); + return mTo->handleEvent(core, event); } else if (mFrom) { - return mFrom->handleEvent(event); + return mFrom->handleEvent(core, event); } return false; } diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index 9f62586..195f413 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -9,7 +9,6 @@ * **************************************************************************/ -#include "Dispatch.hh" #include "Error.hh" #include "Image.hh" #include "Log.hh" @@ -20,25 +19,19 @@ namespace Mf { -Video::Video() +Video::Video() : + mDispatch(Dispatch::global()) { init(); } Video::Video(const Attributes& attribs) : - mAttribs(attribs) + mAttribs(attribs), + mDispatch(Dispatch::global()) { init(); } -Video::Video(const std::string& caption, const std::string& icon) -{ - mAttribs.caption = caption; - mAttribs.icon = icon; - - init(); -} - void Video::init() { Error error = Backend::getError(); @@ -56,7 +49,7 @@ void Video::init() setCursorGrab(mAttribs.cursorGrab); setVideoMode(mAttribs.mode); - video = this; + if (!gCurrentVideo) makeCurrent(); } void Video::recreateContext() @@ -109,11 +102,11 @@ Video::~Video() { SDL_FreeSurface(mContext); - if (video == this) video = 0; + if (gCurrentVideo == this) gCurrentVideo = 0; } -void Video::setVideoMode(const long mode[3]) +void Video::setVideoMode(const int mode[3]) { if (mode != mAttribs.mode || !mContext) { @@ -130,7 +123,7 @@ void Video::setVideoMode(const long mode[3]) #if !defined(linux) && !defined(__linux) && !defined(__linux__) logInfo("video context recreated"); - core.dispatch("video.newcontext"); + mDispatch.dispatch("video.newcontext"); #endif } else Error(Error::SDL_VIDEOMODE).raise(); @@ -145,7 +138,7 @@ Video::Attributes Video::getAttributes() const void Video::resize(int width, int height) { - long mode[] = {width, height, mAttribs.mode[2]}; + int mode[] = {width, height, mAttribs.mode[2]}; setVideoMode(mode); } @@ -290,35 +283,28 @@ int Video::getHeight() const } +void Video::makeCurrent() const +{ + gCurrentVideo = const_cast(this); +} + + +void Video::setDispatch(Dispatch& dispatch) +{ + mDispatch = dispatch; +} + + Video::Attributes::Attributes() { - // set some sane GL and window defaults (see SDL_video.c:217) - colorBuffer[0] = 3; - colorBuffer[1] = 3; - colorBuffer[2] = 2; - colorBuffer[3] = 0; - frameBuffer = 0; - doubleBuffer = true; - depthBuffer = 16; - stencilBuffer = 0; - accumBuffer[0] = 0; - accumBuffer[1] = 0; - accumBuffer[2] = 0; - accumBuffer[3] = 0; - stereo = false; - multisampleBuffers = 0; - multisampleSamples = 0; - swapControl = false; - hardwareOnly = false; - mode[0] = 640; - mode[1] = 480; - mode[2] = 0; - fullscreen = false; - resizable = false; - cursorVisible = true; - cursorGrab = false; + init(); +} - std::vector colors; +Video::Attributes::Attributes(const Settings& settings) +{ + init(); + + std::vector colors; settings.get("colorbuffers", colors); if (colors.size() > 0) colorBuffer[0] = colors[0]; if (colors.size() > 1) colorBuffer[1] = colors[1]; @@ -330,7 +316,7 @@ Video::Attributes::Attributes() settings.get("depthbuffer", depthBuffer); settings.get("stencilbuffer", stencilBuffer); - std::vector accum; + std::vector accum; settings.get("accumbuffers", accum); if (accum.size() > 0) accumBuffer[0] = accum[0]; if (accum.size() > 1) accumBuffer[1] = accum[1]; @@ -354,7 +340,7 @@ Video::Attributes::Attributes() settings.get("showcursor", cursorVisible); settings.get("grab", cursorGrab); - std::vector dimensions; + std::vector dimensions; settings.get("videomode", dimensions); if (dimensions.size() > 1) { @@ -388,8 +374,37 @@ Video::Attributes::Attributes() if (dimensions.size() > 2) mode[2] = dimensions[2]; } +void Video::Attributes::init() +{ + // set some sane GL and window defaults (see SDL_video.c:217) + colorBuffer[0] = 3; + colorBuffer[1] = 3; + colorBuffer[2] = 2; + colorBuffer[3] = 0; + frameBuffer = 0; + doubleBuffer = true; + depthBuffer = 16; + stencilBuffer = 0; + accumBuffer[0] = 0; + accumBuffer[1] = 0; + accumBuffer[2] = 0; + accumBuffer[3] = 0; + stereo = false; + multisampleBuffers = 0; + multisampleSamples = 0; + swapControl = false; + hardwareOnly = false; + mode[0] = 640; + mode[1] = 480; + mode[2] = 0; + fullscreen = false; + resizable = false; + cursorVisible = true; + cursorGrab = false; +} + -Video* video = 0; // most recently instantiated instance +Video* Video::gCurrentVideo = 0; // most recently instantiated instance } // namespace Mf diff --git a/src/Moof/Video.hh b/src/Moof/Video.hh index 9b1a092..d20ce4e 100644 --- a/src/Moof/Video.hh +++ b/src/Moof/Video.hh @@ -17,11 +17,13 @@ #include #include -#include +#include +#include namespace Mf { +class Settings; class Video; typedef boost::shared_ptr