| 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 #ifndef EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ | 5 #ifndef EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ |
| 6 #define EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ | 6 #define EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "embedders/openglui/common/events.h" | 10 #include "embedders/openglui/common/events.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 int InitializeVM(); | 25 int InitializeVM(); |
| 26 int StartMainIsolate(); | 26 int StartMainIsolate(); |
| 27 int CallSetup(bool force = false); | 27 int CallSetup(bool force = false); |
| 28 int CallUpdate(); | 28 int CallUpdate(); |
| 29 int CallShutdown(); | 29 int CallShutdown(); |
| 30 int OnMotionEvent(const char* funtion, int64_t when, | 30 int OnMotionEvent(const char* funtion, int64_t when, |
| 31 float move_x, float move_y); | 31 float move_x, float move_y); |
| 32 int OnKeyEvent(const char* funtion, int64_t when, int32_t key_code, | 32 int OnKeyEvent(const char* funtion, int64_t when, int32_t key_code, |
| 33 bool isAltKeyDown, bool isCtrlKeyDown, bool isShiftKeyDown, | 33 bool isAltKeyDown, bool isCtrlKeyDown, bool isShiftKeyDown, |
| 34 int32_t repeat); | 34 int32_t repeat); |
| 35 inline void OnAccelerometerEvent(float x, float y, float z) { |
| 36 if (x != x_ || y != y_ || z != z_) { |
| 37 x_ = x; |
| 38 y_ = y; |
| 39 z_ = z; |
| 40 accelerometer_changed_ = true; |
| 41 } |
| 42 } |
| 43 |
| 35 void FinishMainIsolate(); | 44 void FinishMainIsolate(); |
| 36 | 45 |
| 37 private: | 46 private: |
| 38 int Invoke(const char *function, int argc, Dart_Handle* args, | 47 int Invoke(const char *function, int argc, Dart_Handle* args, |
| 39 bool failIfNotDefined = true); | 48 bool failIfNotDefined = true); |
| 40 | 49 |
| 41 static Dart_Handle CheckError(Dart_Handle); | 50 static Dart_Handle CheckError(Dart_Handle); |
| 42 | 51 |
| 43 static bool CreateIsolateAndSetupHelper(const char* script_uri, | 52 static bool CreateIsolateAndSetupHelper(const char* script_uri, |
| 44 const char* main, | 53 const char* main, |
| 45 void* data, | 54 void* data, |
| 46 char** error); | 55 char** error); |
| 47 static bool CreateIsolateAndSetup(const char* script_uri, | 56 static bool CreateIsolateAndSetup(const char* script_uri, |
| 48 const char* main, | 57 const char* main, |
| 49 void* data, char** error); | 58 void* data, char** error); |
| 50 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 59 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 51 Dart_Handle library, | 60 Dart_Handle library, |
| 52 Dart_Handle urlHandle); | 61 Dart_Handle urlHandle); |
| 53 static Dart_Handle LoadSourceFromFile(const char* url); | 62 static Dart_Handle LoadSourceFromFile(const char* url); |
| 54 static void ShutdownIsolate(void* callback_data); | 63 static void ShutdownIsolate(void* callback_data); |
| 55 | 64 |
| 56 static bool initialized_vm_; | 65 static bool initialized_vm_; |
| 66 static char* extension_script_; |
| 57 ISized* surface_; | 67 ISized* surface_; |
| 58 Dart_Isolate isolate_; | 68 Dart_Isolate isolate_; |
| 59 bool initialized_script_; | 69 bool initialized_script_; |
| 60 char* main_script_; | 70 char* main_script_; |
| 61 static char* extension_script_; | 71 float x_, y_, z_; // Last values from accelerometer. |
| 72 bool accelerometer_changed_; |
| 62 }; | 73 }; |
| 63 | 74 |
| 64 #endif // EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ | 75 #endif // EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ |
| 65 | 76 |
| OLD | NEW |