Created
August 2, 2015 14:25
-
-
Save collinalexbell/3bb1294ae8da228ad730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"exception thrown: TypeError: surfData is undefined,_SDL_FillRect@file:///Users/collinbell/taggartcybernetics/simulator/run.js:9213:14 | |
__ZN3Sim4drawEv@file:///Users/collinbell/taggartcybernetics/simulator/run.js:18545:3 | |
__ZN3Sim4stepEv@file:///Users/collinbell/taggartcybernetics/simulator/run.js:18756:2 | |
__Z2cbPv@file:///Users/collinbell/taggartcybernetics/simulator/run.js:81020:3 | |
dynCall_vi@file:///Users/collinbell/taggartcybernetics/simulator/run.js:171819:3 | |
Runtime.dynCall@file:///Users/collinbell/taggartcybernetics/simulator/run.js:477:14 | |
Browser_mainLoop_runner/<@file:///Users/collinbell/taggartcybernetics/simulator/run.js:6361:13 | |
Browser.mainLoop.runIter@file:///Users/collinbell/taggartcybernetics/simulator/run.js:6425:13 | |
Browser_mainLoop_runner@file:///Users/collinbell/taggartcybernetics/simulator/run.js:6359:9 | |
SDL.receiveEvent@file:///Users/collinbell/taggartcybernetics/simulator/run.js:8018:15 | |
" run.html:1245:13 | |
"[post-exception status] Exception thrown, see JavaScript console" run.html:1245:13 | |
TypeError: surfData is undefined run.js:9213:13 | |
"pre-main prep time: 50 ms" hello.html:1245:13 | |
"hello, world!" hello.html:1233:13 | |
"Assertion failed: undefined" hello.html:1233:13 | |
"Assertion failed: undefined" hello.html:1245:13 | |
uncaught exception: abort("Assertion failed: undefined") at jsStackTrace@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:1166:13 | |
stackTrace@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:1183:22 | |
abort@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:12241:44 | |
assert@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:357:5 | |
_SDL_FillRect@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:8188:1 | |
_main@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:8675:3 | |
asm._main@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:12029:8 | |
callMain@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:12106:15 | |
doRun@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:12164:42 | |
run/<@file:///Users/collinbell/taggartcybernetics/simulator/hello.js:12175:7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <SDL/SDL.h> | |
#ifdef __EMSCRIPTEN__ | |
#include <emscripten.h> | |
#endif | |
extern "C" int main(int argc, char** argv) { | |
printf("hello, world!\n"); | |
SDL_Init(SDL_INIT_VIDEO); | |
SDL_Surface *screen = SDL_SetVideoMode(256, 256, 32, SDL_HWSURFACE); | |
#ifdef TEST_SDL_LOCK_OPTS | |
EM_ASM("SDL.defaults.copyOnLock = false; SDL.defaults.discardOnLock = true; SDL.defaults.opaqueFrontBuffer = false;"); | |
#endif | |
if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen); | |
for (int i = 0; i < 256; i++) { | |
for (int j = 0; j < 256; j++) { | |
#ifdef TEST_SDL_LOCK_OPTS | |
// Alpha behaves like in the browser, so write proper opaque pixels. | |
int alpha = 255; | |
#else | |
int alpha = (i+j) % 255; | |
#endif | |
//*((Uint32*)screen->pixels + i * 256 + j) = SDL_MapRGBA(screen->format, i, j, 255-i, alpha); | |
} | |
} | |
SDL_Rect rect = { 200, 200, 175, 125 }; | |
SDL_FillRect(screen, &rect, SDL_MapRGBA(screen->format, 0x22, 0x22, 0xff, 0xff)); | |
if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); | |
SDL_Flip(screen); | |
SDL_Quit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I compile with emcc test.cpp -o hello.html