2006-04-13 20:47:06 +00:00
|
|
|
// SDL interface layer
|
|
|
|
// for the Build Engine
|
2012-03-12 04:47:04 +00:00
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
#ifndef __build_interface_layer__
|
|
|
|
#define __build_interface_layer__ SDL
|
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
#include "sdl_inc.h"
|
|
|
|
#include "compat.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "baselayer.h"
|
|
|
|
|
2012-11-24 09:13:29 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
int32_t win_gethinstance(void);
|
|
|
|
#endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
struct sdlappicon {
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t width,height;
|
|
|
|
uint32_t *pixels;
|
2009-06-05 20:09:13 +00:00
|
|
|
uint8_t *mask;
|
2006-04-13 20:47:06 +00:00
|
|
|
};
|
|
|
|
|
2012-11-05 20:04:02 +00:00
|
|
|
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
|
|
|
int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout);
|
|
|
|
#endif
|
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
static inline void idle_waitevent_timeout(uint32_t timeout)
|
|
|
|
{
|
|
|
|
SDL_WaitEventTimeout(NULL, timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void idle_waitevent(void)
|
|
|
|
{
|
|
|
|
SDL_WaitEvent(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void idle(void)
|
|
|
|
{
|
2012-11-24 09:13:29 +00:00
|
|
|
#ifndef _WIN32
|
2012-11-05 02:49:08 +00:00
|
|
|
usleep(1000);
|
2012-11-24 09:13:29 +00:00
|
|
|
#else
|
|
|
|
Sleep(1);
|
|
|
|
#endif
|
2012-11-05 02:49:08 +00:00
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#else
|
|
|
|
#if (__build_interface_layer__ != SDL)
|
|
|
|
#error "Already using the " __build_interface_layer__ ". Can't now use SDL."
|
|
|
|
#endif
|
|
|
|
#endif // __build_interface_layer__
|
|
|
|
|