| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/android/android_graphics_handler.h" | 5 #include "embedders/openglui/android/android_graphics_handler.h" |
| 6 #include "embedders/openglui/android/android_input_handler.h" | 6 #include "embedders/openglui/android/android_input_handler.h" |
| 7 #include "embedders/openglui/android/android_resource.h" |
| 8 #include "embedders/openglui/android/android_sensor.h" |
| 7 #include "embedders/openglui/android/android_sound_handler.h" | 9 #include "embedders/openglui/android/android_sound_handler.h" |
| 8 #include "embedders/openglui/android/eventloop.h" | 10 #include "embedders/openglui/android/eventloop.h" |
| 9 #include "embedders/openglui/common/context.h" | 11 #include "embedders/openglui/common/context.h" |
| 10 #include "embedders/openglui/common/dart_host.h" | 12 #include "embedders/openglui/common/dart_host.h" |
| 11 #include "embedders/openglui/common/vm_glue.h" | 13 #include "embedders/openglui/common/vm_glue.h" |
| 12 | 14 |
| 15 android_app* application_ = NULL; |
| 16 |
| 17 Resource* MakePlatformResource(const char *path) { |
| 18 return new AndroidResource(application_, path); |
| 19 } |
| 20 |
| 13 void android_main(android_app* application) { | 21 void android_main(android_app* application) { |
| 22 application_ = application; |
| 14 app_dummy(); // Link in native_app_glue. | 23 app_dummy(); // Link in native_app_glue. |
| 15 const char* resource_path = "/data/data/com.google.dartndk/app_dart"; | 24 const char* resource_path = "/data/data/com.google.dartndk/app_dart"; |
| 25 EventLoop eventLoop(application); |
| 16 AndroidGraphicsHandler graphics_handler(application, resource_path); | 26 AndroidGraphicsHandler graphics_handler(application, resource_path); |
| 17 VMGlue vm_glue(&graphics_handler, resource_path); | 27 VMGlue vm_glue(&graphics_handler, resource_path); |
| 18 AndroidInputHandler input_handler(&vm_glue, &graphics_handler); | 28 AndroidInputHandler input_handler(&vm_glue, &graphics_handler); |
| 19 AndroidSoundHandler sound_handler(application); | 29 AndroidSoundHandler sound_handler(application); |
| 20 Timer timer; | 30 Timer timer; |
| 21 Context app_context; | 31 Context app_context; |
| 22 app_context.graphics_handler = &graphics_handler; | 32 app_context.graphics_handler = &graphics_handler; |
| 23 app_context.input_handler = &input_handler; | 33 app_context.input_handler = &input_handler; |
| 24 app_context.sound_handler = &sound_handler; | 34 app_context.sound_handler = &sound_handler; |
| 25 app_context.timer = &timer; | 35 app_context.timer = &timer; |
| 26 app_context.vm_glue = &vm_glue; | 36 app_context.vm_glue = &vm_glue; |
| 27 EventLoop eventLoop(application); | |
| 28 DartHost host(&app_context); | 37 DartHost host(&app_context); |
| 29 eventLoop.Run(&host, &input_handler); | 38 eventLoop.Run(&host, &input_handler); |
| 30 } | 39 } |
| 31 | 40 |
| OLD | NEW |