entry.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. /*
  2. * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #include <bgfx/bgfx.h>
  6. #include <bx/string.h>
  7. #include <bx/readerwriter.h>
  8. #include <time.h>
  9. #if BX_PLATFORM_EMSCRIPTEN
  10. # include <emscripten.h>
  11. #endif // BX_PLATFORM_EMSCRIPTEN
  12. #include "entry_p.h"
  13. #include "cmd.h"
  14. #include "input.h"
  15. #if ENTRY_CONFIG_PROFILER
  16. # define RMT_ENABLED
  17. #endif // ENTRY_CONFIG_PROFILER
  18. #include <remotery/lib/Remotery.c>
  19. extern "C" int _main_(int _argc, char** _argv);
  20. namespace entry
  21. {
  22. static uint32_t s_debug = BGFX_DEBUG_NONE;
  23. static uint32_t s_reset = BGFX_RESET_NONE;
  24. static bool s_exit = false;
  25. static Remotery* s_rmt = NULL;
  26. static bx::FileReaderI* s_fileReader = NULL;
  27. static bx::FileWriterI* s_fileWriter = NULL;
  28. extern bx::AllocatorI* getDefaultAllocator();
  29. static bx::AllocatorI* s_allocator = getDefaultAllocator();
  30. #if ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
  31. bx::AllocatorI* getDefaultAllocator()
  32. {
  33. BX_PRAGMA_DIAGNOSTIC_PUSH();
  34. BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4459); // warning C4459: declaration of 's_allocator' hides global declaration
  35. BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow");
  36. static bx::CrtAllocator s_allocator;
  37. return &s_allocator;
  38. BX_PRAGMA_DIAGNOSTIC_POP();
  39. }
  40. #endif // ENTRY_CONFIG_IMPLEMENT_DEFAULT_ALLOCATOR
  41. static const char* s_keyName[] =
  42. {
  43. "None",
  44. "Esc",
  45. "Return",
  46. "Tab",
  47. "Space",
  48. "Backspace",
  49. "Up",
  50. "Down",
  51. "Left",
  52. "Right",
  53. "Insert",
  54. "Delete",
  55. "Home",
  56. "End",
  57. "PageUp",
  58. "PageDown",
  59. "Print",
  60. "Plus",
  61. "Minus",
  62. "LeftBracket",
  63. "RightBracket",
  64. "Semicolon",
  65. "Quote",
  66. "Comma",
  67. "Period",
  68. "Slash",
  69. "Backslash",
  70. "Tilde",
  71. "F1",
  72. "F2",
  73. "F3",
  74. "F4",
  75. "F5",
  76. "F6",
  77. "F7",
  78. "F8",
  79. "F9",
  80. "F10",
  81. "F11",
  82. "F12",
  83. "NumPad0",
  84. "NumPad1",
  85. "NumPad2",
  86. "NumPad3",
  87. "NumPad4",
  88. "NumPad5",
  89. "NumPad6",
  90. "NumPad7",
  91. "NumPad8",
  92. "NumPad9",
  93. "Key0",
  94. "Key1",
  95. "Key2",
  96. "Key3",
  97. "Key4",
  98. "Key5",
  99. "Key6",
  100. "Key7",
  101. "Key8",
  102. "Key9",
  103. "KeyA",
  104. "KeyB",
  105. "KeyC",
  106. "KeyD",
  107. "KeyE",
  108. "KeyF",
  109. "KeyG",
  110. "KeyH",
  111. "KeyI",
  112. "KeyJ",
  113. "KeyK",
  114. "KeyL",
  115. "KeyM",
  116. "KeyN",
  117. "KeyO",
  118. "KeyP",
  119. "KeyQ",
  120. "KeyR",
  121. "KeyS",
  122. "KeyT",
  123. "KeyU",
  124. "KeyV",
  125. "KeyW",
  126. "KeyX",
  127. "KeyY",
  128. "KeyZ",
  129. "GamepadA",
  130. "GamepadB",
  131. "GamepadX",
  132. "GamepadY",
  133. "GamepadThumbL",
  134. "GamepadThumbR",
  135. "GamepadShoulderL",
  136. "GamepadShoulderR",
  137. "GamepadUp",
  138. "GamepadDown",
  139. "GamepadLeft",
  140. "GamepadRight",
  141. "GamepadBack",
  142. "GamepadStart",
  143. "GamepadGuide",
  144. };
  145. BX_STATIC_ASSERT(Key::Count == BX_COUNTOF(s_keyName) );
  146. const char* getName(Key::Enum _key)
  147. {
  148. BX_CHECK(_key < Key::Count, "Invalid key %d.", _key);
  149. return s_keyName[_key];
  150. }
  151. char keyToAscii(Key::Enum _key, uint8_t _modifiers)
  152. {
  153. const bool isAscii = (Key::Key0 <= _key && _key <= Key::KeyZ)
  154. || (Key::Esc <= _key && _key <= Key::Minus);
  155. if (!isAscii)
  156. {
  157. return '\0';
  158. }
  159. const bool isNumber = (Key::Key0 <= _key && _key <= Key::Key9);
  160. if (isNumber)
  161. {
  162. return '0' + (_key - Key::Key0);
  163. }
  164. const bool isChar = (Key::KeyA <= _key && _key <= Key::KeyZ);
  165. if (isChar)
  166. {
  167. enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift };
  168. const bool shift = !!(_modifiers&ShiftMask);
  169. return (shift ? 'A' : 'a') + (_key - Key::KeyA);
  170. }
  171. switch (_key)
  172. {
  173. case Key::Esc: return 0x1b;
  174. case Key::Return: return '\n';
  175. case Key::Tab: return '\t';
  176. case Key::Space: return ' ';
  177. case Key::Backspace: return 0x08;
  178. case Key::Plus: return '+';
  179. case Key::Minus: return '-';
  180. default: break;
  181. }
  182. return '\0';
  183. }
  184. bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv)
  185. {
  186. if (0 == strcmp(_argv[_first], _name) )
  187. {
  188. int arg = _first+1;
  189. if (_argc > arg)
  190. {
  191. _flags &= ~_bit;
  192. _flags |= bx::toBool(_argv[arg]) ? _bit : 0;
  193. }
  194. else
  195. {
  196. _flags ^= _bit;
  197. }
  198. return true;
  199. }
  200. return false;
  201. }
  202. int cmdMouseLock(CmdContext* /*_context*/, void* /*_userData*/, int _argc, char const* const* _argv)
  203. {
  204. if (_argc > 1)
  205. {
  206. inputSetMouseLock(_argc > 1 ? bx::toBool(_argv[1]) : !inputIsMouseLocked() );
  207. return 0;
  208. }
  209. return 1;
  210. }
  211. int cmdGraphics(CmdContext* /*_context*/, void* /*_userData*/, int _argc, char const* const* _argv)
  212. {
  213. if (_argc > 1)
  214. {
  215. if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
  216. || setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv)
  217. || setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
  218. || setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
  219. || setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
  220. || setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
  221. || setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv)
  222. || setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv)
  223. || setOrToggle(s_reset, "hidpi", BGFX_RESET_HIDPI, 1, _argc, _argv)
  224. )
  225. {
  226. return 0;
  227. }
  228. else if (setOrToggle(s_debug, "stats", BGFX_DEBUG_STATS, 1, _argc, _argv)
  229. || setOrToggle(s_debug, "ifh", BGFX_DEBUG_IFH, 1, _argc, _argv)
  230. || setOrToggle(s_debug, "text", BGFX_DEBUG_TEXT, 1, _argc, _argv)
  231. || setOrToggle(s_debug, "wireframe", BGFX_DEBUG_WIREFRAME, 1, _argc, _argv) )
  232. {
  233. bgfx::setDebug(s_debug);
  234. return 0;
  235. }
  236. else if (0 == strcmp(_argv[1], "screenshot") )
  237. {
  238. if (_argc > 2)
  239. {
  240. bgfx::saveScreenShot(_argv[2]);
  241. }
  242. else
  243. {
  244. time_t tt;
  245. time(&tt);
  246. char filePath[256];
  247. bx::snprintf(filePath, sizeof(filePath), "temp/screenshot-%d", tt);
  248. bgfx::saveScreenShot(filePath);
  249. }
  250. return 0;
  251. }
  252. else if (0 == strcmp(_argv[1], "fullscreen") )
  253. {
  254. WindowHandle window = { 0 };
  255. toggleFullscreen(window);
  256. return 0;
  257. }
  258. }
  259. return 1;
  260. }
  261. int cmdExit(CmdContext* /*_context*/, void* /*_userData*/, int /*_argc*/, char const* const* /*_argv*/)
  262. {
  263. s_exit = true;
  264. return 0;
  265. }
  266. static const InputBinding s_bindings[] =
  267. {
  268. { entry::Key::KeyQ, entry::Modifier::LeftCtrl, 1, NULL, "exit" },
  269. { entry::Key::KeyQ, entry::Modifier::RightCtrl, 1, NULL, "exit" },
  270. { entry::Key::KeyF, entry::Modifier::LeftCtrl, 1, NULL, "graphics fullscreen" },
  271. { entry::Key::KeyF, entry::Modifier::RightCtrl, 1, NULL, "graphics fullscreen" },
  272. { entry::Key::Return, entry::Modifier::RightAlt, 1, NULL, "graphics fullscreen" },
  273. { entry::Key::F1, entry::Modifier::None, 1, NULL, "graphics stats" },
  274. { entry::Key::GamepadStart, entry::Modifier::None, 1, NULL, "graphics stats" },
  275. { entry::Key::F1, entry::Modifier::LeftShift, 1, NULL, "graphics stats 0\ngraphics text 0" },
  276. { entry::Key::F3, entry::Modifier::None, 1, NULL, "graphics wireframe" },
  277. { entry::Key::F4, entry::Modifier::None, 1, NULL, "graphics hmd" },
  278. { entry::Key::F4, entry::Modifier::LeftShift, 1, NULL, "graphics hmdrecenter" },
  279. { entry::Key::F4, entry::Modifier::LeftCtrl, 1, NULL, "graphics hmddbg" },
  280. { entry::Key::F7, entry::Modifier::None, 1, NULL, "graphics vsync" },
  281. { entry::Key::F8, entry::Modifier::None, 1, NULL, "graphics msaa" },
  282. { entry::Key::F9, entry::Modifier::None, 1, NULL, "graphics flush" },
  283. { entry::Key::F10, entry::Modifier::None, 1, NULL, "graphics hidpi" },
  284. { entry::Key::Print, entry::Modifier::None, 1, NULL, "graphics screenshot" },
  285. INPUT_BINDING_END
  286. };
  287. #if BX_PLATFORM_EMSCRIPTEN
  288. static AppI* s_app;
  289. static void updateApp()
  290. {
  291. s_app->update();
  292. }
  293. #endif // BX_PLATFORM_EMSCRIPTEN
  294. int runApp(AppI* _app, int _argc, char** _argv)
  295. {
  296. _app->init(_argc, _argv);
  297. bgfx::frame();
  298. WindowHandle defaultWindow = { 0 };
  299. setWindowSize(defaultWindow, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
  300. #if BX_PLATFORM_EMSCRIPTEN
  301. s_app = _app;
  302. emscripten_set_main_loop(&updateApp, -1, 1);
  303. #else
  304. while (_app->update() );
  305. #endif // BX_PLATFORM_EMSCRIPTEN
  306. return _app->shutdown();
  307. }
  308. int main(int _argc, char** _argv)
  309. {
  310. //DBG(BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME);
  311. if (BX_ENABLED(ENTRY_CONFIG_PROFILER) )
  312. {
  313. // rmtSettings* settings = rmt_Settings();
  314. if (RMT_ERROR_NONE != rmt_CreateGlobalInstance(&s_rmt) )
  315. {
  316. s_rmt = NULL;
  317. }
  318. }
  319. #if BX_CONFIG_CRT_FILE_READER_WRITER
  320. s_fileReader = new bx::CrtFileReader;
  321. s_fileWriter = new bx::CrtFileWriter;
  322. #endif // BX_CONFIG_CRT_FILE_READER_WRITER
  323. cmdInit();
  324. cmdAdd("mouselock", cmdMouseLock);
  325. cmdAdd("graphics", cmdGraphics );
  326. cmdAdd("exit", cmdExit );
  327. inputInit();
  328. inputAddBindings("bindings", s_bindings);
  329. entry::WindowHandle defaultWindow = { 0 };
  330. entry::setWindowTitle(defaultWindow, bx::baseName(_argv[0]) );
  331. setWindowSize(defaultWindow, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
  332. int32_t result = ::_main_(_argc, _argv);
  333. inputRemoveBindings("bindings");
  334. inputShutdown();
  335. cmdShutdown();
  336. #if BX_CONFIG_CRT_FILE_READER_WRITER
  337. delete s_fileReader;
  338. s_fileReader = NULL;
  339. delete s_fileWriter;
  340. s_fileWriter = NULL;
  341. #endif // BX_CONFIG_CRT_FILE_READER_WRITER
  342. if (BX_ENABLED(ENTRY_CONFIG_PROFILER)
  343. && NULL != s_rmt)
  344. {
  345. rmt_DestroyGlobalInstance(s_rmt);
  346. }
  347. return result;
  348. }
  349. bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse)
  350. {
  351. s_debug = _debug;
  352. s_reset = _reset;
  353. WindowHandle handle = { UINT16_MAX };
  354. bool mouseLock = inputIsMouseLocked();
  355. const Event* ev;
  356. do
  357. {
  358. struct SE { const Event* m_ev; SE() : m_ev(poll() ) {} ~SE() { if (NULL != m_ev) { release(m_ev); } } } scopeEvent;
  359. ev = scopeEvent.m_ev;
  360. if (NULL != ev)
  361. {
  362. switch (ev->m_type)
  363. {
  364. case Event::Axis:
  365. {
  366. const AxisEvent* axis = static_cast<const AxisEvent*>(ev);
  367. inputSetGamepadAxis(axis->m_gamepad, axis->m_axis, axis->m_value);
  368. }
  369. break;
  370. case Event::Char:
  371. {
  372. const CharEvent* chev = static_cast<const CharEvent*>(ev);
  373. inputChar(chev->m_len, chev->m_char);
  374. }
  375. break;
  376. case Event::Exit:
  377. return true;
  378. case Event::Gamepad:
  379. {
  380. const GamepadEvent* gev = static_cast<const GamepadEvent*>(ev);
  381. DBG("gamepad %d, %d", gev->m_gamepad.idx, gev->m_connected);
  382. }
  383. break;
  384. case Event::Mouse:
  385. {
  386. const MouseEvent* mouse = static_cast<const MouseEvent*>(ev);
  387. handle = mouse->m_handle;
  388. if (mouse->m_move)
  389. {
  390. inputSetMousePos(mouse->m_mx, mouse->m_my, mouse->m_mz);
  391. }
  392. else
  393. {
  394. inputSetMouseButtonState(mouse->m_button, mouse->m_down);
  395. }
  396. if (NULL != _mouse
  397. && !mouseLock)
  398. {
  399. if (mouse->m_move)
  400. {
  401. _mouse->m_mx = mouse->m_mx;
  402. _mouse->m_my = mouse->m_my;
  403. _mouse->m_mz = mouse->m_mz;
  404. }
  405. else
  406. {
  407. _mouse->m_buttons[mouse->m_button] = mouse->m_down;
  408. }
  409. }
  410. }
  411. break;
  412. case Event::Key:
  413. {
  414. const KeyEvent* key = static_cast<const KeyEvent*>(ev);
  415. handle = key->m_handle;
  416. inputSetKeyState(key->m_key, key->m_modifiers, key->m_down);
  417. }
  418. break;
  419. case Event::Size:
  420. {
  421. const SizeEvent* size = static_cast<const SizeEvent*>(ev);
  422. handle = size->m_handle;
  423. _width = size->m_width;
  424. _height = size->m_height;
  425. _reset = !s_reset; // force reset
  426. }
  427. break;
  428. case Event::Window:
  429. break;
  430. case Event::Suspend:
  431. break;
  432. default:
  433. break;
  434. }
  435. }
  436. inputProcess();
  437. } while (NULL != ev);
  438. if (handle.idx == 0
  439. && _reset != s_reset)
  440. {
  441. _reset = s_reset;
  442. bgfx::reset(_width, _height, _reset);
  443. inputSetMouseResolution(_width, _height);
  444. }
  445. _debug = s_debug;
  446. return s_exit;
  447. }
  448. WindowState s_window[ENTRY_CONFIG_MAX_WINDOWS];
  449. bool processWindowEvents(WindowState& _state, uint32_t& _debug, uint32_t& _reset)
  450. {
  451. s_debug = _debug;
  452. s_reset = _reset;
  453. WindowHandle handle = { UINT16_MAX };
  454. bool mouseLock = inputIsMouseLocked();
  455. const Event* ev;
  456. do
  457. {
  458. struct SE
  459. {
  460. SE(WindowHandle _handle)
  461. : m_ev(poll(_handle) )
  462. {
  463. }
  464. ~SE()
  465. {
  466. if (NULL != m_ev)
  467. {
  468. release(m_ev);
  469. }
  470. }
  471. const Event* m_ev;
  472. } scopeEvent(handle);
  473. ev = scopeEvent.m_ev;
  474. if (NULL != ev)
  475. {
  476. handle = ev->m_handle;
  477. WindowState& win = s_window[handle.idx];
  478. switch (ev->m_type)
  479. {
  480. case Event::Axis:
  481. {
  482. const AxisEvent* axis = static_cast<const AxisEvent*>(ev);
  483. inputSetGamepadAxis(axis->m_gamepad, axis->m_axis, axis->m_value);
  484. }
  485. break;
  486. case Event::Char:
  487. {
  488. const CharEvent* chev = static_cast<const CharEvent*>(ev);
  489. win.m_handle = chev->m_handle;
  490. inputChar(chev->m_len, chev->m_char);
  491. }
  492. break;
  493. case Event::Exit:
  494. return true;
  495. case Event::Gamepad:
  496. {
  497. const GamepadEvent* gev = static_cast<const GamepadEvent*>(ev);
  498. DBG("gamepad %d, %d", gev->m_gamepad.idx, gev->m_connected);
  499. }
  500. break;
  501. case Event::Mouse:
  502. {
  503. const MouseEvent* mouse = static_cast<const MouseEvent*>(ev);
  504. win.m_handle = mouse->m_handle;
  505. if (mouse->m_move)
  506. {
  507. inputSetMousePos(mouse->m_mx, mouse->m_my, mouse->m_mz);
  508. }
  509. else
  510. {
  511. inputSetMouseButtonState(mouse->m_button, mouse->m_down);
  512. }
  513. if (!mouseLock)
  514. {
  515. if (mouse->m_move)
  516. {
  517. win.m_mouse.m_mx = mouse->m_mx;
  518. win.m_mouse.m_my = mouse->m_my;
  519. win.m_mouse.m_mz = mouse->m_mz;
  520. }
  521. else
  522. {
  523. win.m_mouse.m_buttons[mouse->m_button] = mouse->m_down;
  524. }
  525. }
  526. }
  527. break;
  528. case Event::Key:
  529. {
  530. const KeyEvent* key = static_cast<const KeyEvent*>(ev);
  531. win.m_handle = key->m_handle;
  532. inputSetKeyState(key->m_key, key->m_modifiers, key->m_down);
  533. }
  534. break;
  535. case Event::Size:
  536. {
  537. const SizeEvent* size = static_cast<const SizeEvent*>(ev);
  538. win.m_handle = size->m_handle;
  539. win.m_width = size->m_width;
  540. win.m_height = size->m_height;
  541. _reset = win.m_handle.idx == 0
  542. ? !s_reset
  543. : _reset
  544. ; // force reset
  545. }
  546. break;
  547. case Event::Window:
  548. {
  549. const WindowEvent* window = static_cast<const WindowEvent*>(ev);
  550. win.m_handle = window->m_handle;
  551. win.m_nwh = window->m_nwh;
  552. ev = NULL;
  553. }
  554. break;
  555. case Event::Suspend:
  556. break;
  557. default:
  558. break;
  559. }
  560. }
  561. inputProcess();
  562. } while (NULL != ev);
  563. if (isValid(handle) )
  564. {
  565. const WindowState& win = s_window[handle.idx];
  566. _state = win;
  567. if (handle.idx == 0)
  568. {
  569. inputSetMouseResolution(win.m_width, win.m_height);
  570. }
  571. }
  572. if (_reset != s_reset)
  573. {
  574. _reset = s_reset;
  575. bgfx::reset(s_window[0].m_width, s_window[0].m_height, _reset);
  576. inputSetMouseResolution(s_window[0].m_width, s_window[0].m_height);
  577. }
  578. _debug = s_debug;
  579. return s_exit;
  580. }
  581. bx::FileReaderI* getFileReader()
  582. {
  583. return s_fileReader;
  584. }
  585. bx::FileWriterI* getFileWriter()
  586. {
  587. return s_fileWriter;
  588. }
  589. bx::AllocatorI* getAllocator()
  590. {
  591. return s_allocator;
  592. }
  593. void* TinyStlAllocator::static_allocate(size_t _bytes)
  594. {
  595. return BX_ALLOC(getAllocator(), _bytes);
  596. }
  597. void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
  598. {
  599. if (NULL != _ptr)
  600. {
  601. BX_FREE(getAllocator(), _ptr);
  602. }
  603. }
  604. } // namespace entry
  605. extern "C" bool entry_process_events(uint32_t* _width, uint32_t* _height, uint32_t* _debug, uint32_t* _reset)
  606. {
  607. return entry::processEvents(*_width, *_height, *_debug, *_reset, NULL);
  608. }