diff --git a/premake4.lua b/premake4.lua
index 852a9b117156060f6f574d8a29b3012ab1ddff16..e71164e9c75471984d3c8ec0d8c6d7c9edc762c5 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -9,7 +9,6 @@ solution "TEngine"
 		"src/fov",
 		"src/physfs",
 		"src/physfs/zlib123",
-		"src/sge2d/include",
 		"/usr/include/SDL",
 	}
 
@@ -33,7 +32,8 @@ project "TEngine"
 	language "C"
 	targetname "t-engine"
 	files { "src/*.c", }
-	links { "physfs", "lua", "fov", "sge2d", "luasocket" }
+	links { "physfs", "lua", "fov", "luasocket" }
+	defines { "_DEFAULT_VIDEOMODE_FLAGS_='SDL_HWSURFACE|SDL_DOUBLEBUF'" }
 
 configuration "macosx"
 	linkoptions { "mac/SDLmain.m", "-framework SDL", "-framework SDL_image", "-framework SDL_ttf", "-framework SDL_mixer", "-framework Cocoa" }
@@ -109,12 +109,3 @@ project "fov"
 	targetname "fov"
 
 	files { "src/fov/*.c", }
-
-project "sge2d"
-	kind "StaticLib"
-	language "C"
-	targetname "sge2d"
-
-	files { "src/sge2d/src/*.c", }
-
-	defines { "_DEFAULT_VIDEOMODE_FLAGS_='SDL_HWSURFACE|SDL_DOUBLEBUF'" }
diff --git a/src/core_lua.c b/src/core_lua.c
index f66d8c8264d674740a493f0af6e7d32d0db38aad..e4bdb6a193b91c98d4307d84528878ff73bc4db5 100644
--- a/src/core_lua.c
+++ b/src/core_lua.c
@@ -7,7 +7,7 @@
 #include "script.h"
 #include "display.h"
 #include "SFMT.h"
-#include "sge.h"
+#include <SDL.h>
 #include <SDL_ttf.h>
 
 /******************************************************************
@@ -262,7 +262,7 @@ static int sdl_surface_drawstring(lua_State *L)
 	SDL_Surface *txt = TTF_RenderUTF8_Solid(*f, str, color);
 	if (txt)
 	{
-		sgeDrawImage(*s, txt, x, y);
+		sdlDrawImage(*s, txt, x, y);
 		SDL_FreeSurface(txt);
 	}
 
@@ -287,7 +287,6 @@ static int sdl_new_surface(lua_State *L)
 		screen->format->Bmask,
 		screen->format->Amask
 		);
-	sgeUseAlpha(*s);
 
 	return 1;
 }
@@ -344,7 +343,7 @@ static int sdl_surface_toscreen(lua_State *L)
 	int y = luaL_checknumber(L, 3);
 	if (s && *s)
 	{
-		sgeDrawImage(screen, *s, x, y);
+		sdlDrawImage(screen, *s, x, y);
 	}
 	return 0;
 }
@@ -357,7 +356,7 @@ static int sdl_surface_merge(lua_State *L)
 	int y = luaL_checknumber(L, 4);
 	if (dst && *dst && src && *src)
 	{
-		sgeDrawImage(*dst, *src, x, y);
+		sdlDrawImage(*dst, *src, x, y);
 	}
 	return 0;
 }
diff --git a/src/display_sdl.c b/src/display_sdl.c
index d82a0c48eb73e29040b4a579fe3dec875e79b6c5..032eed7b9fa52ea02ec013bcc1d55401ddba0bd1 100644
--- a/src/display_sdl.c
+++ b/src/display_sdl.c
@@ -1,8 +1,9 @@
-#include "sge.h"
+#include "SDL.h"
 #include "display_sdl.h"
 #include <stdlib.h>
 
 #define DISPLAY_CHAR_SIZE  16
+SDL_Surface *screen = NULL;
 
 void display_put_char(SDL_Surface *surface, char c, int x, int y, int r, int g, int b)
 {
@@ -28,3 +29,13 @@ void display_put_string(SDL_Surface *surface, const char *s, int x, int y, int r
 		display_put_char(surface, s[i], x + i, y, r, g, b);
 	}
 }
+
+inline void sdlDrawImage(SDL_Surface *dest, SDL_Surface *image, int x, int y)
+{
+	SDL_Rect r;
+	r.w=image->w;
+	r.h=image->h;
+	r.x=x;
+	r.y=y;
+	SDL_BlitSurface(image, NULL, dest, &r);
+}
diff --git a/src/display_sdl.h b/src/display_sdl.h
index 316592915fdfcca53db782039c0911a6099e677f..80f494681fc22fdf063d5caaac22bb9f32d6f02c 100644
--- a/src/display_sdl.h
+++ b/src/display_sdl.h
@@ -40,8 +40,18 @@
 extern "C" {
 #endif
 
+#define sdlLock(surface) do {\
+	if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface);\
+	} while (0)
+
+#define sdlUnlock(surface) do {\
+		if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface);\
+	} while (0)
+
+extern SDL_Surface *screen;
 void display_put_char(SDL_Surface *surface, char c, int x, int y, int r, int g, int b);
 void display_put_string(SDL_Surface *surface, const char *s, int x, int y, int r, int g, int b);
+inline void sdlDrawImage(SDL_Surface *dest, SDL_Surface *image, int x, int y);
 
 #ifdef __cplusplus
 } /* extern "C" */
diff --git a/src/main.c b/src/main.c
index 661bac045a26d43555cab22888ba0cd8f63888e6..207d6faa0e302dcc3d716b893db7127d7b61d5ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,7 +8,6 @@
 #include "lualib.h"
 #include "fov/fov.h"
 #include "SFMT.h"
-#include "sge.h"
 
 #include "types.h"
 #include "script.h"
@@ -60,7 +59,7 @@ typedef struct {
 	Uint32 color;
 } MainStateData;
 
-void on_event(SGEGAMESTATE *state, SDL_Event *event)
+void on_event(SDL_Event *event)
 {
 	switch (event->type) {
 	case SDL_KEYDOWN:
@@ -109,18 +108,10 @@ void on_event(SGEGAMESTATE *state, SDL_Event *event)
 }
 
 // redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state)
+void on_redraw()
 {
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
+	static int Frames = 0;
+	static int T0     = 0;
 
 	if (current_game != LUA_NOREF)
 	{
@@ -132,7 +123,7 @@ void on_redraw(SGEGAMESTATE *state)
 		docall(L, 1, 0);
 	}
 
-	sgeLock(screen);
+	sdlLock(screen);
 	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0x00, 0x00, 0x00));
 
 	if (current_game != LUA_NOREF)
@@ -145,16 +136,29 @@ void on_redraw(SGEGAMESTATE *state)
 		docall(L, 1, 0);
 	}
 
-	sgeUnlock(screen);
+	sdlUnlock(screen);
 
 	// finally display the screen
-	sgeFlip();
+	SDL_Flip(screen);
+
+	/* Gather our frames per second */
+	Frames++;
+	{
+		int t = SDL_GetTicks();
+		if (t - T0 >= 1000) {
+			float seconds = (t - T0) / 1000.0;
+			float fps = Frames / seconds;
+			printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
+			T0 = t;
+			Frames = 0;
+		}
+	}
 }
 
 /**
  * Program entry point.
  */
-int run(int argc, char *argv[])
+int main(int argc, char *argv[])
 {
 	// RNG init
 	init_gen_rand(time(NULL));
@@ -177,38 +181,51 @@ int run(int argc, char *argv[])
 	lua_newtable(L);
 	lua_setglobal(L, "__uids");
 
-	/***************** SDL/SGE2D Init *****************/
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	MainStateData data;
-
 	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO, NOJOYSTICK);
-	sgeOpenScreen("T-Engine", 800, 600, 32, NOFULLSCREEN);
+	Uint32 flags=SDL_INIT_VIDEO | SDL_INIT_TIMER;
+	if (SDL_Init (flags) < 0) {
+		printf("cannot initialize SDL: %s\n", SDL_GetError ());
+		return;
+	}
+	screen = SDL_SetVideoMode(800, 600, 32, _DEFAULT_VIDEOMODE_FLAGS_);
+	if (screen==NULL) {
+		printf("error opening screen: %s\n", SDL_GetError());
+		return;
+	}
+	SDL_WM_SetCaption("T4Engine", NULL);
 	SDL_EnableUNICODE(TRUE);
 	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
 	TTF_Init();
 
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->onEvent = on_event;
-	mainstate->data = &data;
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
 	// And run the lua engine scripts
 	luaL_loadfile(L, "/engine/init.lua");
 	docall(L, 0, 0);
 
-	// start the game running with 25 frames per seconds
-	sgeGameStateManagerRun(manager, 25);
+	bool done = FALSE;
+	SDL_Event event;
+	while ( !done )
+	{
+		/* handle the events in the queue */
+		while (SDL_PollEvent(&event))
+		{
+			switch(event.type)
+			{
+			case SDL_KEYDOWN:
+				/* handle key presses */
+				on_event(&event);
+				break;
+			case SDL_QUIT:
+				/* handle quit requests */
+				done = TRUE;
+				break;
+			default:
+				break;
+			}
+		}
+
+		/* draw the scene */
+		on_redraw();
+	}
 
-	// close the screen and quit
-	sgeCloseScreen();
 	return 0;
 }
diff --git a/src/sge2d/.cvsignore b/src/sge2d/.cvsignore
deleted file mode 100644
index b6cc50af04c002a79373471ff6c6ac1528cd7911..0000000000000000000000000000000000000000
--- a/src/sge2d/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-setup.project
-projects/*
-projects/*/*
diff --git a/src/sge2d/BUILD b/src/sge2d/BUILD
deleted file mode 100644
index 9b6f742f199af3505156a1b193e9c350d96925f6..0000000000000000000000000000000000000000
--- a/src/sge2d/BUILD
+++ /dev/null
@@ -1,20 +0,0 @@
-To build the library, type:
-
-./configure
-
-followed by:
-
-make
-
-You might also consider to bulid the examples found
-under the directory 'demos' by typing:
-
-make examples
-
-If you run into trouble or want to crosscompile for
-gp2x, try:
-
-./configure --help
-
-to get a list of available platforms and supported
-cross compilation kits.
diff --git a/src/sge2d/COPYING b/src/sge2d/COPYING
deleted file mode 100644
index 434d9f229bc8a6c0eea01babda1d0516c15cde96..0000000000000000000000000000000000000000
--- a/src/sge2d/COPYING
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2007 Heiko Irrgang
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/sge2d/Makefile b/src/sge2d/Makefile
deleted file mode 100644
index 987d6f81109feb6810fbb253f5af856b8ea9ecdb..0000000000000000000000000000000000000000
--- a/src/sge2d/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-include setup.project
-include setup.$(PLATFORM)
-
-TARGET=	libsge.a
-
-CFLAGS=-O2 -Wall -Werror -Wpointer-arith -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wshadow -I$(PWD)/include $(SDLCFLAGS) $(DEFINES)
-
-OBJ=	src/sgeinit.o \
-	src/sgescreen.o \
-	src/sgesound.o \
-	src/sgecontrol.o \
-	src/sgeresource.o \
-	src/sgeevent.o \
-	src/sgelist.o \
-	src/sgearray.o \
-	src/sgespriteimage.o \
-	src/sgesprite.o \
-	src/sgestage.o \
-	src/sgegfx.o \
-	src/sgespritegroup.o \
-	src/sgegamestate.o \
-	src/sgefont.o \
-	src/sgepathfinder.o \
-	src/sgeparticles.o \
-	src/sgemisc.o
-
-.c.o:
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(AR) -rs $(TARGET) $(OBJ)
-	$(MAKE) sgetools
-
-test: all
-	cd libtest && $(MAKE)
-	cd libtest && ./libtest
-
-sgetools:
-	cd tools && $(MAKE)
-
-tags:
-	ctags src/*.c include/*.h
-
-clean:
-	cd demos && $(MAKE) clean
-	cd tools && $(MAKE) clean
-	cd libtest && $(MAKE) clean
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-demos: examples
-examples: all
-	cd demos && $(MAKE)
-
-distclean: clean
-	rm -f setup.project
diff --git a/src/sge2d/README.BeOS b/src/sge2d/README.BeOS
deleted file mode 100644
index 316d984eb34b6864d1f7b10dd28b6a264c856f12..0000000000000000000000000000000000000000
--- a/src/sge2d/README.BeOS
+++ /dev/null
@@ -1,10 +0,0 @@
-The BeOS system requires the LibPack developer package installed, which
-you can get from:
-
-http://www.bebits.com/app/3322
-
-To deliver your application, copy the *.so files from the beos directory
-either to the directory your binary is residing, or to /boot/home/config/lib
-
-sge2d should work on Haiku too, but is untested. Please report the result
-if you have tried it.
diff --git a/src/sge2d/README.MorphOS b/src/sge2d/README.MorphOS
deleted file mode 100644
index f133985b7547f97cc4440cdad196fa83022bbb2e..0000000000000000000000000000000000000000
--- a/src/sge2d/README.MorphOS
+++ /dev/null
@@ -1,8 +0,0 @@
-Currently there is a problem with the sga archiver tool on MorphOS.
-
-sga always creates the data files in the directory of sga, so to
-generate data files on MorphOS, you have to copy the sga binary to
-the directory where you want to create the data file and start it
-from there.
-
-We are searching on a solution for this.
diff --git a/src/sge2d/configure b/src/sge2d/configure
deleted file mode 100755
index 5e099806033630d9fd33f13b13fd87157e2c26e1..0000000000000000000000000000000000000000
--- a/src/sge2d/configure
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "--help" ]
-then
-	echo './configure [platform]'
-	echo 'set up build system for platform [platform]'
-	echo 'supported platforms:'
-	echo '	BeOS'
-	echo '	devkitgp2x'
-	echo '	FreeBSD'
-	echo '	GNU/Linux'
-	echo '	gp2x'
-	echo '	Haiku'
-	echo '	MINGW32_NT-5.1'
-	echo '	MorphOS'
-	echo '	open2x'
-	echo '	OpenBSD'
-	echo '	OpenSolaris'
-	echo '	Syllable'
-	exit 0
-fi
-
-echo -n "checking operating system... "
-if [ "$1" = "" ]
-then
-	OS=`uname -o 2>/dev/null`
-	if [ "$OS" = "" ]
-	then
-		OS=`uname -s 2>/dev/null`
-	fi
-else
-	OS=$1
-fi
-
-case "$OS" in
-	"GNU/Linux")
-		echo "PLATFORM=linux" > setup.project
-		;;
-	'MINGW32_NT-5.1')
-		echo "PLATFORM=mingw" > setup.project
-		;;
-	'open2x')
-		echo "PLATFORM=open2x" > setup.project
-		;;
-	'gp2x')
-		echo "PLATFORM=gp2x" > setup.project
-		;;
-	'devkitgp2x')
-		echo "PLATFORM=devkitgp2x" > setup.project
-		;;
-	'FreeBSD')
-		echo "PLATFORM=freebsd" > setup.project
-		;;
-	'OpenBSD')
-		echo "PLATFORM=openbsd" > setup.project
-		;;
-	'SunOS')
-		echo "PLATFORM=sunos" > setup.project
-		;;
-	'Syllable')
-		echo "PLATFORM=syllable" > setup.project
-		;;
-	'MorphOS')
-		echo "PLATFORM=morphos" > setup.project
-		;;
-	'BeOS')
-		echo "PLATFORM=beos" > setup.project
-		;;
-	'Haiku')
-		echo "PLATFORM=beos" > setup.project
-		;;
-	*)
-		echo "unknown platform: $OS"
-		exit 255
-		;;
-esac
-
-echo PATH="$PATH:`pwd`/tools" >> setup.project
-
-echo $OS
-echo
-
-echo configure done
-echo now type make to build
diff --git a/src/sge2d/demos/Makefile b/src/sge2d/demos/Makefile
deleted file mode 100644
index f8c938730b317c424ae97862a567e58167c3b104..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-	@for a in *; do if test -d "$$a" -a -e "$$a/Makefile"; then cd $$a ; $(MAKE) ; cd ..; fi; done
-
-clean:
-	@for a in *; do if test -d "$$a" -a -e "$$a/Makefile"; then cd $$a ; $(MAKE) clean; cd ..; fi; done
-
diff --git a/src/sge2d/demos/animbanks/.cvsignore b/src/sge2d/demos/animbanks/.cvsignore
deleted file mode 100644
index 2864def8e1b32fa044993b6dc773df97b40a92bc..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/animbanks/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-animbanks
-CVS
diff --git a/src/sge2d/demos/animbanks/Makefile b/src/sge2d/demos/animbanks/Makefile
deleted file mode 100644
index dccced381e978c8b42f97121f58cbff873bd78be..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/animbanks/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-PROJECTNAME=animbanks
-
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-data: datafiles
-datafiles:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga asdf ./data.d data/*
diff --git a/src/sge2d/demos/animbanks/animbanks b/src/sge2d/demos/animbanks/animbanks
deleted file mode 100755
index 48b5523b73ca94dd4c5dd6b9d3a972825fb636a3..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/animbanks and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data.d b/src/sge2d/demos/animbanks/data.d
deleted file mode 100644
index f594befaa594b3cc4e708f637a04199bc4a25c9c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data.d and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0001.png b/src/sge2d/demos/animbanks/data/animbanks_0001.png
deleted file mode 100644
index decf18cb6b49da4b900d62f8f45fbcfef2907bf0..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0001.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0002.png b/src/sge2d/demos/animbanks/data/animbanks_0002.png
deleted file mode 100644
index a435d8ade5eb37dd2ed20dfefe3f539da76f5093..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0002.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0003.png b/src/sge2d/demos/animbanks/data/animbanks_0003.png
deleted file mode 100644
index 5b0e0f4036b078a9f846d3bdc8a8adf49800c0c0..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0003.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0004.png b/src/sge2d/demos/animbanks/data/animbanks_0004.png
deleted file mode 100644
index 628f1d0565316d4eaf61c6b7de5685eb3dcb1dd2..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0004.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0005.png b/src/sge2d/demos/animbanks/data/animbanks_0005.png
deleted file mode 100644
index 943ed930a1aeecb152371f0c15ab65239ec92f26..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0005.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0006.png b/src/sge2d/demos/animbanks/data/animbanks_0006.png
deleted file mode 100644
index 5492b88603ca9c3567bb2a712bd73be75c147cd4..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0006.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0007.png b/src/sge2d/demos/animbanks/data/animbanks_0007.png
deleted file mode 100644
index a31e5238d57ed4cada9569c42ecdd9784ad0ef21..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0007.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0008.png b/src/sge2d/demos/animbanks/data/animbanks_0008.png
deleted file mode 100644
index 5ff4c0d5ff4c3437020cfb12914941f41175a4e3..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0008.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0009.png b/src/sge2d/demos/animbanks/data/animbanks_0009.png
deleted file mode 100644
index 85243a5d23318115940291f278ff8b524de1ffd0..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0009.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0010.png b/src/sge2d/demos/animbanks/data/animbanks_0010.png
deleted file mode 100644
index 72ce4db6f907ebec1683a849d0a1e78b6aeab5c0..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0010.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0011.png b/src/sge2d/demos/animbanks/data/animbanks_0011.png
deleted file mode 100644
index 66d9b734ae776740aa30ce35cbed801e86601253..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0011.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0012.png b/src/sge2d/demos/animbanks/data/animbanks_0012.png
deleted file mode 100644
index 50c4f8e1b575314073133acc9ec83bed8997f9ca..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0012.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0013.png b/src/sge2d/demos/animbanks/data/animbanks_0013.png
deleted file mode 100644
index 1cd333b6afd0e9d4a4f885bfe138a66e1784774e..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0013.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0014.png b/src/sge2d/demos/animbanks/data/animbanks_0014.png
deleted file mode 100644
index f7a55299cd277e659d2cff443d1b0551cda62140..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0014.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0015.png b/src/sge2d/demos/animbanks/data/animbanks_0015.png
deleted file mode 100644
index 84a262c073711e8d4c34d225f39930971253b609..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0015.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0016.png b/src/sge2d/demos/animbanks/data/animbanks_0016.png
deleted file mode 100644
index 11816cbce505052150aafe61cfbcb21ad311a699..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0016.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0017.png b/src/sge2d/demos/animbanks/data/animbanks_0017.png
deleted file mode 100644
index fba768a02af9ef35e005178e5e9ededd4aa90bac..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0017.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0018.png b/src/sge2d/demos/animbanks/data/animbanks_0018.png
deleted file mode 100644
index a3167dc970f4324479fe004cd50f8b3f02835485..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0018.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0019.png b/src/sge2d/demos/animbanks/data/animbanks_0019.png
deleted file mode 100644
index 46040a5e6f6d3912bb41c7935cb906483e4058c3..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0019.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0020.png b/src/sge2d/demos/animbanks/data/animbanks_0020.png
deleted file mode 100644
index 980442edefa646b3a5761545c986b6afa4d5da2a..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0020.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0021.png b/src/sge2d/demos/animbanks/data/animbanks_0021.png
deleted file mode 100644
index 40c8e359b2e30968957a8808d8d5f0e2b261fb8b..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0021.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0022.png b/src/sge2d/demos/animbanks/data/animbanks_0022.png
deleted file mode 100644
index 1f87605e67270379b98d7f99c7f374954d2e2578..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0022.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0023.png b/src/sge2d/demos/animbanks/data/animbanks_0023.png
deleted file mode 100644
index 06ff27252faab0a327ea30754b8ce9f78776b4a7..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0023.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0024.png b/src/sge2d/demos/animbanks/data/animbanks_0024.png
deleted file mode 100644
index cbb8ffa3399024990bb88077c88f6a6ed4644693..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0024.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0025.png b/src/sge2d/demos/animbanks/data/animbanks_0025.png
deleted file mode 100644
index e2bcb9d15d034f6f604c41f7d58d95b1902cd68f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0025.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0026.png b/src/sge2d/demos/animbanks/data/animbanks_0026.png
deleted file mode 100644
index 7ac04a0ba6e9072a77dad14ac1e0a08133f83185..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0026.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0027.png b/src/sge2d/demos/animbanks/data/animbanks_0027.png
deleted file mode 100644
index 49da0c8b9a5c69ed7ddb1fb6087a6645aec667cc..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0027.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0028.png b/src/sge2d/demos/animbanks/data/animbanks_0028.png
deleted file mode 100644
index 8955c9e88edf3ac305ae80eaaf984fc921147da5..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0028.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0029.png b/src/sge2d/demos/animbanks/data/animbanks_0029.png
deleted file mode 100644
index 260dc8f2915f65d9e10b4be02a6e3fef53b466dd..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0029.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0030.png b/src/sge2d/demos/animbanks/data/animbanks_0030.png
deleted file mode 100644
index a70230e7f8f1d3b5c4af90f67c30356babad7b7b..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0030.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0031.png b/src/sge2d/demos/animbanks/data/animbanks_0031.png
deleted file mode 100644
index 47d840cb1a817328a23b2e366583fcd50c56aea0..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0031.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0032.png b/src/sge2d/demos/animbanks/data/animbanks_0032.png
deleted file mode 100644
index 99c6d9f90ab9678a2c853695a4788c07997f3483..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0032.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0033.png b/src/sge2d/demos/animbanks/data/animbanks_0033.png
deleted file mode 100644
index c20dd0a9536e05c592c7d62ad273dd4358402723..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0033.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0034.png b/src/sge2d/demos/animbanks/data/animbanks_0034.png
deleted file mode 100644
index 0ba351a2e9e0a4554c7dcf6d39c9fcd2abb522b1..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0034.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0035.png b/src/sge2d/demos/animbanks/data/animbanks_0035.png
deleted file mode 100644
index 5521ddf6cc7be08352a99cd7c24ed3be8195b28d..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0035.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0036.png b/src/sge2d/demos/animbanks/data/animbanks_0036.png
deleted file mode 100644
index 099d86922e3db2dd325cc7302a4d332bb1565705..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0036.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0037.png b/src/sge2d/demos/animbanks/data/animbanks_0037.png
deleted file mode 100644
index 49cdf6025188c351164a52fd535feaa579e0b9fe..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0037.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0038.png b/src/sge2d/demos/animbanks/data/animbanks_0038.png
deleted file mode 100644
index bd6b466a5fc906709901dd7837c990172dad6121..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0038.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0039.png b/src/sge2d/demos/animbanks/data/animbanks_0039.png
deleted file mode 100644
index 18b481c4427d4da15b4f3ecbac372ab0140c0d20..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0039.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/data/animbanks_0040.png b/src/sge2d/demos/animbanks/data/animbanks_0040.png
deleted file mode 100644
index af5e37f14e01017ef9ef30196c1f9e378af4c151..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/animbanks/data/animbanks_0040.png and /dev/null differ
diff --git a/src/sge2d/demos/animbanks/main.c b/src/sge2d/demos/animbanks/main.c
deleted file mode 100644
index 0e1af8f119fdd2b5c263cdc468f6f684c415bebe..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/animbanks/main.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- *
- * This is a basic demonstration of sprite animbanks
- *
- * Move the cursor to move the figure
- * */
-
-#include <sge.h>
-
-// define our data that is passed to our redraw function
-typedef struct {
-	SGESPRITE *player;
-} MainStateData;
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state)
-{
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-
-	sgeFillRect(screen, 0,0,320,240,sgeMakeColor(screen,0x40,0x40,0x40,0xff));
-
-	// check if we need to change the animbank and restart animation
-	if (es.down.pressed) {
-		sgeSpriteSetAnimBank(data->player, 0);
-		sgeSpriteAnimate(data->player, YES);
-	}
-	else if (es.left.pressed) {
-		sgeSpriteSetAnimBank(data->player, 1);
-		sgeSpriteAnimate(data->player, YES);
-	}
-	else if (es.up.pressed) {
-		sgeSpriteSetAnimBank(data->player, 2);
-		sgeSpriteAnimate(data->player, YES);
-	}
-	else if (es.right.pressed) {
-		sgeSpriteSetAnimBank(data->player, 3);
-		sgeSpriteAnimate(data->player, YES);
-	}
-
-	// move the player
-	if (es.down.held) {
-		data->player->y+=2;
-	}
-	else if (es.right.held) {
-		data->player->x+=2;
-	}
-	else if (es.left.held) {
-		data->player->x-=2;
-	}
-	else if (es.up.held) {
-		data->player->y-=2;
-	} else {
-		// stop animation if no key is held
-		sgeSpriteAnimate(data->player, NO);
-		// display frame 3, a more standing like frame
-		sgeSpriteForceFrame(data->player, 3);
-	}
-	
-	sgeSpriteDraw(data->player, screen);
-
-	// finally display the screen
-	sgeFlip();
-}
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	SGEFILE *f;
-	MainStateData data;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("SGE Sprite AnimBanks",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// read spritedata
-	f=sgeOpenFile("data.d","asdf");
-
-	data.player=sgeSpriteNew();
-
-	// load files 0001-0010 to first animbank (walking down)
-	sgeSpriteAddFileRange(data.player,f,"data/animbanks_%04d.png", 1, 10);
-
-	// load 0011-0020 to a new anim bank (walking left)
-	sgeSpriteAddAnimBank(data.player);
-	sgeSpriteAddFileRange(data.player,f,"data/animbanks_%04d.png", 11, 20);
-
-	// load 0021-0030 to a new anim bank (walking up)
-	sgeSpriteAddAnimBank(data.player);
-	sgeSpriteAddFileRange(data.player,f,"data/animbanks_%04d.png", 21, 30);
-
-	// load 0031-0040 to a new anim bank (walking right)
-	sgeSpriteAddAnimBank(data.player);
-	sgeSpriteAddFileRange(data.player,f,"data/animbanks_%04d.png", 31, 40);
-
-	sgeCloseFile(f);
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/demos/array/Makefile b/src/sge2d/demos/array/Makefile
deleted file mode 100644
index e48bf51052d2e412b8334ed47c4d29d662b06b92..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/array/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-PROJECTNAME=array
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
diff --git a/src/sge2d/demos/array/array b/src/sge2d/demos/array/array
deleted file mode 100755
index 89b4de108a1ac068913f03ae5e4ad249570cd0a3..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/array/array and /dev/null differ
diff --git a/src/sge2d/demos/array/main.c b/src/sge2d/demos/array/main.c
deleted file mode 100644
index e488142336f07479cc830292fdcf1fb894dd9007..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/array/main.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <sge.h>
-#include <string.h>
-
-/**
- * first we define our custom structure
- */
-typedef struct {
-	int x;
-	int y;
-	char *name;
-} element;
-
-/**
- * a little helper function for creating a element
- */
-element *createElement(int x, int y, char *name) {
-	element *ret;
-	sgeNew(ret, element);
-	ret->x=x;
-	ret->y=y;
-	/* physically copy the string, so it has to
-	 * be freed explicitly
-	 **/
-	ret->name=strdup(name);
-	return ret;
-}
-
-/**
- * a little helper function for use with sgeArrayForEach to
- * print the arrays content
- **/
-
-void printElement(Uint32 offset, void *data) {
-	element *e=(element *)data;
-	printf("%d: %s, x=%d, y=%d\n", (int)offset, e->name, e->x, e->y);
-}
-
-/**
- * now lets define out free function for use with the autoarray.
- * when using autoarrays, this function is called every time
- * a element is removed from the array
- */
-void freeElement(Uint32 offset, void *data) {
-	element *e=(element *)data;
-	printf("...auto freeing %s\n", e->name);
-	sgeFree(e->name);
-	sgeFree(e);
-}
-
-int run(int argc, char *argv[]) {
-	SGEARRAY *array, *autoarray;
-	element *e;
-
-	/* when using the default array, you'll have to manage
-	 * freeing of the element on your own
-	 **/
-	array=sgeArrayNew();
-
-	/* when using autoarray, you'll give it the function
-	 * to free the elements
-	 **/
-	autoarray=sgeAutoArrayNew(&freeElement);
-
-	/* lets add a few elements to both arrays
-	 * we use createElement for every array, so every
-	 * array receives its own copy of the data
-	 **/
-	e=createElement(0,0,"Element 1");
-	sgeArrayAdd(array,e);
-	e=createElement(0,0,"Element 1");
-	sgeArrayAdd(autoarray,e);
-
-	e=createElement(-1,1,"Element 2");
-	sgeArrayAdd(array,e);
-	e=createElement(-1,1,"Element 2");
-	sgeArrayAdd(autoarray,e);
-
-	/* lets insert one at the beginning of the array */
-	e=createElement(2,3,"Element 3");
-	sgeArrayInsert(array,0,e);
-	e=createElement(2,3,"Element 3");
-	sgeArrayInsert(autoarray,0,e);
-
-	/* now use sgeArrayForEach function to display our array */
-	sgeArrayForEach(array, &printElement);
-
-	printf("...removing middle element\n");
-
-	/* on our normal array, we have to free the data by ourself */
-	e=sgeArrayGet(array,1);
-	sgeFree(e->name);
-	sgeFree(e);
-	sgeArrayRemove(array,1);
-
-	/* on out autoarray, our free function is called automatically */
-	sgeArrayRemove(autoarray, 1);
-
-	/* print content again */
-	sgeArrayForEach(array, &printElement);
-
-	/**
-	 * free our normal array (we have to free data by ourself).
-	 * Ofcourse we could have used sgeArrayForEach and define a 
-	 * helper function for freeing, but this way it looks more
-	 * complex ;)
-	 **/
-	while (array->numberOfElements>0) {
-		/* always remove element 0 because array gets smaller while removing */
-		e=sgeArrayGet(array,0);
-		sgeFree(e->name);
-		sgeFree(e);
-		sgeArrayRemove(array,0);
-	}
-	/* free the array itself */
-	sgeArrayDestroy(array);
-
-	/* free our autoarray, including all remaining elements */
-	sgeArrayDestroy(autoarray);
-
-	return 0;
-}
diff --git a/src/sge2d/demos/basic/.cvsignore b/src/sge2d/demos/basic/.cvsignore
deleted file mode 100644
index 15a13db4511332c27a869138fadd62696c650baf..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/basic/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-basic
diff --git a/src/sge2d/demos/basic/Makefile b/src/sge2d/demos/basic/Makefile
deleted file mode 100644
index c58ed43f2814fc1ba2460bc7562b32fe082f450b..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/basic/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-PROJECTNAME=basic
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
diff --git a/src/sge2d/demos/basic/basic b/src/sge2d/demos/basic/basic
deleted file mode 100755
index 05426672b27c467482ca0ee60b70610a98d9a104..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/basic/basic and /dev/null differ
diff --git a/src/sge2d/demos/basic/main.c b/src/sge2d/demos/basic/main.c
deleted file mode 100644
index 337457fd691f8d40e59da19c8d8967ffdc6e43fb..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/basic/main.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- * This is a basic demonstration of the minimum code for a gameloop using sge2d.
- *
- * It just plots out a red rectangle in the middle of the screen and waits for
- * the user to close the window.
- * */
-
-#include <sge.h>
-
-// define our data that is passed to our redraw function
-typedef struct {
-	Uint32 color;
-} MainStateData;
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state)
-{
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-
-	// draw a rectangle
-	//
-	// IMPORTANT: you should always lock and unlock surfaces if directly
-	// altering pixeldata, on some platforms, e.g. the gp2x, it will lead
-	// to a crash if you dont do so.
-	//
-	// you'll have to do so on most sgegfx.h functions. you do *NOT* need
-	// to lock a surface, if you blit on it (e.g. drawing sprites or using
-	// SDL_BlitSurface
-	sgeLock(screen);
-	sgeFillRect(screen, 100,100,120,40,data->color);
-	sgeUnlock(screen);
-
-	// finally display the screen
-	sgeFlip();
-}
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	MainStateData data;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("Basic SGE loop",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// this is just to demonstrate the use of the gamestate data
-	// everything added to the gamestate data will be available in the gamestates
-	// function (on_redraw on this example) as a 'global' data
-	data.color = sgeMakeColor(screen,0xff,0,0,0xff);
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/demos/collision/.cvsignore b/src/sge2d/demos/collision/.cvsignore
deleted file mode 100644
index 80b4e22700e99dfd35358e030c9df760abee83ed..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/collision/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-collision
diff --git a/src/sge2d/demos/collision/Makefile b/src/sge2d/demos/collision/Makefile
deleted file mode 100644
index 6fc81ad27ace7fd3da9689c1c1f1edb169599536..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/collision/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-PROJECTNAME=collision
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-data:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga asdf ./data.d sprite.png
diff --git a/src/sge2d/demos/collision/collision b/src/sge2d/demos/collision/collision
deleted file mode 100755
index d030a14440ad1559546a2ec4a542e02eafe9e27f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/collision/collision and /dev/null differ
diff --git a/src/sge2d/demos/collision/data.d b/src/sge2d/demos/collision/data.d
deleted file mode 100644
index b213e2ab13fe3d25dc442333737b291a89e215a4..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/collision/data.d and /dev/null differ
diff --git a/src/sge2d/demos/collision/main.c b/src/sge2d/demos/collision/main.c
deleted file mode 100644
index 07e0d395a5efebf97ecd7079588eb7f5556842c6..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/collision/main.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- *
- * This is a basic demonstration of the minimum code for a gameloop using sge2d.
- *
- * It just plots out a red rectangle in the middle of the screen and waits for
- * the user to close the window.
- * */
-
-#include <sge.h>
-
-// define a structure to hold our sprite and a random direction
-typedef struct {
-	SGESPRITE *sprite;
-	int dirx;
-	int diry;
-} SpriteInfo;
-
-// define our data that is passed to our redraw function
-typedef struct {
-	SGEARRAY *sprites;
-} MainStateData;
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state) {
-	int i,n,collided;
-	SpriteInfo *collider;
-	SpriteInfo *spriteinfo;
-
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-
-	// clear screen to black color
-	sgeClearScreen();
-
-	// loop through all sprites
-	for (i=0;i<data->sprites->numberOfElements;i++) {
-		// get the spriteinfo struct from the array
-		spriteinfo=sgeArrayGet(data->sprites, i);
-
-		// now move sprites and turn direction if the move over the screenborder
-		spriteinfo->sprite->x+=spriteinfo->dirx;
-		if ( (spriteinfo->dirx<0 && spriteinfo->sprite->x<0) || (spriteinfo->dirx>0 && spriteinfo->sprite->x>640-sgeSpriteWidth(spriteinfo->sprite)) ) {
-			spriteinfo->dirx*=-1;
-		}
-		spriteinfo->sprite->y+=spriteinfo->diry;
-		if ( (spriteinfo->diry<0 && spriteinfo->sprite->y<0) || (spriteinfo->diry>0 && spriteinfo->sprite->y>480-sgeSpriteHeight(spriteinfo->sprite)) ) {
-			spriteinfo->diry*=-1;
-		}
-
-		// check collision against all other sprites...
-		collided=0;
-		for (n=0;n<data->sprites->numberOfElements&&collided==0;n++) {
-			if (n!=i) { // ... except for itself
-				collider=sgeArrayGet(data->sprites,n);
-				if (sgeSpriteCollide(spriteinfo->sprite,collider->sprite)) {
-					collided=1;
-				}
-			}
-		}
-
-		// if collided, turn direction and move in the new direction
-		if (collided) {
-			if (collider->sprite->x>spriteinfo->sprite->x) {
-				spriteinfo->dirx=-1;
-				collider->dirx=1;
-			} else {
-				spriteinfo->dirx=1;
-				collider->dirx=-1;
-			}
-			if (collider->sprite->y>spriteinfo->sprite->y) {
-				spriteinfo->diry=-1;
-				collider->diry=1;
-			} else {
-				spriteinfo->diry=1;
-				collider->diry=-1;
-			}
-			spriteinfo->sprite->x+=spriteinfo->dirx*2;
-			spriteinfo->sprite->y+=spriteinfo->diry*2;
-		}
-
-		// finally draw the sprite
-		sgeSpriteDraw(spriteinfo->sprite, screen);
-	}
-
-	// finally display the screen
-	sgeFlip();
-}
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	SGEFILE *file;
-	SpriteInfo *spriteinfo;
-
-	MainStateData data;
-	int x,y;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("Basic SGE loop",640,480,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// now open the data file, encrypted with password 'asdf'
-	// the datafile is built with 'make data'
-	file=sgeOpenFile("data.d","asdf");
-
-	data.sprites=sgeArrayNew();
-
-	// we now create a array of sprites
-	for (y=0;y<480;y+=48) {
-		for (x=0;x<640;x+=48) {
-
-			// we hold our data in a SpriteInfo struct
-			sgeNew(spriteinfo, SpriteInfo);
-
-			// load the sprite and set starting positions
-			spriteinfo->sprite=sgeSpriteNewFile(file, "sprite.png");
-			spriteinfo->sprite->x=x;
-			spriteinfo->sprite->y=y;
-
-			// update position for collision detection
-			// handled automatically when drawing the sprite
-			// but because we check for collision before drawing
-			// we have to call this once
-			sgeSpriteUpdatePosition(spriteinfo->sprite);
-
-			// set random directions
-			if (sgeRandom(0,1)) {
-				spriteinfo->dirx=1;
-			} else {
-				spriteinfo->dirx=-1;
-			}
-			if (sgeRandom(0,1)) {
-				spriteinfo->diry=1;
-			} else {
-				spriteinfo->diry=-1;
-			}
-
-			// finally add our SpriteInfo struct to our state data...
-			sgeArrayAdd(data.sprites,(void *)spriteinfo);
-		}
-	}
-	sgeCloseFile(file);
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// used quitted, so we have to clean up all of our data
-	for (y=0;y<data.sprites->numberOfElements;y++) {
-		// we get the first (!!) element, you have to get the first, because
-		// later we will remove the current element and so the array will get
-		// one element smaller
-		spriteinfo=sgeArrayGet(data.sprites,0);
-		sgeSpriteDestroy(spriteinfo->sprite); // destroy the sprite itself
-		sgeFree(spriteinfo); // destroy the spriteinfo struct
-		sgeArrayRemove(data.sprites,0); // remove the first (!!) element
-	}
-	// free the array itself
-	sgeArrayDestroy(data.sprites);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/demos/collision/sprite.png b/src/sge2d/demos/collision/sprite.png
deleted file mode 100644
index 0ce8bf61fe2d749cd414666795a49866ea700abe..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/collision/sprite.png and /dev/null differ
diff --git a/src/sge2d/demos/font/Makefile b/src/sge2d/demos/font/Makefile
deleted file mode 100644
index 7b4c2fc97de0d95b6b3c0b22d611ac297eab189f..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/font/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-PROJECTNAME=font
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-data:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga asdf ./data.d font.png font.png.map retro_big_color.png retro_big_color.png.map
diff --git a/src/sge2d/demos/font/data.d b/src/sge2d/demos/font/data.d
deleted file mode 100644
index d4d2ae6b7478729c0c10f1dcf75c7350b4378678..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/font/data.d and /dev/null differ
diff --git a/src/sge2d/demos/font/font b/src/sge2d/demos/font/font
deleted file mode 100755
index 501187b27eea623a3d2112fd72abf70697afa99c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/font/font and /dev/null differ
diff --git a/src/sge2d/demos/font/font.png b/src/sge2d/demos/font/font.png
deleted file mode 100644
index cee7368b1e81e6ae565c42a541f2ffe13dab41ae..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/font/font.png and /dev/null differ
diff --git a/src/sge2d/demos/font/font.png.map b/src/sge2d/demos/font/font.png.map
deleted file mode 100644
index 6ffaf7a35d15935077ddc9b742b005248064846f..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/font/font.png.map
+++ /dev/null
@@ -1 +0,0 @@
-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!,.- 
diff --git a/src/sge2d/demos/font/main.c b/src/sge2d/demos/font/main.c
deleted file mode 100644
index 8baab2d5b3ab12685786de70419c742e182a736b..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/font/main.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- *
- * This is a demo for using a bitmap font
- *
- * A bitmap font consists of 2 files
- *
- * A graphic file, containing all font characters
- * in one line, with a vertical single pixel line
- * with RGB values (255,0,255) acting as a seperator
- *
- * A map file, containing the characters as they appear
- * in the graphics file.
- *
- * The mapfile has to be called the same name as the
- * graphics file, postfixed by .map
- *
- * See files font.png and font.png.map from this
- * directory as example
- *
- * */
-
-#include <sge.h>
-#include <math.h>
-
-// define our data that is passed to our redraw function
-typedef struct {
-	SGEFONT *font;
-	SGEFONT *fontbig;
-	char *text;
-	int offset;
-	float y;
-	int fontHeight;
-	int textWidth;
-	int currentFontNumber;
-	SGEFONT *currentFont;
-} MainStateData;
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state) {
-	char buf[2];
-	int i;
-	int x;
-	int width;
-	float yy;
-
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-	// switch font if user pressed y key (m on pc)
-	if (es.y.released) {
-		data->currentFontNumber=(data->currentFontNumber+1)%2;
-		if (data->currentFontNumber) {
-			data->currentFont=data->fontbig;
-		} else {
-			data->currentFont=data->font;
-		}
-		data->fontHeight=sgeFontGetLineHeight(data->currentFont);
-		data->textWidth=sgeFontGetWidth(data->currentFont, data->text);
-	}
-
-	// prepare data
-	sgeClearScreen();
-	yy=data->y;
-	// our string has to be 0 terminated
-	strcpy(buf, " ");
-	x=data->offset;
-
-	// print every character
-	for (i=0;i<strlen(data->text);i++) {
-		// copy next char to buffer
-		sprintf(buf, "%c", data->text[i]);
-
-		// now print our character
-		//
-		// we use sgeFontPrintBitmap instead of sgeFontPrint
-		// as sgeFontPrint is only a wrapper, so it will execute
-		// faster
-		//
-		// do this only if can be sure, that the font is a
-		// bitmap font
-		width=sgeFontPrintBitmap(data->currentFont, screen, x, (cos(yy)+1)*(120-(data->fontHeight>>1)), buf);
-		x+=width;
-		yy+=.05;
-	}
-
-	// scroll to the left, increase cos startvalue
-	data->offset-=data->currentFontNumber*2+2;
-	data->y+=.1;
-
-	// check if we have to restart the text
-	if (abs(data->offset)>data->textWidth) {
-		data->offset=320;
-	}
-
-	sgeFontPrintBitmap(data->font, screen, 10, 200, "m - Toggle font");
-
-	// finally display the screen
-	sgeFlip();
-}
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	SGEFILE *f;
-	MainStateData data;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("SGE Bitmap Font",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// prepare the data
-	data.text=(char *)&"Hello World! This is a little demonstration of SGE bitmap font. See font.png and font.png.map as a example how to set up the font data. ";
-	data.offset=320;
-	data.y=.0;
-
-	// load the bitmap font from the data file
-	f=sgeOpenFile("data.d","asdf");
-	data.font=sgeFontNewFile(f, SGEFONT_BITMAP, "font.png");
-	data.fontbig=sgeFontNewFile(f, SGEFONT_BITMAP, "retro_big_color.png");
-	sgeCloseFile(f);
-
-	// precalc needed values for more speed
-	data.fontHeight=sgeFontGetLineHeight(data.font);
-	data.textWidth=sgeFontGetWidth(data.font, data.text);
-	data.currentFontNumber=0;
-	data.currentFont=data.font;
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// clean up
-	sgeFontDestroy(data.font);
-	sgeFontDestroy(data.fontbig);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/demos/font/retro_big_color.png b/src/sge2d/demos/font/retro_big_color.png
deleted file mode 100644
index f1174ee40d9d4e5161392aa1ddd7823ac90383b6..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/font/retro_big_color.png and /dev/null differ
diff --git a/src/sge2d/demos/font/retro_big_color.png.map b/src/sge2d/demos/font/retro_big_color.png.map
deleted file mode 100644
index b9120188a36e407066ad332edd92ed9ed676d4e5..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/font/retro_big_color.png.map
+++ /dev/null
@@ -1 +0,0 @@
-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.!-+*/_@":;()%$ 
diff --git a/src/sge2d/demos/particles/.cvsignore b/src/sge2d/demos/particles/.cvsignore
deleted file mode 100644
index ebf144055f8070e2325840d0239e73afbdaff56b..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/particles/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-particles
diff --git a/src/sge2d/demos/particles/Makefile b/src/sge2d/demos/particles/Makefile
deleted file mode 100644
index 1c308d3560b76f3b734aa6025b99b20f32803507..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/particles/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-PROJECTNAME=particles
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-data: datafiles
-datafiles:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga asdf ./data.d cloud.png
diff --git a/src/sge2d/demos/particles/cloud.png b/src/sge2d/demos/particles/cloud.png
deleted file mode 100644
index 457f2f8f600974d31bffa015e0e6842671b1cc77..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/particles/cloud.png and /dev/null differ
diff --git a/src/sge2d/demos/particles/data.d b/src/sge2d/demos/particles/data.d
deleted file mode 100644
index 7d3a87406b33dbbfd1bf0c02a6e470c8e1b8c75a..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/particles/data.d and /dev/null differ
diff --git a/src/sge2d/demos/particles/main.c b/src/sge2d/demos/particles/main.c
deleted file mode 100644
index 56d17ddd10fb8fa2a3908cb53b04146f10f26df4..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/particles/main.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- *
- * This is a basic demonstration of particle emitters
- *
- * The configuration variables on particles are:
- *
- * emission - how much particles per frame are created
- * speed - how fast are the particles moving
- * angle - angle of the particle emitter in degrees.
- *         0 degrees is to the right, 270 to the top
- * gravity - vertical speed increase/decrease per frame
- *
- * you can add random behaviour by the variables
- *
- * emissionDistribution
- * speedDistribution
- * angleDistribution
- *
- * e.g. a angleDistribution of 60 would and a angle of 90
- * would mean the particles varying randomly between 60-120
- *
- * all variables are float
- *
- * */
-
-#include <sge.h>
-
-// define our data that is passed to our redraw function
-typedef struct {
-	SGEPARTICLES *pixelparticles;
-	SGEPARTICLES *spriteparticles;
-} MainStateData;
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state)
-{
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-
-	sgeClearScreen();
-
-	// rotate the pixel particles by 5 degrees/frame
-	data->pixelparticles->angle+=5;
-	// draw the pixel particles
-	sgeParticlesDraw(data->pixelparticles);
-
-	// move the spriteparticles in a smooth motion across the screen
-	data->spriteparticles->x=cos(M_PI/180*(data->spriteparticles->runtime%360))*140+160;
-	// draw the sprite particles
-	sgeParticlesDraw(data->spriteparticles);
-
-	// finally display the screen
-	sgeFlip();
-}
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	SGEFILE *file;
-	SGESPRITE *sprite;
-	MainStateData data;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("SGE Particles",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a pixel particle emitter
-	// rgb color range between 0x20/0x80/0x20 and 0xff/0xff/0x30
-	data.pixelparticles=sgeParticlesPixelNew(0x20,0x80,0x20,0xff,0xff,0x30);
-	data.pixelparticles->x=160;
-	data.pixelparticles->y=50;
-	data.pixelparticles->speed=2;
-	// emit particles into the angle direction +/- 8
-	data.pixelparticles->angle=90;
-	data.pixelparticles->angleDistribution=16;
-	// let the particles die after 50 frames
-	data.pixelparticles->timeToLive=50;
-	// +/- 10
-	data.pixelparticles->timeToLiveDistribution=20;
-
-
-	// read the sprite for using it with a sprite particle emitter
-	file=sgeOpenFile("data.d","asdf");
-	sprite=sgeSpriteNewFile(file, "cloud.png");
-	sgeCloseFile(file);
-
-	// add the sprite particle emitter
-	data.spriteparticles=sgeParticlesSpriteNew(sprite);
-	data.spriteparticles->emission=10;
-	data.spriteparticles->y=220;
-	// add negative gravity so the particles increase
-	// its speed upwards
-	data.spriteparticles->gravity=-.1;
-	data.spriteparticles->angle=270;
-	data.spriteparticles->angleDistribution=90;
-	data.spriteparticles->timeToLive=120;
-	data.spriteparticles->timeToLiveDistribution=140;
-	data.spriteparticles->speed=.5;
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// clean up
-	sgeParticlesDestroy(data.pixelparticles);
-	sgeParticlesDestroy(data.spriteparticles);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
-
diff --git a/src/sge2d/demos/particles/particles b/src/sge2d/demos/particles/particles
deleted file mode 100755
index 1bca80a8c82dcac90475b3cdc18a369dec0993ac..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/particles/particles and /dev/null differ
diff --git a/src/sge2d/demos/pathfinding/.cvsignore b/src/sge2d/demos/pathfinding/.cvsignore
deleted file mode 100644
index 5e92892d6ee21b99cce2d706328afd4625459b2c..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/pathfinding/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-pathfinding
diff --git a/src/sge2d/demos/pathfinding/Makefile b/src/sge2d/demos/pathfinding/Makefile
deleted file mode 100644
index 303406a1e86a80d5f864d2aee3aa3f5ad82ac30a..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/pathfinding/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-PROJECTNAME=pathfinding
-SGEDIR=../..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
-
-data:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga asdf ./data.d font.png font.png.map
diff --git a/src/sge2d/demos/pathfinding/data.d b/src/sge2d/demos/pathfinding/data.d
deleted file mode 100644
index e8110d9d52b9d96fa578ed935eb92b56ee536f42..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/pathfinding/data.d and /dev/null differ
diff --git a/src/sge2d/demos/pathfinding/font.png b/src/sge2d/demos/pathfinding/font.png
deleted file mode 100644
index 366c03ade8a9de335f97595dc9d88d8722ce4287..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/pathfinding/font.png and /dev/null differ
diff --git a/src/sge2d/demos/pathfinding/font.png.map b/src/sge2d/demos/pathfinding/font.png.map
deleted file mode 100644
index 6ffaf7a35d15935077ddc9b742b005248064846f..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/pathfinding/font.png.map
+++ /dev/null
@@ -1 +0,0 @@
-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!,.- 
diff --git a/src/sge2d/demos/pathfinding/main.c b/src/sge2d/demos/pathfinding/main.c
deleted file mode 100644
index 99624b3b5efa327765c98e90ce18d4cc42e03ddb..0000000000000000000000000000000000000000
--- a/src/sge2d/demos/pathfinding/main.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- *
- * This is a basic pathfinding demonstration
- *
- * we will generate a random maze and will try to
- * find the way from the lower left corner to the
- * upper right corner
- *
- * */
-
-#include <sge.h>
-
-#define STEP_X 16
-#define STEP_Y 16
-
-// define our data that is passed to our redraw function
-typedef struct {
-	SGEPATHFINDER *pathFinder;
-	int found;
-	SGEFONT *font;
-	int leftStart;
-	int rightStart;
-	int disableDiagonal;
-} MainStateData;
-
-void doPathFind(MainStateData *data) {
-	int x,y;
-
-	// create a random pathfinder environment
-	for (y=0;y<240/STEP_Y;y++) {
-		for (x=0;x<320/STEP_X;x++) {
-			if (sgeRandom(0,100)<30) {
-				sgePathFinderSet(data->pathFinder,x,y,1);
-			} else {
-				sgePathFinderSet(data->pathFinder,x,y,0);
-			}
-		}
-	}
-
-	// set random startpoints left and right
-	data->leftStart=sgeRandom(0,240/STEP_Y-1);
-	data->rightStart=sgeRandom(0,240/STEP_Y-1);
-
-	// ensure that start end endpoint are never blocked
-	sgePathFinderSet(data->pathFinder,320/STEP_X-1,data->rightStart,0);
-	sgePathFinderSet(data->pathFinder,0,data->leftStart,0);
-
-	// now find the path, if possible
-	data->found=sgePathFinderFind(data->pathFinder, 0, data->leftStart, 320/STEP_X-1, data->rightStart);
-}
-
-// redraw the screen and update game logics, if any
-void on_redraw(SGEGAMESTATE *state) {
-	int x,y;
-	int xx=0,yy=0;
-	SGEPATHFINDERINFO *pi;
-
-	// prepare event and data variable form the gamestat passed to that
-	// function
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-
-	// has the user closed the window?
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-	// redraw on space/fire
-	if (es.fire.pressed) {
-		doPathFind(data);
-		sgeClearScreen();
-	}
-	// toggle diagonal movement on m_key/y_button
-	if (es.y.released) {
-		data->disableDiagonal=(data->disableDiagonal+1)%2;
-		sgePathFinderDiagonal(data->pathFinder, data->disableDiagonal);
-		sgeClearScreen();
-	}
-
-	// print the maze
-	yy=0;
-	for (y=0;y<240;y+=STEP_Y) {
-		xx=0;
-		for (x=0;x<320;x+=STEP_X) {
-			if (sgePathFinderGet(data->pathFinder,xx,yy)) {
-				sgeFillRect(screen, x, y, STEP_X, STEP_Y, sgeMakeColor(screen,0xff,0,0,0xff));
-			}
-			xx++;
-		}
-		yy++;
-	}
-
-	// print the path or a error message if no path was possible
-	if (data->found) {
-		for (x=0;x<data->pathFinder->path->numberOfElements;x++) {
-			pi=sgeArrayGet(data->pathFinder->path, x);
-			sgeFillRect(screen, pi->x*STEP_X, pi->y*STEP_Y, STEP_X, STEP_Y, sgeMakeColor(screen,0,0xff,0,0xff));
-		}
-	} else {
-		sgeFontPrintBitmap(data->font, screen, 10, 10, "No possible solution");
-	}
-	// print start/end point in extra colors
-	sgeFillRect(screen, 0, data->leftStart*STEP_Y, STEP_X, STEP_Y, sgeMakeColor(screen,0xff,0,0xff,0xff));
-	sgeFillRect(screen, 320-STEP_X, data->rightStart*STEP_Y, STEP_X, STEP_Y, sgeMakeColor(screen,0xff,0,0xff,0xff));
-
-	if (data->disableDiagonal==ENABLE_DIAGONAL) {
-		sgeFontPrintBitmap(data->font, screen, 10, 200, "m - Toggle diagonal - on");
-	} else {
-		sgeFontPrintBitmap(data->font, screen, 10, 200, "m - Toggle diagonal - off");
-	}
-	sgeFontPrintBitmap(data->font, screen, 10, 220, "space - Redraw");
-	// finally display the screen
-	sgeFlip();
-}
-
-
-// this is the main function, you don't use main(), as this is handled different
-// on some platforms
-int run(int argc, char *argv[]) {
-	SGEFILE *f;
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	MainStateData data;
-
-	// initialize engine and set up resolution and depth
-	sgeInit(NOAUDIO,NOJOYSTICK);
-	sgeOpenScreen("Basic SGE loop",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	// add a new gamestate. you will usually have to add different gamestates
-	// like 'main menu', 'game loop', 'load screen', etc.
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	// create the pathfinder
-	data.pathFinder=sgePathFinderNew(320/STEP_X,240/STEP_Y);
-
-	// enable diagonal movement by default
-	data.disableDiagonal=ENABLE_DIAGONAL;
-
-	// generate maze and find path of random start/end points
-	doPathFind(&data);
-
-	// load the bitmap font from the data file
-	f=sgeOpenFile("data.d","asdf");
-	data.font=sgeFontNewFile(f, SGEFONT_BITMAP, "font.png");
-	sgeCloseFile(f);
-
-	// now finally create the gamestate manager and change to the only state
-	// we defined, which is the on_redraw function
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-
-	// start the game running with 30 frames per seconds
-	sgeGameStateManagerRun(manager, 30);
-
-	// clean up
-	sgePathFinderDestroy(data.pathFinder);
-	sgeFontDestroy(data.font);
-
-	// close the screen and quit
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/demos/pathfinding/pathfinding b/src/sge2d/demos/pathfinding/pathfinding
deleted file mode 100755
index 5501dae0bc5e2eb15d464d93e960bd679f043709..0000000000000000000000000000000000000000
Binary files a/src/sge2d/demos/pathfinding/pathfinding and /dev/null differ
diff --git a/src/sge2d/doc/about.html b/src/sge2d/doc/about.html
deleted file mode 100644
index 2278307b99254a26d6400e8e1f561bc8b99ef361..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/about.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>WARNING</h1>
-		<p>The SDL Game Engine is under heavy development, the documentation may be out of date.</p>
-		<p>It is recommended to have a look at the demos directory, which will be kept up to date.</p>
-		<h1>SDL Game Engine</h1>
-		<p>The <b>SDL Game Engine</b> (or SGE in short) is high level multi platform 2d game engine.</p>
-		<p>It is current in a very basic state and API calls may or may not change in the
-		future.</p>
-		<p>SGE is work in progres, so you should check <a href="http://www.sf.net/projects/sge2d" target="_blank">The sge2d sourceforge page</a> regularly</p>
-		<p>Note due to a name conflict the sourceforge project is named <b>sge2d</b></p>
-		<p>So why another 2D game engine you may ask, and the answer is easy: because i did not
-		find one that fitted my needs. This engine is geared towards multi platform devlopment
-		and other then most engines, we do not understand multiplatform as linux, mac and windows.</p>
-		<p>It runs on little and big endian systems and currently supports Linux, BSD,
-		Windows (through mingw), gp2x crosscompilation (on Linux), Syllable. For the near(er) future it is planned
-		to also get it running (if not already) on AmigaOS 4 (maybe 3), AROS, MacOSX, MorphOS, SkyOS.
-		The porting should be easy through two little things:</p>
-		<ul>
-			<li>Low depencies. It only depends on C, SDL, SDL_image and SDL_mixer</li>
-			<li>Custom build system. Should be portable to any platform make is
-			available by copying a config file and (maybe) changing a bunch of variables</li>
-		</ul>
-		<p>Main features for now are:</p>
-		<ul>
-			<li>Game states</li>
-			<li>Encrypted data files</li>
-			<li>Pixel exact sprite collision</li>
-			<li>Animated sprites supporting waypoints as a animation path</li>
-			<li>Basic drawing functions</li>
-			<li>Easy API and helpful macros to speed up development</li>
-		</ul>
-	</body>
-</html>
diff --git a/src/sge2d/doc/default.Makefile b/src/sge2d/doc/default.Makefile
deleted file mode 100644
index 1e3581e0d8888d566eccd435e92c5f8d52b43a16..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/default.Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-PROJECTNAME=__YOUR_PROJECT__
-
-include ../../setup.project
-include ../../setup.$(PLATFORM)
-
-TARGET=$(PROJECTNAME)$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I../../include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-%.o:%.c
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) ../../libsge.a $(STATICLIBS)
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
diff --git a/src/sge2d/doc/index.html b/src/sge2d/doc/index.html
deleted file mode 100644
index 5378d4c2a0dd8cd9b9cdb5efc19be5438e99a862..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/index.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-	</head>
-	<frameset cols="20%, 80%">
-		<frameset rows="100, 200">
-			<frame src="maintoc.html">
-			<frame name="nav" src="tutorialtoc.html">
-		</frameset>
-		<frame name="main" src="about.html">
-		<noframes>
-			You need a frame cabable browser
-		</noframes>
-	</frameset>
-</html>
diff --git a/src/sge2d/doc/license.html b/src/sge2d/doc/license.html
deleted file mode 100644
index 7d6d2b4df33976a45cfa772d6f5cbf59070d158d..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/license.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>SDL Game Engine</h1>
-		The <b>SDL Game Engine</b> is licensed under MIT License:
-		<pre>
-Copyright (c) 2007 Heiko Irrgang
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-</pre>
-</body>
-</html>
diff --git a/src/sge2d/doc/maintoc.html b/src/sge2d/doc/maintoc.html
deleted file mode 100644
index 0f10ef532a127e7ff87ef6c6efcc4377c5de28bb..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/maintoc.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-	</head>
-	<body bgcolor="#ffffff">
-		<h3>SDL Game Engine</h3>
-		<a href="about.html" target="main">About</a><br />
-		<a href="license.html" target="main">License</a><br />
-		<a href="tutorialtoc.html" target="nav">Tutorial</a><br />
-	</body>
-</html>
diff --git a/src/sge2d/doc/sge.css b/src/sge2d/doc/sge.css
deleted file mode 100644
index 5d0a4c66ddb60b8262ab4b512ca5b580efc0db70..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/sge.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.codeblock {
-	background-color: #ebebeb;
-	padding: 30px 30px 30px 30px;
-}
-
-pre {
-	background-color: #ebebeb;
-	padding: 30px 30px 30px 30px;
-}
diff --git a/src/sge2d/doc/tutorialbasicloop.html b/src/sge2d/doc/tutorialbasicloop.html
deleted file mode 100644
index 1955a20ae8167cc0d99588492f372a7858ff2cef..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialbasicloop.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-		<link href="sge.css" rel="StyleSheet" type="text/css">
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>Tutorial</h1>
-		<h3>A basic gameloop</h3>
-		<p>So lets directly go for our first gameloop. Detailed description follows later:</p>
-<pre>#include &lt;sge.h&gt;
-
-void game() {
-	int quit=0;
-	SDL_Event event;
-	sgeGameLoop(event,quit) {
-		switch (event.type) {
-			case SDL_USEREVENT:
-				if (event.user.code==SGEREDRAW) {
-					sgeClearScreen();
-					sgeDrawRect(screen,10,20,30,40,2,sgeMakeColor(0xff,0,0,-1));
-					sgeFlip();
-				}
-				break;
-			case SDL_KEYUP:
-				if (event.key.keysym.sym==SDLK_ESCAPE) {
-					quit=1;
-				}
-				break;
-			case SDL_QUIT:
-				quit=1;
-				break;
-		}
-	}
-}
-
-int run(int argc, char *argv[]) {
-	sgeInit(NOAUDIO,JOYSTICK);
-	sgeOpenScreen("mygame",640,480,32,NOFULLSCREEN);
-	sgeStartGame(game, 25);
-	sgeCloseScreen();
-	return 0;
-}
-</pre>
-		<p>First thing every SGE game has to do is include the sge header file <b>sge.h</b>:</p>
-		<pre>#include &lt;sge.h&gt;</pre>
-		<p>As C programmer you usually start your applications with a basic function called main().
-		You <b>do not do this with SGE</b>. You define a function called <b>run()</b> which takes the
-		same params as main(), as entry function names may be named other than main() on several
-		platforms.</p>
-		<pre>int run(int argc, char *argv[]) {
-}</pre>
-		<p>SGE has to be initialized. This should be your first step in any game you make. SGE does take
-		away some unnecessary typing from the programmer, so you do not have to check if the init failed.
-		SGE will print out some error message and quit by itself.</p>
-		<pre>sgeInit(NOAUDIO,JOYSTICK);</pre>
-		<p>The three params used by sgeInit() tell SGE which subsystems should be initialized and should be: NOAUDIO/AUDIO, NOJOYSTICK/JOYSTICK</p>
-		<p>Then we need a screen to draw on. Again there is no error checking necesarry.</p>
-		<pre>sgeOpenScreen("mygame",640,480,32,NOFULLSCREEN);</pre>
-		<p>The first string sets the string displayed in the window border. Next two values (640,480) is the resolution the display should be opened, followed by the needed bitdepth (32) and a param which selects if the screen opens fullscreen (FULLSCREEN) or not (NOFULLSCREEN)</p>
-		<p>From now on you can access the screen through the global variable <b>screen</b> which is a SDL_Surface.</p>
-		<p>Next we start the game loop. The function starts a redraw timer with 25 frames per second and runs the function <b>game()</b>.</p>
-		<pre>sgeStartGame(game, 25);</pre>
-		<p>In our <b>game()</b> function, we define two variables and start our main gameloop.</p>
-		<pre>void game() {
-	int quit=0;
-	SDL_Event event;
-	sgeGameLoop(event,quit) {
-	}</pre>
-		<p>The sgeGameLoop() function takes a SDL_Event structure and a integer variable which tells it to quit.</p>
-		<p>In the following switch() there are three event blocks captured:</p>
-		<pre>
-			case SDL_USEREVENT:
-				if (event.user.code==SGEREDRAW) {
-					sgeClearScreen();
-					sgeDrawRect(screen,10,20,30,40,2,sgeMakeColor(0xff,0,0,-1));
-					sgeFlip();
-				}
-				break;</pre>
-
-		<p>Every time a frame has to be redrawn, a userevent is triggered, giving usercode SGEREDRAW</p>
-		<p>sgeClearScreen() clears the screen (surprise, eh?)</p>
-		<p>sgeDrawRect() draws a rectangle, which is not filled. There are a bunch of params to it. First you need it
-		to tell where to draw (screen), then the x and y coords where to draw (10,20) and the width and height of
-		the rectangle (30,40). The next param is the linewidth (2) followed by a color to draw with.</p>
-		<p>The color is generated by a call to sgeMakeColor() which takes the rgb values of the color - a full red in this
-		example, plus a alpha value. A alpha value of -1 means: no alpha used at all, whereas 0-255 would mean, fully transprarent
-		to fully opaque.</p>
-		<p>Every time you have finished drawing a frame, you have to use sgeFlip() to show your newly drawn stuff. You will not see
-		anything until you use sgeFlip()</p>
-		<p>The next two blocks handle possible user requests to quit the game loop:</p>
-		<pre>
-			case SDL_KEYUP:
-				if (event.key.keysym.sym==SDLK_ESCAPE) {
-					quit=1;
-				}
-				break;
-			case SDL_QUIT:
-				quit=1;
-				break;</pre>
-		<p>On the first case, we check if the user pressed escape, the second case checks for the user having closed the window.</p>
-	</body>
-</html>
diff --git a/src/sge2d/doc/tutorialfiles.html b/src/sge2d/doc/tutorialfiles.html
deleted file mode 100644
index b5fa9dcdb841857f9f1195ff63f9a942c947bea7..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialfiles.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-		<link href="sge.css" rel="StyleSheet" type="text/css">
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>Tutorial</h1>
-		<h3>Using Encrypted Datafiles</h3>
-		<p>After building the library, you find a command line tool named <b>sga</b> in the tools directory.</p>
-		<p>This program is for creating encrypted data files that you can later use for loading your images, music, sprites and other files.</p>
-		<p>To create a archive file you use the following syntax:</p>
-<pre>./sga mysecretkey myfile.dat data/myimage.png data/mymusic.ogg data/mylogo.jpg</pre>
-		<p>This will generate a file called myfile.dat holding all following files with filenames relative to the actual position and encrypting
-		it with the password 'mysecretkey'</p>
-		<h3>About the encryption</h3>
-		<p>The files are encrypted by a simple XOR operation against the characters of your password. This is a very quick but weak encryption.
-		Do not use it to store any extremly sensitive data, it is easy decryptable as soon as someone knows the password. So dont use any passwords like
-		'mysecretpassword' or something like that, the password will be clearly viewable in the binary executable of your game. It would be a wise choice to
-		choose some text that is displayed somewhere in the game, so it is not so obvious.</p>
-		<p>The command has currently no sanity checks at all so it refuses to overwrite existing files as a protection against data loss though.
-		wrong parameter calls. You'll have to remove the data file first to be able to update your data.</p>
-		<p>The resulting files may have any size (depending on the operating system your game runs on), they are not read completely into ram, only
-		necessary ram for loading the named file is used.</p>
-		<h3>So here's my data, now what?</h3>
-		<p>First you have to open the file:</p>
-		<pre>SGEFILE *myfile=sgeOpenFile("myfile.dat","mysecretkey");</pre>
-		<p>Again, checking if the file open did work is not necessary, SGE will bail out if it fails.</p>
-		<p>You can then load your data with a range of available functions. Here are some examples, they should be pretty obvious what they are doing,
-		for now, you need just to know that they load data from your archive, you'll get more details about this functions later:</p>
-		<pre>SGESPRITE *mysprite=sgeSpriteNewFile(myfile, "data/myimage.png");
-SGEANIMATEDSPRITE *myanimsprite=sgeAnimatedSpriteNewFileRange(myfile, "data/anim%04d.png", 1, 20);
-SGESOUND *mymusic=sgeSoundNew(myfile, "data/mymusic.ogg");</pre>
-		<p>When you're done loading your data, you close the file with:</p>
-		<pre>sgeCloseFile(myfile);</pre>
-	</body>
-</html>
diff --git a/src/sge2d/doc/tutorialprepare.html b/src/sge2d/doc/tutorialprepare.html
deleted file mode 100644
index 6f8841dd7cf3277d65dec157f0106ab1faf91a5f..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialprepare.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-		<link href="sge.css" rel="StyleSheet" type="text/css">
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>Tutorial</h1>
-		<h3>Preparing your project</h3>
-		<p>The <b>SDL Game Engine</b> (or SGE) does not yet provide a installation and is planned to be a static library so the user does not have any dependencies for running games built with it.</p>
-		<p>To start a new project, just create a folder, e.g. projects/myproject <b>within</b> SGE's source directory.</p>
-		<p>Copy the file <b>default.Makefile</b> found in SGE's <b>doc</b> directory over to your new directory and name it <b>Makefile</b></p>
-		<p>Edit the Makefile in your new directory, you'll find a line saying:</p>
-		<p class="codeblock">PROJECTNAME=__YOUR_PROJECT__</p>
-		<p>You may have already guessed it: just rename __YOUR_PROJECT__ with the name your binary should be named.</p>
-		<p>In this Makefile you'll find a row saying:</p>
-		<p class="codeblock">OBJ=main.o</p>
-		<p>This line shows the build system, that there is a file named main.c containing your code. So you should start
-		your project in a file called main.c . Ofcourse you can rename it, but don't forget to also rename the line
-		mentioned above.</p>
-		<p>If you need more than one file for your project, just add them <b>before</b> the main.o with a <b>.o</b> suffix.
-		So if you'll have the main loop of your game in a file called game.<b>c</b>, the line would be:</p>
-		<p class="codeblock">OBJ=game.o main.o</p>
-		<h3>WARNING</h3>
-		<p><b>Do not add the files with the .c suffix, or your files will be deleted on a make clean!</b></p>
-		<p>You are now prepared to build your project by typing <b>make</b> or clean it up by typing <b>make clean</b></p>
-	</body>
-</html>
diff --git a/src/sge2d/doc/tutorialsprites.html b/src/sge2d/doc/tutorialsprites.html
deleted file mode 100644
index 6c02e4aeba9d69670dd70280f0a457dbc7707d5a..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialsprites.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-		<link href="sge.css" rel="StyleSheet" type="text/css">
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>Tutorial</h1>
-		<h3>Using Sprites</h3>
-		<p>SGE does offer some easy functions for handling your sprite data.</p>
-		<p>There are several ways how you can handle sprites:</p>
-		<ul>
-			<li><b>SGESPRITE</b> - A sprite which can have several images playing at a user definalbe speed (frames per seconds)</li>
-			<li><b>SGESPRITEGROUP</b> - A container to easy up handling of larger groups of sprites (e.g. colliding the player sprite against a horde of enemies)</li>
-		</ul>
-		<p>From now on all examples will assume you have a <a href="tutorialfiles.html">SGEFILE</a> open called <b>myfile</b>.</p>
-		<h3>SGESPRITE</h3>
-		<p>There are two functions for loading images. One to add a single image, it adds images to the end of the animation, and one to load a full range of images in one step.</p>
-		<p>To create a animated sprite and add single images you would do:</p>
-		<pre>SGESPRITE *player=sgeSpriteNew();
-sgeSpriteAddFile(player, myfile, "data/playerframeone.png");
-sgeSpriteAddFile(player, myfile, "data/playerframetwo.png");</pre>
-		<p>To ease up loading, you can load a range of images in one step. The files have to be named with a numeric value, e.g. player001.png, player002,png, player003.png ....</p>
-		<p>You would load a range of images like this:</p>
-		<pre>SGESPRITE *player=sgeSpriteNew();
-sgeSpriteAddFileRange(player, myfile, "data/player%03d.png, 1, 20);</pre>
-		<p>This would load images from player001.png to player020.png. The format of the filename string is as it would be for printf, in this case, %03d means, insert a number with 3 digits and leading with zeros, from 1 to 20.</p>
-		<p>To draw the sprites use:</p>
-		<pre>sgeSpriteDraw(myanimatedsprite, screen);
-sgeSpriteDrawXY(myanimatedsprite, 100, 50, screen);</pre>
-		<p>The first would draw the sprite on its internal x/y coordinates, whereas the second draws it on a specific x/y coordinate to the screen</p>
-		<p>To detect collision between sprites, there are two functions:</p>
-		<pre>sgeSpriteCollide(animsprite1, snimsprite2);</pre>
-		<p>Which does a pixel exact collision detection and returns 1 if sprites are colliding</p>
-		<pre>sgeSpriteBoxCollide(animsprite1, snimsprite2);</pre>
-		<p>Which does a bounding box collision detection. It is faster than pixel exact collision detection, so if you dont need pixel exact collision, you should use this function.</p>
-		<p>To free resources of a animated sprite call:</p>
-		<pre>sgeSpriteDestroy(myanimatedsprite);</pre>
-		<h3>SGESPRITEGROUP</h3>
-		<p>Spritegroups are a easy way to handle a bunch of sprites that are belonging to a certain group, e.g. bullets, enemies, players.</p>
-		<p>After creating a spritegroup by calling:</p>
-		<pre>SGESPRITEGROUP *mygroup=sgeSpriteGroupNew();</pre>
-		<p>...you can add simple sprites with:</p>
-		<pre>sgeSpriteGroupAddSprite(mygroup, mysprite);</pre>
-		<p>To draw a whole sprite group at once, just call:</p>
-		<pre>sgeSpriteGroupDraw(mygroup);</pre>
-		<p>Collision detection provides 3 functions, one for checking if two groups collide:</p>
-		<pre>sgeSpriteGroupCollide(mygroup, myothergroup);</pre>
-		<p>one for checking, if a simple sprite collides against a group:</p>
-		<pre>sgeSpriteGroupCollideSprite(mygroup, mysprite);</pre>
-		<p>To free resources of a sprite group call:</p>
-		<pre>sgeSpriteGroupDestroy(mygroup);</pre>
-	</body>
-</html>
diff --git a/src/sge2d/doc/tutorialstages.html b/src/sge2d/doc/tutorialstages.html
deleted file mode 100644
index 7224c8fe00e8c65fd9fba4588bfa759234577366..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialstages.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-		<link href="sge.css" rel="StyleSheet" type="text/css">
-	</head>
-	<body bgcolor="#ffffff">
-		<h1>Tutorial</h1>
-		<h3>Stages</h3>
-		<p>SGE's stages are some kine of world, holding sprites and background layers.
-		They are usefull for parallax scrolling games like jump&amp;run's or sidescroll shooters.
-		Basically they are a container for different graphic layers of different sizes and one layer
-		containing spritegroups.</p>
-		<p>The examples assume, that you have opened a data file on the varialbe <b>myfile</b></p>
-		<h3>Setup</h3>
-		<p>First you have to set up the stage:</p>
-		<pre>SGESTAGE *stage;
-SGESPRITEGROUP *enemies;
-SGESPRITE *tmpenemy;
-SGESPRITE *player=sgeSpriteNewFile(myfile, "data/player.png");;
-
-stage=sgeStageNew(6400, 480);
-enemies=sgeSpriteGroupNew();
-sgeStageAddSpriteGroup(stage, enemies);
-
-tmpenemy=sgeSpriteNewFile(myfile, "data/enemy1.png");
-tmpenemy->x=3000;
-tmpenemy->y=100;
-sgeSpriteGroupAddSprite(enemies, tmpenemy);
-
-tmpenemy=sgeSpriteNewFile(myfile, "data/enemy2.png");
-tmpenemy->x=1000;
-tmpenemy->y=250;
-sgeSpriteGroupAddSprite(enemies, tmpenemy);
-
-sgeStageAddLayer(stage, sgeSpriteNewFile(tmp, "data/backgroundlayer.png"), 0, 0);
-sgeStageSetLayerHeight(stage,
-	sgeStageAddLayer(stage, sgeSpriteNewFile(tmp, "data/foregroundlayer.png"), 0, 240),
-	800);
-</pre>
-		<p>First we have to create the stage:</p>
-		<pre>stage=sgeStageNew(6400, 480);</pre>
-		<p>This will create a stage, of a size 6400 x 480. The stage will have to variables that let you control the camera position
-		of this stage: stage->cameraX and stage->cameraY.</p>
-		<p>Then we add a spritegoup that will contain our enemies:</p>
-		<pre>enemies=sgeSpriteGroupNew();
-sgeStageAddSpriteGroup(stage, enemies);</pre>
-		<p>We then add two enemy sprites and set them within our 6400x480 world.</p>
-		<pre>tmpenemy=sgeSpriteNewFile(myfile, "data/enemy1.png");
-tmpenemy->x=1000;
-tmpenemy->y=250;
-sgeSpriteGroupAddSprite(enemies, tmpenemy);</pre>
-		<p>Lets add a background layer. Layers have to be at least as big as the screen resolution, but can be a lot bigger.
-		The two zeros at the end of the command set the offset the layer will have to the <b>camera</b> resolution. We do not want
-		one for the background layer.</p>
-		<pre>sgeStageAddLayer(stage, sgeSpriteNewFile(tmp, "data/backgroundlayer.png"), 0, 0);</pre>
-		<p>Now comes a little tricky thing. We'll set up a foreground layer. The foregroundlayer is 240 pixel in height, so assuming,
-		our screen resolution would be 640x480, it would cover half of the screen. We want it to look like scrolling in front of the
-		sprites, so it should be at the bottom of the screen, so we give it a y offset of 240 pixel. With the function
-		<b>sgeStageSetLayerHeight</b> we set the relative height to the world. The foreground layer will be handled if it <b>would be</b>
-		800 pixel in height, so it scrolls around vertical.</p>
-		<pre>sgeStageSetLayerHeight(stage,
-	sgeStageAddLayer(stage, sgeSpriteNewFile(tmp, "data/foregroundlayer.png"), 0, 240),
-	800);</pre>
-		<h3>Drawing</h3>
-		<p>In our games redraw routing, we'll have to handle the drawing.</p>
-		<pre>sgeStageDrawLayer(stage, screen, 0);
-sgeStageDrawSpriteGroup(stage, 0);
-sgeSpriteDraw(player);
-if (sgeStageSpriteGroupCollideSprite(stage, 0, player, RELATIVE)) {
-	// this is executed, if player collides
-	// spritegroup 0 (enemies)
-}
-sgeStageDrawLayer(stage, screen, 1);</pre>
-		<p>First, we draw the background, followed by the enemies spritegroup (0) and the player sprite</p>
-		<p>Next we check if the player collides our enemies</p>
-		<pre>if (sgeStageSpriteGroupCollideSprite(stage, 0, player, RELATIVE)) {</pre>
-		<p>So this function checks if collision takes place between the sprite player and the stages spritegroup 0 (enemies), but 
-		whats thate RELATIVE for?</p>
-		<p>You have two ways, to handly your player sprite, you could either position it relative to the screen, or to the world.
-		So imagine our world of 6400x480 at a camera resolution of 640x480. Now our camera will be positioned with stage-&gt;cameraX=128,
-		128 pixels from the left stage border. if we now set player-&gt;x=192, it could be either drawn out on screens coordinate 192 - which
-		is what we currently to, as wie use sgeSpriteDraw, which always is using the screen position - or it could be shown on screen coordinate
-		64, because our camera is on position 128 already. It is not possible the shown way, we would had to define a new stage spritegroup (e.g. players)
-		and add the player sprite to this group, letting sgeStageDrawSpriteGroup() do the job of calculating the real screen address. You'll see
-		this later on the first reallive example.</p>
-		<p>There are two other collision detection functions, depending on what you want to detect. The 1st detects collision with animated sprites,
-		the second detects collision between two stage spritegroups.</p>
-		<pre>sgeStageSpriteGroupCollideAnimatedSprite(stage, groupnumber, animatedsprite, RELATIVE|ABSOLUTE);
-sgeStageSpriteGroupCollideSpriteGroup(stage, groupnumber, othergroupnumber, RELATIVE|ABSOLUTE);</pre>
-	</body>
-</html>
diff --git a/src/sge2d/doc/tutorialtoc.html b/src/sge2d/doc/tutorialtoc.html
deleted file mode 100644
index 0b40038d7e49d25f3d53d0484797a9703f0080a1..0000000000000000000000000000000000000000
--- a/src/sge2d/doc/tutorialtoc.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
-	<head>
-		<title>SDL Game Engine</title>
-	</head>
-	<body bgcolor="#ffffff">
-		<a href="tutorialprepare.html" target="main">Preparing</a><br />
-		<a href="tutorialbasicloop.html" target="main">The basic game</a><br />
-		<a href="tutorialfiles.html" target="main">Handling your data</a><br />
-		<a href="tutorialsprites.html" target="main">Sprites</a><br />
-		<a href="tutorialstages.html" target="main">Stages</a><br />
-	</body>
-</html>
diff --git a/src/sge2d/fonts/retro_big_color.png b/src/sge2d/fonts/retro_big_color.png
deleted file mode 100644
index f1174ee40d9d4e5161392aa1ddd7823ac90383b6..0000000000000000000000000000000000000000
Binary files a/src/sge2d/fonts/retro_big_color.png and /dev/null differ
diff --git a/src/sge2d/fonts/retro_big_color.png.map b/src/sge2d/fonts/retro_big_color.png.map
deleted file mode 100644
index b9120188a36e407066ad332edd92ed9ed676d4e5..0000000000000000000000000000000000000000
--- a/src/sge2d/fonts/retro_big_color.png.map
+++ /dev/null
@@ -1 +0,0 @@
-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.!-+*/_@":;()%$ 
diff --git a/src/sge2d/fonts/sge_default.png b/src/sge2d/fonts/sge_default.png
deleted file mode 100644
index cee7368b1e81e6ae565c42a541f2ffe13dab41ae..0000000000000000000000000000000000000000
Binary files a/src/sge2d/fonts/sge_default.png and /dev/null differ
diff --git a/src/sge2d/fonts/sge_default.png.map b/src/sge2d/fonts/sge_default.png.map
deleted file mode 100644
index 6ffaf7a35d15935077ddc9b742b005248064846f..0000000000000000000000000000000000000000
--- a/src/sge2d/fonts/sge_default.png.map
+++ /dev/null
@@ -1 +0,0 @@
-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!,.- 
diff --git a/src/sge2d/include/sge.h b/src/sge2d/include/sge.h
deleted file mode 100644
index f51f5033caf770fcf8523a01dd45e505d42d9d62..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sge.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef _SGE_H
-#define _SGE_H
-
-#include <sgedefines.h>
-#include <SDL.h>
-#include <SDL_image.h>
-#include <SDL_mixer.h>
-#include <SDL_audio.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef MORPHOS
-	#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <time.h>
-#include <math.h>
-
-#define sgeLock(surface) do {\
-		if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface);\
-	} while (0)
-
-#define sgeUnlock(surface) do {\
-		if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface);\
-	} while (0)
-
-#define sgeBailOut(format, args...) do {\
-		fprintf(stderr,(format),args); \
-		exit(-1); \
-	} while (0)
-
-#define sgeFlip() SDL_Flip(screen)
-
-#define sgeMalloc(target,type,amount) do {\
-		(target)=(type *)malloc((amount+1)*sizeof(type));\
-		if ((target)==NULL) {\
-			sgeBailOut("could not allocate %d bytes of ram\n", (int)((amount)*sizeof(type)));\
-		}\
-		memset(target,0,((amount)*sizeof(type)));\
-	} while (0)
-
-#define sgeMallocNoInit(target,type,amount) do {\
-		(target)=(type *)malloc((amount+1)*sizeof(type));\
-		if ((target)==NULL) {\
-			sgeBailOut("could not allocate %d bytes of ram\n", (int)((amount)*sizeof(type)));\
-		}\
-	} while (0)
-
-#define sgeRealloc(target,type,amount) do {\
-		(target)=realloc((target),sizeof(type)*(amount+1));\
-		if (target==NULL) {\
-			sgeBailOut("could not allocate %d bytes of ram\n", (int)((amount)*sizeof(type)));\
-		}\
-	} while (0)
-
-#define sgeNew(target,type) sgeMalloc(target,type,1);
-
-#define sgeFree(target) do {\
-		free(target);\
-		target=NULL;\
-	} while(0)
-
-#define sgeRandom(from, range) (from + (int) ((float)(range+1) * (rand() / (RAND_MAX + (float)from))))
-#define sgeRandomFloat(from, range) (float) ((float)from + ((float)(range+1) * (rand() / (RAND_MAX + (float)from))))
-
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define sgeByteSwap16(val)    (val)
-#define sgeByteSwap32(val)    (val)
-#else
-#define sgeByteSwap16(val)    SDL_Swap16(val)
-#define sgeByteSwap32(val)    SDL_Swap32(val)
-#endif
-
-#ifdef NOROUND
-#define sgeRound(val) (int)((val*100+50)/100)
-#else
-#define sgeRound(val) round(val)
-#endif
-
-#ifndef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-#endif
-#ifndef MIN
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#endif
-
-#define MINMAX(value, lower, upper) MIN(MAX((value), (lower)), (upper))
-
-#include <sgeinit.h>
-#include <sgegp2x.h>
-#include <sgemisc.h>
-#include <sgelist.h>
-#include <sgearray.h>
-#include <sgescreen.h>
-#include <sgecontrol.h>
-#include <sgegfx.h>
-#include <sgeresource.h>
-#include <sgeevent.h>
-#include <sgesound.h>
-#include <sgespriteimage.h>
-#include <sgesprite.h>
-#include <sgespritegroup.h>
-#include <sgestage.h>
-#include <sgegamestate.h>
-#include <sgefont.h>
-#include <sgepathfinder.h>
-#include <sgeparticles.h>
-
-#endif
diff --git a/src/sge2d/include/sgearray.h b/src/sge2d/include/sgearray.h
deleted file mode 100644
index 149877fb2ba087331ddef720315ef8f35894ac04..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgearray.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _SGEARRAY_H
-#define _SGEARRAY_H
-
-typedef struct {
-	Uint32 numberOfElements;
-	void **element;
-	void (*freeFunction)(Uint32, void *);
-} SGEARRAY;
-
-SGEARRAY *sgeArrayNew(void);
-SGEARRAY *sgeAutoArrayNew(void (*function)(Uint32, void *));
-void sgeArrayDestroy(SGEARRAY *a);
-
-void sgeArrayAdd(SGEARRAY *a, void *e);
-void sgeArrayInsert(SGEARRAY *a, Uint32 offset, void *e);
-void sgeArrayReplace(SGEARRAY *a, Uint32 offset, void *e);
-void *sgeArrayGet(SGEARRAY *a, Uint32 offset);
-void sgeArrayRemove(SGEARRAY *a, Uint32 offset);
-void sgeArrayForEach(SGEARRAY *a, void function(Uint32, void *));
-
-#endif
diff --git a/src/sge2d/include/sgecontrol.h b/src/sge2d/include/sgecontrol.h
deleted file mode 100644
index 775ef5961d1898f30080555565290efea6e4483a..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgecontrol.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _SGECONTROL_H
-#define _SGECONTROL_H
-
-#define SGEREDRAW 0xf00
-
-#define SGETIMER SDL_TimerID
-#define sgeRemoveTimer(timer) SDL_RemoveTimer(timer)
-#define sgeGameLoop(event,quitvar) while ((SDL_WaitEvent(&event)&&(!quit)))
-
-#define sgeStartGame(function, fps) \
-	SGETIMER t=sgeStartRedrawTimer(fps);\
-	function();\
-	sgeStopRedrawTimer(t);
-
-SDL_TimerID sgeAddTimer(int ms, void *function);
-SGETIMER sgeStartRedrawTimer(int fps);
-void sgeStopRedrawTimer(SGETIMER sgetimer);
-Uint32 sgeGetFPS(void);
-
-#endif
diff --git a/src/sge2d/include/sgedefines.h b/src/sge2d/include/sgedefines.h
deleted file mode 100644
index ae3d22b735e56581b0cc7d1ede254c5eb9946271..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgedefines.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SGEDEFINES_H
-#define _SGEDEFINES_H
-
-#define MAXFILENAMELEN 1024
-
-#define AUDIO 1
-#define NOAUDIO 0
-
-#define JOYSTICK 1
-#define NOJOYSTICK 0
-
-#define FULLSCREEN 1
-#define NOFULLSCREEN 0
-
-#define LOOP -1
-#define NOLOOP 0
-
-#define ON 1
-#define OFF 0
-
-#define YES 1
-#define NO 0
-
-#endif
diff --git a/src/sge2d/include/sgeevent.h b/src/sge2d/include/sgeevent.h
deleted file mode 100644
index cf48b29e406fb965b831f3b492c1203af6089469..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgeevent.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _SGEEVENT_H
-#define _SGEEVENT_H
-
-#define PRESSED 1
-#define RELEASED 2
-
-typedef struct {
-	Uint32 held;
-	Uint32 pressed;
-	Uint32 released;
-} SGEEVENTSTATEINPUT;
-
-typedef struct {
-	SGEEVENTSTATEINPUT up;
-	SGEEVENTSTATEINPUT down;
-	SGEEVENTSTATEINPUT right;
-	SGEEVENTSTATEINPUT left;
-	SGEEVENTSTATEINPUT start;
-	SGEEVENTSTATEINPUT select;
-	SGEEVENTSTATEINPUT fire;
-	SGEEVENTSTATEINPUT l1;
-	SGEEVENTSTATEINPUT r1;
-	SGEEVENTSTATEINPUT a;
-	SGEEVENTSTATEINPUT b;
-	SGEEVENTSTATEINPUT x;
-	SGEEVENTSTATEINPUT y;
-	SGEEVENTSTATEINPUT volUp;
-	SGEEVENTSTATEINPUT volDown;
-} SGEEVENTSTATE;
-
-int sgeKeyUp(SDL_Event *e, int type);
-int sgeKeyDown(SDL_Event *e, int type);
-int sgeKeyLeft(SDL_Event *e, int type);
-int sgeKeyRight(SDL_Event *e, int type);
-int sgeKeyStart(SDL_Event *e, int type);
-int sgeKeySelect(SDL_Event *e, int type);
-int sgeKeyFire(SDL_Event *e, int type);
-int sgeKeyL1(SDL_Event *e, int type);
-int sgeKeyR1(SDL_Event *e, int type);
-int sgeKeyA(SDL_Event *e, int type);
-int sgeKeyB(SDL_Event *e, int type);
-int sgeKeyX(SDL_Event *e, int type);
-int sgeKeyY(SDL_Event *e, int type);
-int sgeKeyVolUp(SDL_Event *e, int type);
-int sgeKeyVolDown(SDL_Event *e, int type);
-
-void sgeClearEvents(void);
-void sgeEventApply(SGEEVENTSTATE *state, SDL_Event *event);
-void sgeEventResetInputs(SGEEVENTSTATE *state);
-
-#endif
diff --git a/src/sge2d/include/sgefont.h b/src/sge2d/include/sgefont.h
deleted file mode 100644
index a2335334b740814210513800cbd5f63480e849fa..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgefont.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _SGEFONT_H
-#define _SGEFONT_H
-
-#define SGEFONT_BITMAP 1
-
-typedef struct {
-	SDL_Surface *bitmap;
-	unsigned char *charmap;
-	SGEARRAY *info;
-} SGEBITMAPFONT;
-
-typedef struct {
-	int type;
-	Uint8 alpha;
-	void *data;
-} SGEFONT;
-
-SGEFONT *sgeFontNew(int type);
-SGEFONT *sgeFontNewFile(SGEFILE *f, int type, const char *filename);
-SGEFONT *sgeFontNewFileBitmap(SGEFILE *f, const char *filename);
-void sgeFontDestroy(SGEFONT *f);
-
-int sgeFontGetLineHeight(SGEFONT *f);
-int sgeFontGetLineHeightBitmap(SGEFONT *f);
-int sgeFontPrint(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text);
-int sgeFontPrintBitmap(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text);
-int sgeFontGetWidth(SGEFONT *f, const char *text);
-int sgeFontGetWidthBitmap(SGEFONT *f, const char *text);
-
-#endif
diff --git a/src/sge2d/include/sgegamestate.h b/src/sge2d/include/sgegamestate.h
deleted file mode 100644
index 2cc5351a7605a1910b9fc5098cc0cc8bf5bf65c4..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgegamestate.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _SGEGAMESTATE_H
-#define _SGEGAMESTATE_H
-
-struct _SGEGAMESTATE;
-
-typedef struct {
-	int quit;
-	SGEEVENTSTATE event_state;
-	struct _SGEGAMESTATE *current;
-} SGEGAMESTATEMANAGER;
-
-typedef struct _SGEGAMESTATE {
-	SGEGAMESTATEMANAGER *manager;
-	void *data;
-	void (*onEvent)(struct _SGEGAMESTATE *state, SDL_Event *event);
-	void (*onRedraw)(struct _SGEGAMESTATE *state);
-	int (*onStateChange)(struct _SGEGAMESTATE *state, struct _SGEGAMESTATE* previous);
-} SGEGAMESTATE;
-
-SGEGAMESTATEMANAGER* sgeGameStateManagerNew(void);
-int sgeGameStateManagerChange(SGEGAMESTATEMANAGER *, SGEGAMESTATE *);
-void sgeGameStateManagerRun(SGEGAMESTATEMANAGER*, int);
-void sgeGameStateManagerQuit(SGEGAMESTATEMANAGER*);
-
-SGEGAMESTATE* sgeGameStateNew(void);
-
-#endif
diff --git a/src/sge2d/include/sgegfx.h b/src/sge2d/include/sgegfx.h
deleted file mode 100644
index db716109304fd178978fd95fd4a85fb98bd28b5f..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgegfx.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _SGEGFX_H
-#define _SGEGFX_H
-
-#define sgeClearScreen() SDL_FillRect(screen, NULL, 0)
-
-typedef struct {
-	Uint8 r,g,b,a;
-} SGEPIXELINFO;
-
-typedef struct {
-	int x,y;
-} SGEPOSITION;
-
-SGEPOSITION *sgePositionNew(int x, int y);
-void sgePositionDestroy(SGEPOSITION *p);
-
-SGEPIXELINFO *sgePixelInfoNew(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-void sgePixelInfoDestroy(SGEPIXELINFO *i);
-
-inline Uint32 sgeMakeColor(SDL_Surface *surface, int r, int g, int b, int a);
-inline void sgeFillRect(SDL_Surface *dest, int x, int y, int w, int h, Uint32 color);
-inline void sgeDrawRect(SDL_Surface *dest, int x, int y, int w, int h, int linewidth, Uint32 color);
-inline void sgeDrawPixel(SDL_Surface *dest, int x, int y, Uint32 color);
-inline SGEPIXELINFO *sgeGetPixel(SDL_Surface *dest, int x, int y);
-inline void sgeDrawLine(SDL_Surface *dest, int x, int y, int x2, int y2, Uint32 color);
-inline void sgeDrawImage(SDL_Surface *dest, SDL_Surface *image, int x, int y);
-void sgeIgnoreAlpha(SDL_Surface *s);
-void sgeUseAlpha(SDL_Surface *s);
-SDL_Surface *sgeRotoZoom(SDL_Surface *source, float rotation, float zoom);
-SDL_Surface *sgeChangeSDLSurfaceAlpha(SDL_Surface *s, Uint8 alpha);
-SDL_Surface *sgeCreateSDLSurface(int width, int height, int depth, Uint32 sdlflags);
-
-#endif
diff --git a/src/sge2d/include/sgegp2x.h b/src/sge2d/include/sgegp2x.h
deleted file mode 100644
index 7b35e5a18ff30f6d5c1b23cf8e83d05985c58ae4..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgegp2x.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _GPEGP2X_H
-#define _GPEGP2X_H
-
-// original gp2x defines
-enum MAP_KEY {
-	VK_UP         , // 0
-	VK_UP_LEFT    , // 1
-	VK_LEFT       , // 2
-	VK_DOWN_LEFT  , // 3
-	VK_DOWN       , // 4
-	VK_DOWN_RIGHT , // 5
-	VK_RIGHT      , // 6
-	VK_UP_RIGHT   , // 7
-	VK_START      , // 8
-	VK_SELECT     , // 9
-	VK_FL         , // 10
-	VK_FR         , // 11
-	VK_FA         , // 12
-	VK_FB         , // 13
-	VK_FX         , // 14
-	VK_FY         , // 15
-	VK_VOL_UP     , // 16
-	VK_VOL_DOWN   , // 17
-	VK_TAT          // 18
-};
-
-#endif
diff --git a/src/sge2d/include/sgeinit.h b/src/sge2d/include/sgeinit.h
deleted file mode 100644
index 470e71ec87a412da16c0856f179526327dbf9bf1..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgeinit.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SGEINIT_H
-#define _SGEINIT_H
-
-extern SDL_Joystick *defaultjoystick;
-
-void sgeInit(int useAudio, int useJoystick);
-void sgeTerminate(void);
-
-#endif
diff --git a/src/sge2d/include/sgelist.h b/src/sge2d/include/sgelist.h
deleted file mode 100644
index 362c02274ea5ccf6b9f5ae10a8fa114c79640cd1..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgelist.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _SGEMEM_H
-#define _SGEMEN_H
-
-typedef struct {
-	void *prev;
-	void *next;
-	char *id;
-	void *data;
-} SGELISTENTRY;
-
-typedef struct {
-	Uint32 numberOfEntries;
-	SGELISTENTRY *first;
-	SGELISTENTRY *last;
-	SGELISTENTRY *entries;
-} SGELIST;
-
-typedef void(SGELISTFUNCTION)(const char *id, void *data);
-
-SGELIST *sgeListNew(void);
-SGELISTENTRY *sgeListAdd(SGELIST *l, const char *id, void *data);
-SGELISTENTRY *sgeListInsert(SGELIST *l, SGELISTENTRY *le, const char *id, void *data);
-SGELISTENTRY *sgeListSearch(SGELIST *l, char *id);
-void sgeListRemove(SGELIST *l, char *id);
-void sgeListForEach(SGELIST *l, SGELISTFUNCTION function);
-void sgeListDestroy(SGELIST *l);
-
-#endif
diff --git a/src/sge2d/include/sgemisc.h b/src/sge2d/include/sgemisc.h
deleted file mode 100644
index cb6adb34829a8695fd7b898d635010e4b6d0609b..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgemisc.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SGEMISC_H
-#define _SGEMISC_H
-
-int sgeGetDistance(int x, int y, int xx, int yy);
-
-#endif
diff --git a/src/sge2d/include/sgeparticles.h b/src/sge2d/include/sgeparticles.h
deleted file mode 100644
index dcc2441e273f6719922bee6a3189163a1d083c92..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgeparticles.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef _SGEPARTICLES_H
-#define _SGEPARTICLES_H
-
-typedef struct {
-	Uint32 timeToLive;
-	float speed;
-	float angle;
-	float x,y;
-	float gravity;
-	Uint32 color;
-} SGEPIXELPARTICLE;
-
-typedef struct {
-	Uint8 r1,g1,b1;
-	Uint8 r2,g2,b2;
-} SGEPIXELPARTICLEDATA;
-
-typedef struct {
-	Uint32 timeToLive;
-	float speed;
-	float angle;
-	float x,y;
-	float gravity;
-} SGESPRITEPARTICLE;
-
-typedef struct {
-	SGESPRITE *sprite;
-} SGESPRITEPARTICLEDATA;
-
-typedef struct {
-	SDL_Surface *drawSurface;
-	Uint32 runtime;
-
-	SGEARRAY *particles;
-	Uint32 (*draw)(Uint32, void *);
-	void *(*create)(void *);
-
-	Uint32 infinite;
-	Uint32 x,y;
-	Uint32 timeToLive;
-	Uint32 timeToLiveDistribution;
-	float emission;
-	float emissionDistribution;
-	float internalEmission;
-	float speed;
-	float speedDistribution;
-	float angle;
-	float angleDistribution;
-	float gravity;
-	void *custom;
-	void (*customDestroy)(void *);
-} SGEPARTICLES;
-
-SGEPARTICLES *sgeParticlesNew(
-		void *(*createFunction)(void *),
-		Uint32 (*drawFunction)(Uint32, void *),
-		void (*freeFunction)(Uint32, void *)
-);
-void sgeParticlesDestroy(SGEPARTICLES *p);
-
-void sgeParticlesDraw(SGEPARTICLES *p);
-float sgeParticlesGetNewEmission(SGEPARTICLES *p);
-Uint32 sgeParticlesGetNewTimeToLive(SGEPARTICLES *p);
-float sgeParticlesGetNewSpeed(SGEPARTICLES *p);
-float sgeParticlesGetNewAngle(SGEPARTICLES *p);
-inline float sgeParticlesGetNewX(float x, float angle, float speed);
-inline float sgeParticlesGetNewY(float y, float angle, float speed, float gravity);
-
-// pixel emitter
-
-SGEPARTICLES *sgeParticlesPixelNew(Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2, Uint8 b2);
-void *sgePixelParticleNew(void *p);
-void sgePixelParticleDestroy(Uint32 arrayidx, void *particle);
-Uint32 sgePixelParticleDraw(Uint32 arrayidx, void *p);
-void sgeParticlesPixelCustomDestroy(void *data);
-
-// sprite emitter
-
-SGEPARTICLES *sgeParticlesSpriteNew(SGESPRITE *sprite);
-void *sgeSpriteParticleNew(void *p);
-void sgeSpriteParticleDestroy(Uint32 arrayidx, void *particle);
-Uint32 sgeSpriteParticleDraw(Uint32 arrayidx, void *p);
-void sgeParticlesSpriteCustomDestroy(void *data);
-
-#endif
diff --git a/src/sge2d/include/sgepathfinder.h b/src/sge2d/include/sgepathfinder.h
deleted file mode 100644
index f0fa63d4612c1a337559c59d78952c7ca7e8711e..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgepathfinder.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _SGEPATHFINDER_H
-#define _SGEPATHFINDER_H
-
-#define DISABLE_DIAGONAL 0
-#define ENABLE_DIAGONAL 1
-
-typedef struct {
-	int x;
-	int y;
-	int startWeight;
-	int targetWeight;
-	void *parent;
-} SGEPATHFINDERINFO;
-
-typedef struct {
-	int width;
-	int height;
-	unsigned char *map;
-	SGEARRAY *path;
-	int useDiagonal;
-} SGEPATHFINDER;
-
-SGEPATHFINDER *sgePathFinderNew(int width, int height);
-SGEPATHFINDER *sgePathFinderNewDiagonal(int width, int height, int diagonal);
-void sgePathFinderDestroy(SGEPATHFINDER *p);
-
-SGEPATHFINDERINFO *sgePathFinderInfoNew(int x, int y, int startWeight, int targetWeight, void *parent);
-void sgePathFinderInfoDestroy(SGEPATHFINDERINFO *pi);
-
-inline void sgePathFinderDiagonal(SGEPATHFINDER *p, int diagonal);
-void sgePathFinderSet(SGEPATHFINDER *p, int x, int y, int value);
-int sgePathFinderGet(SGEPATHFINDER *p, int x, int y);
-int sgePathFinderFind(SGEPATHFINDER *p, int startx, int starty, int destx, int desty);
-
-#endif
diff --git a/src/sge2d/include/sgeresource.h b/src/sge2d/include/sgeresource.h
deleted file mode 100644
index e39e4f5e905d10ef34a794322a8bf60aebafc46c..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgeresource.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _SGERESOURCE_H
-#define _SGERESOURCE_H
-
-typedef struct {
-	FILE *f;
-	int numberOfFiles;
-	char *archname;
-	char **fileName;
-	Uint32 *position;
-	Uint32 *fileSize;
-	char *encryptionkey;
-} SGEFILE;
-
-SGEFILE *sgeOpenFile(const char *filename, const char *encryptionkey);
-void sgeCloseFile(SGEFILE *f);
-void sgeEncryptBuffer(void *buffer, Uint32 length, const char *encryptionkey);
-#define sgeDecryptBuffer sgeEncryptBuffer
-void sgeCreateFile(const char *filename, char *filenames[], Uint32 numberOfFiles, const char *encryptionkey);
-int sgeGetFileIndex(SGEFILE *f, const char *filename);
-Uint32 sgeGetFileSize(SGEFILE *f, const char *filename);
-void *sgeReadFile(SGEFILE *f, const char *filename);
-SDL_Surface *sgeReadImage(SGEFILE *f, const char *filename);
-SDL_Surface *sgeReadImageMemory(SGEFILE *f, const char *filename);
-Mix_Chunk *sgeReadSound(SGEFILE *f, const char *filename);
-SDL_Surface *sgeDuplicateSDLSurface(SDL_Surface *s);
-
-#endif
diff --git a/src/sge2d/include/sgescreen.h b/src/sge2d/include/sgescreen.h
deleted file mode 100644
index 71afc8794af13cded0219672092188c181b18476..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgescreen.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _SGESCREEN_H
-#define _SGESCREEN_H
-
-SDL_Surface *screen;
-
-void sgeOpenScreen(const char *title, int width, int height, int depth, int fullscreen);
-void sgeCloseScreen(void);
-
-void sgeHideMouse(void);
-void sgeShowMouse(void);
-
-#endif
diff --git a/src/sge2d/include/sgesound.h b/src/sge2d/include/sgesound.h
deleted file mode 100644
index 98a1b1b5bff24759592ec6138d3cc73495ee76b3..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgesound.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SGESOUND_H
-#define _SGESOUND_H
-
-#include <sge.h>
-
-typedef struct {
-	Mix_Chunk *data;
-	int playing;
-	int channel;
-	char *internalID;
-} SGESOUND;
-
-void sgeSetDefaultSampleRate(int rate);
-int sgeGetDefaultSampleRate(void);
-void sgeSetVolume(int volume);
-int sgeGetVolume(void);
-SGESOUND *sgeSoundNew(SGEFILE *f, const char *name);
-void sgeSoundDestroy(SGESOUND *m);
-
-void sgeSoundPlay(SGESOUND *m, int loop, int fadeinms);
-void sgeSoundStop(SGESOUND *m, int fadeoutms);
-int sgeSoundIsPlaying(SGESOUND *m);
-
-#endif
diff --git a/src/sge2d/include/sgesprite.h b/src/sge2d/include/sgesprite.h
deleted file mode 100644
index 83cf06a758b96fc4cd693a168629d54401a7623c..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgesprite.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef _SGESPRITE_H
-#define _SGESPRITE_H
-
-typedef struct {
-	int x;
-	int y;
-} SGESPRITEWAYPOINT;
-
-typedef struct {
-	int x;
-	int y;
-	Uint32 currentFrame;
-	Uint32 lastFrame;
-	Uint32 framesPerSecond;
-	SGEARRAY *sprite;
-	SGEARRAY *bankSize;
-	Uint32 isMoving;
-	SGEARRAY *wayPoints;
-	float fX, fY;
-	float dirX, dirY;
-	float moveSpeed;
-	int initMove;
-	void *userData;
-	int initialized;
-	int numberOfBanks;
-	int currentBank;
-	int animate;
-	Uint8 alpha;
-} SGESPRITE;
-
-SGESPRITE *sgeSpriteNew(void);
-SGESPRITE *sgeSpriteNewFile(SGEFILE *f, const char *filename);
-SGESPRITE *sgeSpriteNewFileRange(SGEFILE *f, const char *template, Uint32 start, Uint32 end);
-SGESPRITE *sgeSpriteNewSDLSurface(SDL_Surface *surface);
-void sgeSpriteDestroy(SGESPRITE *s);
-
-SGESPRITEIMAGE *sgeSpriteGetCurrentFrame(SGESPRITE *s);
-void sgeSpriteSetFPS(SGESPRITE *s, Uint32 fps);
-void sgeSpriteAddSDLSurface(SGESPRITE *s, SDL_Surface *surface);
-void sgeSpriteAddSpriteImage(SGESPRITE *s, SGESPRITEIMAGE *i);
-void sgeSpriteAddFile(SGESPRITE *s, SGEFILE *f, const char *name);
-void sgeSpriteAddFileRange(SGESPRITE *s, SGEFILE *f, const char *template, Uint32 start, Uint32 end);
-SDL_Surface *sgeSpriteGetSDLSurface(SGESPRITE *s);
-void sgeSpriteDraw(SGESPRITE *s, SDL_Surface *dest);
-void sgeSpriteDrawXY(SGESPRITE *s, int x, int y, SDL_Surface *dest);
-inline void sgeSpriteDrawRotoZoomed(SGESPRITE *s, float rotation, float zoom, SDL_Surface *dest);
-inline void sgeSpriteDrawXYRotoZoomed(SGESPRITE *s, int x, int y, float rotation, float zoom, SDL_Surface *dest);
-void sgeAnimatedspriteUseAlpha(SGESPRITE *s);
-void sgeSpriteIgnoreAlpha(SGESPRITE *s);
-void sgeSpriteIgnoreAlpha(SGESPRITE *s);
-int sgeSpriteBoxCollide(SGESPRITE *a, SGESPRITE *b);
-int sgeSpriteCollide(SGESPRITE *a, SGESPRITE *b);
-int sgeSpriteBoxCollideSpriteImage(SGESPRITE *a, SGESPRITEIMAGE *b);
-int sgeSpriteCollideSpriteImage(SGESPRITE *a, SGESPRITEIMAGE *b);
-int sgeSpriteWidth(SGESPRITE *s);
-int sgeSpriteHeight(SGESPRITE *s);
-void sgeSpriteAddWayPoint(SGESPRITE *s, int x, int y);
-void sgeSpriteRemoveNextWayPoint(SGESPRITE *s);
-void sgeSpriteClearWayPoints(SGESPRITE *s);
-void sgeSpriteStartMovement(SGESPRITE *s, float speed);
-void sgeSpriteAbortMovement(SGESPRITE *s);
-void sgeSpriteMoveTowards(SGESPRITE *s, int x, int y);
-void sgeSpriteSetUserData(SGESPRITE *s, void *data);
-void *sgeSpriteGetUserData(SGESPRITE *s);
-inline void sgeSpriteUpdatePosition(SGESPRITE *s);
-void sgeSpriteUpdate(SGESPRITE *s);
-inline Uint32 sgeSpriteGetNumberOfFrames(SGESPRITE *s);
-inline void sgeSpriteSetNumberOfFrames(SGESPRITE *s, Uint32 number);
-inline SGEARRAY *sgeSpriteGetCurrentSpriteArray(SGESPRITE *s);
-inline void sgeSpriteSetAnimBank(SGESPRITE *s, Uint32 bank);
-void sgeSpriteAddAnimBank(SGESPRITE *s);
-Uint32 sgeSpriteGetAnimBank(SGESPRITE *s);
-void sgeSpriteAnimate(SGESPRITE *s, int state);
-void sgeSpriteResetAnimation(SGESPRITE *s);
-inline void sgeSpriteForceFrame(SGESPRITE *s, Uint32 frame);
-SGESPRITE *sgeSpriteDuplicate(SGESPRITE *s);
-
-#endif
diff --git a/src/sge2d/include/sgespritegroup.h b/src/sge2d/include/sgespritegroup.h
deleted file mode 100644
index 1ffbf6d8ce331f0d255a370071bdfb57dbfeeb66..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgespritegroup.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _SGESPRITEGROUP_H
-#define _SGESPRITEGROUP_H
-
-typedef struct {
-	SGEARRAY *sprite;
-} SGESPRITEGROUP;
-
-SGESPRITEGROUP *sgeSpriteGroupNew(void);
-void sgeSpriteGroupDestroy(SGESPRITEGROUP *g);
-
-void sgeSpriteGroupAddSprite(SGESPRITEGROUP *g, SGESPRITE *s);
-int sgeSpriteGroupCollide(SGESPRITEGROUP *g, SGESPRITEGROUP *cg);
-int sgeSpriteGroupCollideSprite(SGESPRITEGROUP *g, SGESPRITE *s);
-SGESPRITE *sgeSpriteGroupGetCollider(SGESPRITEGROUP *g, SGESPRITEGROUP *cg);
-SGESPRITE *sgeSpriteGroupGetColliderSprite(SGESPRITEGROUP *g, SGESPRITE *s);
-void sgeSpriteGroupDraw(SGESPRITEGROUP *g);
-void sgeSpriteGroupDrawRelative(SGESPRITEGROUP *g, int camx, int camy);
-
-#endif
diff --git a/src/sge2d/include/sgespriteimage.h b/src/sge2d/include/sgespriteimage.h
deleted file mode 100644
index 111d2c67b29122deb5ba2ff33a90aab707e7f8e7..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgespriteimage.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _SGESPRITEIMAGE_H
-#define _SGESPRITEIMAGE_H
-
-typedef struct {
-	int useAlpha;
-	Uint32 collisionColor;
-	int x,y;
-	int w,h;
-	SDL_Surface *image;
-} SGESPRITEIMAGE;
-
-SGESPRITEIMAGE *sgeSpriteImageNew(void);
-SGESPRITEIMAGE *sgeSpriteImageNewFile(SGEFILE *f, const char *name);
-void sgeSpriteImageDestroy(SGESPRITEIMAGE *s);
-
-SGESPRITEIMAGE *sgeSpriteImageDuplicate(SGESPRITEIMAGE *s);
-void sgeSpriteImageSetImage(SGESPRITEIMAGE *s, SDL_Surface *image);
-void sgeSpriteImageDraw(SGESPRITEIMAGE *s, Uint8 alpha, SDL_Surface *dest);
-void sgeSpriteImageDrawXY(SGESPRITEIMAGE *s, int x, int y, Uint8 alpha, SDL_Surface *dest);
-int sgeSpriteImageBoxCollide(SGESPRITEIMAGE *a, SGESPRITEIMAGE *b);
-int sgeSpriteImageCollide(SGESPRITEIMAGE *a, SGESPRITEIMAGE *b);
-void sgeSpriteImageUseAlpha(SGESPRITEIMAGE *s);
-void sgeSpriteImageIgnoreAlpha(SGESPRITEIMAGE *s);
-void sgeSpriteImageSetCollisionColor(SGESPRITEIMAGE *s, int r, int g, int b, int a);
-
-#endif
diff --git a/src/sge2d/include/sgestage.h b/src/sge2d/include/sgestage.h
deleted file mode 100644
index f6d7b5f34600eca37c02fc256dab2618979ed018..0000000000000000000000000000000000000000
--- a/src/sge2d/include/sgestage.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _SGESTAGE_H
-#define _SGESTAGE_H
-
-#define ABSOLUTE 0
-#define RELATIVE 1
-
-#define sgeStageGetSpriteGroup(stage, group) sgeArrayGet(stage->spriteGroups, group)
-
-typedef struct {
-	int x,y;
-	int w,h;
-	SGESPRITE *sprite;
-} SGELAYER;
-
-typedef struct {
-	int cameraX, cameraY;
-	int w, h;
-	SGEARRAY *layers;
-	SGEARRAY *spriteGroups;
-} SGESTAGE;
-
-SGELAYER *sgeLayerNew(SGESPRITE *sprite);
-void sgeLayerDestroy(SGELAYER *l);
-
-SGESTAGE *sgeStageNew(int width, int height);
-void sgeStageDestroy(SGESTAGE *s);
-int sgeStageAddLayer(SGESTAGE *s, SGESPRITE *sprite, int x, int y);
-void sgeStageSetLayerHeight(SGESTAGE *s, int layer, int height);
-void sgeStageSetLayerWidth(SGESTAGE *s, int layer, int width);
-void sgeStageDrawLayer(SGESTAGE *s, SDL_Surface *dest, int layer);
-int sgeStageAddSpriteGroup(SGESTAGE *s, SGESPRITEGROUP *g);
-int sgeStageAddSprite(SGESTAGE *s, int spriteGroup, SGESPRITE *sprite);
-void sgeStageDrawSpriteGroup(SGESTAGE *s, int spriteGroup);
-void sgeStageDrawSpriteGroups(SGESTAGE *s);
-int sgeStageSpriteGroupCollideSprite(SGESTAGE *s, int b, SGESPRITE *a, int orientation);
-int sgeStageSpriteGroupCollideSpriteGroup(SGESTAGE *s, int a, int b, int orientationa);
-SGEPOSITION *sgeStageScreenToReal(SGESTAGE *s, int x, int y);
-
-#endif
diff --git a/src/sge2d/libtest/.cvsignore b/src/sge2d/libtest/.cvsignore
deleted file mode 100644
index 640b848ce162c003cc9461a0c34ea2f351143375..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-libtest
diff --git a/src/sge2d/libtest/Makefile b/src/sge2d/libtest/Makefile
deleted file mode 100644
index fa95763312441437b509945e129f8d14ba1d1cd1..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-SGEDIR=..
-
-include $(SGEDIR)/setup.project
-include $(SGEDIR)/setup.$(PLATFORM)
-
-TARGET=libtest$(EXEC)
-
-OBJ=main.o
-
-CFLAGS=-Wall -I$(SGEDIR)/include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-.c.o:
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) $(SGEDIR)/libsge.a $(STATICLIBS)
-
-testdata:
-	rm -rf ./data.d
-	$(SGEDIR)/tools/sga$(EXEC) asdf ./data.d data/*.*
-
-clean:
-	rm -f stdout.txt stderr.txt
-	rm -f $(OBJ)
-	rm -f $(TARGET)
diff --git a/src/sge2d/libtest/README-SDL.txt b/src/sge2d/libtest/README-SDL.txt
deleted file mode 100644
index 1669736cb52b18cd12ab58171f18886600620b85..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/README-SDL.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Please distribute this file with the SDL runtime environment:
-
-The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
-designed to make it easy to write multi-media software, such as games and
-emulators.
-
-The Simple DirectMedia Layer library source code is available from:
-http://www.libsdl.org/
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
diff --git a/src/sge2d/libtest/README-SDL_image.txt b/src/sge2d/libtest/README-SDL_image.txt
deleted file mode 100644
index 9df79a908cdf019cfe6adc470a4191c916dd7ef6..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/README-SDL_image.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Please include this notice with the runtime environment:
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
-The source is available from the libraries page at the SDL website:
-http://www.libsdl.org/
diff --git a/src/sge2d/libtest/README.SDL_mixer.txt b/src/sge2d/libtest/README.SDL_mixer.txt
deleted file mode 100644
index 0630ca8a7844c00288bb33237297a80d5c594a40..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/README.SDL_mixer.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Please include this notice with the runtime environment:
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
-The source is available from the libraries page at the SDL website:
-http://www.libsdl.org/
diff --git a/src/sge2d/libtest/SDL.dll b/src/sge2d/libtest/SDL.dll
deleted file mode 100755
index a5da7bbdeb488dad9412311b363c0ad1850fc044..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/SDL.dll and /dev/null differ
diff --git a/src/sge2d/libtest/SDL_image.dll b/src/sge2d/libtest/SDL_image.dll
deleted file mode 100755
index c536a5b2dbaa8dc68dfb8cf5e42e64178950e293..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/SDL_image.dll and /dev/null differ
diff --git a/src/sge2d/libtest/SDL_mixer.dll b/src/sge2d/libtest/SDL_mixer.dll
deleted file mode 100755
index 4a10a2565b680cb8aaa1c67a52391bbac1507c1e..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/SDL_mixer.dll and /dev/null differ
diff --git a/src/sge2d/libtest/data.d b/src/sge2d/libtest/data.d
deleted file mode 100644
index b0d3b19246d15229b01c40252ea80726d6a0c3b2..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data.d and /dev/null differ
diff --git a/src/sge2d/libtest/data/KDE_Logout_1.ogg b/src/sge2d/libtest/data/KDE_Logout_1.ogg
deleted file mode 100644
index b170afa02a8872a516ae942c814de64a1c633616..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/KDE_Logout_1.ogg and /dev/null differ
diff --git a/src/sge2d/libtest/data/font.png b/src/sge2d/libtest/data/font.png
deleted file mode 100644
index cee7368b1e81e6ae565c42a541f2ffe13dab41ae..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/font.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/font.png.map b/src/sge2d/libtest/data/font.png.map
deleted file mode 100644
index 6ffaf7a35d15935077ddc9b742b005248064846f..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/data/font.png.map
+++ /dev/null
@@ -1 +0,0 @@
-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!,.- 
diff --git a/src/sge2d/libtest/data/ice0001.png b/src/sge2d/libtest/data/ice0001.png
deleted file mode 100644
index 4940f66284b183756b963c5ea70f61c3ce26566a..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0001.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0002.png b/src/sge2d/libtest/data/ice0002.png
deleted file mode 100644
index f9431ce6edc4237845571b747e47a5db15fbd76b..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0002.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0003.png b/src/sge2d/libtest/data/ice0003.png
deleted file mode 100644
index 19707d2a3b975e8681e63abc4519e2d2b71d08cb..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0003.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0004.png b/src/sge2d/libtest/data/ice0004.png
deleted file mode 100644
index 1488a659f4bbe5dd7152363754ffaa2715ef40a3..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0004.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0005.png b/src/sge2d/libtest/data/ice0005.png
deleted file mode 100644
index 6d62c3e88d6fb264c11ad6e70f4c68764fc5857f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0005.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0006.png b/src/sge2d/libtest/data/ice0006.png
deleted file mode 100644
index cff0cdc08f392f95b4e1406e1535bc89465f1069..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0006.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0007.png b/src/sge2d/libtest/data/ice0007.png
deleted file mode 100644
index 41b9654b027ba5eb5acdfcf0bbad8db970e7e5e7..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0007.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0008.png b/src/sge2d/libtest/data/ice0008.png
deleted file mode 100644
index 0f880d10567a64be13c0f30e0856b8b142b0cc68..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0008.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0009.png b/src/sge2d/libtest/data/ice0009.png
deleted file mode 100644
index ff89ee96e8c7193d527cfc3fb495bba779eeee98..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0009.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0010.png b/src/sge2d/libtest/data/ice0010.png
deleted file mode 100644
index e2af9c6a72bc1d67d91f67a03935445552beb779..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0010.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0011.png b/src/sge2d/libtest/data/ice0011.png
deleted file mode 100644
index 71137f0cfbb5f54b9f8151e9518e7ba078cfc5b5..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0011.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0012.png b/src/sge2d/libtest/data/ice0012.png
deleted file mode 100644
index f6bf18ed30e56ac260abf5bf3841483cd4f7c74d..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0012.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0013.png b/src/sge2d/libtest/data/ice0013.png
deleted file mode 100644
index d35dd87392ac04d3ba4cedaf8afff68acb2235b6..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0013.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0014.png b/src/sge2d/libtest/data/ice0014.png
deleted file mode 100644
index 52299b5a25525597360e53d3811919ee20efde3d..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0014.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0015.png b/src/sge2d/libtest/data/ice0015.png
deleted file mode 100644
index f98b6b6732b2131e5a75099495f8fac9a0ccc62c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0015.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0016.png b/src/sge2d/libtest/data/ice0016.png
deleted file mode 100644
index 86f10066f1e52331e2c3a5852f8c148386d64a2d..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0016.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0017.png b/src/sge2d/libtest/data/ice0017.png
deleted file mode 100644
index cdda4ac91b43c6c24041e5512c46187bf0298530..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0017.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0018.png b/src/sge2d/libtest/data/ice0018.png
deleted file mode 100644
index f51fdb8fcf32190e6e9ad49328ab6f2aadbaa316..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0018.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0019.png b/src/sge2d/libtest/data/ice0019.png
deleted file mode 100644
index e2fe980d341a0bc5b776724c36e611b196c1f58f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0019.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/ice0020.png b/src/sge2d/libtest/data/ice0020.png
deleted file mode 100644
index 06f3b8972693ea6a2c4e3f08aa455f8c9352bd8a..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/ice0020.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/winterbackground.png b/src/sge2d/libtest/data/winterbackground.png
deleted file mode 100644
index 792662ec3317f5bb91ea3b2f167bfeddcb4de8b2..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/winterbackground.png and /dev/null differ
diff --git a/src/sge2d/libtest/data/winterlands.png b/src/sge2d/libtest/data/winterlands.png
deleted file mode 100644
index 981e4086f959445a48e719dd26e95ae6eb260db7..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/data/winterlands.png and /dev/null differ
diff --git a/src/sge2d/libtest/jpeg.dll b/src/sge2d/libtest/jpeg.dll
deleted file mode 100755
index 28759ab9b01398ab8cc73e34c2d8f70033127f2c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/jpeg.dll and /dev/null differ
diff --git a/src/sge2d/libtest/libogg-0.dll b/src/sge2d/libtest/libogg-0.dll
deleted file mode 100755
index fa3eb894ae72b55d04f70d8023d6f3a41b7d7037..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/libogg-0.dll and /dev/null differ
diff --git a/src/sge2d/libtest/libpng12-0.dll b/src/sge2d/libtest/libpng12-0.dll
deleted file mode 100755
index 23a6d30eb7ed4e981f572485fdfd4f4add0d3a2f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/libpng12-0.dll and /dev/null differ
diff --git a/src/sge2d/libtest/libtiff-3.dll b/src/sge2d/libtest/libtiff-3.dll
deleted file mode 100755
index aa243aaadaf0defeedaeb48dec09cc8f7a20923f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/libtiff-3.dll and /dev/null differ
diff --git a/src/sge2d/libtest/libvorbis-0.dll b/src/sge2d/libtest/libvorbis-0.dll
deleted file mode 100755
index 8bde11e48f9244f8dfbd6b6f7e8151048352ceaa..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/libvorbis-0.dll and /dev/null differ
diff --git a/src/sge2d/libtest/libvorbisfile-3.dll b/src/sge2d/libtest/libvorbisfile-3.dll
deleted file mode 100755
index a353179382320822dc53017b62d20f7aa886b596..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/libvorbisfile-3.dll and /dev/null differ
diff --git a/src/sge2d/libtest/main.c b/src/sge2d/libtest/main.c
deleted file mode 100644
index 03624058940ac536fa311cba5bd55378c1d2f524..0000000000000000000000000000000000000000
--- a/src/sge2d/libtest/main.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <sge.h>
-
-typedef struct {
-	SGESPRITE *testimage;
-	SGESPRITE *testcollider;
-	SGESPRITE *testanim;
-	SGESPRITEGROUP *colliders;
-	SGESPRITEGROUP *players;
-	SGESTAGE *stage;
-	SGEFONT *font;
-	float zoom;
-	float rotation;
-} MainStateData;
-
-void on_redraw(SGEGAMESTATE *state)
-{
-	SGEEVENTSTATE es = state->manager->event_state;
-	MainStateData *data = (MainStateData*)state->data;
-	// int x;
-	// int y;
-	Uint32 col = sgeMakeColor(screen,30,30,30,0x20);
-	Uint32 collcol = sgeMakeColor(screen,30,0,0,0x20);
-
-	if (es.start.released) {
-		sgeGameStateManagerQuit(state->manager);
-		return;
-	}
-
-	if (es.down.held) data->testimage->y+=2;
-	if (es.up.held) data->testimage->y-=2;
-	if (es.left.held) data->testimage->x-=2;
-	if (es.right.held) data->testimage->x+=2;
-
-	data->testimage->x = MINMAX(data->testimage->x, 0, screen->w-sgeSpriteWidth(data->testimage)-1);
-	data->testimage->y = MINMAX(data->testimage->y, 0, screen->h-sgeSpriteHeight(data->testimage)-1);
-
-	data->stage->cameraX=data->stage->w*(double)((double)data->testimage->x/(double)(screen->w-sgeSpriteWidth(data->testimage)));
-	data->stage->cameraY=data->stage->h*(double)((double)data->testimage->y/(double)(screen->h-sgeSpriteHeight(data->testimage)));
-
-	sgeStageDrawLayer(data->stage, screen, 0);
-
-	sgeLock(screen);
-	sgeDrawLine(screen, 0, 0, data->testimage->x, data->testimage->y, col);
-	sgeDrawLine(screen, 0, 0, data->testimage->x, data->testimage->y+10, col);
-	sgeDrawLine(screen, 0, 0, data->testimage->x, data->testimage->y+20, col);
-	sgeDrawLine(screen, 0, 0, data->testimage->x, data->testimage->y+30, col);
-	sgeDrawLine(screen, 0, 0, data->testimage->x, data->testimage->y+40, col);
-	sgeUnlock(screen);
-
-	if (sgeStageSpriteGroupCollideSpriteGroup(data->stage, 1, 0, RELATIVE)) {
-		sgeFillRect(screen,1,0,100,100,collcol);
-	}
-
-	sgeStageDrawSpriteGroup(data->stage, 0);
-	sgeSpriteGroupDraw(data->players);
-
-	sgeStageDrawLayer(data->stage, screen, 1);
-
-	sgeFontPrint(data->font, screen, 10, screen->h-sgeFontGetLineHeight(data->font)-10, "Hello World");
-
-	sgeSpriteDrawRotoZoomed(data->testimage, data->rotation, data->zoom, screen);
-
-	data->testimage->alpha=(data->testimage->alpha+4)%255;
-	data->rotation+=.02;
-	data->zoom+=.005;
-
-	sgeFlip();
-}
-
-int run(int argc, char *argv[]) {
-
-	SGEGAMESTATEMANAGER *manager;
-	SGEGAMESTATE *mainstate;
-	SGEFILE *tmp;
-	// SGESOUND *mus;
-	MainStateData data;
-
-	sgeInit(NOAUDIO,JOYSTICK);
-	sgeOpenScreen("SGE libtest",320,240,32,NOFULLSCREEN);
-	sgeHideMouse();
-
-	mainstate = sgeGameStateNew();
-	mainstate->onRedraw = on_redraw;
-	mainstate->data = &data;
-
-	data.colliders=sgeSpriteGroupNew();
-	data.players=sgeSpriteGroupNew();
-
-	data.stage=sgeStageNew(640, 480);
-	sgeStageAddSpriteGroup(data.stage, data.colliders);
-	sgeStageAddSpriteGroup(data.stage, data.players);
-	data.testanim=sgeSpriteNew();
-	sgeSpriteSetFPS(data.testanim,20);
-	tmp=sgeOpenFile("data.d","asdf");
-	data.testimage=sgeSpriteNewFile(tmp, "data/ice0001.png");
-	sgeStageAddLayer(data.stage, sgeSpriteNewFile(tmp, "data/winterbackground.png"), 0, 0);
-	sgeStageSetLayerHeight(data.stage, sgeStageAddLayer(data.stage, sgeSpriteNewFile(tmp, "data/winterlands.png"), 0, 240), 800);
-	data.testcollider=sgeSpriteNewFile(tmp, "data/ice0010.png");
-	sgeSpriteAddFileRange(data.testanim, tmp, "data/ice%04d.png", 1, 20);
-	sgeSpriteGroupAddSprite(data.colliders,sgeSpriteNewFileRange(tmp, "data/ice%04d.png", 1, 20));
-	// mus=sgeSoundNew(tmp, "data/KDE_Logout_1.ogg");
-
-	data.font=sgeFontNewFile(tmp, SGEFONT_BITMAP, "data/font.png");
-
-	sgeCloseFile(tmp);
-
-	sgeSpriteAddWayPoint(data.testcollider, 100, 200);
-	sgeSpriteAddWayPoint(data.testcollider, 100, 0);
-	sgeSpriteAddWayPoint(data.testcollider, 0, 200);
-	sgeSpriteAddWayPoint(data.testcollider, 200, 100);
-	sgeSpriteAddWayPoint(data.testcollider, 200, 200);
-
-	sgeSpriteGroupAddSprite(data.colliders, data.testcollider);
-	sgeSpriteGroupAddSprite(data.players, data.testimage);
-
-	data.zoom=0.1;
-	data.rotation=0.1;
-
-
-	// sgeSoundPlay(mus, LOOP, 4000);
-	// data.testcollider->x=(screen->w>>1)-(sgeSpriteWidth(data.testcollider)>>1);
-	// data.testcollider->y=(screen->h>>1)-(sgeSpriteHeight(data.testcollider)>>1);
-
-	manager = sgeGameStateManagerNew();
-	sgeGameStateManagerChange(manager, mainstate);
-	sgeSpriteStartMovement(data.testcollider, 2);
-	sgeGameStateManagerRun(manager, 30);
-
-	sgeStageDestroy(data.stage);
-	sgeCloseScreen();
-	return 0;
-}
diff --git a/src/sge2d/libtest/powersdl.library b/src/sge2d/libtest/powersdl.library
deleted file mode 100644
index d4b321c7c6d617faf5f563ed204ccd62b8ee07df..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/powersdl.library and /dev/null differ
diff --git a/src/sge2d/libtest/powersdl_image.library b/src/sge2d/libtest/powersdl_image.library
deleted file mode 100644
index 88d82f8d601a86711b9ca60af8c7cfa7fe62503c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/powersdl_image.library and /dev/null differ
diff --git a/src/sge2d/libtest/powersdl_mixer.library b/src/sge2d/libtest/powersdl_mixer.library
deleted file mode 100644
index ff7bd4454cfb836535bb40d336230ca0dec851d9..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/powersdl_mixer.library and /dev/null differ
diff --git a/src/sge2d/libtest/smpeg.dll b/src/sge2d/libtest/smpeg.dll
deleted file mode 100755
index b6eed35a157acb89657a9d74b1c9f7c1c2ef5064..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/smpeg.dll and /dev/null differ
diff --git a/src/sge2d/libtest/zlib1.dll b/src/sge2d/libtest/zlib1.dll
deleted file mode 100755
index 007afc43c3f4463d3fa27ba3ca7c27ab283c61cc..0000000000000000000000000000000000000000
Binary files a/src/sge2d/libtest/zlib1.dll and /dev/null differ
diff --git a/src/sge2d/morphos/README b/src/sge2d/morphos/README
deleted file mode 100644
index 9d2704164403a08b2340a9eed81a804e7042ad63..0000000000000000000000000000000000000000
--- a/src/sge2d/morphos/README
+++ /dev/null
@@ -1,11 +0,0 @@
-These files are from the MorphOS PowerSDL Port.
-
-You can get the current version from:
-http://www.lehtoranta.net/powersdl/
-
-These files can be either copied to system wide
-LIBS: via the command
-
-copy #?.library LIBS:
-
-or can be copied to the application folder
diff --git a/src/sge2d/morphos/powersdl.library b/src/sge2d/morphos/powersdl.library
deleted file mode 100644
index d4b321c7c6d617faf5f563ed204ccd62b8ee07df..0000000000000000000000000000000000000000
Binary files a/src/sge2d/morphos/powersdl.library and /dev/null differ
diff --git a/src/sge2d/morphos/powersdl_image.library b/src/sge2d/morphos/powersdl_image.library
deleted file mode 100644
index 88d82f8d601a86711b9ca60af8c7cfa7fe62503c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/morphos/powersdl_image.library and /dev/null differ
diff --git a/src/sge2d/morphos/powersdl_mixer.library b/src/sge2d/morphos/powersdl_mixer.library
deleted file mode 100644
index ff7bd4454cfb836535bb40d336230ca0dec851d9..0000000000000000000000000000000000000000
Binary files a/src/sge2d/morphos/powersdl_mixer.library and /dev/null differ
diff --git a/src/sge2d/setup.beos b/src/sge2d/setup.beos
deleted file mode 100644
index 51226556403ff93c463721ab875cb9123c2db285..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.beos
+++ /dev/null
@@ -1,6 +0,0 @@
-CC=gcc
-SDLCFLAGS=`sdl-config --cflags`
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DBEOS -DNOROUND
diff --git a/src/sge2d/setup.devkitgp2x b/src/sge2d/setup.devkitgp2x
deleted file mode 100644
index cd6940087b46a491e35a1e3ae213232dafa7344f..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.devkitgp2x
+++ /dev/null
@@ -1,9 +0,0 @@
-GP2XDEVKIT=/usr/local/devkitPro/devkitGP2X
-CC=$(GP2XDEVKIT)/bin/arm-linux-gcc
-RANLIB=$(GP2XDEVKIT)/bin/arm-linux-ranlib
-GP2XINCLUDEDIR=$(GP2XDEVKIT)/include
-SDLCFLAGS=-I$(GP2XINCLUDEDIR) -I$(GP2XINCLUDEDIR)/SDL
-SDLLDFLAGS=-L$(GP2XDEVKIT)/lib -lSDL -lSDL_image -lSDL_mixer -ljpeg -lsmpeg -lpng -lz
-STATICLIBS=
-EXEC=.gpe
-DEFINES=-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_SWSURFACE -DGP2X
diff --git a/src/sge2d/setup.freebsd b/src/sge2d/setup.freebsd
deleted file mode 100644
index b624ef1517745371dd0d2daec1301f6b428f5549..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.freebsd
+++ /dev/null
@@ -1,7 +0,0 @@
-CC=gcc
-SDLCFLAGS=`sdl-config --cflags`
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DBSD -DFREEBSD
-
diff --git a/src/sge2d/setup.gp2x b/src/sge2d/setup.gp2x
deleted file mode 100644
index 91cdb05b0ae1a596f00911cd4d3c6519781c19b2..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.gp2x
+++ /dev/null
@@ -1,9 +0,0 @@
-GP2XDEVKIT=/gp2xsdk
-CC=$(GP2XDEVKIT)/Tools/bin/arm-gp2x-linux-gcc
-RANLIB=$(GP2XDEVKIT)/Tools/bin/arm-gp2x-linux-ranlib
-GP2XINCLUDEDIR=$(GP2XDEVKIT)/Tools/arm-gp2x-linux/include
-SDLCFLAGS=-I$(GP2XINCLUDEDIR) -I$(GP2XINCLUDEDIR)/SDL
-SDLLDFLAGS=-L$(GP2XDEVKIT)/Tools/arm-gp2x-linux -lSDL -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=.gpe
-DEFINES=-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_SWSURFACE -DGP2X
diff --git a/src/sge2d/setup.linux b/src/sge2d/setup.linux
deleted file mode 100644
index 084866d83080e341c5b24537c498cf3d27987a9e..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.linux
+++ /dev/null
@@ -1,6 +0,0 @@
-CC=gcc
-SDLCFLAGS=`sdl-config --cflags`
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DLINUX
diff --git a/src/sge2d/setup.mingw b/src/sge2d/setup.mingw
deleted file mode 100644
index e163a7601675f2458db1b2d2fde4714ed31a21f0..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.mingw
+++ /dev/null
@@ -1,6 +0,0 @@
-CC=gcc
-SDLCFLAGS=`sdl-config --cflags`
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-EXEC=.exe
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DWIN32
diff --git a/src/sge2d/setup.morphos b/src/sge2d/setup.morphos
deleted file mode 100644
index b4b32f7101c01b5a5ee9fe5d5d5effa2886068a1..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.morphos
+++ /dev/null
@@ -1,7 +0,0 @@
-CC=gcc
-PWD=`pwd`
-SDLCFLAGS=`sdl-config --cflags` -Iinclude
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DMORPHOS -DNOROUND
diff --git a/src/sge2d/setup.open2x b/src/sge2d/setup.open2x
deleted file mode 100644
index bec3fd2020ebb9ad635605a486d631061df5b983..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.open2x
+++ /dev/null
@@ -1,11 +0,0 @@
-OPEN2XDEVKIT=/opt/open2x
-OPEN2XSUBDIR=*
-CC=$(OPEN2XDEVKIT)/$(OPEN2XSUBDIR)/bin/arm-open2x-linux-gcc
-RANLIB=$(OPEN2XDEVKIT)/$(OPEN2XSUBDIR)/bin/arm-open2x-linux-ranlib
-OPEN2XINCLUDEDIR=$(OPEN2XDEVKIT)/$(OPEN2XSUBDIR)/include
-SDLCONFIG=$(OPEN2XDEVKIT)/$(OPEN2XSUBDIR)/bin/sdl-config
-SDLCFLAGS=`$(SDLCONFIG) --cflags`
-SDLLDFLAGS=`$(SDLCONFIG) --libs` -lSDL_image -lSDL_mixer -lsmpeg
-STATICLIBS=
-EXEC=.gpe
-DEFINES=-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_SWSURFACE -DGP2X
diff --git a/src/sge2d/setup.openbsd b/src/sge2d/setup.openbsd
deleted file mode 100644
index 30fd5feb86416251f874fb0da1bd4e2a1c268e96..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.openbsd
+++ /dev/null
@@ -1,7 +0,0 @@
-CC=gcc
-SDLCFLAGS=`sdl-config --cflags`
-SDLLDFLAGS=`sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DBSD -DOPENBSD
-
diff --git a/src/sge2d/setup.project b/src/sge2d/setup.project
deleted file mode 100644
index 50d8b443633d5c3f07e79d0e22441c076c4c446c..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.project
+++ /dev/null
@@ -1,2 +0,0 @@
-PLATFORM=linux
-PATH=/home/nicolas/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i486-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/games/bin:/opt/vmware/server/bin:/opt/vmware/server/console/bin:/home/nicolas/tmp/cvs/t-engine4/sge2d-20080723/tools
diff --git a/src/sge2d/setup.sunos b/src/sge2d/setup.sunos
deleted file mode 100644
index d18be595217896e5be044d16a00e574cf7545793..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.sunos
+++ /dev/null
@@ -1,8 +0,0 @@
-SDLBASE=/opt/csw
-CC=gcc
-SDLCFLAGS=`$(SDLBASE)/bin/sdl-config --cflags`
-SDLLDFLAGS=`$(SDLBASE)/bin/sdl-config --libs` -lm -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DBSD -DFREEBSD
-
diff --git a/src/sge2d/setup.syllable b/src/sge2d/setup.syllable
deleted file mode 100644
index bd35dc7f7ea6e4b4418566d69a001b4f5dd2a097..0000000000000000000000000000000000000000
--- a/src/sge2d/setup.syllable
+++ /dev/null
@@ -1,6 +0,0 @@
-CC=gcc
-SDLCFLAGS=-I/usr/indexes/include/SDL `sdl-config --cflags`
-SDLLDFLAGS=-L/usr/indexes/libs `sdl-config --libs` -lSDL_image -lSDL_mixer
-STATICLIBS=
-EXEC=
-DEFINES="-D_DEFAULT_VIDEOMODE_FLAGS_=SDL_HWSURFACE|SDL_DOUBLEBUF" -DSYLLABLE
diff --git a/src/sge2d/src/sgearray.c b/src/sge2d/src/sgearray.c
deleted file mode 100644
index bc3e3a0f06243acd4df44eabe347f82aa03c5299..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgearray.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <sge.h>
-
-SGEARRAY *sgeArrayNew() {
-	SGEARRAY *ret;
-	sgeNew(ret, SGEARRAY);
-	ret->numberOfElements=0;
-	ret->freeFunction=NULL;
-	sgeMalloc(ret->element, void *, 1);
-	return ret;
-}
-
-SGEARRAY *sgeAutoArrayNew(void (*function)(Uint32, void *)) {
-	SGEARRAY *ret=sgeArrayNew();
-	ret->freeFunction=function;
-	return ret;
-}
-
-void sgeArrayDestroy(SGEARRAY *a) {
-	if (a->freeFunction!=NULL) {
-		while (a->numberOfElements>0) {
-			sgeArrayRemove(a, 0);
-		}
-	}
-	sgeFree(a->element);
-	sgeFree(a);
-}
-
-void sgeArrayAdd(SGEARRAY *a, void *e) {
-	a->numberOfElements++;
-	sgeRealloc(a->element, void *, a->numberOfElements);
-	a->element[a->numberOfElements-1]=e;
-}
-
-void sgeArrayInsert(SGEARRAY *a, Uint32 offset, void *e) {
-	if (offset>=a->numberOfElements) {
-		sgeArrayAdd(a, e);
-		return;
-	}
-
-	sgeRealloc(a->element, void *, ++a->numberOfElements);
-	memmove(a->element+offset+1,a->element+offset,(a->numberOfElements-offset-1)*sizeof(void *));
-	a->element[offset]=e;
-}
-
-void sgeArrayReplace(SGEARRAY *a, Uint32 offset, void *e) {
-	if (offset>=a->numberOfElements) {
-		return;
-	}
-
-	a->element[offset]=e;
-}
-
-void *sgeArrayGet(SGEARRAY *a, Uint32 offset) {
-	if (offset<a->numberOfElements) {
-		return a->element[offset];
-	}
-	return NULL;
-}
-
-void sgeArrayRemove(SGEARRAY *a, Uint32 offset) {
-	if (a->numberOfElements>0) {
-		if (a->freeFunction!=NULL) {
-			(a->freeFunction)(offset, a->element[offset]);
-		}
-		memmove(a->element+offset,a->element+offset+1,(a->numberOfElements-offset-1)*sizeof(void *));
-		a->numberOfElements--;
-	}
-}
-
-void sgeArrayForEach(SGEARRAY *a, void function(Uint32, void *)) {
-	Uint32 i;
-	for (i=0;i<a->numberOfElements;i++) {
-		function(i, a->element[i]);
-	}
-}
-
diff --git a/src/sge2d/src/sgecontrol.c b/src/sge2d/src/sgecontrol.c
deleted file mode 100644
index 0e0d4a4ff892123404b2dbc4a5588d47bab34195..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgecontrol.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <sge.h>
-
-Uint32 sgeGlobalFPS=0;
-
-SGETIMER sgeAddTimer(int ms, void *function) {
-	SGETIMER ret;
-	if ((ret=SDL_AddTimer(ms, function, NULL))==NULL) {
-		sgeBailOut("Error adding timer %s\n", "" );
-	}
-	return ret;
-}
-
-static Uint32 sgeRedrawTimer(Uint32 interval, void *param) {
-	SDL_Event event;
-	SDL_UserEvent uevent;
-
-	uevent.type = SDL_USEREVENT;
-	uevent.code = SGEREDRAW;
-	uevent.data1 = NULL;
-	uevent.data2 = NULL; 
-	event.type = SDL_USEREVENT;
-	event.user = uevent;
-	SDL_PushEvent (&event);
-	return interval;
-}
-
-SGETIMER sgeStartRedrawTimer(int fps) {
-	sgeGlobalFPS=fps;
-	return sgeAddTimer(1000/fps, sgeRedrawTimer);
-}
-
-void sgeStopRedrawTimer(SGETIMER sgetimer) {
-	sgeRemoveTimer(sgetimer);
-}
-
-Uint32 sgeGetFPS() {
-	return sgeGlobalFPS;
-}
-
diff --git a/src/sge2d/src/sgeevent.c b/src/sge2d/src/sgeevent.c
deleted file mode 100644
index 7cf0087557f8655921ca2bdfb8bbd2bebfca47ac..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgeevent.c
+++ /dev/null
@@ -1,182 +0,0 @@
-#include <sge.h>
-
-enum sgeKey {
-	sgeUpKey=SDLK_UP,
-	sgeDownKey=SDLK_DOWN,
-	sgeLeftKey=SDLK_LEFT,
-	sgeRightKey=SDLK_RIGHT,
-	sgeStartKey=SDLK_RETURN,
-	sgeSelectKey=SDLK_BACKSPACE,
-	sgeFireKey=SDLK_SPACE,
-	sgeL1Key=SDLK_COMMA,
-	sgeR1Key=SDLK_PERIOD,
-	sgeAKey=SDLK_v,
-	sgeBKey=SDLK_b,
-	sgeXKey=SDLK_n,
-	sgeYKey=SDLK_m,
-	sgeVolUpKey=SDLK_PLUS,
-	sgeVolDownKey=SDLK_MINUS
-};
-
-enum sgeJoy {
-	sgeUpJoy=VK_UP,
-	sgeDownJoy=VK_DOWN,
-	sgeLeftJoy=VK_LEFT,
-	sgeRightJoy=VK_RIGHT,
-	sgeStartJoy=VK_START,
-	sgeSelectJoy=VK_SELECT,
-	sgeFireJoy=VK_TAT,
-	sgeL1Joy=VK_FL,
-	sgeR1Joy=VK_FR,
-	sgeAJoy=VK_FA,
-	sgeBJoy=VK_FB,
-	sgeXJoy=VK_FX,
-	sgeYJoy=VK_FY,
-	sgeVolUpJoy=VK_VOL_UP,
-	sgeVolDownJoy=VK_VOL_DOWN
-};
-
-static int sgeKeyCheck(SDL_Event *e, enum sgeKey key, enum sgeJoy joy, int type) {
-	if (
-			(e->type==SDL_KEYUP) ||
-			(e->type==SDL_JOYBUTTONUP) ||
-			(e->type==SDL_KEYDOWN) ||
-			(e->type==SDL_JOYBUTTONDOWN)
-	) {
-		if (
-				((type==PRESSED) && (e->type==SDL_KEYDOWN) && (e->key.keysym.sym==key)) ||
-				((type==PRESSED) && (e->type==SDL_JOYBUTTONDOWN) && (e->jbutton.button==joy))
-		) {
-			return 1;
-		}
-		if (
-				((type==RELEASED) && (e->type==SDL_KEYUP) && (e->key.keysym.sym==key)) ||
-				((type==RELEASED) && (e->type==SDL_JOYBUTTONUP) && (e->jbutton.button==joy))
-		) {
-			return 1;
-		}
-	}
-	return 0;
-}
-
-int sgeKeyUp(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeUpKey, sgeUpJoy, type);
-}
-
-int sgeKeyDown(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeDownKey, sgeDownJoy, type);
-}
-
-int sgeKeyLeft(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeLeftKey, sgeLeftJoy, type);
-}
-
-int sgeKeyRight(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeRightKey, sgeRightJoy, type);
-}
-
-int sgeKeyStart(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeStartKey, sgeStartJoy, type);
-}
-
-int sgeKeySelect(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeSelectKey, sgeSelectJoy, type);
-}
-
-int sgeKeyFire(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeFireKey, sgeFireJoy, type);
-}
-
-int sgeKeyL1(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeL1Key, sgeL1Joy, type);
-}
-
-int sgeKeyR1(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeR1Key, sgeR1Joy, type);
-}
-
-int sgeKeyA(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeAKey, sgeAJoy, type);
-}
-
-int sgeKeyB(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeBKey, sgeBJoy, type);
-}
-
-int sgeKeyX(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeXKey, sgeXJoy, type);
-}
-
-int sgeKeyY(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeYKey, sgeYJoy, type);
-}
-
-int sgeKeyVolUp(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeVolUpKey, sgeVolUpJoy, type);
-}
-
-int sgeKeyVolDown(SDL_Event *e, int type) {
-	return sgeKeyCheck(e, sgeVolDownKey, sgeVolDownJoy, type);
-}
-
-void sgeClearEvents() {
-	SDL_Event dummy;
-	while (SDL_PollEvent(&dummy)) {}
-}
-
-static void state_check(SGEEVENTSTATEINPUT *input, SDL_Event *event, enum sgeKey key, enum sgeJoy joy)
-{
-	if ((event->type==SDL_KEYDOWN && event->key.keysym.sym==key) || (event->type==SDL_JOYBUTTONDOWN && event->jbutton.button==joy)) {
-		input->held = 1;
-		input->pressed =1;
-	}
-	if ((event->type==SDL_KEYUP && event->key.keysym.sym==key) || (event->type==SDL_JOYBUTTONUP && event->jbutton.button==joy)) {
-		input->held = 0;
-		input->released = 1;
-	}
-}
-
-void sgeEventApply(SGEEVENTSTATE *state, SDL_Event *event)
-{
-	switch (event->type) {
-		case SDL_KEYDOWN:
-		case SDL_KEYUP:
-		case SDL_JOYBUTTONUP:
-		case SDL_JOYBUTTONDOWN:
-			state_check(&state->up, event, sgeUpKey, sgeUpJoy);
-			state_check(&state->down, event, sgeDownKey, sgeDownJoy);
-			state_check(&state->left, event, sgeLeftKey, sgeLeftJoy);
-			state_check(&state->right, event, sgeRightKey, sgeRightJoy);
-			state_check(&state->start, event, sgeStartKey, sgeStartJoy);
-			state_check(&state->select, event, sgeSelectKey, sgeSelectJoy);
-			state_check(&state->fire, event, sgeFireKey, sgeFireJoy);
-			state_check(&state->l1, event, sgeL1Key, sgeL1Joy);
-			state_check(&state->r1, event, sgeR1Key, sgeR1Joy);
-			state_check(&state->a, event, sgeAKey, sgeAJoy);
-			state_check(&state->b, event, sgeBKey, sgeBJoy);
-			state_check(&state->x, event, sgeXKey, sgeXJoy);
-			state_check(&state->y, event, sgeYKey, sgeYJoy);
-			state_check(&state->volUp, event, sgeVolUpKey, sgeVolUpJoy);
-			state_check(&state->volDown, event, sgeVolDownKey, sgeVolDownJoy);
-	}
-}
-
-void sgeEventResetInputs(SGEEVENTSTATE *state)
-{
-	state->up.pressed = state->up.released = 0;
-	state->down.pressed = state->down.released = 0;
-	state->left.pressed = state->left.released = 0;
-	state->right.pressed = state->right.released = 0;
-	state->start.pressed = state->start.released = 0;
-	state->select.pressed = state->select.released = 0;
-	state->fire.pressed = state->fire.released = 0;
-	state->l1.pressed = state->l1.released = 0;
-	state->r1.pressed = state->r1.released = 0;
-	state->a.pressed = state->a.released = 0;
-	state->b.pressed = state->b.released = 0;
-	state->x.pressed = state->x.released = 0;
-	state->y.pressed = state->y.released = 0;
-	state->volUp.pressed = state->volUp.released = 0;
-	state->volDown.pressed = state->volDown.released = 0;
-}
-
diff --git a/src/sge2d/src/sgefont.c b/src/sge2d/src/sgefont.c
deleted file mode 100644
index 77112e80338dcce884b9d6cb869fbf177b885637..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgefont.c
+++ /dev/null
@@ -1,188 +0,0 @@
-#include <sge.h>
-
-typedef struct {
-	int offset;
-	int width;
-} SGEBITMAPFONTINFO;
-
-SGEFONT *sgeFontNew(int type) {
-	SGEFONT *ret;
-	sgeNew(ret, SGEFONT);
-	ret->type=type;
-	ret->alpha=0xff;
-	ret->data=NULL;
-	return ret;
-}
-
-SGEFONT *sgeFontNewFileBitmap(SGEFILE *f, const char *filename) {
-	SGEFONT *ret=sgeFontNew(SGEFONT_BITMAP);
-	SGEBITMAPFONT *data;
-	int i=0;
-	char *tmp;
-	SGEPIXELINFO *pi;
-	SGEBITMAPFONTINFO *fi;
-	int offset=0;
-
-	sgeMalloc(tmp,char,strlen(filename)+5);
-	strcpy(tmp, filename);
-	strcat(tmp,".map");
-
-	sgeNew(data, SGEBITMAPFONT);
-	data->bitmap=sgeReadImage(f,filename);
-	data->charmap=(unsigned char *)sgeReadFile(f, tmp);
-	data->info=sgeArrayNew();
-
-	for (i=0;i<data->bitmap->w;i++) {
-		pi=sgeGetPixel(data->bitmap, i, 0);
-		if (
-				(
-				 (pi->r==255) &&
-				 (pi->g==0) &&
-				 (pi->b==255) &&
-				 (pi->a==255)
-				) ||
-				(i==data->bitmap->w-1)
-		) {
-			sgeNew(fi,SGEBITMAPFONTINFO);
-			fi->offset=offset;
-			fi->width=i-offset-1;
-			sgeArrayAdd(data->info,fi);
-			offset=i+1;
-		}
-		sgePixelInfoDestroy(pi);
-	}
-
-	ret->data=data;
-	return ret;
-}
-
-SGEFONT *sgeFontNewFile(SGEFILE *f, int type, const char *filename) {
-	switch (type) {
-		case SGEFONT_BITMAP:
-			return sgeFontNewFileBitmap(f, filename);
-	}
-	return NULL;
-}
-
-static void sgeFontDestroyBitmap(SGEFONT *f) {
-	SGEBITMAPFONT *bfont;
-	SGEBITMAPFONTINFO *bfi;
-
-	bfont=(SGEBITMAPFONT *)f->data;
-	SDL_FreeSurface(bfont->bitmap);
-	sgeFree(bfont->charmap);
-	while (bfont->info->numberOfElements>0) {
-		bfi=sgeArrayGet(bfont->info,0);
-		sgeFree(bfi);
-		sgeArrayRemove(bfont->info,0);
-	}
-	sgeArrayDestroy(bfont->info);
-	sgeFree(bfont);
-}
-
-void sgeFontDestroy(SGEFONT *f) {
-
-	if (f->data!=NULL) {
-		switch (f->type) {
-			case SGEFONT_BITMAP:
-				sgeFontDestroyBitmap(f);
-				break;
-		}
-	}
-	sgeFree(f);
-}
-
-int sgeFontGetLineHeightBitmap(SGEFONT *f) {
-	SGEBITMAPFONT *bfont;
-	bfont=(SGEBITMAPFONT *)f->data;
-	return bfont->bitmap->h;
-}
-
-int sgeFontGetLineHeight(SGEFONT *f) {
-	if (f->data==NULL) return -1;
-
-	switch (f->type) {
-		case SGEFONT_BITMAP:
-			return sgeFontGetLineHeightBitmap(f);
-	}
-	return -1;
-}
-
-int sgeFontPrintBitmap(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text) {
-	SGEBITMAPFONT *bfont;
-	SGEBITMAPFONTINFO *bfi;
-	int i;
-	int xx=x;
-	int c, idx;
-	char *pos;
-	SDL_Rect src, dst;
-	SDL_Surface *alphasurface;
-
-	bfont=(SGEBITMAPFONT *)f->data;
-
-	dst.y=y;
-	src.h=bfont->bitmap->h;
-	src.y=0;
-
-	for (i=0;i<strlen(text);i++) {
-		c=text[i];
-		pos=strchr((const char *)bfont->charmap, c);
-		if (pos!=NULL) {
-			idx=pos-(char *)bfont->charmap;
-			bfi=sgeArrayGet(bfont->info, idx);
-
-			dst.x=xx;
-			src.x=bfi->offset;
-			src.w=bfi->width;
-			xx+=bfi->width;
-
-			if (f->alpha==0xff) {
-				SDL_BlitSurface(bfont->bitmap, &src, dest, &dst);
-			} else {
-				alphasurface=sgeChangeSDLSurfaceAlpha(bfont->bitmap, f->alpha);
-				SDL_BlitSurface(alphasurface,&src,dest,&dst);
-				SDL_FreeSurface(alphasurface);
-			}
-		}
-	}
-	return xx-x;
-}
-
-int sgeFontPrint(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text) {
-	switch (f->type) {
-		case SGEFONT_BITMAP:
-			return sgeFontPrintBitmap(f, dest, x, y, text);
-	}
-	return 0;
-}
-
-int sgeFontGetWidth(SGEFONT *f, const char *text) {
-	switch (f->type) {
-		case SGEFONT_BITMAP:
-			return sgeFontGetWidthBitmap(f, text);
-	}
-	return 0;
-}
-
-int sgeFontGetWidthBitmap(SGEFONT *f, const char *text) {
-	SGEBITMAPFONT *bfont;
-	SGEBITMAPFONTINFO *bfi;
-	int i;
-	int c, idx;
-	char *pos;
-	int ret=0;
-
-	bfont=(SGEBITMAPFONT *)f->data;
-
-	for (i=0;i<strlen(text);i++) {
-		c=text[i];
-		pos=strchr((const char *)bfont->charmap, c);
-		if (pos!=NULL) {
-			idx=pos-(char *)bfont->charmap;
-			bfi=sgeArrayGet(bfont->info, idx);
-			ret+=bfi->width;
-		}
-	}
-	return ret;
-}
-
diff --git a/src/sge2d/src/sgegamestate.c b/src/sge2d/src/sgegamestate.c
deleted file mode 100644
index 4a14dca3bdf48c49910d6615157ffb343531ddd3..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgegamestate.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <sge.h>
-#include <assert.h>
-
-SGEGAMESTATEMANAGER* sgeGameStateManagerNew(void)
-{
-	SGEGAMESTATEMANAGER *ret;
-	sgeNew(ret, SGEGAMESTATEMANAGER);
-	return ret;
-}
-
-SGEGAMESTATE* sgeGameStateNew(void)
-{
-	SGEGAMESTATE *ret;
-	sgeNew(ret, SGEGAMESTATE);
-	return ret;
-}
-
-void sgeGameStateManagerQuit(SGEGAMESTATEMANAGER *manager)
-{
-	manager->quit = 1;
-}
-
-int sgeGameStateManagerChange(SGEGAMESTATEMANAGER *manager, SGEGAMESTATE *next_state)
-{
-	if (manager->current && manager->current->onStateChange) {
-		if (!manager->current->onStateChange(manager->current, next_state)) {
-			return 0;
-		}
-	}
-	manager->current = next_state;
-	next_state->manager = manager;
-	return 1;
-}
-
-void sgeGameStateManagerRun(SGEGAMESTATEMANAGER *manager, int fps)
-{
-	SDL_Event event;
-	SGETIMER t;
-	sgeClearEvents();
-	t=sgeStartRedrawTimer(fps);
-
-	assert(manager->current);
-	manager->quit = 0;
-
-	while (SDL_WaitEvent(&event) && !manager->quit) {
-		switch (event.type) {
-			case SDL_USEREVENT:
-				if (event.user.code==SGEREDRAW && manager->current->onRedraw) {
-					manager->current->onRedraw(manager->current);
-				}
-				sgeEventResetInputs(&manager->event_state);
-				break;
-			case SDL_KEYDOWN:
-				if (manager->current->onEvent)
-					manager->current->onEvent(manager->current, &event);
-//				sgeEventApply(&manager->event_state, &event);
-				break;
-			case SDL_QUIT:
-				manager->quit = 1;
-				break;
-		}
-	}
-
-	sgeStopRedrawTimer(t);
-}
diff --git a/src/sge2d/src/sgegfx.c b/src/sge2d/src/sgegfx.c
deleted file mode 100644
index 539eb6a821c37863e27e4e0776d9f323ce5d8c15..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgegfx.c
+++ /dev/null
@@ -1,346 +0,0 @@
-#include <sge.h>
-
-SGEPOSITION *sgePositionNew(int x, int y) {
-	SGEPOSITION *ret;
-
-	sgeNew(ret, SGEPOSITION);
-	ret->x=x;
-	ret->y=y;
-	return ret;
-}
-
-void sgePositionDestroy(SGEPOSITION *p) {
-	sgeFree(p);
-}
-
-SGEPIXELINFO *sgePixelInfoNew(Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
-	SGEPIXELINFO *ret;
-
-	sgeNew(ret, SGEPIXELINFO);
-	ret->r=r;
-	ret->g=g;
-	ret->b=b;
-	ret->a=a;
-
-	return ret;
-}
-
-void sgePixelInfoDestroy(SGEPIXELINFO *i) {
-	sgeFree(i);
-}
-
-inline Uint32 sgeMakeColor(SDL_Surface *surface, int r, int g, int b, int a) {
-	Uint32 color;
-	if (a<0) {
-		color=SDL_MapRGB(surface->format,r,g,b);
-	} else {
-		color=SDL_MapRGBA(surface->format,r,g,b,a);
-	}
-	return color;
-}
-
-inline void sgeFillRect(SDL_Surface *dest, int x, int y, int w, int h, Uint32 color) {
-	SDL_Rect rect;
-	rect.x=x;
-	rect.y=y;
-	rect.w=w;
-	rect.h=h;
-	SDL_FillRect(dest, &rect, color);
-}
-
-inline void sgeDrawRect(SDL_Surface *dest, int x, int y, int w, int h, int linewidth, Uint32 color) {
-	sgeFillRect(dest, x, y, w, linewidth, color);
-	sgeFillRect(dest, x, y, linewidth, h, color);
-	sgeFillRect(dest, x+w-linewidth, y, linewidth, h, color);
-	sgeFillRect(dest, x, y+h-linewidth, w, linewidth, color);
-}
-
-inline void sgeDrawPixel(SDL_Surface *dest, int x, int y, Uint32 color) {
-	Uint8 *buf8=NULL;
-	Uint16 *buf16=NULL;
-	Uint32 *buf32=NULL;
-
-	if (x<0 || y<0) return;
-	if (x>=dest->w || y>=dest->h) return;
-
-	switch (dest->format->BitsPerPixel) {
-		case 8:
-			buf8=(Uint8 *)dest->pixels+y*dest->w+x;
-			*buf8=(Uint8)color;
-			break;
-		case 16:
-			buf16=(Uint16 *)dest->pixels+y*dest->w+x;
-			*buf16=(Uint16)color;
-			break;
-		default:
-			buf32=(Uint32 *)dest->pixels+y*dest->w+x;
-			*buf32=color;
-			break;
-	}
-}
-
-inline SGEPIXELINFO *sgeGetPixel(SDL_Surface *dest, int x, int y) {
-	Uint8 p8, *buf8;
-	Uint16 p16, *buf16;
-	Uint32 p32, *buf32;
-	SGEPIXELINFO *ret;
-
-	switch (dest->format->BitsPerPixel) {
-		case 8:
-			buf8=(Uint8 *)dest->pixels;
-			p8=buf8[y*dest->w+x];
-			p32=p8;
-			break;
-		case 16:
-			buf16=(Uint16 *)dest->pixels;
-			p16=buf16[y*dest->w+x];
-			p32=p16;
-			break;
-		default:
-			buf32=(Uint32 *)dest->pixels;
-			p32=buf32[y*dest->w+x];
-			break;
-	}
-	sgeNew(ret, SGEPIXELINFO);
-	SDL_GetRGBA(p32, dest->format, &ret->r, &ret->g, &ret->b, &ret->a);
-	return ret;
-}
-
-inline void sgeDrawLine(SDL_Surface *dest, int x, int y, int x2, int y2, Uint32 color) {
-	int steep=0;
-	int tmp=0;
-	int dx=0;
-	int dy=0;
-	int err=0;
-	int ystep=1;
-	int yy=0;
-	int xx=0;
-
-	if (abs(y2-y)>abs(x2-x)) steep=1;
-	if (steep) {
-		tmp=x;
-		x=y;
-		y=tmp;
-		tmp=x2;
-		x2=y2;
-		y2=tmp;
-	}
-	if (x>x2) {
-		tmp=x;
-		x=x2;
-		x2=tmp;
-		tmp=y;
-		y=y2;
-		y2=tmp;
-	}
-	
-	if (y>y2) {
-		ystep=-1;
-	}
-
-	dx=x2-x;
-	dy=abs(y2-y);
-	err=-dx>>1;
-	yy=y;
-	
-	for (xx=x;xx<=x2;xx++) {
-		if (!steep) {
-			sgeDrawPixel(dest, xx, yy, color);
-		} else {
-			sgeDrawPixel(dest, yy, xx, color);
-		}
-		err+=dy;
-		if (err>0) {
-			yy+=ystep;
-			err-=dx;
-		}
-	}
-}
-
-inline void sgeDrawImage(SDL_Surface *dest, SDL_Surface *image, int x, int y) {
-	SDL_Rect r;
-	r.w=image->w;
-	r.h=image->h;
-	r.x=x;
-	r.y=y;
-	SDL_BlitSurface(image, NULL, dest, &r);
-}
-
-void sgeIgnoreAlpha(SDL_Surface *s) {
-	SDL_SetAlpha(s, 0, SDL_ALPHA_OPAQUE);
-}
-
-void sgeUseAlpha(SDL_Surface *s) {
-	SDL_SetAlpha(s, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
-}
-
-SDL_Surface *sgeRotoZoom(SDL_Surface *source, float rotation, float zoom) {
-	Uint32 *src32=(Uint32*)source->pixels;
-	Uint16 *src16=(Uint16*)source->pixels;
-	Uint8 *src8=(Uint8*)source->pixels;
-	SDL_Surface *ret;
-	SDL_Surface *target=SDL_CreateRGBSurface(
-			source->flags,
-			(int)((float)source->w*zoom)*3,
-			(int)((float)source->h*zoom)<<1,
-			source->format->BitsPerPixel,
-			source->format->Rmask,
-			source->format->Gmask,
-			source->format->Bmask,
-			source->format->Amask
-	);
-	SDL_Rect r;
-	Uint32 *dst32=(Uint32*)target->pixels;
-	Uint16 *dst16=(Uint16*)target->pixels;
-	Uint8 *dst8=(Uint8*)target->pixels;
-
-	int sinfp=(int)((sin(rotation)*65536.0)/zoom);
-	int cosfp=(int)((cos(rotation)*65536.0)/zoom);
-
-	int xc;
-	int yc;
-
-	int tx,ty;
-	int x,y;
-	int tempx,tempy;
-
-	int targetpitch;
-	int sourcepitch;
-	int divider;
-
-	int minx=target->w;
-	int miny=target->h;
-	int maxx=0;
-	int maxy=0;
-
-	switch (source->format->BitsPerPixel) {
-		case 8:
-			divider=0;
-			break;
-		case 16:
-			divider=1;
-			break;
-		default:
-			divider=2;
-			break;
-	}
-
-	targetpitch=target->pitch>>divider;
-	sourcepitch=source->pitch>>divider;
-	xc=(source->w<<15) - ((target->w>>1)*(cosfp+sinfp));
-	yc=(source->h<<15) - ((target->h>>1)*(cosfp-sinfp));
-
-	sgeLock(target);
-	for ( y=0; y<target->h; y++ ) {
-
-		tx=xc;
-		ty=yc;
-
-		for( x=0; x<target->w; x++ ) {
-
-
-			tempx=(tx>>16);
-			tempy=(ty>>16);
-
-			if( (tempx>=0) && (tempx<source->w) && (tempy>=0) && (tempy<source->h) ) {
-				if (x>maxx) {
-					maxx=x;
-				}
-				if (y>maxy) {
-					maxy=y;
-				}
-				if (x<minx) {
-					minx=x;
-				}
-				if (y<miny) {
-					miny=y;
-				}
-				switch (source->format->BitsPerPixel) {
-					case 8:
-						*(dst8+x+y*targetpitch) = *(src8+tempx+tempy*sourcepitch);
-						break;
-					case 16:
-						*(dst16+x+y*targetpitch) = *(src16+tempx+tempy*sourcepitch);
-						break;
-					default:
-						*(dst32+x+y*targetpitch) = *(src32+tempx+tempy*sourcepitch);
-						break;
-				}
-			}
-
-			tx+=cosfp;
-			ty-=sinfp;
-		}
-		xc+=sinfp;
-		yc+=cosfp;
-	}
-	sgeUnlock(target);
-
-	r.x=minx;
-	r.y=miny;
-	r.w=maxx-minx;
-	r.h=maxy-miny;
-
-	ret=SDL_CreateRGBSurface(
-			source->flags,
-			r.w,
-			r.h,
-			source->format->BitsPerPixel,
-			source->format->Rmask,
-			source->format->Gmask,
-			source->format->Bmask,
-			source->format->Amask
-	);
-
-	SDL_SetAlpha(target, 0, 0);
-
-	SDL_BlitSurface(target, &r, ret, NULL);
-	SDL_FreeSurface(target);
-
-	return ret;
-}
-
-SDL_Surface *sgeChangeSDLSurfaceAlpha(SDL_Surface *s, Uint8 alpha) {
-	int x,y;
-	SDL_Surface *ret=sgeDuplicateSDLSurface(s);
-	SGEPIXELINFO *pi;
-
-	sgeLock(ret);
-	for (y=0;y<ret->h;y++) {
-		for (x=0;x<ret->w;x++) {
-			pi=sgeGetPixel(ret,x,y);
-			pi->a=pi->a*alpha/256;
-			sgeDrawPixel(ret,x,y,sgeMakeColor(ret,pi->r,pi->g,pi->b,pi->a));
-			sgePixelInfoDestroy(pi);
-		}
-	}
-	sgeUnlock(ret);
-	return ret;
-}
-
-SDL_Surface *sgeCreateSDLSurface(int width, int height, int depth, Uint32 sdlflags) {
-	SDL_Surface *ret;
-	Uint32 rmask,gmask,bmask,amask;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-	rmask = 0xff000000;
-	gmask = 0x00ff0000;
-	bmask = 0x0000ff00;
-	amask = 0x000000ff;
-#else
-	rmask = 0x000000ff;
-	gmask = 0x0000ff00;
-	bmask = 0x00ff0000;
-	amask = 0xff000000;
-#endif
-
-	if (sdlflags==0) {
-		sdlflags=SDL_SWSURFACE;
-	}
-
-	ret=SDL_CreateRGBSurface(sdlflags, width, height, depth, rmask, gmask, bmask, amask);
-	if (ret==NULL) {
-		sgeBailOut("cannot create new surface: %s\n", SDL_GetError ());
-	}
-	return ret;
-}
diff --git a/src/sge2d/src/sgeinit.c b/src/sge2d/src/sgeinit.c
deleted file mode 100644
index ee5794efb2e9838234a4c20c6c5f7273b61d8c02..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgeinit.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <sge.h>
-
-SDL_Joystick *defaultjoystick;
-
-void sgeInit(int useAudio, int useJoystick) {
-	time_t now;
-	Uint32 flags=SDL_INIT_VIDEO|SDL_INIT_TIMER;
-	if (useAudio) flags|=SDL_INIT_AUDIO;
-#ifdef GP2X
-	flags|=SDL_INIT_JOYSTICK; // force joystick on gp2x
-	useJoystick=1;
-#else
-	if (useJoystick) flags|=SDL_INIT_JOYSTICK;
-#endif
-
-	if (SDL_Init (flags) < 0) {
-		sgeBailOut("cannot initialize SDL: %s\n", SDL_GetError ());
-	}
-	atexit(sgeTerminate);
-
-	if (useJoystick) {
-		if (SDL_NumJoysticks() > 0) {
-			defaultjoystick = SDL_JoystickOpen(0);
-			if(!defaultjoystick) {
-				fprintf (stderr, "cannot open joystick 0: %s\n", SDL_GetError ());
-			}
-		}
-	}
-
-	if (useAudio) {
-		if (Mix_OpenAudio(sgeGetDefaultSampleRate(), MIX_DEFAULT_FORMAT, 2, 2048)==-1) {
-			sgeBailOut("cannot initialize iibmixer: %s\n", Mix_GetError());
-		}
-	}
-
-	time(&now);
-	srand((unsigned int)now);
-}
-
-void sgeTerminate() {
-	if (SDL_WasInit(SDL_INIT_AUDIO)) {
-		Mix_HaltChannel(-1);
-#ifndef MORPHOS
-		Mix_CloseAudio();
-#endif
-	}
-	SDL_Quit();
-#ifdef GP2X
-	chdir("/usr/gp2x");
-	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-}
-
-extern int run(int argc, char *argv[]);
-int main(int argc, char *argv[]) {
-	return run(argc, argv);
-}
diff --git a/src/sge2d/src/sgelist.c b/src/sge2d/src/sgelist.c
deleted file mode 100644
index 947c47005e90cbf1c2209e48f0d79880563c20d5..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgelist.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#include <sge.h>
-
-SGELIST *sgeListNew() {
-	SGELIST *ret;
-	sgeNew(ret, SGELIST);
-	ret->numberOfEntries=0;
-	ret->first=NULL;
-	ret->last=NULL;
-	ret->entries=NULL;
-	return ret;
-}
-
-SGELISTENTRY *sgeListAdd(SGELIST *l, const char *id, void *data) {
-	SGELISTENTRY *ret;
-
-	sgeNew(ret, SGELISTENTRY);
-	l->numberOfEntries++;
-	if (l!=NULL) {
-		ret->prev=l->last;
-	} else {
-		ret->prev=NULL;
-	}
-	if (l!=NULL && l->last!=NULL) {
-		l->last->next=ret;
-	}
-	ret->next=NULL;
-	ret->id=strdup(id);
-	ret->data=data;
-
-	if (l==NULL) return ret;
-
-	if (l->first==NULL) l->first=ret;
-	l->last=ret;
-
-	return ret;
-}
-
-static void sgeListFreeList(SGELISTENTRY *l) {
-	sgeFree(l->id);
-	sgeFree(l);
-}
-
-SGELISTENTRY *sgeListInsert(SGELIST *l, SGELISTENTRY *le, const char *id, void *data) {
-	SGELISTENTRY *ret=sgeListAdd(NULL, id, data);
-	SGELISTENTRY *tmp;
-
-	l->numberOfEntries++;
-	if (le->prev==NULL) {
-		ret->next=le;
-		le->prev=ret;
-		l->first=ret;
-		return ret;
-	}
-
-	tmp=le->prev;
-	tmp->next=ret;
-	ret->prev=tmp;
-	ret->next=le;
-	le->prev=ret;
-
-	return ret;
-}
-
-SGELISTENTRY *sgeListSearch(SGELIST *l, char *id) {
-	SGELISTENTRY *act=l->first;
-
-	while (act!=NULL) {
-		if (strcmp(act->id,id)==0) return act;
-		act=act->next;
-	}
-	return NULL;
-}
-
-void sgeListRemove(SGELIST *l, char *id) {
-	SGELISTENTRY *i=sgeListSearch(l, id);
-	SGELISTENTRY *other=NULL;
-	if (i==NULL) return;
-
-	l->numberOfEntries--;
-	if ((i->prev==NULL) && (i->next==NULL)) {
-		sgeListFreeList(i);
-		return;
-	}
-
-	if (i->prev!=NULL) {
-		other=i->prev;
-		other->next=i->next;
-	}
-	if (i->next!=NULL) {
-		other=i->next;
-		other->prev=i->prev;
-	}
-	sgeListFreeList(i);
-	return;
-}
-
-void sgeListForEach(SGELIST *l, SGELISTFUNCTION function) {
-	SGELISTENTRY *iter=l->first;
-	do {
-		function(iter->id, iter->data);
-		iter=iter->next;
-	} while (iter!=NULL);
-}
-
-void sgeListDestroy(SGELIST *l) {
-	SGELISTENTRY *iter=l->first;
-	SGELISTENTRY *tmp;
-	do {
-		tmp=iter;
-		iter=iter->next;
-		sgeListFreeList(tmp);
-	} while (iter!=NULL);
-	sgeFree(l);
-}
diff --git a/src/sge2d/src/sgemisc.c b/src/sge2d/src/sgemisc.c
deleted file mode 100644
index e5e4ee52ba9941564c2f9a512518c432d6ac8d70..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgemisc.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sge.h>
-
-int sgeGetDistance(int x, int y, int xx, int yy) {
-	int distx=xx-x;
-	int disty=yy-y;
-
-	return (int) sgeRound(sqrt(distx*distx+disty*disty));
-}
-
diff --git a/src/sge2d/src/sgeparticles.c b/src/sge2d/src/sgeparticles.c
deleted file mode 100644
index 407f4f52e9cf2c9a594f9393352f8b763a8e434f..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgeparticles.c
+++ /dev/null
@@ -1,227 +0,0 @@
-#include <sge.h>
-
-SGEPARTICLES *sgeParticlesNew(
-		void *(*createFunction)(void *),
-		Uint32 (*drawFunction)(Uint32, void *),
-		void (*freeFunction)(Uint32, void *)
-) {
-	SGEPARTICLES *ret;
-	sgeNew(ret, SGEPARTICLES);
-	ret->runtime=0;
-	ret->particles=sgeAutoArrayNew(freeFunction);
-	ret->timeToLive=100;
-	ret->timeToLiveDistribution=50;
-	ret->infinite=0;
-	ret->angle=0;
-	ret->angleDistribution=20;
-	ret->gravity=.2;
-	ret->emission=20;
-	ret->emissionDistribution=10;
-	ret->internalEmission=0;
-	ret->speed=1;
-	ret->speedDistribution=.2;
-	ret->create=createFunction;
-	ret->draw=drawFunction;
-	ret->drawSurface=screen;
-	ret->x=0;
-	ret->y=0;
-	ret->custom=NULL;
-	ret->customDestroy=NULL;
-	return ret;
-}
-
-void sgeParticlesDestroy(SGEPARTICLES *p) {
-	sgeArrayDestroy(p->particles);
-	if (p->customDestroy!=NULL) {
-		(p->customDestroy(p->custom));
-	}
-	sgeFree(p);
-}
-
-void sgeParticlesDraw(SGEPARTICLES *p) {
-	Uint32 i;
-	float emission;
-	p->runtime++;
-	emission=sgeParticlesGetNewEmission(p);
-	for (i=0;i<(int)emission;i++) {
-		sgeArrayAdd(p->particles, (void *)(p->create)((void *)p));
-	}
-	for (i=0;i<p->particles->numberOfElements;i++) {
-		i=(p->draw)(i, (void *)p);
-	}
-}
-
-float sgeParticlesGetNewEmission(SGEPARTICLES *p) {
-	if (p->emission<1) {
-		p->internalEmission+=p->emission;
-		if (p->internalEmission>1) {
-			p->internalEmission-=1;
-			return 1;
-		}
-		return 0;
-	}
-	if (p->emissionDistribution!=0) {
-		return p->emission+sgeRandomFloat(-(p->emissionDistribution/2),(p->emissionDistribution));
-	}
-	return p->emission;
-}
-
-Uint32 sgeParticlesGetNewTimeToLive(SGEPARTICLES *p) {
-	if (p->timeToLiveDistribution!=0) {
-		Sint32 tmp;
-		tmp=p->timeToLive+sgeRandom(-(p->timeToLiveDistribution>>1),(p->timeToLiveDistribution));
-		if (tmp>=0) return tmp;
-		return 0;
-	}
-	return p->timeToLive;
-}
-
-float sgeParticlesGetNewSpeed(SGEPARTICLES *p) {
-	if (p->speedDistribution!=0) {
-		return p->speed+sgeRandomFloat(-p->speedDistribution/2,p->speedDistribution);
-	}
-	return p->speed;
-}
-
-float sgeParticlesGetNewAngle(SGEPARTICLES *p) {
-	if (p->angleDistribution!=0) {
-		return p->angle+sgeRandomFloat(-p->angleDistribution/2,p->angleDistribution);
-	}
-	return p->angle;
-}
-
-inline float sgeParticlesGetNewX(float x, float angle, float speed) {
-	return x+cos(M_PI/180*angle)*speed;
-}
-
-inline float sgeParticlesGetNewY(float y, float angle, float speed, float gravity) {
-	return y+sin(M_PI/180*angle)*speed+gravity;
-}
-
-void *sgePixelParticleNew(void *p) {
-	SGEPIXELPARTICLE *ret;
-	SGEPARTICLES *pp=(SGEPARTICLES *)p;
-	SGEPIXELPARTICLEDATA *data=pp->custom;
-	Uint8 r,g,b;
-	sgeNew(ret, SGEPIXELPARTICLE);
-	ret->x=(float)pp->x;
-	ret->y=(float)pp->y;
-	ret->speed=sgeParticlesGetNewSpeed(pp);
-	ret->angle=sgeParticlesGetNewAngle(pp);
-	ret->timeToLive=sgeParticlesGetNewTimeToLive(pp);
-	r=MIN(data->r1,data->r2)+sgeRandom(0,MAX(data->r2,data->r1)-MIN(data->r2,data->r1));
-	g=MIN(data->g1,data->g2)+sgeRandom(0,MAX(data->g2,data->g1)-MIN(data->g2,data->g1));
-	b=MIN(data->b1,data->b2)+sgeRandom(0,MAX(data->b2,data->b1)-MIN(data->b2,data->b1));
-	ret->color=sgeMakeColor(screen,r,g,b,0xff);
-	ret->gravity=0;
-	return ret;
-}
-
-void sgePixelParticleDestroy(Uint32 arrayidx, void *particle) {
-	SGEPIXELPARTICLE *p=(SGEPIXELPARTICLE *)particle;
-	sgeFree(p);
-}
-
-Uint32 sgePixelParticleDraw(Uint32 arrayidx, void *p) {
-	SGEPARTICLES *pp=(SGEPARTICLES *)p;
-	SGEPIXELPARTICLE *particle=sgeArrayGet(pp->particles, arrayidx);
-
-	if (pp->infinite==0) {
-		if (particle->timeToLive<1) {
-			sgeArrayRemove(pp->particles, arrayidx);
-			return arrayidx-1;
-		} else {
-			particle->timeToLive--;
-		}
-	}
-	particle->gravity+=pp->gravity;
-	particle->x=sgeParticlesGetNewX(particle->x, particle->angle, particle->speed);
-	particle->y=sgeParticlesGetNewY(particle->y, particle->angle, particle->speed, particle->gravity);
-
-	sgeDrawPixel(pp->drawSurface, (int)particle->x, (int)particle->y, particle->color);
-	return arrayidx;
-}
-
-void sgeParticlesPixelCustomDestroy(void *data) {
-	SGEPIXELPARTICLEDATA *d=(SGEPIXELPARTICLEDATA *)data;
-	sgeFree(d);
-}
-
-SGEPARTICLES *sgeParticlesPixelNew(Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2, Uint8 b2) {
-	SGEPIXELPARTICLEDATA *data;
-	SGEPARTICLES *ret=sgeParticlesNew(
-			sgePixelParticleNew,
-			sgePixelParticleDraw,
-			sgePixelParticleDestroy
-	);
-	sgeNew(data, SGEPIXELPARTICLEDATA);
-	data->r1=r1;
-	data->g1=g1;
-	data->b1=b1;
-	data->r2=r2;
-	data->g2=g2;
-	data->b2=b2;
-	ret->custom=(void *)data;
-	ret->customDestroy=sgeParticlesPixelCustomDestroy;
-	return ret;
-}
-
-SGEPARTICLES *sgeParticlesSpriteNew(SGESPRITE *sprite) {
-	SGESPRITEPARTICLEDATA *data;
-	SGEPARTICLES *ret=sgeParticlesNew(
-			sgeSpriteParticleNew,
-			sgeSpriteParticleDraw,
-			sgeSpriteParticleDestroy
-	);
-	sgeNew(data, SGESPRITEPARTICLEDATA);
-	data->sprite=sprite;
-	ret->custom=(void *)data;
-	ret->customDestroy=sgeParticlesSpriteCustomDestroy;
-	return ret;
-}
-
-void *sgeSpriteParticleNew(void *p) {
-	SGESPRITEPARTICLE *ret;
-	SGEPARTICLES *pp=(SGEPARTICLES *)p;
-	sgeNew(ret, SGESPRITEPARTICLE);
-	ret->x=(float)pp->x;
-	ret->y=(float)pp->y;
-	ret->speed=sgeParticlesGetNewSpeed(pp);
-	ret->angle=sgeParticlesGetNewAngle(pp);
-	ret->timeToLive=sgeParticlesGetNewTimeToLive(pp);
-	ret->gravity=0;
-	return ret;
-}
-
-void sgeSpriteParticleDestroy(Uint32 arrayidx, void *particle) {
-	SGESPRITEPARTICLE *p=(SGESPRITEPARTICLE *)particle;
-	sgeFree(p);
-}
-
-Uint32 sgeSpriteParticleDraw(Uint32 arrayidx, void *p) {
-	SGEPARTICLES *pp=(SGEPARTICLES *)p;
-	SGESPRITEPARTICLE *particle=sgeArrayGet(pp->particles, arrayidx);
-	SGESPRITEPARTICLEDATA *data=pp->custom;
-
-	if (pp->infinite==0) {
-		if (particle->timeToLive<1) {
-			sgeArrayRemove(pp->particles, arrayidx);
-			return arrayidx-1;
-		} else {
-			particle->timeToLive--;
-		}
-	}
-	particle->gravity+=pp->gravity;
-	particle->x=sgeParticlesGetNewX(particle->x, particle->angle, particle->speed);
-	particle->y=sgeParticlesGetNewY(particle->y, particle->angle, particle->speed, particle->gravity);
-
-	sgeSpriteDrawXY(data->sprite, (int)particle->x, (int)particle->y, pp->drawSurface);
-	return arrayidx;
-}
-
-void sgeParticlesSpriteCustomDestroy(void *data) {
-	SGESPRITEPARTICLEDATA *d=(SGESPRITEPARTICLEDATA *)data;
-	sgeSpriteDestroy(d->sprite);
-	sgeFree(d);
-}
-
diff --git a/src/sge2d/src/sgepathfinder.c b/src/sge2d/src/sgepathfinder.c
deleted file mode 100644
index 50c5fe630003eea83875b1383bbd9cac91810386..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgepathfinder.c
+++ /dev/null
@@ -1,178 +0,0 @@
-#include <sge.h>
-
-static void sgePathFinderInfoFree(Uint32 id, void *data) {
-	sgePathFinderInfoDestroy((SGEPATHFINDERINFO *)data);
-}
-
-SGEPATHFINDER *sgePathFinderNew(int width, int height) {
-	SGEPATHFINDER *ret;
-	sgeNew(ret, SGEPATHFINDER);
-	ret->width=width;
-	ret->height=height;
-	sgeMalloc(ret->map, unsigned char, width*height);
-	ret->path=sgeAutoArrayNew(&sgePathFinderInfoFree);
-	ret->useDiagonal=1;
-	return ret;
-}
-
-SGEPATHFINDER *sgePathFinderNewDiagonal(int width, int height, int diagonal) {
-	SGEPATHFINDER *ret=sgePathFinderNew(width, height);
-	sgePathFinderDiagonal(ret, diagonal);
-	return ret;
-}
-
-void sgePathFinderDestroy(SGEPATHFINDER *p) {
-	if (p->map!=NULL) {
-		sgeFree(p->map);
-	}
-	sgeArrayDestroy(p->path);
-	sgeFree(p);
-}
-
-inline void sgePathFinderDiagonal(SGEPATHFINDER *p, int diagonal) {
-	p->useDiagonal=diagonal;
-}
-
-SGEPATHFINDERINFO *sgePathFinderInfoNew(int x, int y, int startWeight, int targetWeight, void *parent) {
-	SGEPATHFINDERINFO *ret;
-	sgeNew(ret, SGEPATHFINDERINFO);
-	ret->x=x;
-	ret->y=y;
-	ret->startWeight=startWeight;
-	ret->targetWeight=targetWeight;
-	ret->parent=parent;
-	return ret;
-}
-
-void sgePathFinderInfoDestroy(SGEPATHFINDERINFO *pi) {
-	sgeFree(pi);
-}
-
-void sgePathFinderSet(SGEPATHFINDER *p, int x, int y, int value) {
-	p->map[y*p->width+x]=(unsigned char) value;
-}
-
-int sgePathFinderGet(SGEPATHFINDER *p, int x, int y) {
-	if ( (x<0) || (x>p->width-1) ) return 1;
-	if ( (y<0) || (y>p->height-1) ) return 1;
-	return (int)p->map[y*p->width+x];
-}
-
-static int sgePathFinderIsClosed(SGEPATHFINDER *p, unsigned char *map, int x, int y) {
-	if ( (x<0) || (x>p->width-1) ) return 1;
-	if ( (y<0) || (y>p->height-1) ) return 1;
-	return (int)map[y*p->width+x];
-}
-
-int sgePathFinderFind(SGEPATHFINDER *p, int startx, int starty, int destx, int desty) {
-	int found=0;
-	SGEARRAY *openList;
-	SGEARRAY *closedList;
-	unsigned char *scannedMap;
-	SGEPATHFINDERINFO *pi=NULL;
-	SGEPATHFINDERINFO *opi=NULL;
-	int x,y;
-	int dist;
-	int newweight;
-	int idx;
-	int xstart, xend, xstep;
-
-	sgeMalloc(scannedMap, unsigned char, p->width*p->height);
-	openList=sgeArrayNew();
-	closedList=sgeArrayNew();
-	sgeArrayAdd(openList,sgePathFinderInfoNew(startx, starty, 0, 0, NULL));
-
-	while ( (!found) && (openList->numberOfElements) ) {
-		pi=sgeArrayGet(openList, 0);
-		sgeArrayRemove(openList, 0);
-		if ( (pi->x==destx) && (pi->y==desty) ) {
-			sgeArrayAdd(closedList, pi);
-			found=1;
-			continue;
-		}
-		for (y=pi->y-1;y<pi->y+2;y++) {
-			if (p->useDiagonal==ENABLE_DIAGONAL) {
-				xstart=pi->x-1;
-				xend=pi->x+2;
-				xstep=1;
-			} else {
-				if (y==pi->y) {
-					xstart=pi->x-1;
-					xend=pi->x+2;
-					xstep=2;
-				} else {
-					xstart=pi->x;
-					xend=pi->x+1;
-					xstep=1;
-				}
-			}
-			for (x=xstart;x<xend;x+=xstep) {
-				if (
-						(!sgePathFinderIsClosed(p, scannedMap, x, y)) &&
-						(!sgePathFinderGet(p, x, y)) &&
-						((x!=pi->x) || (y!=pi->y))
-				) {
-					dist=sgeGetDistance(x<<7,y<<7,destx<<7,desty<<7);
-					if (openList->numberOfElements) {
-						newweight=pi->startWeight+1+dist;
-
-						opi=sgeArrayGet(openList,0);
-						idx=1;
-						while (
-								(opi->startWeight+opi->targetWeight<=newweight) &&
-								(idx<openList->numberOfElements)
-						) {
-							opi=sgeArrayGet(openList,idx++);
-						}
-						if (idx==openList->numberOfElements) {
-							sgeArrayAdd(openList,sgePathFinderInfoNew(x, y, pi->startWeight+1, dist, pi));
-						} else {
-							sgeArrayInsert(openList,idx-1,sgePathFinderInfoNew(x, y, pi->startWeight+1, dist, pi));
-						}
-					} else {
-						sgeArrayAdd(openList,sgePathFinderInfoNew(x, y, pi->startWeight+1, dist, pi));
-					}
-					scannedMap[y*p->width+x]=1;
-				}
-			}
-		}
-		sgeArrayAdd(closedList, pi);
-	}
-
-	sgeFree(scannedMap);
-
-	while (openList->numberOfElements) {
-		opi=sgeArrayGet(openList,0);
-		sgePathFinderInfoDestroy(opi);
-		sgeArrayRemove(openList,0);
-	}
-	sgeArrayDestroy(openList);
-
-	sgeArrayDestroy(p->path);
-	p->path=sgeAutoArrayNew(&sgePathFinderInfoFree);
-
-	if (!found) {
-		while (closedList->numberOfElements) {
-			opi=sgeArrayGet(closedList,0);
-			sgePathFinderInfoDestroy(opi);
-			sgeArrayRemove(closedList,0);
-		}
-		sgeArrayDestroy(closedList);
-		return 0;
-	}
-
-	while (pi->parent!=NULL) {
-		opi=(SGEPATHFINDERINFO *)pi->parent;
-		sgeArrayInsert(p->path, 0, sgePathFinderInfoNew(pi->x, pi->y, 0, 0, NULL));
-		pi=opi;
-	}
-	while (closedList->numberOfElements) {
-		opi=sgeArrayGet(closedList,0);
-		sgePathFinderInfoDestroy(opi);
-		sgeArrayRemove(closedList,0);
-	}
-	sgeArrayDestroy(closedList);
-
-	return 1;
-}
-
diff --git a/src/sge2d/src/sgeresource.c b/src/sge2d/src/sgeresource.c
deleted file mode 100644
index 7129fe90b2b81fde8b7e37e444f4e187cf5108d0..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgeresource.c
+++ /dev/null
@@ -1,235 +0,0 @@
-#include <sge.h>
-
-#define SGEIMAGE_VIDEO 0
-#define SGEIMAGE_MEMORY 1
-
-static Uint32 sgeReadEncryptedUint32(FILE *f, const char *encryptionkey) {
-	Uint32 ret;
-	fread(&ret,1,sizeof(Uint32),f);
-        sgeDecryptBuffer(&ret, sizeof(Uint32), encryptionkey);
-	ret=sgeByteSwap32(ret);
-	return ret;
-}
-
-static void sgeWriteEncryptedUint32(FILE *f, Uint32 value, const char *encryptionkey) {
-	Uint32 tmp;
-	tmp=sgeByteSwap32(value);
-	sgeEncryptBuffer(&tmp, sizeof(Uint32), encryptionkey);
-	fwrite(&tmp, 1, sizeof(Uint32), f);
-}
-
-SGEFILE *sgeOpenFile(const char *filename, const char *encryptionkey) {
-	int i;
-	SGEFILE *ret;
-	Uint32 *namelens;
-	Uint32 *namepos;
-	char *namebuf=NULL;
-
-	sgeNew(ret,SGEFILE);
-	ret->f=fopen(filename,"rb");
-	if (!ret->f) sgeBailOut("could not open file: %s\n",filename);
-
-	ret->encryptionkey=strdup(encryptionkey);
-	ret->archname=strdup(filename);
-
-	fseek(ret->f, -sizeof(Uint32), SEEK_END);
-	ret->numberOfFiles=sgeReadEncryptedUint32(ret->f, encryptionkey);
-
-	sgeMalloc(namelens, Uint32, ret->numberOfFiles);
-	sgeMalloc(namepos, Uint32, ret->numberOfFiles);
-
-	sgeMalloc(ret->fileName,char *,ret->numberOfFiles);
-	sgeMalloc(ret->position,Uint32,ret->numberOfFiles);
-	sgeMalloc(ret->fileSize,Uint32,ret->numberOfFiles);
-
-	fseek(ret->f, -(ret->numberOfFiles*sizeof(Uint32)*4+sizeof(Uint32)), SEEK_END);
-
-	for (i=0;i<ret->numberOfFiles;i++) {
-		namepos[i]=sgeReadEncryptedUint32(ret->f, encryptionkey);
-		namelens[i]=sgeReadEncryptedUint32(ret->f, encryptionkey);
-		ret->position[i]=sgeReadEncryptedUint32(ret->f, encryptionkey);
-		ret->fileSize[i]=sgeReadEncryptedUint32(ret->f, encryptionkey);
-	}
-
-	for (i=0;i<ret->numberOfFiles;i++) {
-		fseek(ret->f, namepos[i], SEEK_SET);
-		if (namebuf!=NULL) sgeFree(namebuf);
-		sgeMalloc(namebuf, char, namelens[i]+1);
-		fread(namebuf, 1, namelens[i], ret->f);
-		sgeDecryptBuffer(namebuf, namelens[i], encryptionkey);
-		ret->fileName[i]=strdup(namebuf);
-	}
-	if (namebuf!=NULL) sgeFree(namebuf);
-
-	sgeFree(namelens);
-	sgeFree(namepos);
-	rewind(ret->f);
-
-	return ret;
-}
-
-void sgeCloseFile(SGEFILE *f) {
-	int i;
-
-	fclose(f->f);
-
-	for (i=0;i<f->numberOfFiles;i++) {
-		sgeFree(f->fileName[i]);
-	}
-	sgeFree(f->archname);
-	sgeFree(f->fileName);
-	sgeFree(f->position);
-	sgeFree(f->fileSize);
-	sgeFree(f->encryptionkey);
-
-	sgeFree(f);
-}
-
-void sgeEncryptBuffer(void *buffer, Uint32 length, const char *encryptionkey) {
-	int j;
-	unsigned char *buf=buffer;
-	Uint32 keylen=strlen(encryptionkey);
-	for (j=0;j<length;j++) {
-		buf[j]^=encryptionkey[j%(keylen+1)];
-		j++;
-	}
-}
-
-void sgeCreateFile(const char *filename, char *filenames[], Uint32 numberOfFiles, const char *encryptionkey) {
-	int i;
-	FILE *f,*d;
-	struct stat st;
-	Uint32 *fileSizes;
-	Uint32 *filePositions;
-	Uint32 *namePositions;
-	char *buf=NULL;
-	char *namebuf=NULL;
-
-	f=fopen(filename,"wb");
-	if (!f) sgeBailOut("cannot create %s\n", filename);
-
-	sgeMalloc(fileSizes,Uint32,numberOfFiles);
-	sgeMalloc(filePositions,Uint32,numberOfFiles);
-	sgeMalloc(namePositions,Uint32,numberOfFiles);
-
-	for (i=0;i<numberOfFiles;i++) {
-		stat(filenames[i],&st);
-		namePositions[i]=ftell(f);
-		fileSizes[i]=st.st_size;
-
-		if (namebuf==NULL) sgeFree(namebuf);
-		sgeMalloc(namebuf,char,strlen(filenames[i])+1);
-		namebuf=strdup(filenames[i]);
-		sgeEncryptBuffer(namebuf, strlen(filenames[i]), encryptionkey);
-		fwrite(namebuf, 1, strlen(filenames[i]), f);
-		
-		filePositions[i]=ftell(f);
-		d=fopen(filenames[i],"rb");
-		if (!d) sgeBailOut("cannot open %s\n", filenames[i]);
-
-		sgeMalloc(buf,char,fileSizes[i]);
-		fread(buf,1,fileSizes[i],d);
-		sgeEncryptBuffer(buf, fileSizes[i], encryptionkey);
-		fwrite(buf,1,fileSizes[i],f);
-		sgeFree(buf);
-
-		fclose(d);
-	}
-	if (namebuf==NULL) sgeFree(namebuf);
-
-	for (i=0;i<numberOfFiles;i++) {
-		sgeWriteEncryptedUint32(f, namePositions[i], encryptionkey);
-		sgeWriteEncryptedUint32(f, strlen(filenames[i]), encryptionkey);
-		sgeWriteEncryptedUint32(f, filePositions[i], encryptionkey);
-		sgeWriteEncryptedUint32(f, fileSizes[i], encryptionkey);
-	}
-	sgeWriteEncryptedUint32(f, numberOfFiles, encryptionkey);
-	fflush(f);
-	fclose(f);
-
-	sgeFree(fileSizes);
-	sgeFree(filePositions);
-	sgeFree(namePositions);
-}
-
-int sgeGetFileIndex(SGEFILE *f, const char *filename) {
-	int i;
-	for (i=0;i<f->numberOfFiles;i++) {
-		if (strcmp(filename, f->fileName[i])==0) {
-			return i;
-		}
-	}
-	sgeBailOut("file not found: %s\n", filename);
-}
-
-Uint32 sgeGetFileSize(SGEFILE *f, const char *filename) {
-	int i=sgeGetFileIndex(f, filename);
-	return f->fileSize[i];
-}
-
-void *sgeReadFile(SGEFILE *f, const char *filename) {
-	int i=sgeGetFileIndex(f, filename);
-	unsigned char *ret;
-	sgeMalloc(ret, unsigned char, f->fileSize[i]+1);
-	fseek(f->f,f->position[i],SEEK_SET);
-	if (fread(ret,1,f->fileSize[i],f->f)==0) {
-		sgeBailOut("error reading %s from archive\n",filename);
-	}
-	sgeDecryptBuffer(ret, f->fileSize[i], f->encryptionkey);
-	return (void *)ret;
-}
-
-static SDL_Surface *sgeReadImageHelper(SGEFILE *f, const char *filename, int type) {
-	SDL_RWops  *rw;
-	char *d=sgeReadFile(f,filename);
-	SDL_Surface *s, *ret;
-
-	rw=SDL_RWFromMem(d, sgeGetFileSize(f, filename));
-	s=IMG_Load_RW(rw,0);
-	if (s==NULL) sgeBailOut("reading image '%s' failed\n",filename);
-	SDL_FreeRW(rw);
-	sgeFree(d);
-
-	if (type==SGEIMAGE_MEMORY) {
-		return s;
-	}
-
-	ret=SDL_DisplayFormatAlpha(s);
-	if (ret!=NULL) {
-		SDL_FreeSurface(s);
-		return ret;
-	}
-
-	return s;
-}
-
-SDL_Surface *sgeReadImage(SGEFILE *f, const char *filename) {
-	return sgeReadImageHelper(f, filename, SGEIMAGE_VIDEO);
-}
-
-SDL_Surface *sgeReadImageMemory(SGEFILE *f, const char *filename) {
-	return sgeReadImageHelper(f, filename, SGEIMAGE_MEMORY);
-}
-
-Mix_Chunk *sgeReadSound(SGEFILE *f, const char *filename) {
-	SDL_RWops  *rw;
-	char *d=sgeReadFile(f,filename);
-	Mix_Chunk *s;
-
-	rw=SDL_RWFromMem(d, sgeGetFileSize(f, filename));
-	s=Mix_LoadWAV_RW(rw,0);
-	if (s==NULL) sgeBailOut("reading sound '%s' failed\n",filename);
-	SDL_FreeRW(rw);
-	sgeFree(d);
-	return s;
-}
-
-SDL_Surface *sgeDuplicateSDLSurface(SDL_Surface *s) {
-	Uint32 origflags;
-	SDL_Surface *ret=SDL_CreateRGBSurface(s->flags, s->w, s->h, s->format->BitsPerPixel, s->format->Rmask, s->format->Gmask, s->format->Bmask, s->format->Amask);
-	origflags=s->flags;
-	s->flags&=!SDL_SRCALPHA;
-	SDL_BlitSurface(s, NULL, ret, NULL);
-	s->flags=origflags;
-	return ret;
-}
diff --git a/src/sge2d/src/sgescreen.c b/src/sge2d/src/sgescreen.c
deleted file mode 100644
index 9d54478c0ad4cd13f47b789a3efe876ea4bf4f20..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgescreen.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <sge.h>
-
-SDL_Surface *screen;
-
-void sgeOpenScreen(const char *title, int width, int height, int depth, int fullscreen) {
-	Uint32 flags=_DEFAULT_VIDEOMODE_FLAGS_;
-
-	if (fullscreen) {
-		flags|=SDL_FULLSCREEN;
-	}
-
-	screen=SDL_SetVideoMode(width, height, depth, flags);
-	if (screen==NULL) {
-		sgeBailOut("error opening screen: %s\n", SDL_GetError());
-	}
-	SDL_WM_SetCaption(title, NULL);
-}
-
-void sgeHideMouse() {
-	SDL_ShowCursor(SDL_DISABLE);
-}
-
-void sgeShowMouse() {
-	SDL_ShowCursor(SDL_ENABLE);
-}
-
-void sgeCloseScreen() {
-}
diff --git a/src/sge2d/src/sgesound.c b/src/sge2d/src/sgesound.c
deleted file mode 100644
index 129de3a9b7366d6143d1fa131c3bc7cf17ef1323..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgesound.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <sge.h>
-
-int sgeDefaultSampleRate=44100;
-
-void sgeSetDefaultSampleRate(int rate) {
-	sgeDefaultSampleRate=rate;
-}
-
-int sgeGetDefaultSampleRate() {
-	return sgeDefaultSampleRate;
-}
-
-int sgeGlobalVolume=MIX_MAX_VOLUME;
-
-void sgeSetVolume(int volume) {
-	sgeGlobalVolume=volume;
-	Mix_Volume(-1, volume);
-}
-
-int sgeGetVolume() {
-	return sgeGlobalVolume;
-}
-
-SGESOUND *sgeSoundNew(SGEFILE *f, const char *name) {
-	SGESOUND *ret;
-	sgeNew(ret, SGESOUND);
-	ret->data=sgeReadSound(f, name);
-	ret->playing=0;
-	ret->channel=-1;
-	return ret;
-}
-
-void sgeSoundDestroy(SGESOUND *m) {
-	if (m->playing) {
-		Mix_HaltChannel(m->channel);
-	}
-	Mix_FreeChunk(m->data);
-	sgeFree(m);
-}
-
-void sgeSoundPlay(SGESOUND *m, int loop, int fadeinms) {
-	if (m->playing) return;
-
-	if (fadeinms==0) {
-		m->channel=Mix_PlayChannel(-1, m->data, loop);
-	} else {
-		m->channel=Mix_FadeInChannel(-1, m->data, loop, fadeinms);
-	}
-	m->playing=1;
-}
-
-void sgeSoundStop(SGESOUND *m, int fadeoutms) {
-	if (!m->playing) return;
-
-	if (fadeoutms==0) {
-		Mix_HaltChannel(m->channel);
-	} else {
-		Mix_FadeOutChannel(m->channel, fadeoutms);
-	}
-	m->channel=-1;
-	m->playing=0;
-}
-
-int sgeSoundIsPlaying(SGESOUND *m) {
-	if (m->channel<0) return 0;
-	return Mix_Playing(m->channel);
-}
diff --git a/src/sge2d/src/sgesprite.c b/src/sge2d/src/sgesprite.c
deleted file mode 100644
index b8138ba343d278c787aeec11e5fc14258591744c..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgesprite.c
+++ /dev/null
@@ -1,413 +0,0 @@
-#include <sge.h>
-
-SGESPRITE *sgeSpriteNew() {
-	SGESPRITE *ret;
-	sgeNew(ret, SGESPRITE);
-	ret->x=0;
-	ret->y=0;
-	ret->currentFrame=0;
-	sgeSpriteSetFPS(ret, 15);
-	ret->sprite=sgeArrayNew();
-	sgeArrayAdd(ret->sprite, sgeArrayNew());
-	ret->bankSize=sgeArrayNew();
-	sgeArrayAdd(ret->bankSize, 0);
-	ret->isMoving=0;
-	ret->initMove=1;
-	ret->wayPoints=sgeArrayNew();
-	ret->fX=0;
-	ret->fY=0;
-	ret->dirX=0;
-	ret->dirY=0;
-	ret->moveSpeed=1.0;
-	ret->userData=NULL;
-	ret->initialized=0;
-	ret->numberOfBanks=1;
-	ret->currentBank=0;
-	ret->animate=YES;
-	ret->alpha=0xff;
-	return ret;
-}
-
-SGESPRITE *sgeSpriteNewFile(SGEFILE *f, const char *filename) {
-	SGESPRITE *ret=sgeSpriteNew();
-	sgeSpriteAddFile(ret, f, filename);
-	return ret;
-}
-
-SGESPRITE *sgeSpriteNewFileRange(SGEFILE *f, const char *template, Uint32 start, Uint32 end) {
-	SGESPRITE *ret=sgeSpriteNew();
-	sgeSpriteAddFileRange(ret, f, template, start, end);
-	return ret;
-}
-
-SGESPRITE *sgeSpriteNewSDLSurface(SDL_Surface *surface) {
-	SGESPRITE *ret=sgeSpriteNew();
-	sgeSpriteAddSDLSurface(ret, surface);
-	return ret;
-}
-
-void sgeSpriteDestroy(SGESPRITE *s) {
-	int i,n;
-	SGEARRAY *cur;
-
-	for (n=s->numberOfBanks-1;n>-1;n--) {
-		sgeSpriteSetAnimBank(s,n);
-		cur=sgeSpriteGetCurrentSpriteArray(s);
-		for (i=0;i<sgeSpriteGetNumberOfFrames(s);i++) {
-			sgeSpriteImageDestroy(sgeArrayGet(cur,0));
-			sgeArrayRemove(cur,0);
-		}
-		sgeArrayDestroy(cur);
-		sgeArrayRemove(s->sprite,n);
-		sgeArrayRemove(s->bankSize,n);
-	}
-	sgeArrayDestroy(s->sprite);
-	sgeArrayDestroy(s->bankSize);
-
-	sgeSpriteClearWayPoints(s);
-	sgeArrayDestroy(s->wayPoints);
-	sgeFree(s);
-}
-
-SGESPRITE *sgeSpriteDuplicate(SGESPRITE *s) {
-	int i,n;
-	SGESPRITE *ret;
-	SGEARRAY *bank;
-	SGESPRITEIMAGE *image, *newimage;
-
-	ret=sgeSpriteNew();
-	for (i=0;i<s->numberOfBanks;i++) {
-		if (i>0) {
-			sgeSpriteAddAnimBank(ret);
-		}
-		bank=sgeArrayGet(s->sprite,i);
-		for (n=0;n<bank->numberOfElements;n++) {
-			image=sgeArrayGet(bank, n);
-			newimage=sgeSpriteImageDuplicate(image);
-			sgeSpriteAddSpriteImage(ret,newimage);
-		}
-	}
-	ret->x=s->x;
-	ret->y=s->y;
-	ret->currentFrame=s->currentFrame;
-	ret->lastFrame=s->lastFrame;
-	ret->framesPerSecond=s->framesPerSecond;
-	ret->animate=s->animate;
-	ret->currentBank=s->currentBank;
-	ret->alpha=s->alpha;
-	ret->userData=s->userData;
-	sgeSpriteUpdatePosition(ret);
-	return ret;
-}
-
-SGESPRITEIMAGE *sgeSpriteGetCurrentFrame(SGESPRITE *s) {
-	return (SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s), s->currentFrame);
-}
-
-void sgeSpriteSetFPS(SGESPRITE *s, Uint32 fps) {
-	s->framesPerSecond=fps;
-	s->lastFrame=0;
-}
-
-void sgeSpriteAddSDLSurface(SGESPRITE *s, SDL_Surface *surface) {
-	SGESPRITEIMAGE *new;
-	sgeNew(new, SGESPRITEIMAGE);
-	sgeSpriteImageSetImage(new,surface);
-	sgeSpriteAddSpriteImage(s,new);
-}
-
-void sgeSpriteAddSpriteImage(SGESPRITE *s, SGESPRITEIMAGE *i) {
-	sgeArrayAdd(sgeSpriteGetCurrentSpriteArray(s), (void *)i);
-	sgeSpriteSetNumberOfFrames(s, sgeSpriteGetNumberOfFrames(s)+1);
-}
-
-void sgeSpriteAddFile(SGESPRITE *s, SGEFILE *f, const char *name) {
-	SGESPRITEIMAGE *new;
-	SDL_Surface *img=sgeReadImage(f,name);
-	sgeNew(new, SGESPRITEIMAGE);
-	sgeSpriteImageSetImage(new, img);
-	sgeArrayAdd(sgeSpriteGetCurrentSpriteArray(s), (void *)new);
-	sgeSpriteSetNumberOfFrames(s, sgeSpriteGetNumberOfFrames(s)+1);
-}
-
-void sgeSpriteAddFileRange(SGESPRITE *s, SGEFILE *f, const char *template, Uint32 start, Uint32 end) {
-	char *buf;
-	Uint32 i;
-	
-	sgeMalloc(buf, char, MAXFILENAMELEN);
-	for (i=start;i<=end;i++) {
-		memset(buf, 0, MAXFILENAMELEN+1);
-		snprintf(buf, MAXFILENAMELEN, template, i);
-		sgeSpriteAddFile(s, f, buf);
-	}
-	sgeFree(buf);
-}
-
-inline void sgeSpriteUpdatePosition(SGESPRITE *s) {
-	SGESPRITEIMAGE *frame;
-
-	frame=(SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s),s->currentFrame);
-	frame->x=s->x;
-	frame->y=s->y;
-}
-
-void sgeSpriteUpdate(SGESPRITE *s) {
-	SGESPRITEWAYPOINT *wp;
-
-	if (s->isMoving) {
-		wp=sgeArrayGet(s->wayPoints,0);
-		sgeSpriteMoveTowards(s, wp->x, wp->y);
-		if (!s->isMoving) {
-			sgeSpriteRemoveNextWayPoint(s);
-			if (s->wayPoints->numberOfElements>0) {
-				s->isMoving=1;
-			}
-		}
-	}
-
-	if (s->animate) {
-		if ((SDL_GetTicks()-s->lastFrame)>=1000/s->framesPerSecond) {
-			s->lastFrame=SDL_GetTicks();
-			s->currentFrame++;
-			s->currentFrame%=sgeSpriteGetNumberOfFrames(s);
-		}
-	}
-	sgeSpriteUpdatePosition(s);
-}
-
-SDL_Surface *sgeSpriteGetSDLSurface(SGESPRITE *s) {
-	SGESPRITEIMAGE *si;
-	sgeSpriteUpdate(s);
-	si=(SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s),s->currentFrame);
-	return si->image;
-}
-
-void sgeSpriteDraw(SGESPRITE *s, SDL_Surface *dest) {
-	sgeSpriteUpdate(s);
-	sgeSpriteImageDrawXY((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s),s->currentFrame),s->x, s->y, s->alpha, dest);
-}
-
-void sgeSpriteDrawXY(SGESPRITE *s, int x, int y, SDL_Surface *dest) {
-	sgeSpriteUpdate(s);
-	sgeSpriteImageDrawXY((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s),s->currentFrame), x, y, s->alpha, dest);
-}
-
-inline void sgeSpriteDrawRotoZoomed(SGESPRITE *s, float rotation, float zoom, SDL_Surface *dest) {
-	sgeSpriteDrawXYRotoZoomed(s, s->x, s->y, rotation, zoom, dest);
-}
-
-inline void sgeSpriteDrawXYRotoZoomed(SGESPRITE *s, int x, int y, float rotation, float zoom, SDL_Surface *dest) {
-	SGESPRITEIMAGE *sprite;
-	SDL_Surface *rz;
-	SDL_Rect r;
-	SDL_Surface *alphasurface;
-
-	sgeSpriteUpdate(s);
-	sprite=(SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s),s->currentFrame);
-	rz=sgeRotoZoom(sprite->image, rotation, zoom);
-	r.x=x-(rz->w>>1)+(sprite->image->w>>1);
-	r.y=y-(rz->h>>1)+(sprite->image->h>>1);
-
-	if (s->alpha==0xff) {
-		SDL_BlitSurface(rz,NULL,dest,&r);
-	} else {
-		alphasurface=sgeChangeSDLSurfaceAlpha(rz, s->alpha);
-		SDL_BlitSurface(alphasurface,NULL,dest,&r);
-		SDL_FreeSurface(alphasurface);
-	}
-	SDL_FreeSurface(rz);
-}
-
-static void sgeSpriteUseAlphaHelper(Uint32 id, void *data) {
-	SGESPRITEIMAGE *s=(SGESPRITEIMAGE *)data;
-	sgeSpriteImageUseAlpha(s);
-}
-void sgeAnimatedspriteUseAlpha(SGESPRITE *s) {
-	// TODO all sprite banks
-	sgeArrayForEach(sgeSpriteGetCurrentSpriteArray(s), sgeSpriteUseAlphaHelper);
-}
-
-static void sgeSpriteIgnoreAlphaHelper(Uint32 id, void *data) {
-	SGESPRITEIMAGE *s=(SGESPRITEIMAGE *)data;
-	sgeSpriteImageIgnoreAlpha(s);
-}
-void sgeSpriteIgnoreAlpha(SGESPRITE *s) {
-	// TODO all sprite banks
-	sgeArrayForEach(sgeSpriteGetCurrentSpriteArray(s), sgeSpriteIgnoreAlphaHelper);
-}
-
-int sgeSpriteBoxCollide(SGESPRITE *a, SGESPRITE *b) {
-	if (a==b) return 0;
-	return sgeSpriteImageBoxCollide((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(a),a->currentFrame),(SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(b),b->currentFrame));
-}
-
-int sgeSpriteCollide(SGESPRITE *a, SGESPRITE *b) {
-	if (a==b) return 0;
-	return sgeSpriteImageCollide((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(a),a->currentFrame),(SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(b),b->currentFrame));
-}
-
-int sgeSpriteBoxCollideSpriteImage(SGESPRITE *a, SGESPRITEIMAGE *b) {
-	return sgeSpriteImageBoxCollide((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(a),a->currentFrame), b);
-}
-
-int sgeSpriteCollideSpriteImage(SGESPRITE *a, SGESPRITEIMAGE *b) {
-	return sgeSpriteImageCollide((SGESPRITEIMAGE *)sgeArrayGet(sgeSpriteGetCurrentSpriteArray(a),a->currentFrame), b);
-}
-
-int sgeSpriteWidth(SGESPRITE *s) {
-	SGESPRITEIMAGE *i=sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s), s->currentFrame);
-	return i->w;
-}
-
-int sgeSpriteHeight(SGESPRITE *s) {
-	SGESPRITEIMAGE *i=sgeArrayGet(sgeSpriteGetCurrentSpriteArray(s), s->currentFrame);
-	return i->h;
-}
-
-void sgeSpriteAddWayPoint(SGESPRITE *s, int x, int y) {
-	SGESPRITEWAYPOINT *wp;
-	sgeNew(wp, SGESPRITEWAYPOINT);
-	wp->x=x;
-	wp->y=y;
-	sgeArrayAdd(s->wayPoints, wp);
-}
-
-void sgeSpriteRemoveNextWayPoint(SGESPRITE *s) {
-	SGESPRITEWAYPOINT *wp;
-	wp=sgeArrayGet(s->wayPoints,0);
-	sgeFree(wp);
-	sgeArrayRemove(s->wayPoints,0);
-}
-
-void sgeSpriteClearWayPoints(SGESPRITE *s) {
-	int i;
-	for (i=0;i<s->wayPoints->numberOfElements;i++) {
-		sgeSpriteRemoveNextWayPoint(s);
-	}
-}
-
-void sgeSpriteStartMovement(SGESPRITE *s, float speed) {
-	SGESPRITEWAYPOINT *wp=sgeArrayGet(s->wayPoints, 0);
-	s->fX=(float)wp->x;
-	s->fY=(float)wp->y;
-	s->moveSpeed=speed;
-	s->isMoving=1;
-}
-
-void sgeSpriteAbortMovement(SGESPRITE *s) {
-	s->isMoving=0;
-	s->initMove=1;
-	sgeSpriteClearWayPoints(s);
-}
-
-void sgeSpriteMoveTowards(SGESPRITE *s, int x, int y) {
-	int dx, dy;
-	if (s->initMove) {
-		dx=x-s->x;
-		dy=y-s->y;
-		s->fX=(float)s->x;
-		s->fY=(float)s->y;
-		if (abs(dx)>abs(dy)) {
-			if (dx<0) {
-				s->dirX=-1;
-			} else {
-				s->dirX=1;
-			}
-			s->dirY=(float)dy/(float)dx;
-			if ( (dx<0) && (dy<0) )  {
-				s->dirY*=-1;
-			}
-		} else {
-			s->dirX=(float)dx/(float)dy;
-			if ( (dx<0) && (dy<0) )  {
-				s->dirX*=-1;
-			}
-			if (dy<0) {
-				s->dirY=-1;
-			} else {
-				s->dirY=1;
-			}
-		}
-		s->initMove=0;
-	}
-	s->fX+=s->dirX*s->moveSpeed;
-	s->fY+=s->dirY*s->moveSpeed;
-	s->x=(int)s->fX;
-	s->y=(int)s->fY;
-
-
-	if ( (s->dirX>0) && (s->fX>=(float)x) ) {
-		s->dirX=0;
-		s->x=x;
-		s->fX=(float)x;
-	} else if ( (s->dirX<0) && (s->fX<=(float)x) ) {
-		s->dirX=0;
-		s->x=x;
-		s->fX=(float)x;
-	}
-	if ( (s->dirY>0) && (s->fY>=(float)y) ) {
-		s->dirY=0;
-		s->y=y;
-		s->fY=(float)y;
-	} else if ( (s->dirY<0) && (s->fY<=(float)y) ) {
-		s->dirY=0;
-		s->y=y;
-		s->fY=(float)y;
-	}
-	if ( (s->x==x) && (s->y==y) ) {
-		s->isMoving=0;
-		s->initMove=1;
-	}
-}
-
-void sgeSpriteSetUserData(SGESPRITE *s, void *data) {
-	s->userData=(void *)data;
-}
-
-void *sgeSpriteGetUserData(SGESPRITE *s) {
-	return (void *)s->userData;
-}
-
-inline Uint32 sgeSpriteGetNumberOfFrames(SGESPRITE *s) {
-	return (Uint32)sgeArrayGet(s->bankSize,s->currentBank);
-}
-
-inline void sgeSpriteSetNumberOfFrames(SGESPRITE *s, Uint32 number) {
-	sgeArrayReplace(s->bankSize,s->currentBank,(void *)number);
-}
-
-inline SGEARRAY *sgeSpriteGetCurrentSpriteArray(SGESPRITE *s) {
-	SGEARRAY *ret=sgeArrayGet(s->sprite, s->currentBank);
-	return ret;
-}
-
-inline void sgeSpriteSetAnimBank(SGESPRITE *s, Uint32 bank) {
-	s->currentBank=bank;
-	s->currentFrame=0;
-	s->lastFrame=0;
-}
-
-void sgeSpriteAddAnimBank(SGESPRITE *s) {
-	Uint32 nextbank=s->bankSize->numberOfElements;
-	sgeArrayAdd(s->sprite, sgeArrayNew());
-	sgeArrayAdd(s->bankSize, 0);
-	sgeSpriteSetAnimBank(s, nextbank);
-	s->numberOfBanks++;
-}
-
-Uint32 sgeSpriteGetAnimBank(SGESPRITE *s) {
-	return s->currentBank;
-}
-
-void sgeSpriteAnimate(SGESPRITE *s, int state) {
-	s->animate=state;
-}
-
-void sgeSpriteResetAnimation(SGESPRITE *s) {
-	sgeSpriteForceFrame(s,0);
-}
-
-inline void sgeSpriteForceFrame(SGESPRITE *s, Uint32 frame) {
-	s->currentFrame=frame;
-	s->lastFrame=frame;
-}
diff --git a/src/sge2d/src/sgespritegroup.c b/src/sge2d/src/sgespritegroup.c
deleted file mode 100644
index a119905ff1f0a293a9e6815a2ebafc8fc3faa0ef..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgespritegroup.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <sge.h>
-
-SGESPRITEGROUP *sgeSpriteGroupNew(void) {
-	SGESPRITEGROUP *ret;
-	sgeNew(ret, SGESPRITEGROUP);
-	ret->sprite=sgeArrayNew();
-	return ret;
-}
-
-static void sgeSpriteGroupDestroySpriteHelper(Uint32 id, void *data) {
-	SGESPRITE *s=(SGESPRITE *)data;
-	if (s!=NULL) sgeSpriteDestroy(s);
-}
-
-void sgeSpriteGroupDestroy(SGESPRITEGROUP *g) {
-	sgeArrayForEach(g->sprite, sgeSpriteGroupDestroySpriteHelper);
-	sgeArrayDestroy(g->sprite);
-	sgeFree(g);
-}
-
-void sgeSpriteGroupAddSprite(SGESPRITEGROUP *g, SGESPRITE *s) {
-	sgeArrayAdd(g->sprite,s);
-}
-
-int sgeSpriteGroupCollide(SGESPRITEGROUP *g, SGESPRITEGROUP *cg) {
-	if (sgeSpriteGroupGetCollider(g,cg)==NULL) return 0;
-	return 1;
-}
-
-int sgeSpriteGroupCollideSprite(SGESPRITEGROUP *g, SGESPRITE *s) {
-	if (sgeSpriteGroupGetColliderSprite(g,s)==NULL) return 0;
-	return 1;
-}
-
-SGESPRITE *sgeSpriteGroupGetCollider(SGESPRITEGROUP *g, SGESPRITEGROUP *cg) {
-	SGESPRITE *tmpa;
-	int i;
-	for (i=0;i<g->sprite->numberOfElements;i++) {
-		tmpa=(SGESPRITE *)sgeArrayGet(g->sprite,i);
-		if (sgeSpriteGroupCollideSprite(cg, tmpa)) return tmpa;
-	}
-	return NULL;
-}
-
-SGESPRITE *sgeSpriteGroupGetColliderSprite(SGESPRITEGROUP *g, SGESPRITE *s) {
-	SGESPRITE *tmpa;
-	int i;
-	for (i=0;i<g->sprite->numberOfElements;i++) {
-		tmpa=(SGESPRITE *)sgeArrayGet(g->sprite,i);
-		if (sgeSpriteCollide(tmpa,s)) return tmpa;
-	}
-	return NULL;
-}
-
-void sgeSpriteGroupDraw(SGESPRITEGROUP *g) {
-	SGESPRITE *tmpa;
-	int i;
-	for (i=0;i<g->sprite->numberOfElements;i++) {
-		tmpa=(SGESPRITE *)sgeArrayGet(g->sprite,i);
-		sgeSpriteDraw(tmpa, screen);
-	}
-}
-
-void sgeSpriteGroupDrawRelative(SGESPRITEGROUP *g, int camx, int camy) {
-	SGESPRITE *tmpa;
-	int i;
-	for (i=0;i<g->sprite->numberOfElements;i++) {
-		tmpa=(SGESPRITE *)sgeArrayGet(g->sprite,i);
-		sgeSpriteDrawXY(tmpa, tmpa->x-camx, tmpa->y-camy, screen);
-	}
-}
-
diff --git a/src/sge2d/src/sgespriteimage.c b/src/sge2d/src/sgespriteimage.c
deleted file mode 100644
index c0177691f3076acdce8c7756093cbb33ac0fff80..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgespriteimage.c
+++ /dev/null
@@ -1,213 +0,0 @@
-#include <sge.h>
-
-SGESPRITEIMAGE *sgeSpriteImageNew() {
-	SGESPRITEIMAGE *ret;
-	sgeNew(ret, SGESPRITEIMAGE);
-	ret->image=NULL;
-	ret->useAlpha=1;
-	ret->x=0;
-	ret->y=0;
-	ret->w=0;
-	ret->h=0;
-	return ret;
-}
-
-SGESPRITEIMAGE *sgeSpriteImageNewFile(SGEFILE *f, const char *name) {
-	SGESPRITEIMAGE *ret;
-	SDL_Surface *img=sgeReadImage(f,name);
-	sgeNew(ret, SGESPRITEIMAGE);
-	sgeSpriteImageSetImage(ret, img);
-	return ret;
-}
-
-void sgeSpriteImageDestroy(SGESPRITEIMAGE *s) {
-	if (s->image!=NULL) SDL_FreeSurface(s->image);
-	sgeFree(s);
-}
-
-SGESPRITEIMAGE *sgeSpriteImageDuplicate(SGESPRITEIMAGE *s) {
-	SGESPRITEIMAGE *newimage;
-	sgeNew(newimage,SGESPRITEIMAGE);
-	newimage->useAlpha=s->useAlpha;
-	newimage->collisionColor=s->collisionColor;
-	newimage->x=s->x;
-	newimage->y=s->y;
-	newimage->w=s->w;
-	newimage->h=s->h;
-	newimage->image=sgeDuplicateSDLSurface(s->image);
-	return newimage;
-}
-
-void sgeSpriteImageSetImage(SGESPRITEIMAGE *s, SDL_Surface *image) {
-	if (s->image!=NULL) SDL_FreeSurface(s->image);
-	s->image=image;
-	s->w=image->w;
-	s->h=image->h;
-	if (image->format->BitsPerPixel==32) {
-		s->useAlpha=1;
-	} else {
-		sgeSpriteImageSetCollisionColor(s, 0, 0, 0, 0xff);
-	}
-}
-
-void sgeSpriteImageDraw(SGESPRITEIMAGE *s, Uint8 alpha, SDL_Surface *dest) {
-	SDL_Rect r;
-	SDL_Surface *alphasurface;
-	r.x=s->x;
-	r.y=s->y;
-	if (alpha==0xff) {
-		SDL_BlitSurface(s->image,NULL,dest,&r);
-	} else {
-		alphasurface=sgeChangeSDLSurfaceAlpha(s->image, alpha);
-		SDL_BlitSurface(alphasurface,NULL,dest,&r);
-		SDL_FreeSurface(alphasurface);
-	}
-}
-
-void sgeSpriteImageDrawXY(SGESPRITEIMAGE *s, int x, int y, Uint8 alpha, SDL_Surface *dest) {
-	SDL_Rect r;
-	SDL_Surface *alphasurface;
-	r.x=x;
-	r.y=y;
-
-	if (alpha==0xff) {
-		SDL_BlitSurface(s->image,NULL,dest,&r);
-	} else {
-		alphasurface=sgeChangeSDLSurfaceAlpha(s->image, alpha);
-		SDL_BlitSurface(alphasurface,NULL,dest,&r);
-		SDL_FreeSurface(alphasurface);
-	}
-}
-
-int sgeSpriteImageBoxCollide(SGESPRITEIMAGE *a, SGESPRITEIMAGE *b) {
-	Sint32 axaw, bxbw;
-	Sint32 ayah, bybh;
-
-	axaw=a->x+a->w;
-	bxbw=b->x+b->w;
-
-	if (
-			( (axaw>=b->x) && (axaw<=bxbw) ) ||
-			( (a->x<=b->x) && (axaw>=b->x) ) ||
-			( (b->x<=a->x) && (bxbw>=a->x) )
-	) {
-		ayah=a->y+a->h;
-		bybh=b->y+b->h;
-		if ( (ayah>=b->y) && (ayah<=bybh) ) {
-			return 1;
-		}
-		if ( (a->y>=b->y) && (a->y<=bybh) ) {
-			return 1;
-		}
-		if ( (b->y<=a->y) && (bybh>=a->y) ) {
-			return 1;
-		}
-		if ( (a->y<=b->y) && (ayah>=b->y) ) {
-			return 1;
-		}
-		return 0;
-	}
-	if ( (a->x>=b->x) && (a->x<=bxbw) ) {
-		ayah=a->y+a->h;
-		bybh=b->y+b->h;
-		if ( (ayah>=b->y) && (ayah<=bybh) ) {
-			return 1;
-		}
-		if ( (a->y>=b->y) && (a->y<=bybh) ) {
-			return 1;
-		}
-		if ( (b->y<=a->y) && (bybh>=a->y) ) {
-			return 1;
-		}
-		if ( (a->y<=b->y) && (ayah=b->y) ) {
-			return 1;
-		}
-		return 0;
-	}
-	return 0;
-}
-
-int sgeSpriteImageCollide(SGESPRITEIMAGE *a, SGESPRITEIMAGE *b) {
-	int ax, ay;
-	int bx, by;
-	int cw, ch;
-	int x,y;
-	Uint32 *a32, *b32;
-	Uint16 *a16, *b16;
-	Uint8 *a8, *b8;
-	Uint32 pa, pb, tmpcola, tmpcolb;
-	Uint8 ra,ga,ba,aa,rb,gb,bb,ab;
-	if (sgeSpriteImageBoxCollide(a,b)) {
-		if (a->x>b->x) {
-			ax=0;
-			bx=a->x-b->x;
-			cw=MIN(MIN(b->w-(a->x-b->x),a->w),b->w);
-		} else {
-			ax=b->x-a->x;
-			bx=0;
-			cw=MIN(MIN(a->w-(b->x-a->x),a->w),b->w);
-		}
-		if (a->y>b->y) {
-			ay=0;
-			by=a->y-b->y;
-			ch=MIN(MIN(b->h-(a->y-b->y),a->h),b->h);
-		} else {
-			ay=b->y-a->y;
-			by=0;
-			ch=MIN(MIN(a->h-(b->y-a->y),a->h),b->h);
-		}
-		if (ch<1 || cw<1) {
-			return 0;
-		}
-		a32=(Uint32 *)a->image->pixels;
-		b32=(Uint32 *)b->image->pixels;
-		a16=(Uint16 *)a->image->pixels;
-		b16=(Uint16 *)b->image->pixels;
-		a8=(Uint8 *)a->image->pixels;
-		b8=(Uint8 *)b->image->pixels;
-		for (x=0;x<cw;x++) {
-			for (y=0;y<ch;y++) {
-				if (a->image->format->BitsPerPixel==32||a->image->format->BitsPerPixel==24) {
-					pa=a32[(y+ay)*a->w+x+ax];
-					pb=b32[(y+by)*b->w+x+bx];
-				} else if (a->image->format->BitsPerPixel==16) {
-					pa=a16[(y+ay)*a->w+x+ax];
-					pb=b16[(y+by)*b->w+x+bx];
-				} else {
-					pa=a8[(y+ay)*a->w+x+ax];
-					pb=b8[(y+by)*b->w+x+bx];
-				}
-				SDL_GetRGBA(pa, a->image->format, &ra, &ga, &ba, &aa);
-				SDL_GetRGBA(pb, b->image->format, &rb, &gb, &bb, &ab);
-				if (a->useAlpha==1 && b->useAlpha==1 && aa!=0 && ab!=0) return 1;
-				if (a->useAlpha==0 && b->useAlpha==0) {
-					tmpcola=SDL_MapRGB(a->image->format,ra,ga,ba);
-					tmpcolb=SDL_MapRGB(b->image->format,rb,gb,bb);
-					if (tmpcola!=a->collisionColor && tmpcolb!=b->collisionColor) return 1;
-				}
-			}
-		}
-	}
-	return 0;
-}
-
-void sgeSpriteImageUseAlpha(SGESPRITEIMAGE *s) {
-	sgeUseAlpha(s->image);
-	s->useAlpha=1;
-}
-
-void sgeSpriteImageIgnoreAlpha(SGESPRITEIMAGE *s) {
-	sgeIgnoreAlpha(s->image);
-	s->useAlpha=0;
-}
-
-void sgeSpriteImageSetCollisionColor(SGESPRITEIMAGE *s, int r, int g, int b, int a) {
-	Uint32 col;
-	if (a<0) {
-		col=SDL_MapRGB(s->image->format, r, g, b);
-	} else {
-		col=SDL_MapRGBA(s->image->format, r, g, b, a);
-	}
-	s->collisionColor=col;
-}
-
diff --git a/src/sge2d/src/sgestage.c b/src/sge2d/src/sgestage.c
deleted file mode 100644
index c42cee3423cc961a9bbf8fad530da6844fbfbea7..0000000000000000000000000000000000000000
--- a/src/sge2d/src/sgestage.c
+++ /dev/null
@@ -1,168 +0,0 @@
-#include <sge.h>
-
-SGELAYER *sgeLayerNew(SGESPRITE *sprite) {
-	SGELAYER *ret;
-	SGESPRITEIMAGE *i=sgeArrayGet(sgeSpriteGetCurrentSpriteArray(sprite), sprite->currentFrame);
-	sgeNew(ret, SGELAYER);
-	ret->x=0;
-	ret->y=0;
-	ret->w=i->image->w;
-	ret->h=i->image->h;
-	ret->sprite=sprite;
-	return ret;
-}
-
-void sgeLayerDestroy(SGELAYER *l) {
-	sgeSpriteDestroy(l->sprite);
-	sgeFree(l);
-}
-
-SGESTAGE *sgeStageNew(int width, int height) {
-	SGESTAGE *ret;
-	sgeNew(ret, SGESTAGE);
-	ret->cameraX=0;
-	ret->cameraY=0;
-	ret->w=width;
-	ret->h=height;
-	ret->layers=sgeArrayNew();
-	ret->spriteGroups=sgeArrayNew();
-	return ret;
-}
-
-static void sgeStageDestroyLayersHelper(Uint32 id, void *data) {
-	SGELAYER *l=(SGELAYER *)data;
-	sgeLayerDestroy(l);
-}
-
-static void sgeStageDestroySpriteGroupsHelper(Uint32 id, void *data) {
-	SGESPRITEGROUP *g=(SGESPRITEGROUP *)data;
-	sgeSpriteGroupDestroy(g);
-}
-
-void sgeStageDestroy(SGESTAGE *s) {
-	sgeArrayForEach(s->layers, sgeStageDestroyLayersHelper);
-	sgeArrayDestroy(s->layers);
-	sgeArrayForEach(s->spriteGroups, sgeStageDestroySpriteGroupsHelper);
-	sgeArrayDestroy(s->spriteGroups);
-	sgeFree(s);
-}
-
-int sgeStageAddLayer(SGESTAGE *s, SGESPRITE *sprite, int x, int y) {
-	SGELAYER *l;
-	l=sgeLayerNew(sprite);
-	l->x=x;
-	l->y=y;
-	sgeArrayAdd(s->layers, l);
-	return s->layers->numberOfElements-1;
-}
-
-void sgeStageSetLayerHeight(SGESTAGE *s, int layer, int height) {
-	SGELAYER *l=(SGELAYER *)sgeArrayGet(s->layers, layer);
-	l->h=height;
-}
-
-void sgeStageSetLayerWidth(SGESTAGE *s, int layer, int width) {
-	SGELAYER *l=(SGELAYER *)sgeArrayGet(s->layers, layer);
-	l->w=width;
-}
-
-void sgeStageDrawLayer(SGESTAGE *s, SDL_Surface *dest, int layer) {
-	SDL_Rect r;
-	SGELAYER *l=(SGELAYER *)sgeArrayGet(s->layers, layer);
-	SGEARRAY *cur=sgeSpriteGetCurrentSpriteArray(l->sprite);
-	SGESPRITEIMAGE *i=sgeArrayGet(cur, l->sprite->currentFrame);
-	int newx, newy;
-	double tmp;
-	newx=s->cameraX-l->x;
-	if (l->x!=0) {
-		newx-=screen->w;
-	}
-	newy=s->cameraY-l->y;
-	if (l->y!=0) {
-		newy-=screen->h;
-	}
-	tmp=(double)newx*(double)((double)(i->w+l->x-screen->w)/(double)s->w);
-	r.x=(int)tmp;
-	tmp=(double)newy*(double)((double)(i->h+l->y-screen->h)/(double)s->h);
-	r.y=(int)tmp;
-	r.w=dest->w;
-	r.h=dest->h;
-
-	SDL_BlitSurface(i->image, &r, dest, NULL);
-}
-
-int sgeStageAddSpriteGroup(SGESTAGE *s, SGESPRITEGROUP *g) {
-	sgeArrayAdd(s->spriteGroups, g);
-	return s->spriteGroups->numberOfElements-1;
-}
-
-int sgeStageAddSprite(SGESTAGE *s, int spriteGroup, SGESPRITE *sprite) {
-	SGESPRITEGROUP *g=sgeArrayGet(s->spriteGroups,spriteGroup);
-	sgeSpriteGroupAddSprite(g, sprite);
-	return g->sprite->numberOfElements-1;
-}
-
-void sgeStageDrawSpriteGroup(SGESTAGE *s, int spriteGroup) {
-	SGESPRITEGROUP *g=sgeArrayGet(s->spriteGroups,spriteGroup);
-	sgeSpriteGroupDrawRelative(g, s->cameraX, s->cameraY);
-}
-
-void sgeStageDrawSpriteGroups(SGESTAGE *s) {
-	Uint32 i;
-	SGESPRITEGROUP *g;
-	for (i=0;i<s->spriteGroups->numberOfElements;i++) {
-		g=(SGESPRITEGROUP *)sgeArrayGet(s->spriteGroups,i);
-		sgeSpriteGroupDrawRelative(g, s->cameraX, s->cameraY);
-	}
-}
-
-int sgeStageSpriteGroupCollideSprite(SGESTAGE *s, int b, SGESPRITE *a, int orientation) {
-	SGESPRITEGROUP *g;
-	SGESPRITE *collider;
-	SGESPRITEIMAGE *collidersprite, *colliderimage;
-	int ret=0;
-
-	if (b > s->spriteGroups->numberOfElements-1) {
-		return 0;
-	}
-
-	g=(SGESPRITEGROUP *)sgeArrayGet(s->spriteGroups, b);
-	collidersprite=sgeSpriteGetCurrentFrame(a);
-	colliderimage=sgeSpriteImageDuplicate(collidersprite);
-
-	if (orientation==RELATIVE) {
-		colliderimage->x+=s->cameraX;
-		colliderimage->y+=s->cameraY;
-	}
-
-	collider=sgeSpriteNew();
-	sgeSpriteAddSpriteImage(collider, colliderimage);
-
-	ret=sgeSpriteGroupCollideSprite(g, collider);
-	sgeSpriteDestroy(collider);
-	return ret;
-}
-
-int sgeStageSpriteGroupCollideSpriteGroup(SGESTAGE *s, int a, int b, int orientationa) {
-	SGESPRITE *tmpa;
-	SGESPRITEGROUP *g;
-	int i;
-
-	if (
-			(b > s->spriteGroups->numberOfElements-1) ||
-			(a > s->spriteGroups->numberOfElements-1)
-	) {
-		return 0;
-	}
-
-	g=(SGESPRITEGROUP *)sgeArrayGet(s->spriteGroups, a);
-	for (i=0;i<g->sprite->numberOfElements;i++) {
-		tmpa=(SGESPRITE *)sgeArrayGet(g->sprite,i);
-		if (sgeStageSpriteGroupCollideSprite(s, b, tmpa, orientationa)) return 1;
-	}
-	return 0;
-}
-
-SGEPOSITION *sgeStageScreenToReal(SGESTAGE *s, int x, int y) {
-	return sgePositionNew(x+s->cameraX,y+s->cameraY);
-}
diff --git a/src/sge2d/tools/.cvsignore b/src/sge2d/tools/.cvsignore
deleted file mode 100644
index cc84fce2ccf2c49127aa597967e66591a49df78d..0000000000000000000000000000000000000000
--- a/src/sge2d/tools/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-sga
diff --git a/src/sge2d/tools/Makefile b/src/sge2d/tools/Makefile
deleted file mode 100644
index c2305c17896f0d8383153ccec38e9e4bf6252fba..0000000000000000000000000000000000000000
--- a/src/sge2d/tools/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-include ../setup.project
-include ../setup.$(PLATFORM)
-
-TARGET=sga$(EXEC)
-
-OBJ=sga.o
-
-CFLAGS=-Wall -I../include $(SDLCFLAGS)
-LDFLAGS=$(SDLLDFLAGS)
-
-.c.o:
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-all:$(OBJ)
-	$(CC) -o $(TARGET) $(LDFLAGS) $(OBJ) ../libsge.a $(STATICLIBS)
-
-test:
-	rm -f ./test.db
-	$(TARGET) secretkey ./test.db sga.c sga.o
-
-clean:
-	rm -rf stdout.txt stderr.txt
-	rm -f ./test.db
-	rm -f $(OBJ)
-	rm -f $(TARGET)
diff --git a/src/sge2d/tools/sga b/src/sge2d/tools/sga
deleted file mode 100755
index 09c3f422fdcb603c2b39089e3adcdf721fa20b20..0000000000000000000000000000000000000000
Binary files a/src/sge2d/tools/sga and /dev/null differ
diff --git a/src/sge2d/tools/sga.c b/src/sge2d/tools/sga.c
deleted file mode 100644
index 6babafbf14393b7e89bbeb5bd3a8c2e6eb69beaf..0000000000000000000000000000000000000000
--- a/src/sge2d/tools/sga.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <sge.h>
-
-int run(int argc, char *argv[]) {
-	char **files;
-	int i;
-	int nfiles=0;
-	struct stat st;
-
-	if (argc<4) {
-		printf("usage: sga [encryptionkey] [target] [files] ...\n");
-		exit(0);
-	}
-
-	if (stat(argv[2],&st)==0) {
-		printf("file %s already exists\n\n", argv[2]);
-		printf("to prevent accidently removement of important data files\nthough wrong parameter usage, this tool\nrefuses to overwrite archives. remove it first\n");
-		exit(-1);
-	}
-
-	sgeInit(NOAUDIO, NOJOYSTICK);
-	for (i=3;i<argc;i++) {
-		if (strcmp(argv[i],argv[2])!=0) nfiles++;
-	}
-	sgeMalloc(files,char*,nfiles);
-	for (i=3;i<argc;i++) {
-		if (strcmp(argv[i],argv[2])!=0) files[i-3]=argv[i];
-	}
-	sgeCreateFile(argv[2], files,nfiles,argv[1]);
-	sgeFree(files);
-	return 0;
-}
diff --git a/src/sge2d/win32/README-SDL.txt b/src/sge2d/win32/README-SDL.txt
deleted file mode 100644
index 1669736cb52b18cd12ab58171f18886600620b85..0000000000000000000000000000000000000000
--- a/src/sge2d/win32/README-SDL.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Please distribute this file with the SDL runtime environment:
-
-The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
-designed to make it easy to write multi-media software, such as games and
-emulators.
-
-The Simple DirectMedia Layer library source code is available from:
-http://www.libsdl.org/
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
diff --git a/src/sge2d/win32/README-SDL_image.txt b/src/sge2d/win32/README-SDL_image.txt
deleted file mode 100644
index 9df79a908cdf019cfe6adc470a4191c916dd7ef6..0000000000000000000000000000000000000000
--- a/src/sge2d/win32/README-SDL_image.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Please include this notice with the runtime environment:
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
-The source is available from the libraries page at the SDL website:
-http://www.libsdl.org/
diff --git a/src/sge2d/win32/README.SDL_mixer.txt b/src/sge2d/win32/README.SDL_mixer.txt
deleted file mode 100644
index 0630ca8a7844c00288bb33237297a80d5c594a40..0000000000000000000000000000000000000000
--- a/src/sge2d/win32/README.SDL_mixer.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Please include this notice with the runtime environment:
-
-This library is distributed under the terms of the GNU LGPL license:
-http://www.gnu.org/copyleft/lesser.html
-
-The source is available from the libraries page at the SDL website:
-http://www.libsdl.org/
diff --git a/src/sge2d/win32/SDL.dll b/src/sge2d/win32/SDL.dll
deleted file mode 100755
index a5da7bbdeb488dad9412311b363c0ad1850fc044..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/SDL.dll and /dev/null differ
diff --git a/src/sge2d/win32/SDL_image.dll b/src/sge2d/win32/SDL_image.dll
deleted file mode 100755
index c536a5b2dbaa8dc68dfb8cf5e42e64178950e293..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/SDL_image.dll and /dev/null differ
diff --git a/src/sge2d/win32/SDL_mixer.dll b/src/sge2d/win32/SDL_mixer.dll
deleted file mode 100755
index 4a10a2565b680cb8aaa1c67a52391bbac1507c1e..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/SDL_mixer.dll and /dev/null differ
diff --git a/src/sge2d/win32/jpeg.dll b/src/sge2d/win32/jpeg.dll
deleted file mode 100755
index 28759ab9b01398ab8cc73e34c2d8f70033127f2c..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/jpeg.dll and /dev/null differ
diff --git a/src/sge2d/win32/libogg-0.dll b/src/sge2d/win32/libogg-0.dll
deleted file mode 100755
index fa3eb894ae72b55d04f70d8023d6f3a41b7d7037..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/libogg-0.dll and /dev/null differ
diff --git a/src/sge2d/win32/libpng12-0.dll b/src/sge2d/win32/libpng12-0.dll
deleted file mode 100755
index 23a6d30eb7ed4e981f572485fdfd4f4add0d3a2f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/libpng12-0.dll and /dev/null differ
diff --git a/src/sge2d/win32/libtiff-3.dll b/src/sge2d/win32/libtiff-3.dll
deleted file mode 100755
index aa243aaadaf0defeedaeb48dec09cc8f7a20923f..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/libtiff-3.dll and /dev/null differ
diff --git a/src/sge2d/win32/libvorbis-0.dll b/src/sge2d/win32/libvorbis-0.dll
deleted file mode 100755
index 8bde11e48f9244f8dfbd6b6f7e8151048352ceaa..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/libvorbis-0.dll and /dev/null differ
diff --git a/src/sge2d/win32/libvorbisfile-3.dll b/src/sge2d/win32/libvorbisfile-3.dll
deleted file mode 100755
index a353179382320822dc53017b62d20f7aa886b596..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/libvorbisfile-3.dll and /dev/null differ
diff --git a/src/sge2d/win32/smpeg.dll b/src/sge2d/win32/smpeg.dll
deleted file mode 100755
index b6eed35a157acb89657a9d74b1c9f7c1c2ef5064..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/smpeg.dll and /dev/null differ
diff --git a/src/sge2d/win32/zlib1.dll b/src/sge2d/win32/zlib1.dll
deleted file mode 100755
index 007afc43c3f4463d3fa27ba3ca7c27ab283c61cc..0000000000000000000000000000000000000000
Binary files a/src/sge2d/win32/zlib1.dll and /dev/null differ