2012-10-22 22:39:59 -04:00
|
|
|
/*
|
2013-01-13 13:57:24 -05:00
|
|
|
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
2012-10-22 22:39:59 -04:00
|
|
|
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <bx/bx.h>
|
|
|
|
|
|
|
|
#if BX_PLATFORM_EMSCRIPTEN
|
|
|
|
|
|
|
|
#include <emscripten/emscripten.h>
|
2012-10-22 23:23:04 -04:00
|
|
|
#include <alloca.h>
|
|
|
|
#include <setjmp.h>
|
2012-10-22 22:39:59 -04:00
|
|
|
|
2013-01-13 14:20:56 -05:00
|
|
|
#include "entry.h"
|
|
|
|
|
|
|
|
namespace entry
|
|
|
|
{
|
2013-01-17 01:44:51 -05:00
|
|
|
const Event* poll()
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void release(const Event* _event)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void setWindowSize(uint32_t _width, uint32_t _height)
|
2013-01-13 14:20:56 -05:00
|
|
|
{
|
2013-01-17 01:44:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void toggleWindowFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-01-13 14:20:56 -05:00
|
|
|
} // namespace entry
|
|
|
|
|
2012-10-22 22:39:59 -04:00
|
|
|
extern int _main_(int _argc, char** _argv);
|
|
|
|
|
2012-10-22 23:23:04 -04:00
|
|
|
static jmp_buf s_main;
|
|
|
|
static jmp_buf s_loop;
|
2012-10-22 22:39:59 -04:00
|
|
|
|
|
|
|
void emscripten_yield()
|
|
|
|
{
|
|
|
|
if (!setjmp(s_main) )
|
|
|
|
{
|
|
|
|
longjmp(s_loop, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
if (!setjmp(s_loop) )
|
|
|
|
{
|
|
|
|
longjmp(s_main, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int _argc, char** _argv)
|
|
|
|
{
|
|
|
|
if (!setjmp(s_loop) )
|
|
|
|
{
|
2012-10-22 23:23:04 -04:00
|
|
|
alloca(16<<10);
|
2012-10-22 22:39:59 -04:00
|
|
|
_main_(_argc, _argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
emscripten_set_main_loop(loop, 10, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // BX_PLATFORM_EMSCRIPTEN
|