.PHONY: run debug docs portable installer
run: all
- @$(CD) src && $(MAKE) run
+ @cd src && $(MAKE) run
debug: all
- @$(CD) src && $(MAKE) debug
+ @cd src && $(MAKE) debug
docs:
$(DOXYGEN)
if WIN32
portable: all
- $(SH) win32/makepackage.sh -p $(prefix) -d "$(DATA_FILES)" \
+ $(SH) win32/makepackage.sh -p $(prefix) -d "@DATA_FILES@" \
-s $(STRIP) -V $(VERSION)
installer: all
- $(SH) win32/makepackage.sh -p $(prefix) -d "$(DATA_FILES)" \
+ $(SH) win32/makepackage.sh -p $(prefix) -d "@DATA_FILES@" \
-s $(STRIP) -V $(VERSION) -i $(MAKENSIS)
endif
if test x$missing == xyes
then
- AC_MSG_WARN([It looks like you're missing some dependencies--building may fail!])
+ AC_MSG_ERROR([Please resolve the missing dependencies, and try again.])
fi
"Converted to Lua by Charles McGarvey",
"-----")
+--for key,value in pairs(_G) do print(key, value) end
+meh = Blah:new()
+meh:sayHello()
+print(meh:myStr(3.1415))
+
-- Scene API:
--
-- Functions:
-- 2 include warnings
-- 3 print everything, including debug messages
-loglevel = 2
+loglevel = 2
/**
* @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
+ * 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 <boost/shared_ptr.hpp>
#include <lua.hpp>
-#include <Moof/Log.hh>
-
namespace Mf {
return true;
}
+ /**
+ * Get the value of a field from the table.
+ */
+
+ template <typename T, typename V>
+ bool get(T& value, V field) const
+ {
+ pushField(field);
+ bool ret = Slot(mState, -1).get(value);
+ lua_pop(mState, 1);
+ return ret;
+ }
+
/**
* Copy the value and push the copy to the stack.
}
- void pushMetatable() const
+ void pushMetaTable() const
{
lua_getmetatable(mState, index);
}
lua_setglobal(mState, name.c_str());
}
-
Result doString(const std::string& commands)
{
return (Result)luaL_dostring(mState, commands.c_str());
//Mf::Octree<Quad>::Ptr mOctree;
std::list< boost::shared_ptr<Impl::Quad> > mObjects;
- std::list< Mf::Line<2> > mLines;
+ std::list<Mf::Line2> mLines;
Mf::Aabb<3> mBounds;
int scale(Mf::Script& script)
{
- if (script.getSize() == 3)
+ int size = script.getSize();
+
+ if (size == 1)
{
- Mf::Vector3 vec;
- script[1].requireNumber().get(vec[0]);
- script[2].requireNumber().get(vec[1]);
- script[3].requireNumber().get(vec[2]);
+ Mf::Scalar value = 1.0;
+ script[1].requireNumber().get(value);
Mf::Matrix4 scaling;
- cml::matrix_scale(scaling, vec);
+ cml::matrix_uniform_scale(scaling, value);
mTransform = scaling * mTransform;
}
- else if (script.getSize() == 1)
+ else if (size == 3)
{
- Mf::Scalar value = 1.0;
- script[1].requireNumber().get(value);
+ Mf::Vector3 vec;
+ script[1].requireNumber().get(vec[0]);
+ script[2].requireNumber().get(vec[1]);
+ script[3].requireNumber().get(vec[2]);
Mf::Matrix4 scaling;
- cml::matrix_uniform_scale(scaling, value);
+ cml::matrix_scale(scaling, vec);
mTransform = scaling * mTransform;
}
else
int drawTilemap(Mf::Script& script)
{
- Mf::Script::Slot table = script[1].requireTable();
- Mf::Script::Slot top = script[-1];
+ Mf::Script::Slot table = script[1].requireTable();
- int width = 1;
- int height = 1;
- int nTiles = 0;
+ int width = 1;
+ int height = 1;
+ int nTiles = 0;
- table.pushField("width");
- top.get(width);
- script.pop();
+ table.get(width, "width");
nTiles = table.getLength();
if (nTiles % width != 0)
int wPlus1 = w + 1;
int hPlus1 = h + 1;
- table.pushField(i);
-
Mf::Texture::TileIndex index;
- top.get(index);
-
- script.pop();
+ table.get(index, i);
vertices[h][wPlus1] = Mf::demote(mTransform *
Mf::Vector4(wPlus1, h, 0.0, 1.0));
}
Quad::Surface surface = Quad::NONE;
-
- table.pushField("surface");
- top.get(surface);
- script.pop();
+ table.get(surface, "surface");
if (surface != Quad::NONE)
{
Mf::Vector2 tr = Mf::demote(vertices[height][width]);
mLines.push_back(Mf::Line<2>(bl, tr));
- Mf::logInfo("new line");
}
return 0;
if (param.isTable())
{
- script.push(1);
- param.pushField();
- top.get(index);
-
- param.pushField("u_scale");
- top.get(width);
-
- param.pushField("blend");
- top.get(blending);
-
- param.pushField("fog");
- top.get(fog);
+ param.get(index, 1);
+ param.get(width, "u_scale");
+ param.get(blending, "blend");
+ param.get(fog, "fog");
}
else if (param.isNumber())
{
Mf::Vector3 vertices[2][width+1];
Mf::Scalar xf;
- Mf::Scalar increment = 1.0 / Mf::Scalar(width);
+ Mf::Scalar increment = SCALAR(1.0) / Mf::Scalar(width);
for (int h = 0; h <= 1; ++h)
{
END
END
-1000 ICON "yoink.ico"
+1000 ICON "../win32/yoink.ico"
# libvorbis 1.2.3
# lua 5.1.4
# openal-soft 1.11.753
-# zlib 1.2.3
#
# This script requires a working mingw32 toolchain and other basic tools.
-# Have fun!
+# You also need zlib which may not have been included with your mingw32
+# installation; you're on your own for that one. Have fun!
#
# Example usage:
# ./makedeps.sh -H i486-mingw32 -p /usr/i486-mingw32 -m "-j8"
}
DESTDIR="`pwd`/deps"
-mkdir -p $DESTDIR
-rm -f $DESTDIR/README
+mkdir -p "$DESTDIR"
+rm -f "$DESTDIR/README"
+rm -rf "$DESTDIR/$PREFIX"
PACKAGE="boost_1_42_0"
) || die "installing $PACKAGE"
-PACKAGE="zlib123-dll"
-cd $DESTDIR
-test ! -f $PACKAGE.zip && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE")
-(md5sum -c <<"EOL"
-cc7fa97f9c19386bb701acc79d0abbca zlib123-dll.zip
-EOL
-) || die "verifying $PACKAGE"
-rm -rf $PACKAGE
-unzip -d $PACKAGE $PACKAGE.zip || die "unpackaging $PACKAGE"
-cd $PACKAGE
-($HOST-dlltool -k -d lib/zlib.def -D zlib1.dll -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="zlib123-dll"
+#cd $DESTDIR
+#test ! -f $PACKAGE.zip && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE")
+#(md5sum -c <<"EOL"
+#cc7fa97f9c19386bb701acc79d0abbca zlib123-dll.zip
+#EOL
+#) || die "verifying $PACKAGE"
+#rm -rf $PACKAGE
+#unzip -d $PACKAGE $PACKAGE.zip || die "unpackaging $PACKAGE"
+#cd $PACKAGE
+#($HOST-dlltool -k -d lib/zlib.def -D zlib1.dll -l libzdll.a && \
+#$HOST-ranlib 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="libpng-1.4.1"
rm -rf $PACKAGE
tar xzf $PACKAGE.tar.gz || die "unpackaging $PACKAGE"
cd $PACKAGE
-./configure --host=$HOST --prefix=$PREFIX \
-CPPFLAGS="-I$DESTDIR/$PREFIX/include" \
-LDFLAGS="-L$DESTDIR/$PREFIX/lib" || die "configuring $PACKAGE"
-make $MAKEOPTS || die "making $PACKAGE"
-make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
+cp scripts/makefile.mingw Makefile && \
+make $MAKEOPTS prefix="$PREFIX" CC="$HOST-gcc" AR="$HOST-ar" RANLIB="$HOST-ranlib" \
+ZLIBINC="-I$DESTDIR/$PREFIX/include" \
+ZLIBLIB="-L$DESTDIR/$PREFIX/lib" libpng.a libpng14.dll || die "making $PACKAGE"
+make DESTDIR=$DESTDIR install prefix="$PREFIX" || die "installing $PACKAGE"
PACKAGE="lua-5.1.4"
#
# Yoink
-# Run this script to create a portable win32 package.
+# Run this script to create a win32 package.
#
function showhelp()
}
ROOT="$PWD"
-BUILD="$PWD/tmp-$$"
-NAME="yoink-$VERSION"
-ARCHIVE="$BUILD/$NAME"
-INSTALLER_SCRIPT="$ROOT/win32/yoink.nsi"
+BUILD="$ROOT/tmp-$$"
+DIRECTORY="yoink-$VERSION"
+ARCHIVE="$BUILD/$DIRECTORY"
MAN2HTML="$ROOT/doc/man2html.sh"
UNIX2DOS="$ROOT/win32/unix2dos.sh"
-DLLS="libogg-0 libpng14-14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1"
+DLLS="libogg-0 libpng14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1"
if test ! -f "src/version.c"
if test "x$MAKENSIS" = x
then
-# build the portable archive
+# build portable archive
+ echo "No valid makensis executable passed;"
+ echo "making portable package instead..."
+ NAME="$DIRECTORY.zip"
cd "$BUILD"
- zip -r $NAME.zip $NAME || die "zipping portable archive"
+ zip -r "$NAME" "$DIRECTORY" || die "zipping portable archive"
cd "$ROOT"
- mv "$BUILD/$NAME.zip" .
- echo "Done! Package saved to $NAME.zip."
+ mv "$BUILD/$NAME" .
+ echo "Done! Package saved to $NAME."
else
# build an installer
- cd "$BULID"
- "$MAKENSIS" "$INSTALLER_SCRIPT" \
- -DINSTALLFILES="$NAME" -DVERSION="$VERSION" \
+ NAME="yoinksetup-$VERSION.exe"
+ cd "$BUILD"
+ cp "$ROOT/win32/yoink.nsi" .
+ "$MAKENSIS" -DROOTPATH="$ROOT" -DINSTALLFILES="$ARCHIVE" \
+ -DVERSION="$VERSION" -DOUTFILE="$NAME" yoink.nsi \
|| die "running '$MAKENSIS'"
cd "$ROOT"
- mv "$BUILD/$NAME.exe" .
- echo "Done! Installer saved to $NAME.exe."
+ mv "$BUILD/$NAME" .
+ echo "Done! Installer saved to $NAME."
fi
;Name and file
Name "Yoink"
- OutFile "yoinksetup-$VERSION.exe"
+ OutFile "${OUTFILE}"
SetCompressor /SOLID lzma
;Default installation folder
;--------------------------------
;Interface Settings
- !define MUI_ICON "../src/setup.ico"
- !define MUI_UNICON "../src/uninstall.ico"
+ !define MUI_ICON "${ROOTPATH}/win32/setup.ico"
+ !define MUI_UNICON "${ROOTPATH}/win32/uninstall.ico"
!define MUI_COMPONENTSPAGE_SMALLDESC
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
- File /r "$INSTALLFILES/*"
+ File /r "${INSTALLFILES}/*"
;Store installation folder
WriteRegStr HKCU "Software\Yoink" "" $INSTDIR
CreateShortCut "$SMPROGRAMS\Yoink\Uninstall.lnk" "$INSTDIR\uninstall.exe"
WriteRegStr HKCU "Software\Games\Yoink" "" "$INSTDIR"
- WriteRegStr HKCU "Software\Games\Yoink" "Version" "$VERSION"
+ WriteRegStr HKCU "Software\Games\Yoink" "Version" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayName" "Yoink"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayVersion" "$VERSION"
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayVersion" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "UninstallString" "$INSTDIR\uninstall.exe"
SectionEnd