Browse Source

Examples: Android: Using LoadIniSettingsFromMemory() / SaveIniSettingsToMemory() to save in appropriate location for Android. (#5836)

pull/5842/head
Rewtio 2 years ago
committed by ocornut
parent
commit
c2694ef75e
  1. 1
      docs/CHANGELOG.txt
  2. 9
      examples/example_android_opengl3/main.cpp

1
docs/CHANGELOG.txt

@ -181,6 +181,7 @@ Other Changes:
- Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (#5721) - Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (#5721)
- Examples: Added all SDL examples to default VS solution. - Examples: Added all SDL examples to default VS solution.
- Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (#5725) - Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (#5725)
- Examples: Android: Enable .ini file loading/saving into application internal data folder. (#5836) [@rewtio]
- Backends: GLFW: Honor GLFW_CURSOR_DISABLED by not setting mouse position. (#5625) [@scorpion-26] - Backends: GLFW: Honor GLFW_CURSOR_DISABLED by not setting mouse position. (#5625) [@scorpion-26]
- Backends: GLFW: Add glfwGetError() call on GLFW 3.3 to inhibit missing mouse cursor errors. (#5785) [@mitchellh] - Backends: GLFW: Add glfwGetError() call on GLFW 3.3 to inhibit missing mouse cursor errors. (#5785) [@mitchellh]
- Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows - Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows

9
examples/example_android_opengl3/main.cpp

@ -9,6 +9,7 @@
#include <android/asset_manager.h> #include <android/asset_manager.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <GLES3/gl3.h> #include <GLES3/gl3.h>
#include <string>
// Data // Data
static EGLDisplay g_EglDisplay = EGL_NO_DISPLAY; static EGLDisplay g_EglDisplay = EGL_NO_DISPLAY;
@ -17,6 +18,7 @@ static EGLContext g_EglContext = EGL_NO_CONTEXT;
static struct android_app* g_App = NULL; static struct android_app* g_App = NULL;
static bool g_Initialized = false; static bool g_Initialized = false;
static char g_LogTag[] = "ImGuiExample"; static char g_LogTag[] = "ImGuiExample";
static std::string g_IniFilename = "";
// Forward declarations of helper functions // Forward declarations of helper functions
static int ShowSoftKeyboardInput(); static int ShowSoftKeyboardInput();
@ -70,9 +72,10 @@ void init(struct android_app* app)
ImGui::CreateContext(); ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
// Disable loading/saving of .ini file from disk. // Redirect loading/saving of .ini file to our location.
// FIXME: Consider using LoadIniSettingsFromMemory() / SaveIniSettingsToMemory() to save in appropriate location for Android. // Make sure 'g_IniFilename' persists while we use Dear ImGui.
io.IniFilename = NULL; g_IniFilename = std::string(app->activity->internalDataPath) + "/imgui.ini";
io.IniFilename = g_IniFilename.c_str();;
// Setup Dear ImGui style // Setup Dear ImGui style
ImGui::StyleColorsDark(); ImGui::StyleColorsDark();

Loading…
Cancel
Save