19 #define GL_BGR GL_BGR_EXT
22 #define GL_BGRA GL_BGRA_EXT
25 #define APIENTRY __stdcall
28 #define WINGDIAPI __declspec(dllimport)
36 static bool NeverEnd() {
return false;}
38 static const double PI = 3.14159265;
47 #define foritr(a,b) for(auto a=b.begin(),end=b.end();a!=end;++a)
54 #define foritrNoInc(a,b) for(auto a=b.begin(),end=b.end();a!=end;)
56 SDL_Surface*
LoadImage( std::string filename );
93 double lengthSquared()
const;
103 Point2D operator* (
const double scale)
const {
return Point2D(x * scale, y * scale); }
104 Point2D operator/ (
const double scale)
const {
return Point2D(x / scale, y / scale); }
107 Point2D operator*= (
const double scale) {
return mult(scale); }
108 Point2D operator/= (
const double scale) {
return div(scale); }
112 friend ostream &operator<<(ostream &out,
Point2D p)
114 out<<
"("<<p.
x<<
","<<p.
y<<
")";
130 Size2D (
double width,
double height):w(width),h(height) {}
155 unsigned int nextPow2(
unsigned int i);
174 int randInt(
int max = RAND_MAX);
192 float randFloat(
float min=0,
float max=1);
195 vector<string>
splitString(
string s,
char delim=
'\n',
int rep=0);
197 template<
typename NumTy>
string ToString(
const NumTy& Num)
199 stringstream StrStream;
201 return StrStream.str();