From: Charles McGarvey Date: Sun, 24 Jan 2010 04:51:15 +0000 (-0700) Subject: reformatting X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=commitdiff_plain;h=837bae9f2bf7b25e1d3d2625eeaf39c1d2f48827 reformatting --- 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