diff options
| author | grm <grm@eyesin.space> | 2026-03-14 02:29:15 +0200 |
|---|---|---|
| committer | grm <grm@eyesin.space> | 2026-03-14 02:29:15 +0200 |
| commit | 650e5afde271d22b3653832daf339e1bd09a10d6 (patch) | |
| tree | cc5e536b0150de1109daa43a055547d2266e60dd /lib/imgui-1.92.6/examples/example_android_opengl3/android | |
| parent | 20e64711ce2a09b657fb79d59cb824e9e34d2b07 (diff) | |
| download | cgame-master.tar.gz cgame-master.tar.bz2 cgame-master.zip | |
Diffstat (limited to 'lib/imgui-1.92.6/examples/example_android_opengl3/android')
6 files changed, 143 insertions, 0 deletions
diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/.gitignore b/lib/imgui-1.92.6/examples/example_android_opengl3/android/.gitignore new file mode 100644 index 0000000..41afcd5 --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/.gitignore @@ -0,0 +1,14 @@ +build/ +*.iml +.gradle +.idea +.DS_Store +/captures +.externalNativeBuild +.cxx +local.properties + +# Android Studio puts a Gradle wrapper here, that we don't want: +gradle/ +!gradle/libs.versions.toml +gradlew* diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/build.gradle b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/build.gradle new file mode 100644 index 0000000..e142f19 --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/build.gradle @@ -0,0 +1,37 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + +android { + namespace 'imgui.example.android' + compileSdk 36 + + defaultConfig { + applicationId "imgui.example.android" + minSdk 24 + targetSdk 36 + versionCode 1 + versionName "1.0" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = '11' + } + externalNativeBuild { + cmake { + path file('../../CMakeLists.txt') + version '3.22.1' + } + } +} diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6410b5a --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + + <application + android:label="ImGuiExample" + android:allowBackup="false" + android:fullBackupContent="false" + android:hasCode="true"> + + <activity + android:name="imgui.example.android.MainActivity" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:configChanges="orientation|keyboardHidden|screenSize" + android:exported="true"> + <meta-data android:name="android.app.lib_name" + android:value="ImGuiExample" /> + + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/java/MainActivity.kt b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/java/MainActivity.kt new file mode 100644 index 0000000..896a88c --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/app/src/main/java/MainActivity.kt @@ -0,0 +1,40 @@ +package imgui.example.android + +import android.app.NativeActivity +import android.os.Bundle +import android.content.Context +import android.view.inputmethod.InputMethodManager +import android.view.KeyEvent +import java.util.concurrent.LinkedBlockingQueue + +class MainActivity : NativeActivity() { + public override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + + fun showSoftInput() { + val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.showSoftInput(this.window.decorView, 0) + } + + fun hideSoftInput() { + val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow(this.window.decorView.windowToken, 0) + } + + // Queue for the Unicode characters to be polled from native code (via pollUnicodeChar()) + private var unicodeCharacterQueue: LinkedBlockingQueue<Int> = LinkedBlockingQueue() + + // We assume dispatchKeyEvent() of the NativeActivity is actually called for every + // KeyEvent and not consumed by any View before it reaches here + override fun dispatchKeyEvent(event: KeyEvent): Boolean { + if (event.action == KeyEvent.ACTION_DOWN) { + unicodeCharacterQueue.offer(event.getUnicodeChar(event.metaState)) + } + return super.dispatchKeyEvent(event) + } + + fun pollUnicodeChar(): Int { + return unicodeCharacterQueue.poll() ?: 0 + } +} diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/build.gradle b/lib/imgui-1.92.6/examples/example_android_opengl3/android/build.gradle new file mode 100644 index 0000000..7f09f7c --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/build.gradle @@ -0,0 +1,5 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false +} diff --git a/lib/imgui-1.92.6/examples/example_android_opengl3/android/settings.gradle b/lib/imgui-1.92.6/examples/example_android_opengl3/android/settings.gradle new file mode 100644 index 0000000..38b6dc3 --- /dev/null +++ b/lib/imgui-1.92.6/examples/example_android_opengl3/android/settings.gradle @@ -0,0 +1,22 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +include ':app' |
