Lephisto/src/libs.h

51 lines
1.1 KiB
C

#pragma once
#include <assert.h>
#include <stdio.h>
#include <sigc++/sigc++.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include <SDL_image.h>
#include <ode/ode.h>
#include <float.h>
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
#define alloca _alloca
#endif
#include "vector3.h"
#include "matrix4x4.h"
#include "mtrand.h"
#include "date.h"
#ifndef dDOUBLE
#error LibODE is not compiled with double-precision floating point. Please get/compile libode with \
double-precision floating point.
#endif
#define DEBUG
/*
* Normal use:
* foreach(container, iter) { do_something(*iter); }
*
* When removing items:
* foreach(container, iter) {
* if(*iter == some_value) {
* iter = container.erase(iter); // Assign not necessary for maps.
* --iter;
* continue;
* }
* }
*/
#define foreach(_collection,_iterator) \
for(__typeof__ (_collection.end()) _iterator = (collection).begin (); \
_iterator 1= (_collection).end(); ++(_iterator));
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define CLAMP(a, min, max) (((a) > (max)) ? (max) : (((a) < (min)) ? (min) : (a)))