| 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" |
| 11 #include "embedders/openglui/common/isized.h" | 11 #include "embedders/openglui/common/isized.h" |
| 12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
| 13 | 13 |
| 14 class VMGlue { | 14 class VMGlue { |
| 15 public: | 15 public: |
| 16 explicit VMGlue(ISized* surface, | 16 explicit VMGlue(ISized* surface, |
| 17 const char* script_path, | 17 const char* script_path, |
| 18 const char* extension_script = NULL, | 18 const char* extension_script = NULL, |
| 19 const char* main_script = NULL); | 19 const char* main_script = NULL); |
| 20 ~VMGlue() { | 20 ~VMGlue() { |
| 21 delete[] main_script_; | 21 delete[] main_script_; |
| 22 delete[] extension_script_; | 22 delete[] extension_script_; |
| 23 } | 23 } |
| 24 | 24 |
| 25 int InitializeVM(); | 25 int InitializeVM(); |
| 26 int StartMainIsolate(); | 26 int StartMainIsolate(); |
| 27 int CallSetup(); | 27 int CallSetup(bool force = false); |
| 28 int CallUpdate(); | 28 int CallUpdate(); |
| 29 int CallShutdown(); |
| 29 int OnMotionEvent(const char* funtion, int64_t when, | 30 int OnMotionEvent(const char* funtion, int64_t when, |
| 30 float move_x, float move_y); | 31 float move_x, float move_y); |
| 31 int OnKeyEvent(const char* funtion, int64_t when, int32_t flags, | 32 int OnKeyEvent(const char* funtion, int64_t when, int32_t flags, |
| 32 int32_t key_code, int32_t meta_state, int32_t repeat); | 33 int32_t key_code, int32_t meta_state, int32_t repeat); |
| 33 void FinishMainIsolate(); | 34 void FinishMainIsolate(); |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 int Invoke(const char *function, int argc, Dart_Handle* args, | 37 int Invoke(const char *function, int argc, Dart_Handle* args, |
| 37 bool failIfNotDefined = true); | 38 bool failIfNotDefined = true); |
| 38 | 39 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 54 ISized* surface_; | 55 ISized* surface_; |
| 55 Dart_Isolate isolate_; | 56 Dart_Isolate isolate_; |
| 56 bool initialized_vm_; | 57 bool initialized_vm_; |
| 57 bool initialized_script_; | 58 bool initialized_script_; |
| 58 char* main_script_; | 59 char* main_script_; |
| 59 static char* extension_script_; | 60 static char* extension_script_; |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 #endif // EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ | 63 #endif // EMBEDDERS_OPENGLUI_COMMON_VM_GLUE_H_ |
| 63 | 64 |
| OLD | NEW |