PolyEmscriptenCore.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. Copyright (C) 2011 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #include "polycode/core/PolyEmscriptenCore.h"
  20. #include "polycode/view/linux/PolycodeView.h"
  21. #include "polycode/core/PolyCoreServices.h"
  22. #include "polycode/core/PolyCoreInput.h"
  23. #include "polycode/core/PolyMaterialManager.h"
  24. #include "polycode/core/PolyThreaded.h"
  25. #include "polycode/core/PolyLogger.h"
  26. #include "polycode/core/PolyOpenGLGraphicsInterface.h"
  27. #include "polycode/core/PolyBasicFileProvider.h"
  28. #ifndef NO_PHYSFS
  29. #include "polycode/core/PolyPhysFSFileProvider.h"
  30. #endif
  31. #include <SDL2/SDL.h>
  32. #include <stdio.h>
  33. #include <limits.h>
  34. #include <dirent.h>
  35. #include <iostream>
  36. #include <unistd.h>
  37. #include <sys/types.h>
  38. #include <sys/stat.h>
  39. #include <sys/wait.h>
  40. #include <pwd.h>
  41. using namespace Polycode;
  42. using std::vector;
  43. void EmscriptenCoreMutex::lock()
  44. {
  45. //pthread_mutex_lock(&pMutex);
  46. }
  47. void EmscriptenCoreMutex::unlock() {
  48. // pthread_mutex_unlock(&pMutex);
  49. }
  50. long getThreadID() {
  51. return 0;
  52. }
  53. void Core::getScreenInfo(int *width, int *height, int *hz) {
  54. SDL_DisplayMode current;
  55. SDL_GetCurrentDisplayMode(0, &current);
  56. if (width) *width = current.w;
  57. if (height) *height = current.h;
  58. if (hz) *hz = current.refresh_rate;
  59. }
  60. EmscriptenCore::EmscriptenCore(PolycodeView *view, int _xRes, int _yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex, bool retinaSupport) : Core(_xRes, _yRes, fullScreen, vSync, aaLevel, anisotropyLevel, frameRate, monitorIndex) {
  61. this->resizableWindow = view->resizable;
  62. fileProviders.push_back(new BasicFileProvider());
  63. #ifndef NO_PHYSFS
  64. fileProviders.push_back(new PhysFSFileProvider());
  65. #endif
  66. char *buffer = getcwd(NULL, 0);
  67. defaultWorkingDirectory = String(buffer);
  68. free(buffer);
  69. struct passwd *pw = getpwuid(getuid());
  70. const char *homedir = pw->pw_dir;
  71. userHomeDirectory = String(homedir);
  72. windowTitle = (String*)view->windowData;
  73. if(resizableWindow) {
  74. unsetenv("SDL_VIDEO_CENTERED");
  75. } else {
  76. setenv("SDL_VIDEO_CENTERED", "1", 1);
  77. }
  78. sdlContext = nullptr;
  79. sdlWindow = nullptr;
  80. int sdlerror = SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK);
  81. if(sdlerror < 0) {
  82. Logger::log("SDL_Init failed! Code: %d, %s\n", sdlerror, SDL_GetError());
  83. }
  84. eventMutex = createMutex();
  85. renderThread = new RenderThread();
  86. renderer = new Renderer(renderThread);
  87. OpenGLGraphicsInterface *renderInterface = new OpenGLGraphicsInterface();
  88. renderInterface->lineSmooth = true;
  89. renderer->setGraphicsInterface(this, renderInterface);
  90. services->setRenderer(renderer);
  91. setVideoMode(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, retinaSupport);
  92. SDL_JoystickEventState(SDL_ENABLE);
  93. int numJoysticks = SDL_NumJoysticks();
  94. for(int i=0; i < numJoysticks; i++) {
  95. SDL_JoystickOpen(i);
  96. input->addJoystick(i);
  97. }
  98. #ifndef NO_PAUDIO
  99. services->getSoundManager()->setAudioInterface(new PAAudioInterface());
  100. #else
  101. services->getSoundManager()->setAudioInterface(new SDLAudioInterface());
  102. #endif
  103. lastMouseX = 0;
  104. lastMouseY = 0;
  105. }
  106. void EmscriptenCore::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, bool retinaSupport) {
  107. //renderer->Resize(xRes, yRes);
  108. //CoreServices::getInstance()->getMaterialManager()->reloadProgramsAndTextures();
  109. //dispatchEvent(new Event(), EVENT_CORE_RESIZE);
  110. Core::setVideoMode(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, retinaSupport);
  111. }
  112. void EmscriptenCore::handleVideoModeChange(VideoModeChangeInfo* modeInfo){
  113. this->xRes = modeInfo->xRes;
  114. this->yRes = modeInfo->yRes;
  115. this->fullScreen = modeInfo->fullScreen;
  116. this->aaLevel = modeInfo->aaLevel;
  117. this->anisotropyLevel = modeInfo->anisotropyLevel;
  118. this->vSync = modeInfo->vSync;
  119. SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24);
  120. SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1);
  121. SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8);
  122. SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8);
  123. SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8);
  124. SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8);
  125. if(aaLevel > 0) {
  126. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
  127. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, aaLevel); //0, 2, 4
  128. } else {
  129. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
  130. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
  131. }
  132. flags = SDL_WINDOW_OPENGL;
  133. if(fullScreen) {
  134. flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
  135. }
  136. if(resizableWindow) {
  137. flags |= SDL_WINDOW_RESIZABLE;
  138. }
  139. if(modeInfo->retinaSupport) {
  140. flags |= SDL_WINDOW_ALLOW_HIGHDPI;
  141. }
  142. if(vSync) {
  143. if(SDL_GL_SetSwapInterval(-1) == -1) {
  144. SDL_GL_SetSwapInterval(1);
  145. }
  146. } else {
  147. SDL_GL_SetSwapInterval(0);
  148. }
  149. if(!sdlWindow) {
  150. sdlWindow = SDL_CreateWindow(windowTitle->c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, xRes, yRes, flags);
  151. sdlContext = SDL_GL_CreateContext(sdlWindow);
  152. SDL_Surface* icon = SDL_LoadBMP("icon.bmp");
  153. if(icon){
  154. SDL_SetWindowIcon(sdlWindow, icon);
  155. } else {
  156. Logger::log("icon error: %s\n",SDL_GetError());
  157. }
  158. } else {
  159. SDL_SetWindowSize(sdlWindow, xRes, yRes);
  160. }
  161. int x, y;
  162. SDL_GL_GetDrawableSize(sdlWindow, &x, &y);
  163. if(x >= xRes){
  164. backingX = x;
  165. } else {
  166. backingX = xRes;
  167. }
  168. if(y >= yRes) {
  169. backingY = y;
  170. } else {
  171. backingY = yRes;
  172. }
  173. /*
  174. int glewcode = glewInit();
  175. if (glewcode != GLEW_OK){
  176. Logger::log("glewInit failed! code: %d, %s\n", glewcode, glewGetErrorString(glewcode));
  177. }
  178. */
  179. //setVSync(modeInfo->vSync);
  180. renderer->setAnisotropyAmount(modeInfo->anisotropyLevel);
  181. renderThread->initGlobals();
  182. }
  183. vector<Polycode::Rectangle> EmscriptenCore::getVideoModes() {
  184. vector<Polycode::Rectangle> retVector;
  185. SDL_DisplayMode modes;
  186. for(int i=0;i<SDL_GetNumDisplayModes(0);++i) {
  187. SDL_GetDisplayMode(0, i, &modes);
  188. Rectangle res;
  189. res.w = modes.w;
  190. res.h = modes.h;
  191. retVector.push_back(res);
  192. }
  193. return retVector;
  194. }
  195. EmscriptenCore::~EmscriptenCore() {
  196. SDL_GL_DeleteContext(sdlContext);
  197. SDL_DestroyWindow(sdlWindow);
  198. SDL_Quit();
  199. }
  200. void EmscriptenCore::openURL(String url) { // TODO
  201. int childExitStatus;
  202. pid_t pid = fork();
  203. if (pid == 0) {
  204. execl("/usr/bin/xdg-open", "/usr/bin/xdg-open", url.c_str(), (char *)0);
  205. } else {
  206. pid_t ws = waitpid( pid, &childExitStatus, WNOHANG);
  207. }
  208. }
  209. String EmscriptenCore::executeExternalCommand(String command, String args, String inDirectory) {
  210. String finalCommand = command + " " + args;
  211. if(inDirectory != "") {
  212. finalCommand = "cd " + inDirectory + " && " + finalCommand;
  213. }
  214. FILE *fp = popen(finalCommand.c_str(), "r");
  215. if(!fp) {
  216. return "Unable to execute command";
  217. }
  218. int fd = fileno(fp);
  219. char path[2048];
  220. String retString;
  221. while (fgets(path, sizeof(path), fp) != NULL) {
  222. retString = retString + String(path);
  223. }
  224. pclose(fp);
  225. return retString;
  226. }
  227. void *ManagedThreadFunc(void *data) {
  228. Threaded *target = (Threaded*)data;
  229. target->runThread();
  230. target->scheduledForRemoval = true;
  231. return NULL;
  232. }
  233. void EmscriptenCore::createThread(Threaded *target) {
  234. Core::createThread(target);
  235. // pthread_t thread;
  236. // pthread_create( &thread, NULL, ManagedThreadFunc, (void*)target);
  237. }
  238. unsigned int EmscriptenCore::getTicks() {
  239. return SDL_GetTicks();
  240. }
  241. void EmscriptenCore::enableMouse(bool newval) {
  242. if(newval) {
  243. SDL_ShowCursor(1);
  244. //SDL_WM_GrabInput(SDL_GRAB_OFF);
  245. } else {
  246. SDL_ShowCursor(0);
  247. //SDL_WM_GrabInput(SDL_GRAB_ON);
  248. }
  249. Core::enableMouse(newval);
  250. }
  251. void EmscriptenCore::captureMouse(bool newval) {
  252. if(newval) {
  253. SDL_SetWindowGrab(sdlWindow, SDL_TRUE);
  254. } else {
  255. SDL_SetWindowGrab(sdlWindow, SDL_FALSE);
  256. }
  257. Core::captureMouse(newval);
  258. }
  259. bool EmscriptenCore::checkSpecialKeyEvents(PolyKEY key) {
  260. if(key == KEY_a && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL))) {
  261. dispatchEvent(new Event(), Core::EVENT_SELECT_ALL);
  262. return true;
  263. }
  264. if(key == KEY_c && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL))) {
  265. dispatchEvent(new Event(), Core::EVENT_COPY);
  266. return true;
  267. }
  268. if(key == KEY_x && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL))) {
  269. dispatchEvent(new Event(), Core::EVENT_CUT);
  270. return true;
  271. }
  272. if(key == KEY_z && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL)) && (input->getKeyState(KEY_LSHIFT) || input->getKeyState(KEY_RSHIFT))) {
  273. dispatchEvent(new Event(), Core::EVENT_REDO);
  274. return true;
  275. }
  276. if(key == KEY_z && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL))) {
  277. dispatchEvent(new Event(), Core::EVENT_UNDO);
  278. return true;
  279. }
  280. if(key == KEY_v && (input->getKeyState(KEY_LCTRL) || input->getKeyState(KEY_RCTRL))) {
  281. dispatchEvent(new Event(), Core::EVENT_PASTE);
  282. return true;
  283. }
  284. return false;
  285. }
  286. void EmscriptenCore::Render() {
  287. renderer->beginFrame();
  288. services->Render(Polycode::Rectangle(0, 0, getBackingXRes(), getBackingYRes()));
  289. renderer->endFrame();
  290. renderThread->updateRenderThread();
  291. }
  292. void EmscriptenCore::flushRenderContext(){
  293. SDL_GL_SwapWindow(sdlWindow);
  294. }
  295. bool EmscriptenCore::systemUpdate() {
  296. if(!running)
  297. return false;
  298. doSleep();
  299. updateCore();
  300. SDL_Event event;
  301. while ( SDL_PollEvent(&event) ) {
  302. switch (event.type) {
  303. case SDL_QUIT:
  304. running = false;
  305. break;
  306. case SDL_WINDOWEVENT:
  307. switch (event.window.event) {
  308. case SDL_WINDOWEVENT_RESIZED:
  309. if (resizableWindow) {
  310. unsetenv("SDL_VIDEO_CENTERED");
  311. } else {
  312. setenv("SDL_VIDEO_CENTERED", "1", 1);
  313. }
  314. this->xRes = event.window.data1;
  315. this->yRes = event.window.data2;
  316. SDL_SetWindowSize(sdlWindow, xRes, yRes);
  317. int x, y;
  318. SDL_GL_GetDrawableSize(sdlWindow, &x, &y);
  319. if (x >= xRes) {
  320. backingX = x;
  321. } else {
  322. backingX = xRes;
  323. }
  324. if (y >= yRes) {
  325. backingY = y;
  326. } else {
  327. backingY = yRes;
  328. }
  329. dispatchEvent(new Event(), EVENT_CORE_RESIZE);
  330. break;
  331. case SDL_WINDOWEVENT_FOCUS_GAINED:
  332. gainFocus();
  333. break;
  334. case SDL_WINDOWEVENT_FOCUS_LOST:
  335. loseFocus();
  336. break;
  337. }
  338. break;
  339. case SDL_JOYAXISMOTION:
  340. input->joystickAxisMoved(event.jaxis.axis, ((Number)event.jaxis.value)/32767.0, event.jaxis.which);
  341. break;
  342. case SDL_JOYBUTTONDOWN:
  343. input->joystickButtonDown(event.jbutton.button, event.jbutton.which);
  344. break;
  345. case SDL_JOYBUTTONUP:
  346. input->joystickButtonUp(event.jbutton.button, event.jbutton.which);
  347. break;
  348. case SDL_KEYDOWN:
  349. if(!checkSpecialKeyEvents((PolyKEY)(event.key.keysym.sym))) {
  350. input->setKeyState((PolyKEY)(event.key.keysym.sym), event.key.keysym.sym, true, getTicks()); }
  351. break;
  352. case SDL_KEYUP:
  353. input->setKeyState((PolyKEY)(event.key.keysym.sym), event.key.keysym.sym, false, getTicks());
  354. break;
  355. case SDL_MOUSEWHEEL:
  356. if(event.wheel.y > 0) {
  357. input->mouseWheelUp(getTicks());
  358. } else if(event.wheel.y < 0) {
  359. input->mouseWheelDown(getTicks());
  360. }
  361. break;
  362. case SDL_MOUSEBUTTONDOWN:
  363. switch (event.button.button) {
  364. case SDL_BUTTON_LEFT:
  365. input->setMouseButtonState(CoreInput::MOUSE_BUTTON1, true, getTicks());
  366. break;
  367. case SDL_BUTTON_RIGHT:
  368. input->setMouseButtonState(CoreInput::MOUSE_BUTTON2, true, getTicks());
  369. break;
  370. case SDL_BUTTON_MIDDLE:
  371. input->setMouseButtonState(CoreInput::MOUSE_BUTTON3, true, getTicks());
  372. break;
  373. }
  374. break;
  375. case SDL_MOUSEBUTTONUP:
  376. switch(event.button.button) {
  377. case SDL_BUTTON_LEFT:
  378. input->setMouseButtonState(CoreInput::MOUSE_BUTTON1, false, getTicks());
  379. break;
  380. case SDL_BUTTON_RIGHT:
  381. input->setMouseButtonState(CoreInput::MOUSE_BUTTON2, false, getTicks());
  382. break;
  383. case SDL_BUTTON_MIDDLE:
  384. input->setMouseButtonState(CoreInput::MOUSE_BUTTON3, false, getTicks());
  385. break;
  386. }
  387. break;
  388. case SDL_MOUSEMOTION:
  389. input->setDeltaPosition(lastMouseX - event.motion.x, lastMouseY - event.motion.y);
  390. input->setMousePosition(event.motion.x, event.motion.y, getTicks());
  391. lastMouseY = event.motion.y;
  392. lastMouseX = event.motion.x;
  393. break;
  394. default:
  395. break;
  396. }
  397. }
  398. return running;
  399. }
  400. void EmscriptenCore::setCursor(int cursorType) {
  401. }
  402. void EmscriptenCore::warpCursor(int x, int y) {
  403. SDL_WarpMouseInWindow(sdlWindow, x, y);
  404. lastMouseX = x;
  405. lastMouseY = y;
  406. }
  407. /*void EmscriptenCore::lockMutex(CoreMutex *mutex) {
  408. EmscriptenCoreMutex *smutex = (EmscriptenCoreMutex*)mutex;
  409. SDL_mutexP(smutex->pMutex);
  410. }
  411. void EmscriptenCore::unlockMutex(CoreMutex *mutex) {
  412. EmscriptenCoreMutex *smutex = (EmscriptenCoreMutex*)mutex;
  413. SDL_mutexV(smutex->pMutex);
  414. }*/
  415. CoreMutex *EmscriptenCore::createMutex() {
  416. EmscriptenCoreMutex *mutex = new EmscriptenCoreMutex();
  417. //pthread_mutex_init(&mutex->pMutex, NULL);
  418. return mutex;
  419. }
  420. void EmscriptenCore::copyStringToClipboard(const String& str) {
  421. SDL_SetClipboardText(str.c_str());
  422. }
  423. String EmscriptenCore::getClipboardString() {
  424. String rval;
  425. if(SDL_HasClipboardText() ==SDL_TRUE){
  426. rval=SDL_GetClipboardText();
  427. } else {
  428. rval="";
  429. }
  430. return rval;
  431. }
  432. void EmscriptenCore::createFolder(const String& folderPath) {
  433. mkdir(folderPath.c_str(), 0700);
  434. }
  435. void EmscriptenCore::copyDiskItem(const String& itemPath, const String& destItemPath) {
  436. int childExitStatus;
  437. pid_t pid = fork();
  438. if (pid == 0) {
  439. execl("/bin/cp", "/bin/cp", "-RT", itemPath.c_str(), destItemPath.c_str(), (char *)0);
  440. } else {
  441. pid_t ws = waitpid( pid, &childExitStatus, 0);
  442. }
  443. }
  444. void EmscriptenCore::moveDiskItem(const String& itemPath, const String& destItemPath) {
  445. int childExitStatus;
  446. pid_t pid = fork();
  447. if (pid == 0) {
  448. execl("/bin/mv", "/bin/mv", itemPath.c_str(), destItemPath.c_str(), (char *)0);
  449. } else {
  450. pid_t ws = waitpid( pid, &childExitStatus, 0);
  451. }
  452. }
  453. void EmscriptenCore::removeDiskItem(const String& itemPath) {
  454. int childExitStatus;
  455. pid_t pid = fork();
  456. if (pid == 0) {
  457. execl("/bin/rm", "/bin/rm", "-rf", itemPath.c_str(), (char *)0);
  458. } else {
  459. pid_t ws = waitpid( pid, &childExitStatus, 0);
  460. }
  461. }
  462. String EmscriptenCore::openFolderPicker() {
  463. String r = "";
  464. return r;
  465. }
  466. vector<String> EmscriptenCore::openFilePicker(vector<CoreFileExtension> extensions, bool allowMultiple) {
  467. vector<String> r;
  468. return r;
  469. }
  470. String EmscriptenCore::saveFilePicker(std::vector<CoreFileExtension> extensions) {
  471. String r = "";
  472. return r;
  473. }
  474. void EmscriptenCore::resizeTo(int xRes, int yRes) {
  475. this->xRes = xRes;
  476. this->yRes = yRes;
  477. dispatchEvent(new Event(), EVENT_CORE_RESIZE);
  478. }
  479. bool EmscriptenCore::systemParseFolder(const String& pathString, bool showHidden, vector< OSFileEntry >& targetVector) {
  480. DIR *d;
  481. struct dirent *dir;
  482. d = opendir(pathString.c_str());
  483. if(d) {
  484. while ((dir = readdir(d)) != NULL) {
  485. if(dir->d_name[0] != '.' || (dir->d_name[0] == '.' && showHidden)) {
  486. if(dir->d_type == DT_DIR) {
  487. targetVector.push_back(OSFileEntry(pathString, dir->d_name, OSFileEntry::TYPE_FOLDER));
  488. } else {
  489. targetVector.push_back(OSFileEntry(pathString, dir->d_name, OSFileEntry::TYPE_FILE));
  490. }
  491. }
  492. }
  493. closedir(d);
  494. }
  495. return true;
  496. }
  497. Number EmscriptenCore::getBackingXRes() {
  498. return backingX;
  499. }
  500. Number EmscriptenCore::getBackingYRes() {
  501. return backingY;
  502. }