OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ |
| 6 #define EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ |
| 7 |
| 8 #include <android_native_app_glue.h> |
| 9 #include "embedders/openglui/common/events.h" |
| 10 #include "embedders/openglui/common/input_handler.h" |
| 11 #include "embedders/openglui/common/lifecycle_handler.h" |
| 12 |
| 13 class EventLoop { |
| 14 public: |
| 15 explicit EventLoop(android_app* application); |
| 16 void Run(LifeCycleHandler* activity_handler, |
| 17 InputHandler* input_handler); |
| 18 |
| 19 protected: |
| 20 void Activate(); |
| 21 void Deactivate(); |
| 22 void ProcessActivityEvent(int32_t command); |
| 23 int32_t ProcessInputEvent(AInputEvent* event); |
| 24 bool OnTouchEvent(AInputEvent* event); |
| 25 bool OnKeyEvent(AInputEvent* event); |
| 26 |
| 27 static void ActivityCallback(android_app* application, int32_t command); |
| 28 static int32_t InputCallback(android_app* application, AInputEvent* event); |
| 29 |
| 30 private: |
| 31 bool enabled_; |
| 32 bool quit_; |
| 33 android_app* application_; |
| 34 LifeCycleHandler* lifecycle_handler_; |
| 35 InputHandler* input_handler_; |
| 36 }; |
| 37 |
| 38 #endif // EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ |
| 39 |
OLD | NEW |