Index: Canvas.cpp
===================================================================
--- Canvas.cpp	(revision 42)
+++ Canvas.cpp	(working copy)
@@ -25,7 +25,9 @@
 
 #define Window X11Window //oops
 #include <SDL/SDL_syswm.h>
+#ifndef WIN32
 #include <X11/X.h>
+#endif
 #undef Window
 
 
@@ -621,6 +623,7 @@
   SDL_VERSION( &sys.version );
   SDL_GetWMInfo( &sys );
 
+#ifndef WIN32
   // take focus...
   XEvent ev = { 0 };
   ev.xclient.type         = ClientMessage;
@@ -636,7 +639,7 @@
 	      NoEventMask, //SubstructureRedirectMask,
 	      &ev);    
   XSync( sys.info.x11.display, False );
-
+#endif
   //XRaiseWindow( sys.info.x11.display, sys.info.x11.window );
 }
 
Index: Config.h
===================================================================
--- Config.h	(revision 42)
+++ Config.h	(working copy)
@@ -56,6 +56,10 @@
 #define COLOUR_BLACK   0x101010
 #define COLOUR_BROWN   0x703010
 
+#ifdef WIN32
+#define INSTALL_BASE_PATH "./data/"
+#endif
+
 #ifndef INSTALL_BASE_PATH
 #  define INSTALL_BASE_PATH "/usr/share/numptyphysics"
 #endif
Index: create-win32-dist.sh
===================================================================
--- create-win32-dist.sh	(revision 0)
+++ create-win32-dist.sh	(revision 0)
@@ -0,0 +1,31 @@
+#!/bin/sh -x
+# simple script to prepare numptywin32 for release
+
+# folder in which we create the binary distro
+DIST=NumptyPhysicsWin32
+
+# shared libraries to be put into the dist
+DLLS="SDL.dll SDL_image.dll jpeg.dll libpng12-0.dll zlib1.dll"
+
+# level files and data files
+DATA="*.jpg *.png *.nph"
+
+# misc files to be placed into the distro
+MISC="README.win32"
+
+# binary executable, when compiled
+BINARY=Game.exe
+
+# target name in distro folder (without .exe)
+NAME=NumptyPhysics
+
+make
+rm -rf $DIST
+mkdir $DIST
+mkdir $DIST/data
+cp i686/$BINARY $DIST/$NAME.exe
+cp $DATA $DIST/data
+cp $DLLS $DIST
+cp $MISC $DIST
+find $DIST
+
Index: Game.cpp
===================================================================
--- Game.cpp	(revision 42)
+++ Game.cpp	(working copy)
@@ -25,6 +25,10 @@
 #include <errno.h>
 #include <sys/stat.h>
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
 #include "Common.h"
 #include "Array.h"
 #include "Config.h"
@@ -1098,8 +1102,10 @@
       } else {
         m_levels.addPath( DEFAULT_LEVEL_PATH );
       }
+#ifndef WIN32
       std::string u( getenv("HOME") );
       m_levels.addPath( (u + "/" USER_LEVEL_PATH).c_str() );
+#endif
     } else {
       for ( int i=1;i<argc;i++ ) {
 	m_levels.addPath( argv[i] );
@@ -1129,7 +1135,11 @@
     if ( file ) {
       p = file;
     } else {
+#ifdef WIN32
+      p = "./data/L99_saved.nph";
+#else
       p = getenv("HOME"); p+="/"USER_BASE_PATH"/L99_saved.nph";
+#endif
     }
     if ( m_scene.save( p ) ) {
       m_levels.addPath( p.c_str() );
@@ -1487,14 +1497,19 @@
 };
 
 
+#ifdef WIN32
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+    LPSTR lpCmdLine, int nCmdShow)
+#else
 int main(int argc, char** argv)
+#endif
 {
   try {
     putenv("SDL_VIDEO_X11_WMCLASS=NPhysics");
     if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) {
       throw "Couldn't initialize SDL";
     }
-
+#ifndef WIN32
     if ( mkdir( (string(getenv("HOME"))+"/"USER_BASE_PATH).c_str(),
 		0755)==0 ) {
       printf("created user dir\n");
@@ -1519,8 +1534,13 @@
       }
     } else {
       Game game( argc, (const char**)argv );
+#else
+      Game game( 0, (const char**)NULL );
+#endif
       game.run();
+#ifndef WIN32
     }
+#endif
   } catch ( const char* e ) {
     cout <<"*** CAUGHT: "<<e<<endl;
   } 
Index: README.win32
===================================================================
--- README.win32	(revision 0)
+++ README.win32	(revision 0)
@@ -0,0 +1,19 @@
+Win32 "port" by Thomas Perl <thpinfo.com>
+=========================================
+
+You need MinGW32 and msys to compile this. You will also need
+gcc-g++ from the mingw file release webpage and have your "make"
+binary linked to "mingw32-make", because the default "make" will
+not work and give you errors.
+
+You also need to install SDL and SDL_image development headers,
+and copy the DLL files from the Win32 binary distributions for
+SDL and SDL_image to this folder, so the "create-win32-dist.sh"
+script can find them and copy them into the correct location.
+
+Saved levels are placed in the "data" folder, and that's also
+where you should put downloaded levels.
+
+Upstream: http://numptyphysics.garage.maemo.org
+Porter's webpage: http://thpinfo.com
+
