X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FCore.cc;fp=src%2FMoof%2FCore.cc;h=b9ad92a63a8e29e8c7f59e1e6cc310a03bca5b36;hp=190f4c8d4d3bd064735c2f07da709c926fb77ddf;hb=837bae9f2bf7b25e1d3d2625eeaf39c1d2f48827;hpb=81ff940d1bea07447f8218ab9a764fbf393431e8 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: *************************************************/ -