Index: cpp/gdk/nonstd.h
===================================================================
--- cpp/gdk/nonstd.h	(revision 69)
+++ cpp/gdk/nonstd.h	(revision 82)
@@ -1,44 +1,35 @@
-//Define rnd01, rnd0N, and randomN so that they
-//work in your C++ environment.
-//Some other functions/macros may also be needed if they
-//are missing in your environment, like min, max, etc.
+#ifndef _NONSTD_H_
+#define _NONSTD_H_
 
-#ifndef __NONSTD_H
-#define __NONSTD_H
-
-#define APPLICATION_NAME "Framsticks"
-#define MAIN_FRAMSTICKS
 #define SAFEDELETE(p) {if (p) {delete p; p=NULL;}}
 #define SAFEDELETEARRAY(p) {if (p) {delete[] p; p=NULL;}}
 
-//#ifndef _Windows   included below?
-//#include <stdlib.h>
-//#endif
+#define roundToInt(x) ((int)(floor((x)+0.5)))
+
+
+#define CPP_STR(s) CPP_XSTR(s)
+#define CPP_XSTR(s) #s
+
 
 #define DB(x) //output debug info. If needed, use #define DB(x) x
 //#define DB(x) x
 
+
 // ms visual c++
 #ifdef _MSC_VER
- #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
- #include <windows.h>
- #include <stdio.h>
- #include <stdarg.h>
+ #include <stdio.h> //musi byc najpierw ten include zeby robic definy ponizej (albo bedzie '_vsnprintf': attributes inconsistent with previous declaration, stdio.h:358)
  #define vsnprintf _vsnprintf
- #define _USE_MATH_DEFINES //after this is defined, the next #include <math.h> or <cmath> will define:
- //#ifndef M_PI
- //#define M_PI 3.1415926535897932384626433832795
- //#endif
- //#ifndef M_PI_2
- //#define M_PI_2 (M_PI/2)
- //#endif
+ #define snprintf _snprintf
+#endif
 
+#ifdef MOBILE2D
+ #define strdup _strdup
 #endif
 
 /////////////////////////////////////////////////////// 64-bit int type and other macros
-#ifdef _Windows
+#ifdef _WIN32
 	typedef __int64 LONGLONG;
-	#define PATHSEPARATORCHAR '\\'
-	#define PATHSEPARATORSTRING "\\"
+	#define PATH_SEPARATOR_CHAR '\\'
+	#define PATH_SEPARATOR_STRING "\\"
 	#define FPU_THROWS_EXCEPTIONS
 	#define FOPEN_READ "rt"
@@ -47,6 +38,6 @@
 #else
 	#define LONGLONG long long int
-	#define PATHSEPARATORCHAR '/'
-	#define PATHSEPARATORSTRING "/" 
+	#define PATH_SEPARATOR_CHAR '/'
+	#define PATH_SEPARATOR_STRING "/"
 	#define FOPEN_READ "r"
 	#define FOPEN_WRITE "w"
@@ -54,44 +45,36 @@
 #endif
 
-#ifdef __BORLANDC__
-	#define fileExists(f) (!access(f,0))
-        #include "stdlib.h" //random
-	#define rnd01 ((double)((double)_lrand()/(double)(LRAND_MAX+1)))
-	//#define rnd01 ((double)((double)rand()/(RAND_MAX+1)))
-	#define rnd0N(num) ((double)((num)*rnd01))
-	#define randomN(num) random(num) //uses _lrand
-#else
-	#ifdef _MSC_VER
-	#define fileExists(f) (!access(f,0))
-	#else
-	#define fileExists(f) (!access(f,R_OK))
-	#endif
 
-	//#define FLOATRAND
-	#ifdef FLOATRAND
-		#define randomN(x) ((int)((x)*drand48()))
-		#define rnd01 (drand48())
-  		#define rnd0N(x) (drand48()*(x))
-	#else
-		#define rnd01 ((double)(rand()/(RAND_MAX+1.0)))
-		#define rnd0N(x) ((x)*rnd01)
-		#define randomN(x) ((int)rnd0N(x))
-	#endif
+
+#ifdef LINUX
+ #include <strings.h>
+ #define stricmp(a,b) strcasecmp(a,b)
+ #define _isnan(a) isnan(a) //do nonstd_math.h?
+ #define GET_APP_HOME "./"
+ #define GET_APP_RESOURCES "./"
 #endif
 
-
-#ifdef __GNUC__
-/*
-	#define min(a,b) (((a)>(b))?(b):(a))
-	#define max(a,b) (((a)>(b))?(a):(b))
-	#define abs(a) ((a)>=0?(a):-(a))
-*/
-#include <algorithm>
-using namespace std;
+#ifdef IPHONE
+ #include <string>
+ #define _isnan(a) isnan(a) //do nonstd_math.h?
+ std::string getAppHome(); //w tym pliku deklaracja funkcji nie pasuje...
+ std::string getAppResources();
+ #define GET_APP_HOME getAppHome()
+ #define GET_APP_RESOURCES getAppResources()
 #endif
 
-#ifdef DEFINE_STRICMP_AS_STRCASECMP
-#define stricmp(a,b) strcasecmp(a,b)
+#ifdef SHP
+ //#define __assert_func(a,b,c,d) 0 //Currently, we are sorry to inform you that assert() is not yet supported. We have considered your request for internal discussion. No ale na szczêcie w³asna (byle by by³a, bo i tak zak³adamy ze assert ktore przeciez dziala tylko w trybie debug nie jest potrzebne na bada) implementacja w "bada-assert.cpp"
+ #define GET_APP_HOME "/Home/"
+ #define GET_APP_RESOURCES "/Res/"
 #endif
 
+#if defined(_WIN32) && !defined(SHP)
+    #define GET_APP_HOME ".\\"
+    #define GET_APP_RESOURCES ".\\"
 #endif
+
+//typedef unsigned char boolean; //niestety nie mozna uzyc 'bool' bo VC w rpcndr.h wlasnie tak definiuje booleana, jako unsigned char
+//typedef char byte; //rozne srodowiska c++ definiuja byte jako unsigned char! w javie jest inaczej -> trzeba i tak zmienic w portowanych zrodlach byte na char.
+
+#endif
