DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR doesn't seem to work

17 views
Skip to first unread message

Frederico Zveiter

unread,
Mar 17, 2019, 6:44:04 PM3/17/19
to emscripten-discuss
Hi everyone!

I'm trying my first steps on emscripten but have bumped on a wall.
I'm trying to run a very basic hello world style empty canvas SDL2.
It compiles well but when I run it seems that the generated js is not able to grab the canvas element.

If I compile with 'emcc main.cpp -v --emrun -s USE_SDL=2 -o Build\main.html' it gives me the following error: "Rules for selecting event targets in HTML5 API are changing: instead of using document.getElementById() that only can refer to elements by their DOM ID, new event target selection mechanism uses the more flexible function document.querySelector() that can look up element names, classes, and complex CSS selectors. Build with -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 to change to the new lookup rules. See https://github.com/emscripten-core/emscripten/pull/7977 for more details."

And if I compile with 'emcc main.cpp -v --emrun -s USE_SDL=2 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -o Build\main.html' it gives me this other one: "exception thrown: SyntaxError: '' is not a valid selector,__findEventTarget@http://localhost:6931/main.js:6696:92
_emscripten_set_canvas_element_size@http://localhost:6931/main.js:6722:20

I'm using emscripten version 1.38.29.
Tested in Chrome 73.0.3683.75 (64 bits) and Firefox 65.0.2 (64 bits)

Here is the code for main.cpp:
#include <SDL.h>
int main(int argc, char* argv[])
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window *window;
    SDL_Renderer *renderer;
    SDL_CreateWindowAndRenderer(256, 256, 0, &window, &renderer);
    SDL_Surface *screen = SDL_CreateRGBSurface(0, 256, 256, 8, 0, 0, 0, 0);
    if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen);
    if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
    SDL_RenderPresent(renderer);
    SDL_Quit();
    return 0;
}

Also, my end goal is to port a small game and I appreciate if you could point me to some basic working examples using SDL2 and Open GL, since the ones I found seems outdated.

Thanks!
Fred

Alon Zakai

unread,
May 13, 2019, 1:30:11 PM5/13/19
to emscripte...@googlegroups.com
>  Also, my end goal is to port a small game and I appreciate if you could point me to some basic working examples using SDL2 and Open GL, since the ones I found seems outdated.

The test suite has many working examples - look in tests/test_browser.py (tests with "sdl2" in the name use SDL2, etc. - can also search by emcc flags in that file).



--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages