c) License
II. Developers
a) Notes regarding the code
- b) Porting
+ b) Sending patches
III. Packagers
a) The build system
b) Targeting Win32
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.
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
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.
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
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
./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.
#
# Checks for programs.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_PROG_CXX
AC_PROG_CC
#
# Configure platform-specific stuff.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "${host}" in
*mingw32*)
#
# Checks for configuration arguments.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_ARG_ENABLE([debug],
[ --enable-debug include debugging symbols and features],
#
# Split the version number into components.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
#
# Checks for system functions/headers and compiler characteristics.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_C_STRINGIZE
AC_C_INLINE
#
# Checks for build dependencies.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##### boost #####
website="http://www.boost.org/"
#
# Find the game resources to install.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
-o -name "*.ogg" \
#
# Create the build files.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_CONFIG_FILES([Makefile
data/Makefile
#
# Print a friendly little message.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ""
echo " Configuration complete! :-)"
-- Left end tower block
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Front
3, 3, 3, 3, 3})
-- Leftmost background tower block
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Front
end
-- Foreground building with pitched roof
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Left wall
-1, -1, -1})
-- The ground
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Courtyard
end
-- Background building with pitched roof
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Front wall
end
-- More ground to the right
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Ground under house
0, 1, 1, 1, 1, 1, 1, -1, -1, -1})
-- Right foreground tower block
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Front
3, 3, 3, 3, 3})
-- Right end tower block
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Front
3, 3, 3, 3, 3})
-- Background
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ResetTransform()
Translate(-0.3, -0.3, -35)
})
-- Trees
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetTexture("Trees")
-- Example Yoink Configuration File
--- vim: ft=lua ts=4
+-- ex:ft=lua ts=4 sw=4 tw=75
print "loading default settings..."
-- 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.
.\"
-.\" 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
-/*******************************************************************************
-
- 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 <map>
#include <vector>
/**
- * 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
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<Data>
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
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) :
/**
- * 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<Frame> mFrames; ///< List of frames.
- Mf::Scalar mDelay; ///< Scale frame durations.
- bool mLoop; ///< Does the sequence repeat?
- std::string mNext; ///< Next sequence name.
+ std::vector<Frame> 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) :
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;
}
/**
- * 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)
std::string nameStr;
name.get(nameStr);
- mSequences.insert(std::pair<std::string,Sequence>(nameStr,
- Sequence(script, table)));
+ mSequences.insert(std::make_pair(nameStr,
+ Sequence(script, table)));
return 0;
}
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");
}
- std::map<std::string,Sequence> mSequences; ///< List of sequences.
+ std::map<std::string,Sequence> mSequences; ///< List of sequences.
};
/**
- * 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)
mFrameIndex = mCurrentSequence->mFrames[0].mIndex;
mTimeAccum = 0.0;
mFrameDuration = mCurrentSequence->mDelay *
- mCurrentSequence->mFrames[0].mDuration;
+ mCurrentSequence->mFrames[0].mDuration;
}
}
* 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;
}
}
/**
- * 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)
return Mf::Resource::getPath("animations/" + name + ".lua");
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
typedef boost::shared_ptr<Animation> 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
#endif // _ANIMATION_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <iostream>
// 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;
}
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;
mState.position = position;
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <string>
+
#include <boost/shared_ptr.hpp>
#include <Moof/Aabb.hh>
#include "Animation.hh"
-
class Character;
typedef boost::shared_ptr<Character> CharacterP;
#endif // _CHARACTER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <sstream>
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:
return stream.str();
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _ERRORHANDLER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <Moof/Core.hh>
#include <Moof/Error.hh>
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);
}
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;
}
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());
}
mState.camera.setProjection(cml::rad(45.0), width / height, 1.0, 200.0);
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#include <Moof/Math.hh>
#include <Moof/Sound.hh>
-#include <Moof/Line.hh>
+#include <Moof/Line.hh> // TODO
#include <Moof/Plane.hh>
#include <Moof/Ray.hh>
#include <Moof/Sphere.hh>
#include <Moof/Timer.hh>
-#include "Hud.hh"
#include "GameState.hh"
+#include "Hud.hh"
class GameLayer;
#endif // _GAMELAYER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
* The data.
*/
+#include <string>
+#include <vector>
+
#include <boost/shared_ptr.hpp>
#include <Moof/Camera.hh>
Mf::Script script;
std::vector<std::string> 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: *************************************************/
-
-/*******************************************************************************
-
- 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 <Moof/Sound.hh>
return false;
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _HEROINE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <Moof/Core.hh>
#include <Moof/OpenGL.hh>
#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)
{
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());
}
return false;
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _HUD_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cstdlib> // atexit, getenv
#include <iostream>
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
<< " 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;
}
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();
return 0;
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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
};
-#endif // _YOINKAPP_HH_
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
+#endif // _MAIN_HH_
#
# libmoof.a
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
noinst_LIBRARIES = libmoof.a
#
# yoink
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bin_PROGRAMS = yoink
-/*******************************************************************************
-
- 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"
*/
-
-
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#include <Moof/Plane.hh>
#include <Moof/Shape.hh>
-#include <Moof/Frustum.hh>
+#include <Moof/Frustum.hh> // FIXME this file is quite broken
#include <Moof/OpenGL.hh>
#include <Moof/Texture.hh>
*/
-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);
+ }
};
#endif // _MOOF_AABB_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
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));
}
}
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);
}
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_CAMERA_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <algorithm>
#include <cstdlib> // exit, srand
/**
- * 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()
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);
}
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;
}
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();
}
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();
{
(*it)->removedFromCore();
logInfo << "stack: " << mStack.size()
- << " [popped " << (*it).get() << "]" << std::endl;
+ << " [popped " << (*it).get() << "]"
+ << std::endl;
}
if (fixIt) mStackIt = --mStack.begin();
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);
}
char name[128];
SDL_VideoDriverName(name, sizeof(name));
logInfo << "initialized SDL; using video driver `"
- << name << "'" << std::endl;
+ << name << "'" << std::endl;
}
if (FE_Init() != 0)
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()
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <string>
+
#include <boost/shared_ptr.hpp>
#include <Moof/Dispatch.hh>
/**
- * 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
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
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:
/*
* 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
#endif // _MOOF_CORE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_CULLABLE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <map>
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;
inline void removeHandler(unsigned id)
{
- std::pair<HandlerIter,HandlerIter> matching(mHandlers.equal_range(id));
+ std::pair<HandlerIter,HandlerIter>
+ matching(mHandlers.equal_range(id));
for (HandlerIter it = matching.first; it != matching.second; ++it)
{
std::pair<CallbackIter,CallbackIter>
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);
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);
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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);
};
#endif // _MOOF_DISPATCH_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_DRAWABLE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
namespace Mf {
-class Entity;
-typedef boost::shared_ptr<Entity> EntityP;
-
class Frustum;
* specified volume (take up space).
*/
+class Entity;
+typedef boost::shared_ptr<Entity> EntityP;
+
+
class Entity : public Cullable, public Drawable
{
protected:
#endif // _MOOF_ENTITY_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_ERROR_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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;
#endif // _MOOF_EVENT_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <Moof/Aabb.hh>
#include <Moof/Frustum.hh>
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);
}
for (int j = 0; j < 8; ++j)
{
- if (mPlanes[i].intersects(corners[j]) ==
- Plane::NEGATIVE)
+ if (mPlanes[i].intersects(corners[j]) == Plane::NEGATIVE)
{
--nInside;
}
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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;
#endif // _MOOF_FRUSTUM_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
// 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.
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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
{
#endif // _MOOF_HASH_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cstdio> // FILE
#include <cstring> // strncmp
#include <boost/algorithm/string.hpp>
-#include <SDL/SDL.h>
#include <png.h>
+#include <SDL/SDL.h>
#include "Core.hh"
#include "Error.hh"
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;
{
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
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_IMAGE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_INTERPOLATOR_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_LAYER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#include <Moof/Shape.hh>
#include <Moof/Texture.hh>
-#include <Moof/Log.hh>
-
namespace Mf {
#endif // _MOOF_LINE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <fstream>
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));
}
-/*******************************************************************************
-
- 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_
/**
* @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 <cstdlib> // exit
/**
- * 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
*/
#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
-/*******************************************************************************
-
- 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 <string>
#endif // _MOOF_MANAGER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
-// 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);
#endif // _MOOF_MATH_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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));
#endif // _MOOF_MODALDIALOG_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#include <list>
#include <boost/shared_ptr.hpp>
-
#include <stlplus/ntree.hpp>
#include <Moof/Aabb.hh>
#endif // _MOOF_OCTREE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#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
#endif // _MOOF_OPENGL_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
/*
- * 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>
}
- /* 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();
}
/**
- * 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;
#endif // _MOOF_PLANE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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);
#endif // _MOOF_RAY_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_RECTANGLE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <unistd.h>
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
/**
* 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.
*/
#endif // _MOOF_RESOURCE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
template <int D = 3>
struct LinearState
{
- typedef cml::vector< Scalar, cml::fixed<D> > Vector;
- typedef boost::function<const Vector& (const LinearState&)> ForceFunction;
+ typedef cml::vector< Scalar, cml::fixed<D> > Vector;
+ typedef boost::function<const Vector& (const LinearState&)>
+ ForceFunction;
// primary
}
template <>
-inline State2 interpolate<State2>(const State2& a, const State2& b, Scalar alpha)
+inline State2 interpolate<State2>(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<State3>(const State3& a, const State3& b, Scalar alpha)
+inline State3 interpolate<State3>(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;
}
#endif // _MOOF_RIGIDBODY_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <iostream>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
-
#include <lua.hpp>
#include <Moof/Log.hh>
};
/**
- * 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) :
// 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
/**
- * 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
/**
- * Get a pointer value (for userdata, tables, threads, and functions).
+ * Get a pointer value (for userdata, tables, threads, and
+ * functions).
*/
const void* getIdentifier() const
}
/**
- * 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()
/**
- * 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()
}
/**
- * 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
/**
- * 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)
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());
}
/**
* 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)
#endif // _MOOF_SCRIPT_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cstdlib> // getenv
save();
}
-//Settings& Settings::getInstance()
-//{
- //static Settings settings;
- //return settings;
-//}
-
void Settings::parseArgs(int argc, char* argv[])
{
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: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_SETTINGS_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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<D>& ray,
- typename Ray<D>::Intersection& hit)
+ typename Ray<D>::Intersection& hit)
{
return SCALAR(-1.0);
}
#endif // _MOOF_SHAPE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cstdio>
#include <deque>
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);
{
// nothing more to play, stopping...
mIsPlaying = false;
- std::remove(mBuffers.begin(), mBuffers.end(), bufferObj);
+ std::remove(mBuffers.begin(), mBuffers.end(),
+ bufferObj);
}
}
}
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);
{
// 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()
{
alcMakeContextCurrent(gAlContext);
logInfo << "opened sound device `"
- << alcGetString(gAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER)
+ << alcGetString(gAlDevice,
+ ALC_DEFAULT_DEVICE_SPECIFIER)
<< "'" << std::endl;
}
}
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]);
}
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void SoundStream::enqueue(const std::string& name)
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
* Load and play sounds, current supports ogg vorbis.
*/
+#include <string>
+
#include <boost/shared_ptr.hpp>
#include <Moof/Math.hh>
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);
#endif // _MOOF_SOUND_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#include <Moof/OpenGL.hh>
#include <Moof/Shape.hh>
+// TODO this needs work
namespace Mf {
//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;
+ }
};
#endif // _MOOF_SPHERE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <stdexcept>
#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();
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_STRINGTOOLS_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cstdio> // FILE
#include <cstring> // strncmp
/**
- * 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<Impl>
}
/**
- * 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()
}
/**
- * 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)
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:
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",
/**
- * 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.
*/
/*
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
(
*/
/**
- * 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.
*/
}
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];
/**
- * 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()
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];
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;
};
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
* Image-loading and OpenGL texture loading.
*/
+#include <string>
+
#include <boost/shared_ptr.hpp>
#include <Moof/Image.hh>
/**
- * 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.
*/
/**
- * 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);
#endif // _MOOF_TEXTURE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
*/
#include <boost/function.hpp>
-
#include <SDL/SDL.h>
}
-// =============================================================================
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Mutex
{
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()
} // namespace Mf
-
#endif // _MOOF_THREAD_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <cerrno>
#include <ctime>
#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_()
{
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)
#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()
{
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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();
/**
- * 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.
*/
/**
- * 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);
} // namespace Mf
-
#endif // _MOOF_TIMER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _MOOF_TRANSITION_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
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);
}
}
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)
{
}
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;
}
}
-Video* video = 0;
+Video* video = 0; // most recently instantiated instance
} // namespace Mf
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
/*] 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.
#include <string>
#include <boost/shared_ptr.hpp>
-
#include <SDL/SDL.h>
#include <Moof/Core.hh>
-/*******************************************************************************
-
- 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 <map>
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;
}
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
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<Impl::Quad> >& objects = mImpl->mObjects;
std::list< boost::shared_ptr<Impl::Quad> >::const_iterator it;
bool Scene::castRay(const Mf::Ray<2>& ray,
- std::list<Mf::Ray<2>::Intersection>& hits) const
+ std::list<Mf::Ray<2>::Intersection>& hits) const
{
std::list< Mf::Line<2> >& lines = mImpl->mLines;
std::list< Mf::Line<2> >::const_iterator it;
return Mf::Resource::getPath("scenes/" + name + ".lua");
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _SCENE_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <iostream>
Mf::Texture::getTileCoords(index, coords, what);
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
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: *************************************************/
-
-/*******************************************************************************
-
- 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 <Moof/Core.hh>
#include <Moof/OpenGL.hh>
interp.init(0.0, 1.0);
Mf::Transition<Mf::Lerp>::Ptr transition =
- Mf::Transition<Mf::Lerp>::alloc(mGameLayer, titleLayer, interp);
+ Mf::Transition<Mf::Lerp>::alloc(mGameLayer, titleLayer,
+ interp);
Mf::core.push(transition);
return true;
return false;
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _TITLELAYER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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 <algorithm>
#include <cstdarg>
nPrinted = std::min(nPrinted, (int)sizeof(buffer) - 1);
}
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _TYPESETTER_HH_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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"
const char* COMPILE_TIME = "Unknown";
#endif
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
-/*******************************************************************************
-
- 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_
#endif // _VERSION_H_
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
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