| 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/android/context.h" | 5 #include "embedders/android/context.h" |
| 6 #include "embedders/android/dart_host.h" | 6 #include "embedders/android/dart_host.h" |
| 7 #include "embedders/android/eventloop.h" | 7 #include "embedders/android/eventloop.h" |
| 8 #include "embedders/android/graphics.h" | 8 #include "embedders/android/graphics.h" |
| 9 #include "embedders/android/input_service.h" | 9 #include "embedders/android/input_service.h" |
| 10 #include "embedders/android/vm_glue.h" | 10 #include "embedders/android/vm_glue.h" |
| 11 | 11 |
| 12 SoundService* psound_service; | 12 SoundService* psound_service; |
| 13 | 13 |
| 14 void android_main(android_app* application) { | 14 void android_main(android_app* application) { |
| 15 Timer timer; | 15 Timer timer; |
| 16 Graphics graphics(application, &timer); | 16 Graphics graphics(application, &timer); |
| 17 VMGlue vmGlue(&graphics); | 17 VMGlue vm_glue(&graphics); |
| 18 InputService inputService(application, &vmGlue, | 18 InputService input_handler(application, &vm_glue, |
| 19 graphics.width(), graphics.height()); | 19 graphics.width(), graphics.height()); |
| 20 SoundService sound_service(application); | 20 SoundService sound_service(application); |
| 21 psound_service = &sound_service; | 21 Context app_context; |
| 22 Context context; | 22 app_context.graphics = &graphics; |
| 23 context.graphics = &graphics; | 23 app_context.input_handler = &input_handler; |
| 24 context.input_handler = &inputService; | 24 app_context.sound_service = &sound_service; |
| 25 context.sound_service = psound_service; | 25 app_context.timer = &timer; |
| 26 context.timer = &timer; | 26 app_context.vm_glue = &vm_glue; |
| 27 context.vm_glue = &vmGlue; | |
| 28 EventLoop eventLoop(application); | 27 EventLoop eventLoop(application); |
| 29 DartHost host(&context); | 28 DartHost host(&app_context); |
| 30 eventLoop.Run(&host, &context); | 29 eventLoop.Run(&host, &app_context); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void PlayBackground(const char* path) { | 32 int32_t PlayBackgroundSound(const char* path) { |
| 34 psound_service->PlayBackground(path); | 33 return psound_service->PlayBackground(path); |
| 35 } | 34 } |
| 36 | 35 |
| 37 void StopBackground() { | 36 void StopBackgroundSound() { |
| 38 psound_service->StopBackground(); | 37 psound_service->StopBackground(); |
| 39 } | 38 } |
| 39 |
| 40 int32_t LoadSoundSample(const char* path) { |
| 41 return psound_service->LoadSample(path); |
| 42 } |
| 43 |
| 44 int32_t PlaySoundSample(const char* path) { |
| 45 return psound_service->PlaySample(path); |
| 46 } |
| OLD | NEW |