]> Dogcows Code - chaz/yoink/commitdiff
pch support
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Wed, 13 Jul 2011 06:15:39 +0000 (00:15 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Wed, 13 Jul 2011 06:15:39 +0000 (00:15 -0600)
63 files changed:
Makefile
build/arch/gentoo/yoink.ebuild
options.lua
src/Animation.hh
src/GameState.hh
src/Hud.cc
src/Hud.hh
src/TilemapFont.hh
src/moof/aabb.cc
src/moof/aabb.hh
src/moof/application.cc
src/moof/application.hh
src/moof/backend.cc
src/moof/backend.hh
src/moof/camera.hh
src/moof/contact.hh
src/moof/cullable.hh
src/moof/debug.hh
src/moof/dispatcher.hh
src/moof/drawable.hh
src/moof/entity.hh
src/moof/event.hh
src/moof/frustum.hh
src/moof/hash.hh
src/moof/image.cc
src/moof/image.hh
src/moof/interpolator.hh
src/moof/line.hh
src/moof/log.hh
src/moof/manager.hh
src/moof/math.hh
src/moof/mesh.hh
src/moof/modal_dialog.hh
src/moof/network.hh
src/moof/opengl.hh
src/moof/packet.cc
src/moof/packet.hh
src/moof/plane.hh
src/moof/precompile.hh [new file with mode: 0644]
src/moof/ray.hh
src/moof/resource.cc
src/moof/resource.hh
src/moof/rigid_body.hh
src/moof/rules.mk
src/moof/runloop.hh
src/moof/script.hh
src/moof/service.hh
src/moof/settings.hh
src/moof/shape.hh
src/moof/socket.hh
src/moof/sound.cc
src/moof/sound.hh
src/moof/sphere.hh
src/moof/sprite.cc
src/moof/sprite.hh
src/moof/string.cc
src/moof/string.hh
src/moof/thread.hh
src/moof/timer.hh
src/moof/video.hh
src/rules.mk
src/stlplus/rules.mk
src/yoink.hh

index a0c754b694dbf64e9d42fc277ec02fcacfcbd9a7..dfdfaeb072e71a2ed66dabb04fbf4f3b563b6ed3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,39 +4,57 @@
 # Use this file with GNU make to compile and install Yoink.
 #
 
-# Set V to `1' to echo each build command in full.  The default behavior
-# will keep output minimal.
+# Set V to `1' to echo each build command in full.  The default behavior will
+# keep output minimal so that warnings are clearly visible.
 V      = 0
 
 SHELL  = /bin/sh
 
 
 ifeq (menuconfig,$(MAKECMDGOALS))
+# If all we want is to bring up the configure script, then we really don't
+# need to define any other functions or recipes process anything else.
 menuconfig:
        ./configure --interactive
 .PHONY: menuconfig
 else
 
+# Recipe to create `config.h' which is included by some source files.
 config.h: config.mk
        $(Q)$(configure) --export-header=$@
 
+# Recipe to create `config.sed' which is used by some recipes to search and
+# replace certain terms in some files, usually with a `.in' suffix.
 config.sed: config.mk
        $(Q)$(configure) --export-terms=$@
 
+# Recipe to create `config.mk' which is the makefile with important configure
+# options set.
 config.mk:
        $(Q)$(configure) --interactive --print-instructions=no
 
+
+# Include the configure makefile; fail if it doesn't exist.
 include config.mk
 
 
-#
-# Define some useful functions.
-#
+# This simple variable will be appended with targets which must be built
+# before the `install-data' target.
+data_targets   :=
 
-DATA_TARGETS   :=
-EXEC_TARGETS   :=
-SUBDIRS                :=
+# This simple variable will be appended with targets which must be built
+# before the `install-exec' target.
+exec_targets   :=
 
+# This simple variable will be appended with subdirectories which contain
+# rules as well as their corresponding subdirectories under the build
+# directory, any directory which might have files to be installed.
+subdirs                :=
+
+# Function to include rules from subdirectories.  This is the core of the
+# non-recursive make method this build system uses.  It works by managing
+# several stacks and helping to append the appropriate values to the simple
+# variables defined above.
 define include_func =
 ifeq (,$$d)
 dir    := $1
@@ -51,14 +69,14 @@ d   := $$(dir)
 data   :=
 exec   :=
 include $$(dir)/rules.mk
-SUBDIRS += $$d $$b
-data   := $$(sort $$(data) $$(appdir_$$b) $$(mandir_$$b) $$(pkgdatadir_$$b) $$(desktop_$$b))
+subdirs += $$d $$b
+data   := $$(sort $$(data) $$(mandir_$$b) $$(datadir_$$b) $$(pkgdatadir_$$b) $$(desktop_$$b))
 exec   := $$(sort $$(exec) $$(bindir_$$b) $$(libdir_$$b))
-deps   := $$(filter %.d,$$(exec:%.o=%.d))
+deps   := $$(filter %.d,$$(call depfile,$$(exec)))
 clean   := $$(clean) $$(deps) $$(exec) $$(data)
 DEPFILE := $$(DEPFILE) $$(deps)
-DATA_TARGETS += $$(data)
-EXEC_TARGETS += $$(exec)
+data_targets += $$(data)
+exec_targets += $$(exec)
 d      := $$(dirstack_$$(sp))
 data   := $$(datstack_$$(sp))
 exec   := $$(exestack_$$(sp))
@@ -66,11 +84,16 @@ sp  := $$(basename $$(sp))
 endef
 include        = $(foreach i,$1,$(eval $(call include_func,$i)))
 
-targets                = $(EXEC_TARGETS) $(DATA_TARGETS)
+# These shortcut variables are meant to be used to simplify included rules.
 builddir       = build/obj
 b              = $(builddir)/$(d)
 this           = $(d)/rules.mk
 
+# Function to convert object file paths to dependency file paths.  This also
+# supports pre-compiled header files.
+depfile        = $(patsubst %.h.gch,%.d,$(patsubst %.hh.gch,%.d,$(1:%.o=%.d)))
+
+# Determine the suffix that installed manual pages should have.
 ifeq (gzip,$(manCompression))
 MANEXT=.gz
 else
@@ -79,42 +102,64 @@ MANEXT=.bz2
 endif
 endif
 
-
-#
-# Include the subdirectories--order is not important.
-#
-
+# Now do the actual inclusion of the rules from these subdirectories.
 $(call include,src data doc)
--include build/arch/$(platform)/rules.mk
-
 
-#
-# Define some common rules.
-#
+# Also include platform-specific rules, if they exist.
+-include build/arch/$(platform)/rules.mk
 
+# Handle automatic tracking of dependencies, if enabled.  This adds overhead
+# and should be disabled if not needed.
 ifeq (true,$(tracking))
-PKG_CFLAGS     += -MD -MP -MF $(@:%.o=%.d) -MT $@
+PKG_CFLAGS     += -MT $@ -MMD -MP -MF $(call depfile,$@)
 -include $(DEPFILE)
 endif
 
+# Handle the inclusion of a PCH file, if enabled.  Using a PCH file can
+# improve build times in some (but not all) cases.  The rules should also
+# define the `pchfile' variable to the path of the PCH file.  Only one PCH
+# file can be used.  If the PCH file has a `.h' suffix, it is included only
+# when compiling C sources, otherwise it will be included only when compiling
+# C++ sources.
+ifeq (true,$(pch))
+ifneq (,$(pchfile))
+PCH_FLAGS      = -Winvalid-pch -include $(pchfile)
+endif
+endif
+
 # Include current directory to allow sources to include config.h.
 override CPPFLAGS      += -I. -DHAVE_CONFIG_H=1
+
+# The target C++ flags should mirror the target C flags by default.
 TGT_CXXFLAGS           = $(TGT_CFLAGS)
+
+# Define the default flags passed to the library archiver.
 ARFLAGS                = rc
+
+# Define the default install program.
 INSTALL                = install
 
+# Define the `tarname' to be used as a base filename for distributable
+# archives.
 tarname                = $(TARNAME)-$(VERSION)
 
-cmd_compile_c  = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(CPPFLAGS) \
+# Define the commands needed to make several different types of files.  Don't
+# used these commands directly because they don't account for verbosity;
+# instead use the commands without the `cmd_' prefix (defined below).
+cmd_compile_c  = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(PCH_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
                  $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
-cmd_compile_cc = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) \
+cmd_compile_cc = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(PCH_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
                  $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
-cmd_link_c     = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(CPPFLAGS) \
-                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
+cmd_link_c     = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(PCH_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
+                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) $(MYLDFLAGS) \
                  $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
-cmd_link_cc    = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) \
-                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
+cmd_link_cc    = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(PCH_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
+                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) $(MYLDFLAGS) \
                  $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
+cmd_compile_pch        = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(MYCFLAGS) $(CPPFLAGS) \
+                 $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_compile_pchh       = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $(CPPFLAGS) \
+                         $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
 cmd_ar         = $(AR) $(ARFLAGS) $@ $^; $(RANLIB) $@
 cmd_compile_rc = $(WINDRES) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) -i $<
 cmd_sed                = sed -f config.sed <$< >$@
@@ -126,26 +171,40 @@ cmd_xxd           = id=$(subst .,_,$(notdir $<)); \
                  xxd -i <$< >>$@; \
                  printf ", 0x00\n};\n" >>$@
 cmd_configure  = ./configure
-func_install   = mkdir -p $(DESTDIR)$3 && $(INSTALL) -m $1 $2 $(DESTDIR)$3
+
+# Define some useful functions.  Don't use these functions directly because
+# they don't account for verbosity; instead use the functions without the
+# `func_' prefix (defined below).
 func_remove    = rm -f $1
+func_install   = mkdir -p $(DESTDIR)$3 && $(INSTALL) -m $1 $2 $(DESTDIR)$3
 func_dist      = git archive HEAD --prefix='$(tarname)/' | $1 >"$(tarname).tar.$2" && \
-                 (md5 "$(tarname).tar.$2" 2>/dev/null || md5sum "$(tarname).tar.$2")
-
-compile_c      = $(call func_print,CC,$@) $(cmd_compile_c)
-compile_cc     = $(call func_print,CXX,$@) $(cmd_compile_cc)
-compile_rc     = $(call func_print,RC,$@) $(cmd_compile_rc)
-link_c         = $(call func_print,LINK,$@) $(cmd_link_c)
-link_cc                = $(call func_print,LINK,$@) $(cmd_link_cc)
-ar             = $(call func_print,AR,$@) $(cmd_ar)
-sed            = $(call func_print,SED,$@) $(cmd_sed)
-gzip           = $(call func_print,GZIP,$@) $(cmd_gzip)
-bzip2          = $(call func_print,BZIP2,$@) $(cmd_bzip2)
-xxd            = $(call func_print,XXD,$@) $(cmd_xxd)
-configure      = $(call func_print,MAKE,$@) $(cmd_configure)
-dist           = $(call func_print,DIST,$1) $(func_dist)
+                 (openssl md5 "$(tarname).tar.$2" 2>/dev/null || \
+                 md5 "$(tarname).tar.$2" 2>/dev/null || \
+                 md5sum "$(tarname).tar.$2" 2>/dev/null)
+
+# These commands and functions should be used in most recipes to compile
+# sources, link objects, compress files, create distfiles, install files, etc.
+compile_c      = $(call func_print,CC,$@)      $(cmd_compile_c)
+compile_cc     = $(call func_print,CXX,$@)     $(cmd_compile_cc)
+compile_rc     = $(call func_print,RC,$@)      $(cmd_compile_rc)
+link_c         = $(call func_print,LINK,$@)    $(cmd_link_c)
+link_cc                = $(call func_print,LINK,$@)    $(cmd_link_cc)
+compile_pch    = $(call func_print,CC,$@)      $(cmd_compile_pch)
+compile_pchh   = $(call func_print,CXX,$@)     $(cmd_compile_pchh)
+ar             = $(call func_print,AR,$@)      $(cmd_ar)
+sed            = $(call func_print,SED,$@)     $(cmd_sed)
+gzip           = $(call func_print,GZIP,$@)    $(cmd_gzip)
+bzip2          = $(call func_print,BZIP2,$@)   $(cmd_bzip2)
+xxd            = $(call func_print,XXD,$@)     $(cmd_xxd)
+configure      = $(call func_print,MAKE,$@)    $(cmd_configure)
+dist           = $(call func_print,DIST,$1)    $(func_dist)
+remove         = $(call func_print,RM,$1)      $(func_remove)
 install                = $(call func_print,CP,$(DESTDIR:%/=%)$(3:%/=%)/$(notdir $2)) $(func_install)
-remove         = $(call func_print,RM,$1) $(func_remove)
 
+# The mechanism used by this makefile to handle verbosity simply requires (by
+# convention) commands in rules to be prefixed with `$Q' and the commands and
+# functions defined above will then print a single line describing the command
+# instead of the entire command.
 ifeq (1,$V)
 Q              =
 func_print     =
@@ -155,16 +214,18 @@ func_print        = printf "\x20\x20$1\t%s\n" $2;
 endif
 
 
-#
-# Define the implicit rules.
-#
-
+# Define the implicit rules.  Targets and sources which match do not need to
+# be explicitly stated in the rule definitions.
+%.o: %.c
+       $(Q)$(compile_c)
+%.h.gch: %.h
+       $(Q)$(compile_pch)
 %.o: %.cc
        $(Q)$(compile_cc)
 %.o: %.cpp
        $(Q)$(compile_cc)
-%.o: %.c
-       $(Q)$(compile_c)
+%.hh.gch: %.hh
+       $(Q)$(compile_pchh)
 %.o: %.rc
        $(Q)$(compile_rc)
 %: %.in
@@ -174,6 +235,10 @@ endif
 %.bz2: %
        $(Q)$(bzip2)
 
+# More explicit rules which allow targets in the build directory to be made
+# directly.  A special rules is also defined to create directories or copy
+# files under the build directory to match the structure of the source
+# directory.
 $(builddir)/%.o: %.cc
        $(Q)$(compile_cc)
 $(builddir)/%.o: %.cpp
@@ -192,65 +257,66 @@ $(builddir)/%: %
        $(Q)if [ -d $< ]; then mkdir -p $@; elif [ -f $< ]; then cp -f $< $@; fi
 
 
-#
-# Define the phony targets.
-#
-
+# Define the default target(s).  This should `make' just about everything.
 .DEFAULT_GOAL :=
-all: $(targets)
+all: $(exec_targets) $(data_targets)
 
+# Define the recipe to clean the targets.  This will remove the target files
+# and the empty directories of the build hierarchy.
 clean:
        $(Q)$(foreach f,$(clean),$(call remove,$f);)
        $(Q)if [ -d $(builddir) ]; then find $(builddir) -type d -empty -delete; fi
 
+# Make the project even cleaner by removing files created by configuration.
 distclean: clean
        $(Q)cd build && $(MAKE) clean
        $(Q)$(call remove,config.h);$(call remove,config.mk);$(call remove,config.sed)
 
-
+# Installation happens in two separated phases, installing the executable
+# (i.e. platform-specific) files and installing the data files.
 install: install-data install-exec
 
-install-data: $(DATA_TARGETS)
-       $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(pkgdatadir_$d),\
+# Recipe to install the data files.  Right now, that includes files destined
+# for `pkgdatadir' and `mandir'.
+install-data: $(data_targets)
+       $(Q)$(foreach d,$(subdirs),$(foreach f,$(pkgdatadir_$d),\
                $(call install,644,$f,$(dir $(f:$d%=$(pkgdatadir)%)));))
-       $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(mandir_$d),\
+       $(Q)$(foreach d,$(subdirs),$(foreach f,$(mandir_$d),\
                $(call install,644,$f,\
                $(dir $(f:$d%=$(mandir)/man$(shell echo "$f" | sed 's/[^.]*\.\([^.]*\).*/\1/')%)));))
 
-install-exec: $(EXEC_TARGETS)
-       $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(bindir_$d),\
+# Recipe to install executable files.  Right now, that includes files destined
+# for `bindir'.
+install-exec: $(exec_targets)
+       $(Q)$(foreach d,$(subdirs),$(foreach f,$(bindir_$d),\
                $(call install,755,$f,$(dir $(f:$d%=$(bindir)%)));))
 
-install-desktop-entry: $(DATA_TARGETS)
-       $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(desktop_$d),\
+# Recipe to install desktop entry file(s) to /usr/share/applications.
+install-desktop-entry: $(data_targets)
+       $(Q)$(foreach d,$(subdirs),$(foreach f,$(desktop_$d),\
                $(call install,644,$f,/usr/share/applications);))
 
-
+# Target used to create distfiles in all the supported compression formats.
 dist-all: dist-bzip2 dist-gzip dist-lzma dist-xz
 
+# Separate targets to create distfiles in the corresponding formats.
 dist-bzip2:
        $(Q)$(call dist,bzip2,bz2)
-
 dist-gzip:
        $(Q)$(call dist,gzip,gz)
-
 dist-lzma:
        $(Q)$(call dist,lzma,lzma)
-
 dist-xz:
        $(Q)$(call dist,xz,xz)
 
+# The `dist' target will create the distfile in whatever format was set in the
+# configuration.
 dist: dist-$(archiveFormat)
 
 
-#
-# Prevent make from removing any build targets.
-#
-
-.SECONDARY: $(clean)
-
-.PHONY: all clean distclean install install-data install-exec
-.PHONY: install-desktop-entry
+# Define which targets do not actually correspond to real files.
+.PHONY: all clean distclean
+.PHONY: install install-data install-exec install-desktop-entry
 .PHONY: dist dist-all dist-gzip dist-bzip2 dist-xz dist-lzma
 
 endif  # menuconfig
index b27524e9e5a489a9409349ce7da70430863cda77..b69232c4d8f0105163e808d882735be4c070fb7d 100644 (file)
@@ -29,11 +29,11 @@ DEPEND="${RDEPEND}
 
 src_configure() {
        egamesconf --disable-dependency-tracking \
-               --install-icon=no \
-               --print-instructions=no \
+               --install-icon=no --print-instructions=no \
                $(use_enable debug) \
                $(use_enable double-precision) \
                $(use_enable hotload) \
+               $(use_enable pch) \
                $(use_enable threads) \
                $(use_with gtk) \
                $(use_with qt4)
index 4839144d99f97a9ca19c30b40c6ecf39645a4bd5..429c5b8ef577033c5535e347b9b922928cc213d8 100644 (file)
@@ -294,6 +294,19 @@ rebuilt when you run make.  This may add some overhead
 to the build process.
 
 If in doubt, say Yes.
+]]
+               },
+               {
+                       symbol  = "pch",
+                       value   = false,
+                       cmdline = "--enable-pch",
+                       name    = "Use Precompiled Header",
+                       caption = "Enable building and using a precompiled header.",
+                       help    = [[
+Recent versions of GCC can use precompiled headers
+which may improve compile times.
+
+If in doubt, say No.
 ]]
                },
                {
index c8cdca8ed752c4b3addfdc4ee0ccd61906cabc19..d49dfb5f785f99d13b99ca2940a4fc967f1c3a6d 100644 (file)
 #ifndef _ANIMATION_HH_
 #define _ANIMATION_HH_
 
-/**
- * @file Animation.hh
- * Motion picture!!
- */
-
 #include <string>
 
 #include <boost/shared_ptr.hpp>
 #include <moof/math.hh>
 
 
+/**
+ * \file Animation.hh
+ * Motion picture!!
+ */
+
 class Animation;
 typedef boost::shared_ptr<Animation> AnimationP;
 
index ecf9e05e08b60af28a0dfc07847d52bb42756ad6..76ecc34b37131ca0cd1a3126fbd0ef353dd95365 100644 (file)
 #ifndef _GAMESTATE_HH_
 #define _GAMESTATE_HH_
 
-/**
- * \file GameState.hh
- * The data.
- */
-
 #include <string>
 #include <vector>
 
 #include "Scene.hh"
 
 
+/**
+ * \file GameState.hh
+ * The data.
+ */
+
 struct GameState
 {
        moof::script                    script;
index dde53ee37b5f486c807dfda50680841387163c21..20d6b4e3beee63d470a272a782b5a83b55a69807 100644 (file)
@@ -8,7 +8,7 @@
 *****************************************************************************/
 
 #include <moof/aabb.hh>
-#include <moof/log.hh>
+#include <moof/debug.hh>
 #include <moof/opengl.hh>
 #include <moof/video.hh>
 
index 05882ed0121f439250925846594991335bb13cad..905d6e16b8cb6d184450ae44aad1f46fa6330cb2 100644 (file)
 #ifndef _HUD_HH_
 #define _HUD_HH_
 
-/**
- * @file Hud.hh
- * Heads-up Display
- */
-
 #include <moof/drawable.hh>
 #include <moof/math.hh>
 //#include <moof/rectangle.hh>
 #include "GameState.hh"
 
 
+/**
+ * \file Hud.hh
+ * Heads-up Display
+ */
+
+
 // forward declarations
 class rectangle;
 
index b3759a93aee111e12e5d45215daf3d684a2bbe7c..89c7ffe4c7e220b19995d9503f0337efc67daded 100644 (file)
 #ifndef _TILEMAPFONT_HH_
 #define _TILEMAPFONT_HH_
 
+#include <moof/sprite.hh>
+
+
 /**
- * @file TilemapFont.hh
+ * \file TilemapFont.hh
  * Text on the screen.
  */
 
-#include <moof/sprite.hh>
-
 
 /*
 class TilemapFont : public moof::texture
index f403f7aa28f34c88629405eb9b077e6817945376..61e16eaa36863aa77616a117d2054d6fc3e9f459 100644 (file)
 #include "aabb.hh"
 #include "script.hh"
 
+
 namespace moof {
 
+
 void import_aabb_class(script& script)
 {
 }
 
+
 } // namepsace moof
 
index 3228b5a225a412927a0601b68c5a77bc608a5383..8a677f46adc834330bff428e32a44b286d9c488a 100644 (file)
 #ifndef _MOOF_AABB_HH_
 #define _MOOF_AABB_HH_
 
-/**
- * \file aabb.hh
- * Axis-aligned Bounding Box
- */
-
 #include <moof/cullable.hh>
 #include <moof/drawable.hh>
 #include <moof/math.hh>
 #include <moof/opengl.hh>
 
 
+/**
+ * \file aabb.hh
+ * Axis-aligned Bounding Box
+ */
+
 namespace moof {
 
 
@@ -256,7 +256,7 @@ inline bool aabb<3>::is_visible(const frustum& frustum) const
 }
 
 typedef aabb<2>                aabb2;
-typedef aabb2          rectangle;
+typedef aabb<2>                rectangle;
 typedef aabb<3>                aabb3;
 
 
index e0b73b78d9ac053e7a5f8805a2431acc4c730235..84f1a24040593ef2de145d117f8401314f5b3117 100644 (file)
@@ -7,16 +7,14 @@
 *
 *****************************************************************************/
 
-#include <cstdlib>                     // exit, srand
-#include <boost/noncopyable.hpp>
+#include <cstdlib>             // exit, srand
 
 #include <SDL/SDL.h>
-#include "fastevents.h"
 
 #include "application.hh"
+#include "fastevents.h"
 #include "log.hh"
 #include "settings.hh"
-#include "timer.hh"
 #include "video.hh"
 
 
index 5c808670bde984ce524873d45b8e6d7fe0ddeece..e96198770c56b6c184d51c75fe0a829475c59938 100644 (file)
 #ifndef _MOOF_APPLICATION_HH_
 #define _MOOF_APPLICATION_HH_
 
-/**
- * \file application.hh
- * The main loop.
- */
-
-#include <boost/noncopyable.hpp>
-
 #include <moof/event.hh>
 #include <moof/math.hh>
 #include <moof/runloop.hh>
+#include <moof/thread.hh>
 #include <moof/timer.hh>
 
 
+/**
+ * \file application.hh
+ * The main loop.
+ */
+
 namespace moof {
 
 
index fa3ad3102ab546a9cc630f49ff3d4a8a2fcb046b..5b995c553b9c21b317377c6fd93201cbc7ada060 100644 (file)
@@ -14,9 +14,9 @@
 #include <stdexcept>
 
 #include <SDL/SDL.h>
-#include "fastevents.h"
 
 #include "backend.hh"
+#include "fastevents.h"
 #include "log.hh"
 
 
index b25e53ae7fbf14c382a93c3b1c6646724a7b26f8..6711de8891b6dad0bb9489ddaa4740b495a77383 100644 (file)
@@ -15,7 +15,6 @@
  * Initialize the backend libraries and subsystems.
  */
 
-
 namespace moof {
 
 
index 43e547163d9a0ff8206a3a91475b75d85050e0a4..7484e4e7a64bd6845182f900d12906acdd08896a 100644 (file)
 #ifndef _MOOF_CAMERA_HH_
 #define _MOOF_CAMERA_HH_
 
-/**
- * \file camera.hh
- * Classes related to managing the modelview and perspective matrices.
- */
-
 #include <moof/event.hh>
 #include <moof/frustum.hh>
 #include <moof/math.hh>
 #include <moof/rigid_body.hh>
 
 
+/**
+ * \file camera.hh
+ * Classes related to managing the modelview and perspective matrices.
+ */
+
 namespace moof {
 
 
index 1d1998e19e69b273ad88acaaed6ce649089e06c1..42e93bbe73356b2b31017dd8e24bdfe19b763b4f 100644 (file)
 #ifndef _MOOF_CONTACT_HH_
 #define _MOOF_CONTACT_HH_
 
+#include <moof/math.hh>
+
+
 /**
  * \file contact.hh
  * Represents a collision between entities.
  */
 
-#include <moof/math.hh>
-
-
 namespace moof {
 
 
index 3f0169a391670dc427bf149296a3d2d704f68a2b..e3a2bb7345da647d1166b3b1d974a2b6ac089f20 100644 (file)
@@ -15,7 +15,6 @@
  * Representation for an object that may or may not be visible.
  */
 
-
 namespace moof {
 
 
index baa0304ae535db72e3baf4ce6272614c4357e724..ef42dff33a7c22ab8d7e0b962aa2c19f526e98d7 100644 (file)
 #ifndef _MOOF_DEBUG_HH_
 #define _MOOF_DEBUG_HH_
 
+#include <exception>
+
+#include <moof/log.hh>
+
+
 /**
  * \file debug.hh
  * Debugging facilities.
  */
 
-#include <cstdlib>             // exit
-
-#include <stlplus/portability/debug.hpp>
-
-#include <moof/log.hh>
 
 
 #undef ASSERT
index f2613e8fdeb2d11aba27b51c7758ef3e6fbdd989..7a1a08109a65ec441ea42127fe54ef2572e7a505 100644 (file)
 #ifndef _MOOF_DISPATCH_HH_
 #define _MOOF_DISPATCH_HH_
 
-/**
- * \file dispatcher.hh
- * Classes that deal with message dispatching.
- */
-
 #include <string>
 
 #include <boost/bind.hpp>
 #include <boost/weak_ptr.hpp>
 
 
+/**
+ * \file dispatcher.hh
+ * Classes that deal with message dispatching.
+ */
+
 namespace moof {
 
 
index 2f5c6cd09b4ac20261c93722caa39e9cffb6e0d6..4caf0cafa61e4f30b3c9fb1a2f80421f72c5f451 100644 (file)
 #ifndef _MOOF_DRAWABLE_HH_
 #define _MOOF_DRAWABLE_HH_
 
+#include <moof/math.hh>
+
+
 /**
  * \file drawable.hh
  * Representation for an object that can be drawn to the screen.
  */
 
-#include <moof/math.hh>
-
-
 namespace moof {
 
 
index 92b4dc5dd7b074b747020d3a7fc807c7da49ebc5..c86dc9a022aed1d5b2c86dc84a47ff8196262dfa 100644 (file)
 #ifndef _MOOF_ENTITY_HH_
 #define _MOOF_ENTITY_HH_
 
-/**
- * \file entity.hh
- * Interface class for cullable and drawable objects.
- */
-
 #include <boost/shared_ptr.hpp>
 
 #include <moof/aabb.hh>
 #include <moof/sphere.hh>
 
 
+/**
+ * \file entity.hh
+ * Interface class for cullable and drawable objects.
+ */
+
 namespace moof {
 
 
index 8635e5f8d77c021c3312e05b7c7ae648e7c5b4ac..7b7687330dd71eed93fba76bc84f35ea5e179bf0 100644 (file)
 #ifndef _MOOF_EVENT_HH_
 #define _MOOF_EVENT_HH_
 
+#include <SDL/SDL.h>
+
+
 /**
  * \file event.hh
  * Defines an event object.
  */
        
-#include <SDL/SDL.h>
-
-
 namespace moof {
 
 
index c603a97884c056e1fc408bf7bbace8305728d8f4..8386d702a824d956a87b6a572613d9e4257d0c38 100644 (file)
 #ifndef _MOOF_FRUSTUM_HH_
 #define _MOOF_FRUSTUM_HH_
 
+#include <moof/math.hh>
+#include <moof/plane.hh>
+
+
 /**
  * \file frustum.hh
  * All things related to frustums!
  */
        
-#include <moof/math.hh>
-#include <moof/plane.hh>
-
 namespace moof {
 
+
 template <int D> class aabb;
 template <int D> class sphere;
 
@@ -61,6 +63,7 @@ private:
        plane planes_[6]; // left, right, bottom, top, near, far
 };
 
+
 } // namespace moof
 
 #endif // _MOOF_FRUSTUM_HH_
index 8b14ac5596bc65957c3491f76dc49db2eaced093..810a1282163788410d62a1a5186758e3490bad1c 100644 (file)
 #ifndef _MOOF_HASH_HH_
 #define _MOOF_HASH_HH_
 
-/**
- * \file hash.hh
- * Hash tables and functions.
- */
-
 #include <string>
 
 #include <stlplus/containers/hash.hpp>
 
 
+/**
+ * \file hash.hh
+ * Hash tables and functions.
+ */
+
 namespace moof {
 
 
index 09f797ca8f3fc3d9235fb7ccf4f1ad21f5f84eae..77b15c13903bead2a4bd05bc33e3a0081fbd2f91 100644 (file)
@@ -7,14 +7,16 @@
 *
 *****************************************************************************/
 
-#include <cstring>             // strncmp
 #include <fstream>
 #include <stdexcept>
-
 #include <png.h>
+
 #include <SDL/SDL.h>
 
+#include <stlplus/portability/file_system.hpp>
+
 #include "backend.hh"
+#include "debug.hh"
 #include "image.hh"
 #include "log.hh"
 #include "opengl.hh"
 namespace moof {
 
 
+MOOF_REGISTER_RESOURCE(image, bmp, textures);
 MOOF_REGISTER_RESOURCE(image, png, textures);
 
-//static int power_of_two(int input)
-//{
-       //int value = 1;
-
-       //while (value < input)
-       //{
-               //value <<= 1;
-       //}
-       //return value;
-//}
-
-unsigned image::global_object_ = 0;
 
+static int higher_power_of_two(int input)
+{
+       int value = 2;
+       while (value <= input) value <<= 1;
+       return value;
+}
 
-static void read_from_stream(png_structp context, png_bytep data, png_size_t length)
+static void read_from_stream(png_structp context,
+               png_bytep data, png_size_t length)
 {
        std::istream& stream(*(std::istream*)png_get_io_ptr(context));
        stream.read((char*)data, length);
 }
 
 
-image::image(const std::string& path) :
-       pixels_(0),
-       object_(0),
-       min_filter_(GL_NEAREST),
-       mag_filter_(GL_NEAREST),
-       tile_s_(1),
-       tile_t_(1),
-       wrap_s_(GL_CLAMP),
-       wrap_t_(GL_CLAMP)
+struct texture_attributes
+{
+       texture_attributes() :
+               min_filter(GL_NEAREST),
+               mag_filter(GL_NEAREST),
+               tile_s(1),
+               tile_t(1),
+               wrap_s(GL_CLAMP_TO_EDGE),
+               wrap_t(GL_CLAMP_TO_EDGE) {}
+
+       void init(const std::string& info)
+       {
+               script script;
+               log::import(script);
+
+               script::slot g = script.globals();
+#define EXPORT_CONSTANT(K) g.set_field(#K, GL_##K)
+               EXPORT_CONSTANT(CLAMP);
+               EXPORT_CONSTANT(CLAMP_TO_EDGE);
+               EXPORT_CONSTANT(REPEAT);
+               EXPORT_CONSTANT(LINEAR);
+               EXPORT_CONSTANT(NEAREST);
+               EXPORT_CONSTANT(LINEAR_MIPMAP_LINEAR);
+               EXPORT_CONSTANT(LINEAR_MIPMAP_NEAREST);
+               EXPORT_CONSTANT(NEAREST_MIPMAP_LINEAR);
+               EXPORT_CONSTANT(NEAREST_MIPMAP_NEAREST);
+#undef export_constant
+
+               if (script.do_string(info) != script::success)
+               {
+                       std::string str;
+                       script[-1].get(str);
+                       log_warning(str);
+               }
+               else
+               {
+                       log_info("loading texture information...");
+
+                       script::slot globals = script.globals();
+                       globals.get(min_filter, "min_filter");
+                       globals.get(mag_filter, "mag_filter");
+                       globals.get(tile_s, "tile_s");
+                       globals.get(tile_t, "tile_t");
+                       globals.get(wrap_s, "wrap_s");
+                       globals.get(wrap_t, "wrap_t");
+               }
+       }
+
+       GLuint  min_filter;
+       GLuint  mag_filter;
+       int     tile_s;
+       int     tile_t;
+       GLuint  wrap_s;
+       GLuint  wrap_t;
+};
+
+
+static SDL_Surface* load_png(const std::string& path, texture_attributes& attribs)
 {
        std::ifstream file(path.c_str(), std::ifstream::binary);
        if (!file.good())
index 62f8699abb029503b1e87b2db97c56d96bc1d356..4dee19fde9ffe4a2e9ec65d4ee3e28c8c587df6c 100644 (file)
 #ifndef _MOOF_IMAGE_HH_
 #define _MOOF_IMAGE_HH_
 
-/**
- * \file image.hh
- * Defines classes for loading and manipulating images.
- */
-
 #include <boost/noncopyable.hpp>
 
 #include <moof/dispatcher.hh>
 #include <moof/resource.hh>
 
 
+/**
+ * \file image.hh
+ * Defines classes for loading and manipulating images.
+ */
+
 namespace moof {
 
 
index 83dd0c9bdf095d1f289f8d8ec15896c294afd0b5..5078578a02052a017519ec419bf4e8009a035005 100644 (file)
 #ifndef _MOOF_INTERPOLATOR_HH_
 #define _MOOF_INTERPOLATOR_HH_
 
+#include <moof/math.hh>
+
+
 /**
  * \file interpolator.hh
  * Functions and classes concerning interpolations between values.
  */
 
-#include <moof/math.hh>
-
-
 namespace moof {
 
 
index 8f5794d52850643b1531587f3e4f0a537f249a9e..60a0b34eb89402ed23f1c1c2d9e3a63a41887fe7 100644 (file)
 #ifndef _MOOF_LINE_HH_
 #define _MOOF_LINE_HH_
 
-/**
- * \file line.hh
- * Classes related to line segments.
- */
-
 #include <moof/contact.hh>
 #include <moof/drawable.hh>
 #include <moof/image.hh>
 #include <moof/sphere.hh>
 
 
+/**
+ * \file line.hh
+ * Classes related to line segments.
+ */
+
 namespace moof {
 
 
index addf37c135f9066025c019aa7818ef16b93851d4..10691268d56e4d013eed8316b5a04401135b9291 100644 (file)
 #ifndef _MOOF_LOG_HH_
 #define _MOOF_LOG_HH_
 
+#include <cstdlib>             // exit
+#include <iostream>
+#include <string>
+
+
 /**
  * \file log.hh
  * Functions related to logging the process.  The logging functions are
  * least critical.
  */
 
-#include <cstdlib>             // exit
-#include <iostream>
-#include <string>
-
-
 namespace moof {
 
 
index a3963e8a1341f8929f6407722bee32938063791b..907815f56b30f8f8c41af849593ee4d2154bad3b 100644 (file)
 #ifndef _MOOF_MANAGER_HH_
 #define _MOOF_MANAGER_HH_
 
+#include <string>
+#include <boost/shared_ptr.hpp>
+
+#include <moof/hash.hh>
+
+
 /**
  * \file manager.hh
  * A manager is a collection of named objects of the same type.  Libraries
  * have any interested code.
  */
 
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-
-#include <moof/hash.hh>
-
-
 namespace moof {
 
 
index e7cd3f03951f873c04ec37dcb3e02a91993f78e6..e72dec0bbd1853992131253f7e2ef7da4203efd0 100644 (file)
 #ifndef _MOOF_MATH_HH_
 #define _MOOF_MATH_HH_
 
-/**
- * \file math.hh
- * General math-related types and functions.
- */
+#include <cmath>
+
+#include <boost/shared_ptr.hpp>
+#include <SDL/SDL_opengl.h>
+
+#include <cml/cml.h>
 
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <cmath>
-
-#include <cml/cml.h>
-#include <SDL/SDL_opengl.h>
 
 #if ENABLE_DOUBLE_PRECISION
 typedef GLdouble       GLscalar;
@@ -35,6 +33,11 @@ typedef GLfloat              GLscalar;
 #endif
 
 
+/**
+ * \file math.hh
+ * General math-related types and functions.
+ */
+
 namespace moof {
 
 
@@ -137,7 +140,7 @@ inline void rk4(S& state, scalar t, scalar dt)
        D b = evaluate<S,D>(state, t, dt * SCALAR(0.5), a);
        D c = evaluate<S,D>(state, t, dt * SCALAR(0.5), b);
        D d = evaluate<S,D>(state, t, dt, c);
-       state.step((a + (b + c) * SCALAR(2.0) + d) * SCALAR(1.0/6.0), dt);
+       state.step((a + (b + c) * SCALAR(2.0) + d) * (SCALAR(1.0)/SCALAR(6.0)), dt);
 }
 
 
index 26accec43e1410b295797c6dbda017f7ac9b9faf..3f0dc24a6dc78c319be23ed521787a625a16e2da 100644 (file)
 #ifndef _MOOF_MESH_HH_
 #define _MOOF_MESH_HH_
 
-/**
- * \file mesh.hh
- * Defines classes for loading and manipulating meshes.
- */
-
 #include <iostream>
 #include <map>
 #include <vector>
 #include <moof/resource.hh>
 
 
+/**
+ * \file mesh.hh
+ * Defines classes for loading and manipulating meshes.
+ */
+
 namespace moof {
 
 
index 4afeb39b1d998a78d066470b66916c25cd364b3e..392f3ab61c2209cf5ead0e15f6980d1f9a80f226 100644 (file)
 #ifndef _MOOF_MODAL_DIALOG_HH_
 #define _MOOF_MODAL_DIALOG_HH_
 
-/**
- * \file modal_dialog.hh
- * A class for creating and running modal dialogs.  Several toolkits are
- * supported, but only one can be used as determined at build time.
- */
-
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
 #include <moof/resource.hh>
 
 
+/**
+ * \file modal_dialog.hh
+ * A class for creating and running modal dialogs.  Several toolkits are
+ * supported, but only one can be used as determined at build time.
+ */
+
 namespace moof {
 
 
index 998473b7f88535fb70d4324172c1f54f86e6c5e2..7a544e6e107cd234ff68795ae999b6baf8baa401 100644 (file)
 #ifndef _MOOF_NETWORK_HH_
 #define _MOOF_NETWORK_HH_
 
+#include <string>
+#include <vector>
+
+
 /**
  * \file network.hh
  * Builds a high-level protocol and match-making system on top of network
  * sockets for multiplayer support.
  */
 
-#include <string>
-#include <vector>
-
-
 namespace moof {
 
 
index 6eeb5532f60427a07ada8bc167852c77c378be95..7c802001bed7751ee4e1dbce956b80b2eb914ffb 100644 (file)
 #ifndef _MOOF_OPENGL_HH_
 #define _MOOF_OPENGL_HH_
 
-/**
- * \file opengl.hh
- * Defines macros for OpenGL functions that operate on scalars, vectors, and
- * matrices.
- */
-
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
 #include <moof/math.hh>
 
 
+/**
+ * \file opengl.hh
+ * Defines macros for OpenGL functions that operate on scalars, vectors, and
+ * matrices.
+ */
+
 // generic function arguments
 
 #define ARGS_P         const GLscalar* p
index 9cfb5bbfe38a05435bef4cc55d7822ed4293c665..782e6098c2eed7c9c75d8b614714fcd2e3d92cf1 100644 (file)
@@ -9,20 +9,23 @@
 *
 **************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <algorithm>
+#include <cstdlib>
+
+#include <SDL/SDL.h>
+
 #if HAVE_BYTESWAP_H
 #include <byteswap.h>
 #endif
-#include <cstdlib>
 
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
 
-#include <SDL/SDL.h>
-
 #include "packet.hh"
 
 
index 55dd96c7a201989ab1bf7458a47edad34152881a..c23891541da08096b19d15550a4722a9fc86c356 100644 (file)
 #ifndef _MOOF_PACKET_HH_
 #define _MOOF_PACKET_HH_
 
-/**
- * \file packet.hh
- * Classes for building and interpreting datagram packets.
- */
-
 #include <cstring>
 #include <stdexcept>
+#include <stdint.h>
 #include <string>
 #include <vector>
 
-
 #ifndef PAGE_SIZE
 #define PAGE_SIZE 4096
 #endif
 
 
+/**
+ * \file packet.hh
+ * Classes for building and interpreting datagram packets.
+ */
+
 namespace moof {
        
 
index 83b5517385380a18f59c5cc167640d96b76e8e88..258feb978d09fff08f1884cabf2a09fbc653ff48 100644 (file)
 #ifndef _MOOF_PLANE_HH_
 #define _MOOF_PLANE_HH_
 
+#include <moof/math.hh>
+#include <moof/shape.hh>
+
+
 /**
  * \file plane.hh
  * Classes and functions related to planes.
  */
 
-#include <moof/math.hh>
-#include <moof/shape.hh>
-
-
 namespace moof {
 
 
diff --git a/src/moof/precompile.hh b/src/moof/precompile.hh
new file mode 100644 (file)
index 0000000..dafa1d5
--- /dev/null
@@ -0,0 +1,59 @@
+
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
+**]  All rights reserved.
+*
+* 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_PRECOMPILE_HH_
+#define _MOOF_PRECOMPILE_HH_
+
+/**
+ * \file precompile.hh
+ * PCH includes for quicker compiles.
+ */
+
+#include <algorithm>
+#include <bitset>
+#include <cerrno>
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <iostream>
+#include <limits>
+#include <list>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <stdint.h>
+#include <stddef.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <boost/algorithm/string.hpp>
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/weak_ptr.hpp>
+#include <lua.hpp>
+#include <png.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_opengl.h>
+#include <zlib.h>
+
+#endif // _MOOF_PRECOMPILE_HH_
+
index b992903b8bb2d892bf853af68d409d1e136363fa..71d1e7a96a40d58e67f0ba73b350aca85047c7e8 100644 (file)
 #ifndef _MOOF_RAY_HH_
 #define _MOOF_RAY_HH_
 
-/**
- * \file ray.hh
- * A class for lines that start at one point and go to infinity in some
- * direction.
- */
-
 #include <moof/drawable.hh>
 #include <moof/image.hh>
 #include <moof/math.hh>
 #include <moof/opengl.hh>
 
 
+/**
+ * \file ray.hh
+ * A class for lines that start at one point and go to infinity in some
+ * direction.
+ */
+
 namespace moof {
 
 
index 7a60d0e304e6e4c444dbeb5d920c3a5215c4e478..8188313b8442011b615925cd61e1aafcf6b81260 100644 (file)
 
 #include <queue>
 
+#include <boost/algorithm/string.hpp>
+#include <boost/weak_ptr.hpp>
+
+#include <stlplus/portability/file_system.hpp>
+
 #if ENABLE_HOTLOADING
 #include <sys/inotify.h>
 #include <sys/ioctl.h>
 #endif
 
-#include <boost/algorithm/string.hpp>
-#include <boost/weak_ptr.hpp>
-#include <stlplus/portability/file_system.hpp>
-
 #include "hash.hh"
+#include "log.hh"
 #include "resource.hh"
 
 #ifndef BUF_SIZE
index 41dfd61ac11d5ab3bbd94262fcf58c543183181f..d4f416227ee1f9b3985ce8579cf7ab4ac44dfbc1 100644 (file)
 #ifndef _MOOF_RESOURCE_HH_
 #define _MOOF_RESOURCE_HH_
 
-/**
- * \file resource.hh
- * Interface for textures, sounds, and other types of resources.
- */
-
 #include <map>
 #include <stdexcept>
 #include <string>
 #include <boost/shared_ptr.hpp>
 #include <boost/function.hpp>
 
-#include <moof/debug.hh>
 
+/**
+ * \file resource.hh
+ * Interface for textures, sounds, and other types of resources.
+ */
 
 namespace moof {
 
index 67e12ddce4d4b87e1a48e7b17816cf3806c63bb5..b8b9048c358e92fa70f01ab9d43af899308545eb 100644 (file)
 #ifndef _MOOF_RIGID_BODY_HH_
 #define _MOOF_RIGID_BODY_HH_
 
-/**
- * \file rigid_body.hh
- * Classes and functions for simulating rigid body physics.
- */
-
 #include <vector>
 
 #include <boost/bind.hpp>
 #include <moof/math.hh>
 
 
+/**
+ * \file rigid_body.hh
+ * Classes and functions for simulating rigid body physics.
+ */
+
 namespace moof {
 
 
index 5bae72c35058e0fbdc0d1deaccb41f6bf121a464..a970bc434920bdea0edd682dc355462890170378 100644 (file)
@@ -4,12 +4,21 @@
 #
 
 objects        = $(patsubst %.c,$(builddir)/%.o,$(patsubst %.cc,$(builddir)/%.o,$(wildcard $d/*.c $d/*.cc)))
-$(objects): TGT_CFLAGS := -I$d -I$d/..
-$(objects): config.h $(this) | $b
+$(objects): TGT_CFLAGS := -I$b -I$b/.. -I$d -I$d/..
+$(objects): config.h | $b
 
 library        = $b/libmoof.a
 $(library): $(objects)
        $(Q)$(ar)
 
+ifeq (true,$(pch))
+pchfile        := $b/precompile.hh
+exec   += $(pchfile) $(pchfile).gch
+$(pchfile).gch: TGT_CFLAGS := -I$b -I$b/.. -I$d -I$d/..
+$(pchfile).gch: $(pchfile)
+$(pchfile): config.mk | $b
+$(objects): $(pchfile).gch
+endif
+
 exec   += $(objects) $(library)
 
index 6d56d83dcb60662a7a2fd0bb0367d5c24806ad32..43d4ea2e580fc2e2f5982797401a3a1e6caae20a 100644 (file)
 #ifndef _MOOF_RUNLOOP_HH_
 #define _MOOF_RUNLOOP_HH_
 
-/**
- * \file runloop.hh
- * Thread timer management class.
- */
-
 #include <vector>
 
 #include <boost/noncopyable.hpp>
 #include <moof/thread.hh>
 
 
+/**
+ * \file runloop.hh
+ * Thread timer management class.
+ */
+
 namespace moof {
 
 
index 79412acb3bb4b9526d782d54dca8699676621100..ae582fcbe07f566005370383335e2bbbedf72911 100644 (file)
 #ifndef _MOOF_SCRIPT_HH_
 #define _MOOF_SCRIPT_HH_
 
-/**
- * \file script.hh
- * A thin wrapper over Lua 5.1.  This is not meant as a complicated binding
- * package between C++ and Lua.  It is not meant to obscure the division
- * between C++ and Lua but rather to clarify it and make it more manageable.
- * 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 <cstring>
 #include <iostream>
 #include <map>
 #include <lua.hpp>
 
 
+/**
+ * \file script.hh
+ * A thin wrapper over Lua 5.1.  This is not meant as a complicated binding
+ * package between C++ and Lua.  It is not meant to obscure the division
+ * between C++ and Lua but rather to clarify it and make it more manageable.
+ * 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.
+ */
+
 namespace moof {
 
 
index c0ca674112b89921399e407c601a59ae9431cdfe..1a8b363ff7fc806fd2f2e7bd56dc4f0e64000d4d 100644 (file)
 #ifndef _MOOF_SERVICE_HH_
 #define _MOOF_SERVICE_HH_
 
-/**
- * \file service.hh
- * Classes for publishing and finding network services.
- */
-
 #include <map>
 
 #include <moof/math.hh>
 #include <moof/socket.hh>
 
 
+/**
+ * \file service.hh
+ * Classes for publishing and finding network services.
+ */
+
 namespace moof {
 
 
index c8459cf1ee4b69f9fc2c88c00aaba6f401fb4dbc..0b8ccc22cba147bd3677272887611be4cb25983a 100644 (file)
 #ifndef _MOOF_SETTINGS_HH_
 #define _MOOF_SETTINGS_HH_
 
-/**
- * \file settings.hh
- * Load, store, save program settings.
- */
-
 #include <string>
 #include <vector>
 
 #include <moof/script.hh>
 
 
+/**
+ * \file settings.hh
+ * Load, store, save program settings.
+ */
+
 namespace moof {
 
 
index 9af106bf424831e4808956631b647946d4be6947..1d6d73674606cf945596bb9bc8bd9ab3338bde00 100644 (file)
 #ifndef _MOOF_SHAPE_HH_
 #define _MOOF_SHAPE_HH_
 
-/**
- * \file shape.hh
- * Declares an interface for shapes.
- */
-
 #include <moof/drawable.hh>
 #include <moof/math.hh>
 #include <moof/opengl.hh>
 #include <moof/ray.hh>
 
+
+/**
+ * \file shape.hh
+ * Declares an interface for shapes.
+ */
+
 // frustum
 // plane (can construct from triangle2)
 // ray
index 08a5f50b1e88bec974ab9d1988d83eb10459a561..a7d02f92e8be64000d802c0bae7237e6ff7ec493 100644 (file)
 #ifndef _MOOF_SOCKET_HH_
 #define _MOOF_SOCKET_HH_
 
-/**
- * \file socket.hh
- * Network-related classes, including a reinterpreted sockets API.
- */
-
 #include <algorithm>
 #include <cstring>
 #include <iostream>
@@ -44,7 +39,6 @@
 #include <moof/packet.hh>
 #include <moof/thread.hh>
 
-
 #ifndef AI_ADDRCONFIG
 #define AI_ADDRCONFIG 0
 #endif
 #endif
 
 
+/**
+ * \file socket.hh
+ * Network-related classes, including a reinterpreted sockets API.
+ */
+
 namespace moof {
 
 
index 8b22c4798e95967b2c7ce848fd206a28641de938..bcd86670c302d4e6ff17d3bc0133eb73043cd9d9 100644 (file)
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
 
-#include "log.hh"
+#include "debug.hh"
 #include "sound.hh"
 #include "resource.hh"
 #include "runloop.hh"
 #include "thread.hh"
 #include "timer.hh"
 
+
 #ifndef BUF_SIZE
 #define BUF_SIZE 8192
 #endif
@@ -94,12 +95,12 @@ int         sound_backend::retain_count = 0;
 ALCdevice*     sound_backend::al_device;
 ALCcontext*    sound_backend::al_context;
 
+
 class sound_resource;
 typedef resource_handle<sound_resource> sound_handle;
 
 MOOF_REGISTER_RESOURCE(sound_resource, ogg, sounds);
 
-
 class sound_resource : public boost::noncopyable
 {
 public:
index 1f7fcfe788c1e33d5fd44975f4d26e8d98cf8400..3639d7b3496ea5ebce73974f609644ecb5c3c63a 100644 (file)
 #ifndef _MOOF_SOUND_HH_
 #define _MOOF_SOUND_HH_
 
-/**
- * \file sound.hh
- * Load and play sounds, currently supports ogg vorbis.
- */
-
 #include <string>
 
 #include <boost/shared_ptr.hpp>
 #include <moof/math.hh>
 
 
+/**
+ * \file sound.hh
+ * Load and play sounds, currently supports ogg vorbis.
+ */
+
 namespace moof {
 
 
index 75c5808a476cfe5d4e4256f52f76bbd4d691c149..15a80314dc6afa3ce2518e067ac76ce3d2494d92 100644 (file)
 #ifndef _MOOF_SPHERE_HH_
 #define _MOOF_SPHERE_HH_
 
-/**
- * \file sphere.hh
- * A round shape like a circle or sphere.
- * TODO: This class needs some work.
- */
-
 #include <moof/contact.hh>
 #include <moof/cullable.hh>
 #include <moof/drawable.hh>
 #include <moof/shape.hh>
 
 
+/**
+ * \file sphere.hh
+ * A round shape like a circle or sphere.
+ * TODO: This class needs some work.
+ */
+
 namespace moof {
 
 
index b71a4b99ee8a860393047a4bc15eb0a27dd49251..602fc2cbe4cfa6361f7629d7d7028f04114261a4 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <boost/algorithm/string.hpp>
 #include <boost/bind.hpp>
+
 #include <stlplus/portability/file_system.hpp>
 
 #include "dispatcher.hh"
index 88029e52bbf0e442a90932e47a52a8a4ed90916e..b88b007f5ffe697dab5d1942b551a1cc5f496363 100644 (file)
 #ifndef _MOOF_SPRITE_HH_
 #define _MOOF_SPRITE_HH_
 
-/**
- * \file sprite.hh
- * Image-loading and OpenGL texture loading.
- */
-
 #include <string>
 
 #include <moof/image.hh>
 #include <moof/math.hh>
 
 
+/**
+ * \file sprite.hh
+ * Image-loading and OpenGL texture loading.
+ */
+
 namespace moof {
 
 
index a73bcd0723d0e9fd8f454fcc7c485513d0443686..995553c59f58d24980ef37bd1adbd1d41b5d1dea 100644 (file)
@@ -11,9 +11,9 @@
 
 #include <boost/shared_array.hpp>
 
-#include "ConvertUTF.h"
 #include "script.hh"
 #include "string.hh"
+#include "ConvertUTF.h"
 
 
 namespace moof {
index 4194abb08e1679d959b1a5cf58292df366ac241c..25a7360cdcd88eec82deae0b3388aafdb6df4104 100644 (file)
 #ifndef _MOOF_STRING_HH_
 #define _MOOF_STRING_HH_
 
-/**
- * \file string.hh
- * Functions and classes related to string manipulation.
- */
-
 #include <string>
 
 #include <boost/noncopyable.hpp>
 
 
+/**
+ * \file string.hh
+ * Functions and classes related to string manipulation.
+ */
+
 namespace moof {
 
 
index 17d3170beaf4ce1304feb2da5584332a19d2250c..af251e157b8a64ef433c70794ddde72509c8a98f 100644 (file)
 #ifndef _MOOF_THREAD_HH_
 #define _MOOF_THREAD_HH_
 
-/**
- * \file thread.hh
- * Light C++ wrapper around the SDL threads API.
- */
-
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
 #include <moof/timer.hh>
 
 
+/**
+ * \file thread.hh
+ * Light C++ wrapper around the SDL threads API.
+ */
+
 namespace moof {
 
 
index edd1de2deaf2cab1a98eff1502dffb0802efed86..a429ba955e0206158814ce120661ef54974b6e09 100644 (file)
 #ifndef _MOOF_TIMER_HH_
 #define _MOOF_TIMER_HH_
 
-/**
- * \file timer.hh
- * Functions for measuring time in a friendly unit.
- */
-
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
 #include <boost/noncopyable.hpp>
 #include <moof/math.hh>
 
 
+/**
+ * \file timer.hh
+ * Functions for measuring time in a friendly unit.
+ */
+
 namespace moof {
 
 
index 6b4980e519fb48391f5249bb109cf3d979f8f1a5..9ec795f0f0ed1c4312f486e676f9d2703743990d 100644 (file)
 #ifndef _MOOF_VIDEO_HH_
 #define _MOOF_VIDEO_HH_
 
-/**
- * \file video.hh
- * Classes for managing a video context.
- */
-
 #include <string>
 
 #include <boost/shared_ptr.hpp>
 #include <moof/timer.hh>
 
 
+/**
+ * \file video.hh
+ * Classes for managing a video context.
+ */
+
 namespace moof {
 
 
index 16ebea65b22660307107188bfc07b07751d77eae..cbf2776361555ee78e6d48162d83b12f3956dc6d 100644 (file)
@@ -13,17 +13,24 @@ endif
 
 ifeq (true,$(includeConfig))
 objects        += $b/config.o          # Also compile in the configuration.
+exec   += $b/config.gz
 exec   += $b/config.c          # Make config.c a build target.
-$b/config.c: config.mk
+$b/config.gz: config.mk
+       $(Q)$(gzip)
+$b/config.c: $b/config.gz
        $(Q)$(xxd)
 endif
 
-$(objects): TGT_CFLAGS := -I$d
-$(objects): config.h $(this) | $b
+$(objects): TGT_CFLAGS := -I$b -I$d
+$(objects): config.h | $b
 # Make all objects depend on config.h; it's excessive, but config.h won't be
 # remade otherwise if dependencies are not being generated.  The alternative
 # is to maintain an accurate list of objects with a dependency on config.h.
 
+ifeq (true,$(pch))
+$(objects): $b/moof/precompile.hh.gch
+endif
+
 exec   += $(objects)           # Make the objects build targets.
 
 bindir_$b := $b/$(projectName)$(EXEEXT)        # Install executable to bindir.
index b15fa5201bbadc71c0a60bde340cb6fde50afe2c..3e4f41de05edd2aeea7b9c3ddc463be498f55df7 100644 (file)
@@ -5,7 +5,7 @@
 
 objects        = $(patsubst %.cpp,$(builddir)/%.o,$(shell find $d -name "*.cpp"))
 $(objects): TGT_CFLAGS := -I$d -I$d/containers -I$d/portability
-$(objects): config.mk $(this) | $b/containers $b/portability
+$(objects): config.mk | $b/containers $b/portability
 
 library        = $b/libstlplus.a
 $(library): $(objects)
index edd38bfd5d3a97c4429e6a6b6f81be02e492c78c..8a2a28c13a7eb4abb883932e7984f507edd0911c 100644 (file)
 #ifndef _YOINK_HH_
 #define _YOINK_HH_
 
-/**
- * \file yoink.hh
- * This is the big enchilada.
- */
-
 #include <iostream>
 #include <string>
 #include <vector>
 
 #include <boost/shared_ptr.hpp>
 
-#include <moof/math.hh>
-#include <moof/sound.hh>
-
 #include <moof/line.hh>                // TODO
+#include <moof/math.hh>
 #include <moof/plane.hh>
 #include <moof/ray.hh>
+#include <moof/sound.hh>
 #include <moof/sphere.hh>
 #include <moof/timer.hh>
 
 #include "Hud.hh"
 
 
+/**
+ * \file yoink.hh
+ * This is the big enchilada.
+ */
+
 class yoink
 {
 public:
This page took 0.083564 seconds and 4 git commands to generate.