• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 
8 #include "include/core/SkTypes.h"
9 #include "include/private/SkTHash.h"
10 #include "tools/sk_app/Application.h"
11 #include "tools/sk_app/ios/Window_ios.h"
12 #include "tools/timer/Timer.h"
13 
14 #include "SDL.h"
15 
16 using sk_app::Application;
17 
main(int argc,char * argv[])18 int main(int argc, char* argv[]) {
19     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0) {
20         SkDebugf("Could not initialize SDL!\n");
21         return 1;
22     }
23 
24     Application* app = Application::Create(argc, argv, nullptr);
25 
26     SDL_Event event;
27     bool done = false;
28     while (!done) {
29         while (SDL_PollEvent(&event)) {
30             switch (event.type) {
31                 // events handled by the windows
32                 case SDL_WINDOWEVENT:
33                 case SDL_FINGERDOWN:
34                 case SDL_FINGERMOTION:
35                 case SDL_FINGERUP:
36                 case SDL_KEYDOWN:
37                 case SDL_KEYUP:
38                 case SDL_TEXTINPUT:
39                     done = sk_app::Window_ios::HandleWindowEvent(event);
40                     break;
41 
42                 case SDL_QUIT:
43                     done = true;
44                     break;
45 
46                 default:
47                     break;
48             }
49         }
50 
51         app->onIdle();
52     }
53     delete app;
54 
55     SDL_Quit();
56 
57     return 0;
58 }
59