emscripten-ports / SDL2

Other
166 stars 64 forks source link

unable to build #1

Closed nickdesaulniers closed 9 years ago

nickdesaulniers commented 9 years ago

Hi, I'm getting the following compiler error:

➜  build git:(master) ✗ em++ ../main.cpp -std=c++1y -s USE_SDL=2
WARNING  root: including port: sdl2
WARNING  root: building port: sdl2
/Users/Nicholas/.emscripten_ports/sdl2/SDL2-master/src/atomic/SDL_spinlock.c:59:12: error: cannot
      initialize return object of type 'SDL_bool' with an rvalue of type 'bool'
    return (__sync_lock_test_and_set(lock, 1) == 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Nicholas/.emscripten_ports/sdl2/SDL2-master/src/atomic/SDL_atomic.c:119:12: error: cannot
      initialize return object of type 'SDL_bool' with an rvalue of type 'bool'
    return __sync_bool_compare_and_swap(a, oldval, newval);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
1 error generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
Traceback (most recent call last):
  File "/Users/Nicholas/mozilla/emscripten/emcc", line 1090, in <module>
    args = system_libs.process_args(args, shared.Settings)
  File "/Users/Nicholas/mozilla/emscripten/tools/system_libs.py", line 712, in process_args
    args = port.process_args(Ports, args, settings, shared)
  File "/Users/Nicholas/mozilla/emscripten/tools/ports/sdl.py", line 57, in process_args
    get(ports, settings, shared)
  File "/Users/Nicholas/mozilla/emscripten/tools/ports/sdl.py", line 50, in get
    return [shared.Cache.get('sdl2', create)]
  File "/Users/Nicholas/mozilla/emscripten/tools/cache.py", line 36, in get
    temp = creator()
  File "/Users/Nicholas/mozilla/emscripten/tools/ports/sdl.py", line 46, in create
    ports.run_commands(commands)
  File "/Users/Nicholas/mozilla/emscripten/tools/system_libs.py", line 589, in run_commands
    run_commands(commands)
  File "/Users/Nicholas/mozilla/emscripten/tools/system_libs.py", line 26, in run_commands
    pool.map(call_process, commands, chunksize=1)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 558, in get
    raise self._value
Exception: Command '['/usr/local/bin/python2', '/Users/Nicholas/mozilla/emscripten/emcc', '/Users/Nicholas/.emscripten_ports/sdl2/SDL2-master/src/atomic/SDL_spinlock.c', '-O2', '-o', '/Users/Nicholas/.emscripten_cache/ports-builds/sdl2/src/atomic/SDL_spinlock.c.o', '-I/Users/Nicholas/.emscripten_cache/ports-builds/sdl2/include', '-O2', '-DUSING_GENERATED_CONFIG_H', '-Wno-warn-absolute-paths', '-w']' returned non-zero exit status 1
/Users/Nicholas/.emscripten_ports/sdl2/SDL2-master/src/SDL.c:84:12: error: cannot initialize return
      object of type 'SDL_bool' with an rvalue of type 'bool'
    return (SDL_SubsystemRefCount[subsystem_index] == 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Nicholas/.emscripten_ports/sdl2/SDL2-master/src/SDL.c:98:12: error: cannot initialize return
      object of type 'SDL_bool' with an rvalue of type 'bool'
    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
nickdesaulniers commented 9 years ago

Looks like someone else is having this issue: https://www.mail-archive.com/emscripten-discuss@googlegroups.com/msg02279.html.

➜  build git:(master) ✗ emcc -v
emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) 1.27.1
clang version 3.4 (https://github.com/kripken/emscripten-fastcomp-clang 0848a3e6d19f71fbc117fc470961bef074e614fa) (https://github.com/kripken/emscripten-fastcomp.git 0a328798bd208d573647d96d106cf79a09ef8d97)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
INFO     root: (Emscripten: Running sanity checks)
kripken commented 9 years ago

Please test on lastest incoming, should be fixed there.

nickdesaulniers commented 9 years ago

Fixed in 1.28.2.

nickdesaulniers commented 9 years ago

I'm now getting a bunch of unresolved symbols:

warning: unresolved symbol: SDL_CreateTextureFromSurface
warning: unresolved symbol: SDL_CreateRenderer
warning: unresolved symbol: SDL_GL_CreateContext
warning: unresolved symbol: SDL_CreateWindow
warning: unresolved symbol: SDL_DestroyTexture

Does emscripten not patch these in for me at link time?

/Users/Nicholas/mozilla/emscripten/em++    -Wall -Wextra -O3 -s USE_SDL=2 -std=c++1y -o CMakeFiles/main.dir/main.cpp.o -c /Users/Nicholas/code/c++/sdl2/main.cpp
Linking CXX executable main.html
/usr/local/Cellar/cmake/3.1.0/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/Users/Nicholas/mozilla/emscripten/em++      @CMakeFiles/main.dir/objects1.rsp  -o main.html @CMakeFiles/main.dir/linklibs.rsp
WARNING  root: emcc: cannot find library "nul"
warning: unresolved symbol: SDL_CreateTextureFromSurface
warning: unresolved symbol: SDL_CreateRenderer
warning: unresolved symbol: SDL_GL_CreateContext
warning: unresolved symbol: SDL_CreateWindow
warning: unresolved symbol: SDL_DestroyTexture
kripken commented 9 years ago

Are those SDL2 methods? If so, are they in our SDL2 port?

nickdesaulniers commented 9 years ago

Yes and not sure how to tell what's currently supported and what's not. Those methods show up throughout various tests.

kripken commented 9 years ago

grep for it in the repo, for example. use the source :)

https://github.com/emscripten-ports

nickdesaulniers commented 9 years ago

Does this mean I have to put #ifdefs in my code to call a different function if compiling with emcc?

nickdesaulniers commented 9 years ago

One of the tests doesn't call most of the functions I'm getting warnings for, but it does call SDL_GL_CreateContext. Seems like I'll have to study the test case more to understand how they handle context creation.

nickdesaulniers commented 9 years ago

I can't run the test case on its own outside of the repo. "INFO: No OpenGL ES support on this system" Note the readme in the repo contains info on how to build internally, and the official documentation doesn't produce a working build. Not sure how sdl2 support is supposed to work out of the box?

Daft-Freak commented 9 years ago

The SDL2 test cases don't work standalone, they need to be linked to an internal library. The example in the docs works fine for me. What errors are you getting with that?

Also all SDL2 methods should link, if something isn't supported it would fail at runtime.

nickdesaulniers commented 9 years ago

Here's my test case. The errors I'm getting:

warning: unresolved symbol: SDL_GL_CreateContext
warning: unresolved symbol: SDL_CreateWindow
nickdesaulniers commented 9 years ago

Ah, wasn't passing -s USE_SDL=2 to the linking phase. All set. (in cmake, I used set_target_properties(<target name> PROPERTIES LINK_FLAGS "-s USE_SDL=2") instead of add_definitions). See this.

omac777 commented 6 years ago

No matter what I try, I can't build a wasm from a cpp with SDL2. Here is the first error of many that are similar: ERROR:root:/home/dma2/.emscripten_ports/sdl2/SDL2-version_13/src/atomic/SDL_spinlock.c: No such file or directory ("/home/dma2/.emscripten_ports/sdl2/SDL2-version_13/src/atomic/SDL_spinlock.c" was expected to be an input file, based on the commandline arguments provided)

I'm on archlinux and I installed the emscripten package with pacman.

em++ --version
emcc (Emscripten gcc/clang-like replacement) 1.38.1 ()
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here are the commands I tried to invoke my source file with:

em++ -v `sdl2-config --cflags` -std=c++11 hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html
em++ -v `sdl2-config --cflags` -std=c++11 hello_world_sdl.cpp -s WASM=1 -s USE_SDL=2 -o hello_world_sdl.html
em++ -v -s USE_SDL=2 `sdl2-config --cflags` -std=c++11 hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html
em++ -v -s USE_SDL=2 -std=c++1y hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html
em++ -v -std=c++1y hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html -s USE_SDL=2
em++ -v `sdl2-config --cflags` -std=c++11 hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html -s USE_SDL=2
em++ -v -s USE_SDL=2 `sdl2-config --cflags` -std=c++11 hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html -s USE_SDL=2
em++ -v -s USE_SDL=2 hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html
em++ -v -std=c++1y hello_world_sdl.cpp -s WASM=1 -o hello_world_sdl.html -s USE_SDL=2
em++ -v -std=c++1y hello_world_sdl.cpp -s USE_SDL=2 -s WASM=1 -o hello_world_sdl.html
em++ -v -std=c++1y hello_world_sdl.cpp -s USE_SDL=2 -s USE_SDL_IMAGE=2  -s WASM=1 -o hello_world_sdl.html
cat hello_world_sdl.cpp
#define __gnuc_va_list va_list
#define _G_va_list va_list

#include <string>
#include <iostream>
#include <SDL.h>
#include <SDL_image.h>
#include "res_path.h"
#include "cleanup.h"

#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif

//Screen attributes
const int SCREEN_WIDTH  = 640;
const int SCREEN_HEIGHT = 480;

/*
 * Log an SDL error with some error message to the output stream of our choice
 * @param os The output stream to write the message too
 * @param msg The error message to write, format will be msg error: SDL_GetError()
 */
void logSDLError(std::ostream &os, const std::string &msg){
  os << msg << " error: " << SDL_GetError() << std::endl;
}
/*
 * Loads an image into a texture on the rendering device
 * @param file The image file to load
 * @param ren The renderer to load the texture onto
 * @return the loaded texture, or nullptr if something went wrong.
 */
SDL_Texture* loadTexture(const std::string &file, SDL_Renderer *ren){
  SDL_Texture *texture = IMG_LoadTexture(ren, file.c_str());
  if (texture == nullptr){
    logSDLError(std::cout, "LoadTexture");
  }
  return texture;
}
/*
 * Draw an SDL_Texture to an SDL_Renderer at position x, y, with some desired
 * width and height
 * @param tex The source texture we want to draw
 * @param rend The renderer we want to draw too
 * @param x The x coordinate to draw too
 * @param y The y coordinate to draw too
 * @param w The width of the texture to draw
 * @param h The height of the texture to draw
 */
void renderTexture(SDL_Texture *tex, SDL_Renderer *ren, int x, int y, int w, int h){
  //Setup the destination rectangle to be at the position we want
  SDL_Rect dst;
  dst.x = x;
  dst.y = y;
  dst.w = w;
  dst.h = h;
  SDL_RenderCopy(ren, tex, NULL, &dst);
}
/*
 * Draw an SDL_Texture to an SDL_Renderer at position x, y, preserving
 * the texture's width and height
 * @param tex The source texture we want to draw
 * @param rend The renderer we want to draw too
 * @param x The x coordinate to draw too
 * @param y The y coordinate to draw too
 */
void renderTexture(SDL_Texture *tex, SDL_Renderer *ren, int x, int y){
  int w, h;
  SDL_QueryTexture(tex, NULL, NULL, &w, &h);
  renderTexture(tex, ren, x, y, w, h);
}

int main(int, char**){
  //Start up SDL and make sure it went ok
  if (SDL_Init(SDL_INIT_VIDEO) != 0){
    logSDLError(std::cout, "SDL_Init");
    return 1;
  }

  //Setup our window and renderer, this time let's put our window in the center
  //of the screen
  SDL_Window *window = SDL_CreateWindow("Lesson 4", SDL_WINDOWPOS_CENTERED,
                    SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
  if (window == nullptr){
    logSDLError(std::cout, "CreateWindow");
    SDL_Quit();
    return 1;
  }
  SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
  if (renderer == nullptr){
    logSDLError(std::cout, "CreateRenderer");
    cleanup(window);
    SDL_Quit();
    return 1;
  }

  //The texture we'll be using
  const std::string resPath = getResourcePath("Lesson4");
  SDL_Texture *image = loadTexture(resPath + "image.png", renderer);
  if (image == nullptr){
    cleanup(image, renderer, window);
    IMG_Quit();
    SDL_Quit();
    return 1;
  }

  //Our texture size won't change, so we can get it here
  //instead of constantly allocating/deleting ints in the loop
  int iW, iH;
  SDL_QueryTexture(image, NULL, NULL, &iW, &iH);
  int x = SCREEN_WIDTH / 2 - iW / 2;
  int y = SCREEN_HEIGHT / 2 - iH / 2;

  //Our event structure
  SDL_Event e;
  //For tracking if we want to quit
  bool quit = false;
  while (!quit){
    //Read any events that occured, for now we'll just quit if any event occurs
    while (SDL_PollEvent(&e)){
      //If user closes the window
      if (e.type == SDL_QUIT){
    quit = true;
      }
      //If user presses any key
      if (e.type == SDL_KEYDOWN){

    //every key is captured and dumped with the exceptions of:
    //print screen key
    //Left Windows logo key
    //All the non-standard pc 101 extra multimedia keys

    //std::cout << "scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
    switch (e.key.keysym.sym) {
      //case SDLK_ESCAPE:
      //std::cout << "escape scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;

    case SDLK_UNKNOWN:
      std::cout << "SDLK_UNKNOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RETURN:
      std::cout << "SDLK_RETURN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_ESCAPE:
      std::cout << "SDLK_ESCAPE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_BACKSPACE:
      std::cout << "SDLK_BACKSPACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_TAB:
      std::cout << "SDLK_TAB scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SPACE:
      std::cout << "SDLK_SPACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_EXCLAIM:
      std::cout << "SDLK_EXCLAIM scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_QUOTEDBL:
      std::cout << "SDLK_QUOTEDBL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_HASH:
      std::cout << "SDLK_HASH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PERCENT:
      std::cout << "SDLK_PERCENT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_DOLLAR:
      std::cout << "SDLK_DOLLAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AMPERSAND:
      std::cout << "SDLK_AMPERSAND scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_QUOTE:
      std::cout << "SDLK_QUOTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LEFTPAREN:
      std::cout << "SDLK_LEFTPAREN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RIGHTPAREN:
      std::cout << "SDLK_RIGHTPAREN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_ASTERISK:
      std::cout << "SDLK_ASTERISK scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PLUS:
      std::cout << "SDLK_PLUS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_COMMA:
      std::cout << "SDLK_COMMA scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MINUS:
      std::cout << "SDLK_MINUS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PERIOD:
      std::cout << "SDLK_PERIOD scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SLASH:
      std::cout << "SDLK_SLASH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_0:
      std::cout << "SDLK_0 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_1:
      std::cout << "SDLK_1 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_2:
      std::cout << "SDLK_2 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_3:
      std::cout << "SDLK_3 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_4:
      std::cout << "SDLK_4 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_5:
      std::cout << "SDLK_5 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_6:
      std::cout << "SDLK_6 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_7:
      std::cout << "SDLK_7 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_8:
      std::cout << "SDLK_8 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_9:
      std::cout << "SDLK_9 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_COLON:
      std::cout << "SDLK_COLON scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SEMICOLON:
      std::cout << "SDLK_SEMICOLON scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LESS:
      std::cout << "SDLK_LESS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_EQUALS:
      std::cout << "SDLK_EQUALS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_GREATER:
      std::cout << "SDLK_GREATER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_QUESTION:
      std::cout << "SDLK_QUESTION scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AT:
      std::cout << "SDLK_AT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LEFTBRACKET:
      std::cout << "SDLK_LEFTBRACKET scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_BACKSLASH:
      std::cout << "SDLK_BACKSLASH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RIGHTBRACKET:
      std::cout << "SDLK_RIGHTBRACKET scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CARET:
      std::cout << "SDLK_CARET scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_UNDERSCORE:
      std::cout << "SDLK_UNDERSCORE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_BACKQUOTE:
      std::cout << "SDLK_BACKQUOTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_a:
      std::cout << "SDLK_a scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_b:
      std::cout << "SDLK_b scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_c:
      std::cout << "SDLK_c scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_d:
      std::cout << "SDLK_d scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_e:
      std::cout << "SDLK_e scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_f:
      std::cout << "SDLK_f scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_g:
      std::cout << "SDLK_g scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_h:
      std::cout << "SDLK_h scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_i:
      std::cout << "SDLK_i scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_j:
      std::cout << "SDLK_j scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_k:
      std::cout << "SDLK_k scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_l:
      std::cout << "SDLK_l scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_m:
      std::cout << "SDLK_m scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_n:
      std::cout << "SDLK_n scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_o:
      std::cout << "SDLK_o scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_p:
      std::cout << "SDLK_p scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_q:
      std::cout << "SDLK_q scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_r:
      std::cout << "SDLK_r scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_s:
      std::cout << "SDLK_s scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_t:
      std::cout << "SDLK_t scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_u:
      std::cout << "SDLK_u scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_v:
      std::cout << "SDLK_v scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_w:
      std::cout << "SDLK_w scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_x:
      std::cout << "SDLK_x scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_y:
      std::cout << "SDLK_y scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_z:
      std::cout << "SDLK_z scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CAPSLOCK:
      std::cout << "SDLK_CAPSLOCK scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F1:
      std::cout << "SDLK_F1 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F2:
      std::cout << "SDLK_F2 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F3:
      std::cout << "SDLK_F3 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F4:
      std::cout << "SDLK_F4 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F5:
      std::cout << "SDLK_F5 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F6:
      std::cout << "SDLK_F6 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F7:
      std::cout << "SDLK_F7 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F8:
      std::cout << "SDLK_F8 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F9:
      std::cout << "SDLK_F9 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F10:
      std::cout << "SDLK_F10 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F11:
      std::cout << "SDLK_F11 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F12:
      std::cout << "SDLK_F12 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PRINTSCREEN:
      std::cout << "SDLK_PRINTSCREEN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SCROLLLOCK:
      std::cout << "SDLK_SCROLLLOCK scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PAUSE:
      std::cout << "SDLK_PAUSE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_INSERT:
      std::cout << "SDLK_INSERT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_HOME:
      std::cout << "SDLK_HOME scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PAGEUP:
      std::cout << "SDLK_PAGEUP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_DELETE:
      std::cout << "SDLK_DELETE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_END:
      std::cout << "SDLK_END scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PAGEDOWN:
      std::cout << "SDLK_PAGEDOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RIGHT:
      std::cout << "SDLK_RIGHT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LEFT:
      std::cout << "SDLK_LEFT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_DOWN:
      std::cout << "SDLK_DOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_UP:
      std::cout << "SDLK_UP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_NUMLOCKCLEAR:
      std::cout << "SDLK_NUMLOCKCLEAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_DIVIDE:
      std::cout << "SDLK_KP_DIVIDE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MULTIPLY:
      std::cout << "SDLK_KP_MULTIPLY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MINUS:
      std::cout << "SDLK_KP_MINUS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_PLUS:
      std::cout << "SDLK_KP_PLUS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_ENTER:
      std::cout << "SDLK_KP_ENTER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_1:
      std::cout << "SDLK_KP_1 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_2:
      std::cout << "SDLK_KP_2 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_3:
      std::cout << "SDLK_KP_3 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_4:
      std::cout << "SDLK_KP_4 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_5:
      std::cout << "SDLK_KP_5 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_6:
      std::cout << "SDLK_KP_6 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_7:
      std::cout << "SDLK_KP_7 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_8:
      std::cout << "SDLK_KP_8 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_9:
      std::cout << "SDLK_KP_9 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_0:
      std::cout << "SDLK_KP_0 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_PERIOD:
      std::cout << "SDLK_KP_PERIOD scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_APPLICATION:
      std::cout << "SDLK_APPLICATION scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_POWER:
      std::cout << "SDLK_POWER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_EQUALS:
      std::cout << "SDLK_KP_EQUALS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F13:
      std::cout << "SDLK_F13 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F14:
      std::cout << "SDLK_F14 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F15:
      std::cout << "SDLK_F15 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F16:
      std::cout << "SDLK_F16 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F17:
      std::cout << "SDLK_F17 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F18:
      std::cout << "SDLK_F18 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F19:
      std::cout << "SDLK_F19 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F20:
      std::cout << "SDLK_F20 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F21:
      std::cout << "SDLK_F21 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F22:
      std::cout << "SDLK_F22 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F23:
      std::cout << "SDLK_F23 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_F24:
      std::cout << "SDLK_F24 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_EXECUTE:
      std::cout << "SDLK_EXECUTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_HELP:
      std::cout << "SDLK_HELP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MENU:
      std::cout << "SDLK_MENU scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SELECT:
      std::cout << "SDLK_SELECT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_STOP:
      std::cout << "SDLK_STOP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AGAIN:
      std::cout << "SDLK_AGAIN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_UNDO:
      std::cout << "SDLK_UNDO scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CUT:
      std::cout << "SDLK_CUT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_COPY:
      std::cout << "SDLK_COPY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PASTE:
      std::cout << "SDLK_PASTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_FIND:
      std::cout << "SDLK_FIND scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MUTE:
      std::cout << "SDLK_MUTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_VOLUMEUP:
      std::cout << "SDLK_VOLUMEUP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_VOLUMEDOWN:
      std::cout << "SDLK_VOLUMEDOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_COMMA:
      std::cout << "SDLK_KP_COMMA scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_EQUALSAS400:
      std::cout << "SDLK_KP_EQUALSAS400 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_ALTERASE:
      std::cout << "SDLK_ALTERASE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SYSREQ:
      std::cout << "SDLK_SYSREQ scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CANCEL:
      std::cout << "SDLK_CANCEL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CLEAR:
      std::cout << "SDLK_CLEAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_PRIOR:
      std::cout << "SDLK_PRIOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RETURN2:
      std::cout << "SDLK_RETURN2 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SEPARATOR:
      std::cout << "SDLK_SEPARATOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_OUT:
      std::cout << "SDLK_OUT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_OPER:
      std::cout << "SDLK_OPER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CLEARAGAIN:
      std::cout << "SDLK_CLEARAGAIN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CRSEL:
      std::cout << "SDLK_CRSEL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_EXSEL:
      std::cout << "SDLK_EXSEL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_00:
      std::cout << "SDLK_KP_00 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_000:
      std::cout << "SDLK_KP_000 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_THOUSANDSSEPARATOR:
      std::cout << "SDLK_THOUSANDSSEPARATOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_DECIMALSEPARATOR:
      std::cout << "SDLK_DECIMALSEPARATOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CURRENCYUNIT:
      std::cout << "SDLK_CURRENCYUNIT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CURRENCYSUBUNIT:
      std::cout << "SDLK_CURRENCYSUBUNIT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_LEFTPAREN:
      std::cout << "SDLK_KP_LEFTPAREN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_RIGHTPAREN:
      std::cout << "SDLK_KP_RIGHTPAREN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_LEFTBRACE:
      std::cout << "SDLK_KP_LEFTBRACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_RIGHTBRACE:
      std::cout << "SDLK_KP_RIGHTBRACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_TAB:
      std::cout << "SDLK_KP_TAB scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_BACKSPACE:
      std::cout << "SDLK_KP_BACKSPACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_A:
      std::cout << "SDLK_KP_A scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_B:
      std::cout << "SDLK_KP_B scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_C:
      std::cout << "SDLK_KP_C scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_D:
      std::cout << "SDLK_KP_D scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_E:
      std::cout << "SDLK_KP_E scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_F:
      std::cout << "SDLK_KP_F scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_XOR:
      std::cout << "SDLK_KP_XOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_POWER:
      std::cout << "SDLK_KP_POWER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_PERCENT:
      std::cout << "SDLK_KP_PERCENT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_LESS:
      std::cout << "SDLK_KP_LESS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_GREATER:
      std::cout << "SDLK_KP_GREATER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_AMPERSAND:
      std::cout << "SDLK_KP_AMPERSAND scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_DBLAMPERSAND:
      std::cout << "SDLK_KP_DBLAMPERSAND scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_VERTICALBAR:
      std::cout << "SDLK_KP_VERTICALBAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_DBLVERTICALBAR:
      std::cout << "SDLK_KP_DBLVERTICALBAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_COLON:
      std::cout << "SDLK_KP_COLON scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_HASH:
      std::cout << "SDLK_KP_HASH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_SPACE:
      std::cout << "SDLK_KP_SPACE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_AT:
      std::cout << "SDLK_KP_AT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_EXCLAM:
      std::cout << "SDLK_KP_EXCLAM scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMSTORE:
      std::cout << "SDLK_KP_MEMSTORE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMRECALL:
      std::cout << "SDLK_KP_MEMRECALL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMCLEAR:
      std::cout << "SDLK_KP_MEMCLEAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMADD:
      std::cout << "SDLK_KP_MEMADD scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMSUBTRACT:
      std::cout << "SDLK_KP_MEMSUBTRACT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMMULTIPLY:
      std::cout << "SDLK_KP_MEMMULTIPLY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_MEMDIVIDE:
      std::cout << "SDLK_KP_MEMDIVIDE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_PLUSMINUS:
      std::cout << "SDLK_KP_PLUSMINUS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_CLEAR:
      std::cout << "SDLK_KP_CLEAR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_CLEARENTRY:
      std::cout << "SDLK_KP_CLEARENTRY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_BINARY:
      std::cout << "SDLK_KP_BINARY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_OCTAL:
      std::cout << "SDLK_KP_OCTAL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_DECIMAL:
      std::cout << "SDLK_KP_DECIMAL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KP_HEXADECIMAL:
      std::cout << "SDLK_KP_HEXADECIMAL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LCTRL:
      std::cout << "SDLK_LCTRL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LSHIFT:
      std::cout << "SDLK_LSHIFT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LALT:
      std::cout << "SDLK_LALT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_LGUI:
      std::cout << "SDLK_LGUI scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RCTRL:
      std::cout << "SDLK_RCTRL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RSHIFT:
      std::cout << "SDLK_RSHIFT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RALT:
      std::cout << "SDLK_RALT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_RGUI:
      std::cout << "SDLK_RGUI scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MODE:
      std::cout << "SDLK_MODE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIONEXT:
      std::cout << "SDLK_AUDIONEXT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOPREV:
      std::cout << "SDLK_AUDIOPREV scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOSTOP:
      std::cout << "SDLK_AUDIOSTOP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOPLAY:
      std::cout << "SDLK_AUDIOPLAY scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOMUTE:
      std::cout << "SDLK_AUDIOMUTE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MEDIASELECT:
      std::cout << "SDLK_MEDIASELECT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_WWW:
      std::cout << "SDLK_WWW scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_MAIL:
      std::cout << "SDLK_MAIL scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_CALCULATOR:
      std::cout << "SDLK_CALCULATOR scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_COMPUTER:
      std::cout << "SDLK_COMPUTER scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_SEARCH:
      std::cout << "SDLK_AC_SEARCH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_HOME:
      std::cout << "SDLK_AC_HOME scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_BACK:
      std::cout << "SDLK_AC_BACK scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_FORWARD:
      std::cout << "SDLK_AC_FORWARD scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_STOP:
      std::cout << "SDLK_AC_STOP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_REFRESH:
      std::cout << "SDLK_AC_REFRESH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AC_BOOKMARKS:
      std::cout << "SDLK_AC_BOOKMARKS scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_BRIGHTNESSDOWN:
      std::cout << "SDLK_BRIGHTNESSDOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_BRIGHTNESSUP:
      std::cout << "SDLK_BRIGHTNESSUP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_DISPLAYSWITCH:
      std::cout << "SDLK_DISPLAYSWITCH scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KBDILLUMTOGGLE:
      std::cout << "SDLK_KBDILLUMTOGGLE scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KBDILLUMDOWN:
      std::cout << "SDLK_KBDILLUMDOWN scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_KBDILLUMUP:
      std::cout << "SDLK_KBDILLUMUP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_EJECT:
      std::cout << "SDLK_EJECT scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_SLEEP:
      std::cout << "SDLK_SLEEP scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_APP1:
      std::cout << "SDLK_APP1 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_APP2:
      std::cout << "SDLK_APP2 scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOREWIND:
      std::cout << "SDLK_AUDIOREWIND scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    case SDLK_AUDIOFASTFORWARD:
      std::cout << "SDLK_AUDIOFASTFORWARD scancode:" << e.key.keysym.scancode << " sym:" << e.key.keysym.sym << " modifiers:" << e.key.keysym.mod << std::endl;
      break;
    }

    //quit = true;
      }
      //If user clicks the mouse
      if (e.type == SDL_MOUSEBUTTONDOWN){

    std::string whichMouseButton;
    switch(e.button.button) {
    case SDL_BUTTON_LEFT:
      whichMouseButton = std::string("SDL_BUTTON_LEFT");
      break;
    case SDL_BUTTON_MIDDLE:
      whichMouseButton = std::string("SDL_BUTTON_MIDDLE");
      break;
    case SDL_BUTTON_RIGHT:
      whichMouseButton = std::string("SDL_BUTTON_RIGHT");
      break;
    }

    std::string numberMouseClicks;
    switch(e.button.clicks) {
    case 1:
      numberMouseClicks = std::string("singleclick");
      break;
    case 2:
      numberMouseClicks = std::string("doubleclick");
      break;
    }

    std::cout <<
      "timestamp:" << e.button.timestamp <<
      " windowID:" << e.button.windowID <<
      " which mouseinstance:" << e.button.which <<
      " button:" << whichMouseButton <<
      " clicks:" << numberMouseClicks <<
      " x:" << e.button.x <<
      " y:" << e.button.y <<
      std::endl;

    //quit = true;
      }
    }
    //Rendering
    SDL_RenderClear(renderer);
    //Draw the image
    renderTexture(image, renderer, x, y);
    //Update the screen
    SDL_RenderPresent(renderer);
  }
  //Destroy the various items
  cleanup(image, renderer, window);
  IMG_Quit();
  SDL_Quit();

  return 0;
}
kripken commented 6 years ago

@omac777 perhaps something went wrong with the install. I'd try emcc --clear-cache --clear-ports, and if that doesn't work, reinstall it from scratch.

Alternatively, maybe there's something wrong in that source file - although I can't see how it could cause that error. To check, can build one of the known working testcases from the emscripten test suite, grep for USE_SDL=2 in tests/test_browser.py.

omac777 commented 6 years ago

yes: "emcc --clear-cache --clear-ports" helped. thank you. Also needed to comment out event case blocks for SDLK_APP1, SDLK_APP2, SDLK_AUDIOREWIND, SDLK_AUDIOFASTFORWARD. Were those deprecated?

Daft-Freak commented 6 years ago

Those were added in 2.0.6 and we're still on 2.0.5. (I still haven't got around to testing and merging the update (#52))