diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-04-27 23:03:37 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-04-27 23:03:37 +0000 |
| commit | 4a2a45dde3659418be419ee5773ec8ac7f6b08b1 (patch) | |
| tree | 1df51367e1b6e36a32e5dc85af9deb14de9950a8 /NativeApp/include/Android/AndroidAppBase.hpp | |
| parent | Imgui: handling surface pretransform (diff) | |
| download | DiligentTools-4a2a45dde3659418be419ee5773ec8ac7f6b08b1.tar.gz DiligentTools-4a2a45dde3659418be419ee5773ec8ac7f6b08b1.zip | |
Updated Android native app to better handle orientation changes
Diffstat (limited to 'NativeApp/include/Android/AndroidAppBase.hpp')
| -rw-r--r-- | NativeApp/include/Android/AndroidAppBase.hpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/NativeApp/include/Android/AndroidAppBase.hpp b/NativeApp/include/Android/AndroidAppBase.hpp index 21cd937..403c62d 100644 --- a/NativeApp/include/Android/AndroidAppBase.hpp +++ b/NativeApp/include/Android/AndroidAppBase.hpp @@ -42,31 +42,16 @@ public: void SetState(android_app* state, const char* native_activity_class_name); void InitSensors(); void ProcessSensors(int32_t id); - void DrawFrame(); + virtual void DrawFrame(); bool IsReady(); virtual void TrimMemory() = 0; virtual void TermDisplay() = 0; static int32_t HandleInput(android_app* app, AInputEvent* event); static void HandleCmd(android_app* app, int32_t cmd); - bool CheckWindowSizeChanged() - { - auto new_window_width = ANativeWindow_getWidth(app_->window); - auto new_window_height = ANativeWindow_getHeight(app_->window); - if (new_window_width != window_width_ || new_window_height != window_height_) - { - window_width_ = new_window_width; - window_height_ = new_window_height; - return true; - } - else - return false; - } - protected: virtual void Initialize() { - CheckWindowSizeChanged(); } virtual int Resume(ANativeWindow* window) = 0; @@ -100,10 +85,8 @@ private: void ShowUI(); void UpdateFPS(float fFPS); - bool initialized_resources_ = false; - bool has_focus_ = false; - int32_t window_width_ = 0; - int32_t window_height_ = 0; + bool initialized_resources_ = false; + bool has_focus_ = false; ASensorManager* sensor_manager_ = nullptr; const ASensor* accelerometer_sensor_ = nullptr; |
