[debug=no])
AC_ARG_ENABLE([double-precision],
- [ --enable-double-precision use double-precision numbers],
+ [ --enable-double-precision use doubles instead of floats],
[double_precision=$enableval],
[double_precision=no])
AC_ARG_ENABLE([profile],
- [ --enable-profile make a binary for use with gprof profiler],
+ [ --enable-profile make a binary with code profiling instructions],
[profile=$enableval],
[profile=no])
[extra_warnings=$enableval],
[extra_warnings=no])
+AC_ARG_ENABLE([clock_gettime],
+ [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()],
+ [clock_gettime=$enableval],
+ [clock_gettime=no])
+
AC_ARG_ENABLE([threads],
- [ --enable-threads use threads for some parallel tasks],
+ [ --enable-threads use threads for concurrency where appropriate],
[threads=$enableval],
[threads=no])
AC_ARG_ENABLE([gtk],
- [ --enable-gtk enable GTK+ info/warning dialogs],
+ [ --enable-gtk enable GTK+ modal dialogs],
[gtk=$enableval],
[gtk=no])
AC_ARG_ENABLE([qt4],
- [ --enable-qt4 enable QT info/warning dialogs],
+ [ --enable-qt4 enable QT modal dialogs],
[qt4=$enableval],
[qt4=no])
if test x$gtk = xyes
then
AC_DEFINE([USE_GTK], 1,
- [Define to 1 if you want to use GTK+ info/error dialogs.])
+ [Define to 1 if you want to use GTK+ modal dialogs.])
elif test x$qt4 = xyes
then
AC_DEFINE([USE_QT4], 1,
- [Define to 1 if you want to use QT4 info/error dialogs.])
+ [Define to 1 if you want to use QT4 modal dialogs.])
fi
AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
##### clock_gettime #####
-AC_SEARCH_LIBS([clock_gettime], [rt],
- [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
- [Define to 1 if you have the 'clock_gettime' function.])])
+if test x$clock_gettime = xyes
+then
+ AC_SEARCH_LIBS([clock_gettime], [rt],
+ [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
+ [Define to 1 if you have the 'clock_gettime' function.])])
+fi
#
# Checks for build dependencies.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+echo "checking for dependencies..."
+
##### boost #####
website="http://www.boost.org/"
BOOST_SMART_PTR
##### SDL #####
website="http://www.libsdl.org/"
-AM_PATH_SDL([1.2.10],
- [CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"])
+PKG_CHECK_MODULES([SDL], [sdl],
+ [LIBS="$LIBS $SDL_LIBS"
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
+ [missing=yes
+ echo "***** Missing SDL ($website) *****"])
##### opengl, glu #####
website="http://www.mesa3d.org/"
-AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
- [missing=yes
- echo "***** Missing GL headers ($website) *****"])
-if test x$WIN32 = xyes
-then
-# autoconf library search macro doesn't find opengl32 on windows because it uses
-# different name hashing or something, but it links fine; assume it's there
- LIBS="$LIBS -lglu32 -lopengl32"
-else
- AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
- [missing=yes
- echo "***** Missing libGL ($website) *****"])
- AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
- [missing=yes
- echo "***** Missing libGLU ($website) *****"])
-fi
-
-##### openal #####
-website="http://connect.creativelabs.com/openal/"
-AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
- [missing=yes
- echo "***** Missing OpenAL headers ($website) *****"])
-AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
- [missing=yes
- echo "***** Missing libopenal ($website) *****"])
+PKG_CHECK_MODULES([OPENGL], [gl glu],
+ [LIBS="$LIBS $OPENGL_LIBS"
+ CFLAGS="$CFLAGS $OPENGL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $GLU_CFLAGS"],
+ [missing=yes
+ echo "***** Missing OpenGL ($website) *****"])
##### liblua #####
website="http://www.lua.org/"
[missing=yes
echo "***** Missing libpng ($website) *****"])
+##### openal #####
+website="http://connect.creativelabs.com/openal/"
+PKG_CHECK_MODULES([OPENAL], [openal],
+ [LIBS="$LIBS $OPENAL_LIBS"
+ CFLAGS="$CFLAGS $OPENAL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
+ [missing=yes
+ echo "***** Missing OpenAL ($website) *****"])
+
##### libvorbis #####
website="http://www.xiph.org/downloads/"
PKG_CHECK_MODULES([VORBIS], [vorbisfile],
if test x$missing == xyes
then
- AC_MSG_WARN([It looks like you're missing some dependencies--building may fail.])
+ AC_MSG_WARN([It looks like you're missing some dependencies--building may fail!])
fi
echo ""
echo " Configuration complete! :-)"
echo ""
-echo " Target: $target"
-echo " Prefix: $prefix"
-echo " Data Directory: $DATADIR"
-echo " Debug: $debug"
-echo " Double Precision: $double_precision"
-echo " Profile: $profile"
-echo " Extra Warnings: $extra_warnings"
+echo " Host: $target"
+echo " Prefix: $prefix"
+echo " Data: $DATADIR"
+echo ""
+echo " CXX: $CXX"
+echo " CXXFLAGS: $(echo $CXXFLAGS)"
+echo " LIBS: $(echo $LIBS)"
echo ""
echo " To finish the installation, execute:"
echo " make"
config file.
.TP
.I USER
-\fByoink\fP uses this variable to guess the user's nickname, for a high
-score entry or whatever.
+\fByoink\fP uses this variable as the user's name, for a high score entry
+or whatever.
.TP
.I YOINK_DATADIR
If set to a path of a valid directory, \fByoink\fP will look in this
mNewContextDispatch = dispatch.addTarget("video.newcontext",
boost::bind(&Main::setupGL));
setupGL();
-
- addChild(TitleLayer::alloc());
}
{
if (children().size() == 0)
{
- Mf::logWarning("main view has no children");
- stop();
- return;
+ //Mf::logWarning("main view has no children");
+ //stop();
+ //return;
+ addChild(TitleLayer::alloc());
}
Mf::View::update(t, dt);
<< " Compiler: "COMPILER_STRING << std::endl
<< " Assets: " << assets << std::endl
<< "Build options: "
+#ifndef HAVE_CLOCK_GETTIME
+ << "-"
+#endif
+ << "clock_gettime "
#ifdef NDEBUG
<< "-"
#endif
{
std::string path(name);
- logInfo << "opening image file " << path << std::endl;
FILE* fp = Image::openFile(path);
if (!fp) return;
png_textp texts = 0;
int numTexts;
- logInfo("checking signature...");
bytesRead = fread(signature, 1, sizeof(signature), fp);
- logInfo << "reading " << bytesRead << " bytes of signature"
- << std::endl;
if (bytesRead < sizeof(signature) ||
png_sig_cmp(signature, 0, sizeof(signature)) != 0) goto cleanup;
- logInfo("creating png structures...");
pngObj = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
if (!pngObj) goto cleanup;
pngInfoEnd = png_create_info_struct(pngObj);
if (!pngInfoEnd) goto cleanup;
- logInfo("setting up long jump...");
if (setjmp(png_jmpbuf(pngObj))) goto cleanup;
png_init_io(pngObj, fp);
png_read_info(pngObj, pngInfo);
bpp = png_get_bit_depth(pngObj, pngInfo);
- logInfo << "texture bpp: " << bpp << std::endl;
colors = png_get_color_type(pngObj, pngInfo);
switch (colors)
{
channels = png_get_channels(pngObj, pngInfo);
mDepth = bpp * channels;
- logInfo << "texture channels: " << channels << std::endl;
if (channels == 3) mColorMode = GL_RGB;
else mColorMode = GL_RGBA;
// read comments
png_get_text(pngObj, pngInfo, &texts, &numTexts);
- logInfo << "num texts: " << numTexts << std::endl;
for (int i = 0; i < numTexts; ++i)
{
if (strncmp(texts[i].key, "TextureInfo", 11) == 0)
cleanup:
- logInfo("cleaning up...");
delete[] rows;
png_destroy_read_struct(pngObj ? &pngObj : 0,
pngInfo ? &pngInfo : 0,
*
**************************************************************************/
+#include "Dispatch.hh"
#include "Error.hh"
#include "Image.hh"
#include "Log.hh"
namespace Mf {
-Video::Video() :
- mDispatch(Dispatch::global())
+Video::Video()
{
init();
}
Video::Video(const Attributes& attribs) :
- mAttribs(attribs),
- mDispatch(Dispatch::global())
+ mAttribs(attribs)
{
init();
}
#if !defined(linux) && !defined(__linux) && !defined(__linux__)
logInfo("video context recreated");
- mDispatch.dispatch("video.newcontext");
+ Dispatch::global().dispatch("video.newcontext");
#endif
}
else Error(Error::SDL_VIDEOMODE).raise();
}
}
-Video::Attributes Video::getAttributes() const
+Video::Attributes Video::attributes() const
{
return mAttribs;
}
}
-void Video::setDispatch(Dispatch& dispatch)
-{
- mDispatch = dispatch;
-}
-
-
Video::Attributes::Attributes()
{
init();
#include <SDL/SDL.h>
#include <Moof/Backend.hh>
-#include <Moof/Dispatch.hh>
namespace Mf {
+
class Settings;
class Video;
~Video();
void setVideoMode(const int mode[3]);
- Attributes getAttributes() const;
+ Attributes attributes() const;
void resize(int width, int height);
bool iconify();
int getWidth() const;
int getHeight() const;
+ void makeCurrent() const;
+
static Video* current()
{
return gCurrentVideo;
}
- void makeCurrent() const;
-
- void setDispatch(Dispatch& dispatch);
-
private:
void init();
SDL_Surface* mContext;
unsigned mFlags;
Attributes mAttribs;
- Dispatch& mDispatch;
static Video* gCurrentVideo;
};
--- /dev/null
+#!/bin/bash
+
+# Download and cross-compile dependencies for Yoink. This script requires
+# bash, wget, unzip, tar, rsync, patch, make, install and sudo. Have fun!
+
+HOST="i686-mingw32"
+PREFIX="/usr/$HOST/usr"
+
+MAKEOPTS="-j8"
+
+#####
+
+function die()
+{
+ echo "die:" $@
+ exit 1
+}
+
+function sync()
+{
+ # install the files from $DESTDIR to $PREFIX
+ echo "Installing to $PREFIX..."
+ sudo rsync -av $DESTDIR/$PREFIX/* $PREFIX/ || die "syncing dependencies"
+}
+
+DESTDIR="`pwd`/deps"
+mkdir -p $DESTDIR
+rm -f $DESTDIR/README
+
+PACKAGE="zlib123-dll"
+cd $DESTDIR
+[[ ! -f $PACKAGE.zip ]] && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+unzip -d $PACKAGE $PACKAGE.zip || die "unpackaging $PACKAGE"
+cd $PACKAGE
+($HOST-dlltool -d lib/zlib.def -l libzdll.a && \
+mkdir -p $DESTDIR/$PREFIX/{lib,include} && \
+install -p -m 0644 include/* $DESTDIR/$PREFIX/include/ && \
+install -p -m 0755 zlib1.dll $DESTDIR/$PREFIX/bin/ && \
+install -p -m 0755 libzdll.a $DESTDIR/$PREFIX/lib/ && \
+cd $DESTDIR/$PREFIX/lib && \
+ln -fs libzdll.a libz.dll.a) || die "installing $PACKAGE"
+
+PACKAGE="libogg-1.1.4"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
+cd $PACKAGE
+./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE"
+make $MAKEOPTS || die "making $PACKAGE"
+make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
+
+# install dependencies thus built thus far
+sync
+
+PACKAGE="boost_1_42_0"
+VERSION="1.42.0"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.bz2 ]] && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xjf $PACKAGE.tar.bz2 || die "unpackaging $PACKAGE"
+(mkdir -p $DESTDIR/$PREFIX/include && \
+rm -rf $DESTDIR/$PREFIX/include/boost && \
+cp -r $PACKAGE/boost $DESTDIR/$PREFIX/include/boost) || die "installing $PACKAGE"
+
+PACKAGE="SDL-1.2.14"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
+cd $PACKAGE
+./configure --host=$HOST --prefix=$PREFIX --disable-stdio-redirect || die "configuring $PACKAGE"
+make $MAKEOPTS || die "making $PACKAGE"
+make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
+
+PACKAGE="libvorbis-1.2.3"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
+cd $PACKAGE
+./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE"
+make $MAKEOPTS || die "making $PACKAGE"
+make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
+
+PACKAGE="openal-soft-1.11.753-bin"
+cd $DESTDIR
+[[ ! -f $PACKAGE.zip ]] && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+unzip $PACKAGE.zip || die "unpackaging $PACKAGE"
+cd $PACKAGE
+(mkdir -p $DESTDIR/$PREFIX/{lib/pkgconfig,include/AL} && \
+install -p -m 0644 include/AL/* $DESTDIR/$PREFIX/include/AL/ && \
+install -p -m 0755 Win32/soft_oal.dll $DESTDIR/$PREFIX/bin/OpenAL32.dll && \
+install -p -m 0755 openal-info.exe $DESTDIR/$PREFIX/bin/ && \
+install -p -m 0755 lib/Win32/libOpenAL32.dll.a $DESTDIR/$PREFIX/lib/ && \
+cat >$DESTDIR/$PREFIX/lib/pkgconfig/openal.pc <<EOL
+prefix=$PREFIX
+exec_prefix=\${prefix}
+libdir=\${exec_prefix}/lib
+includedir=\${prefix}/include
+
+Name: OpenAL
+Description: OpenAL is a cross-platform 3D audio API
+Requires:
+Version: 1.11.753
+Libs: -L\${libdir} -lOpenAL32
+Cflags: -I\${includedir}
+EOL
+) || die "installing $PACKAGE"
+
+PACKAGE="libpng-1.4.1"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://prdownloads.sourceforge.net/libpng/$PACKAGE.tar.gz?download" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
+cd $PACKAGE
+./configure --host=$HOST --prefix=$PREFIX || die "configuring $PACKAGE"
+make $MAKEOPTS || die "making $PACKAGE"
+make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
+
+PACKAGE="lua-5.1.4"
+cd $DESTDIR
+[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://www.lua.org/ftp/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+rm -rf $PACKAGE
+tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
+cd $PACKAGE
+patch -p1 <<"EOL"
+diff -ur lua-5.1.4.orig/Makefile lua-5.1.4/Makefile
+--- lua-5.1.4.orig/Makefile 2008-08-11 18:40:48.000000000 -0600
++++ lua-5.1.4/Makefile 2010-03-03 23:11:41.673472345 -0700
+@@ -13,7 +13,8 @@
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+ INSTALL_INC= $(INSTALL_TOP)/include
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+-INSTALL_MAN= $(INSTALL_TOP)/man/man1
++INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
++INSTALL_PC= $(INSTALL_LIB)/pkgconfig
+ #
+ # You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
+@@ -41,10 +42,11 @@
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++TO_BIN= lua.exe luac.exe
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.dll.a
+ TO_MAN= lua.1 luac.1
++TO_PC= lua.pc
+
+ # Lua version and release.
+ V= 5.1
+@@ -59,11 +61,12 @@
+ src/lua test/hello.lua
+
+ install: dummy
+- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
++ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_PC) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
++ cd etc && $(INSTALL_DATA) $(TO_PC) $(INSTALL_PC)
+
+ ranlib:
+ cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
+diff -ur lua-5.1.4.orig/src/Makefile lua-5.1.4/src/Makefile
+--- lua-5.1.4.orig/src/Makefile 2008-01-19 12:37:58.000000000 -0700
++++ lua-5.1.4/src/Makefile 2010-03-03 22:45:47.101159854 -0700
+@@ -105,7 +105,7 @@
+
+ mingw:
+ $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
+- "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
++ "AR=$(CC) -shared -Wl,--out-implib,liblua.dll.a -o" "RANLIB=strip --strip-unneeded" \
+ "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe
+ $(MAKE) "LUAC_T=luac.exe" luac.exe
+
+EOL
+patch -p1 <<EOL
+diff -ur lua-5.1.4.orig/etc/lua.pc lua-5.1.4/etc/lua.pc
+--- lua-5.1.4.orig/etc/lua.pc 2008-08-08 06:46:11.000000000 -0600
++++ lua-5.1.4/etc/lua.pc 2010-03-03 22:46:49.160471491 -0700
+@@ -8,7 +8,7 @@
+ R= 5.1.4
+
+ # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
+-prefix= /usr/local
++prefix= $PREFIX
+ INSTALL_BIN= \${prefix}/bin
+ INSTALL_INC= \${prefix}/include
+ INSTALL_LIB= \${prefix}/lib
+EOL
+make $MAKEOPTS CC="$HOST-gcc" RANLIB="$HOST-ranlib" mingw || die "making $PACKAGE"
+make INSTALL_TOP=$DESTDIR/$PREFIX install || die "installing $PACKAGE"
+chmod 755 $DESTDIR/$PREFIX/lib/liblua.dll.a
+
+# libopengl32 and libglu32 pc files
+mkdir -p $DESTDIR/$PREFIX/lib/pkgconfig
+cat >$DESTDIR/$PREFIX/lib/pkgconfig/gl.pc <<EOL
+prefix=$PREFIX
+exec_prefix=\${prefix}
+libdir=\${exec_prefix}/lib
+includedir=\${prefix}/include
+
+Name: gl
+Description: OpenGL library
+Requires:
+Version:
+Libs: -L\${libdir} -lopengl32
+Cflags: -I\${includedir}
+EOL
+cat >$DESTDIR/$PREFIX/lib/pkgconfig/glu.pc <<EOL
+prefix=$PREFIX
+exec_prefix=\${prefix}
+libdir=\${exec_prefix}/lib
+includedir=\${prefix}/include
+
+Name: glu
+Description: OpenGL Utility library
+Requires: gl
+Version:
+Libs: -L\${libdir} -lglu32
+Cflags: -I\${includedir}
+EOL
+
+sync
+
+cd $DESTDIR/$PREFIX
+cat >README <<EOL
+
+Yoink Win32 Dependencies
+Created `date`
+
+These dependencies were generated automatically by makedeps.sh available in
+the Yoink repository. You should find here all the header files, DLL's,
+implibs, and pkgconfig files required to build Yoink that are not provided
+with the standard mingw32 toolchain.
+
+These files are licensed such that their general distribution under
+reasonable conditions is allowable. The copyrights of these binaries go to
+their various respective owners. Look up the specific library for specific
+terms and conditions, or see the COPYING file in the Yoink package.
+
+EOL
+tar cjf deps.tar.bz2 * || die "archiving dependencies"
+mv deps.tar.bz2 $DESTDIR/..
+
+echo "Done!"
+