MCPcopy Create free account
hub / github.com/android/ndk-samples / Engine

Class Engine

teapots/more-teapots/src/main/cpp/MoreTeapotsNativeActivity.cpp:49–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47//-------------------------------------------------------------------------
48struct android_app;
49class Engine {
50 MoreTeapotsRenderer renderer_;
51
52 ndk_helper::GLContext* gl_context_;
53
54 bool initialized_resources_;
55 bool has_focus_;
56
57 ndk_helper::DoubletapDetector doubletap_detector_;
58 ndk_helper::PinchDetector pinch_detector_;
59 ndk_helper::DragDetector drag_detector_;
60 ndk_helper::PerfMonitor monitor_;
61
62 ndk_helper::TapCamera tap_camera_;
63
64 android_app* app_;
65
66 ASensorManager* sensor_manager_;
67 const ASensor* accelerometer_sensor_;
68 ASensorEventQueue* sensor_event_queue_;
69
70 void UpdateFPS(float fps);
71 void ShowUI();
72 void TransformPosition(ndk_helper::Vec2& vec);
73
74 public:
75 static void HandleCmd(struct android_app* app, int32_t cmd);
76 static int32_t HandleInput(android_app* app, AInputEvent* event);
77
78 Engine();
79 ~Engine();
80 void SetState(android_app* app);
81 int InitDisplay(android_app* app);
82 void LoadResources();
83 void UnloadResources();
84 void DrawFrame();
85 void TermDisplay();
86 void TrimMemory();
87 bool IsReady();
88
89 void UpdatePosition(AInputEvent* event, int32_t index, float& x, float& y);
90
91 void InitSensors();
92 void ProcessSensors(int32_t id);
93 void SuspendSensors();
94 void ResumeSensors();
95};
96
97//-------------------------------------------------------------------------
98// Ctor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected