Xcode-iOS/Demos/src/keyboard.c
changeset 11307 003462e40c4f
parent 11306 45fbdef6a227
child 11498 d4f87399777f
     1.1 --- a/Xcode-iOS/Demos/src/keyboard.c	Tue Aug 15 22:53:57 2017 -0300
     1.2 +++ b/Xcode-iOS/Demos/src/keyboard.c	Tue Aug 15 23:00:54 2017 -0300
     1.3 @@ -157,7 +157,6 @@
     1.4  SDL_Texture*
     1.5  loadFont(void)
     1.6  {
     1.7 -
     1.8      SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");
     1.9  
    1.10      if (!surface) {
    1.11 @@ -208,18 +207,18 @@
    1.12  int
    1.13  main(int argc, char *argv[])
    1.14  {
    1.15 -    int index;                  /* index of last key we pushed in the bitmap font */
    1.16      SDL_Window *window;
    1.17      SDL_Event event;            /* last event received */
    1.18      SDL_Scancode scancode;      /* scancode of last key we pushed */
    1.19      int width;
    1.20      int height;
    1.21 +    int done;
    1.22  
    1.23      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.24          printf("Error initializing SDL: %s", SDL_GetError());
    1.25      }
    1.26      /* create window */
    1.27 -    window = SDL_CreateWindow("iPhone keyboard test", 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
    1.28 +    window = SDL_CreateWindow("iOS keyboard test", 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
    1.29      /* create renderer */
    1.30      renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC);
    1.31  
    1.32 @@ -229,16 +228,13 @@
    1.33      /* load up our font */
    1.34      loadFont();
    1.35  
    1.36 -    int done = 0;
    1.37 -
    1.38 +    done = 0;
    1.39      while (!done) {
    1.40          while (SDL_PollEvent(&event)) {
    1.41              switch (event.type) {
    1.42              case SDL_QUIT:
    1.43                  done = 1;
    1.44                  break;
    1.45 -            case SDL_TEXTINPUT:
    1.46 -                break;
    1.47              case SDL_KEYDOWN:
    1.48                  if (event.key.keysym.scancode == SDL_SCANCODE_BACKSPACE) {
    1.49                      if (numChars > 0) {
    1.50 @@ -269,5 +265,6 @@
    1.51      SDL_DestroyTexture(texture);
    1.52      SDL_DestroyRenderer(renderer);
    1.53      SDL_DestroyWindow(window);
    1.54 +    SDL_Quit();
    1.55      return 0;
    1.56  }