OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "embedders/openglui/emulator/emulator_embedder.h" | 5 #include "embedders/openglui/emulator/emulator_embedder.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/time.h> | 8 #include <sys/time.h> |
9 #include <time.h> | 9 #include <time.h> |
10 #include "embedders/openglui/common/canvas_context.h" | 10 #include "embedders/openglui/common/canvas_context.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 DART_EXPORT void emulator_main(int argc, char** argv, const char* script) { | 98 DART_EXPORT void emulator_main(int argc, char** argv, const char* script) { |
99 EmulatorGraphicsHandler graphics_handler(argc, argv); | 99 EmulatorGraphicsHandler graphics_handler(argc, argv); |
100 if (argc > 0) { | 100 if (argc > 0) { |
101 int i = argc - 1; | 101 int i = argc - 1; |
102 size_t len = strlen(argv[i]); | 102 size_t len = strlen(argv[i]); |
103 if (len > 5 && strcmp(".dart", argv[i] + len - 5) == 0) { | 103 if (len > 5 && strcmp(".dart", argv[i] + len - 5) == 0) { |
104 script = argv[i]; | 104 script = argv[i]; |
105 } | 105 } |
106 } | 106 } |
107 VMGlue vm_glue(&graphics_handler, ".", "gl.dart", script); | 107 VMGlue vm_glue(&graphics_handler, ".", "gl.dart", script, 1); |
108 InputHandler input_handler(&vm_glue); | 108 InputHandler input_handler(&vm_glue); |
109 input_handler_ptr = &input_handler; | 109 input_handler_ptr = &input_handler; |
110 SoundHandler sound_handler; | 110 SoundHandler sound_handler; |
111 Timer timer; | 111 Timer timer; |
112 Context app_context; | 112 Context app_context; |
113 app_context.graphics_handler = &graphics_handler; | 113 app_context.graphics_handler = &graphics_handler; |
114 app_context.input_handler = &input_handler; | 114 app_context.input_handler = &input_handler; |
115 app_context.sound_handler = &sound_handler; | 115 app_context.sound_handler = &sound_handler; |
116 app_context.timer = &timer; | 116 app_context.timer = &timer; |
117 app_context.vm_glue = &vm_glue; | 117 app_context.vm_glue = &vm_glue; |
118 DartHost host(&app_context); | 118 DartHost host(&app_context); |
119 lifecycle_handler_ptr = &host; | 119 lifecycle_handler_ptr = &host; |
120 glutReshapeFunc(reshape); | 120 glutReshapeFunc(reshape); |
121 glutDisplayFunc(display); | 121 glutDisplayFunc(display); |
122 glutKeyboardFunc(keyboard); | 122 glutKeyboardFunc(keyboard); |
123 glutMouseFunc(mouse); | 123 glutMouseFunc(mouse); |
124 glutMotionFunc(motion); | 124 glutMotionFunc(motion); |
125 lifecycle_handler_ptr->OnStart(); | 125 lifecycle_handler_ptr->OnStart(); |
126 lifecycle_handler_ptr->Activate(); | 126 lifecycle_handler_ptr->Activate(); |
127 lifecycle_handler_ptr->Resume(); | 127 lifecycle_handler_ptr->Resume(); |
128 gettimeofday(&tvStart, NULL); | 128 gettimeofday(&tvStart, NULL); |
129 glutTimerFunc(1, tick, 0); | 129 glutTimerFunc(1, tick, 0); |
130 glutMainLoop(); | 130 glutMainLoop(); |
131 } | 131 } |
132 | 132 |
OLD | NEW |