-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
18,721 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[submodule "ImguiDemoSdl/src/main/cpp/deps/imgui"] | ||
path = ImguiDemoSdl/src/main/cpp/deps/imgui | ||
url = https://github.com/ocornut/imgui | ||
[submodule "ImguiDemoSdl/src/main/cpp/deps/glm"] | ||
path = ImguiDemoSdl/src/main/cpp/deps/glm | ||
url = https://github.com/g-truc/glm | ||
[submodule "ImguiDemoSdl/src/main/cpp/deps/SDL"] | ||
path = ImguiDemoSdl/src/main/cpp/deps/SDL | ||
url = https://github.com/sfalexrog/SDL | ||
branch = cmake_fixes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
add_library( # Sets the name of the library. | ||
native-lib | ||
|
||
# Sets the library as a shared library. | ||
SHARED | ||
|
||
# Provides a relative path to your source file(s). | ||
src/main/cpp/native-lib.cpp ) | ||
|
||
# Searches for a specified prebuilt library and stores the path as a | ||
# variable. Because CMake includes system libraries in the search path by | ||
# default, you only need to specify the name of the public NDK library | ||
# you want to add. CMake verifies that the library exists before | ||
# completing its build. | ||
|
||
find_library( # Sets the name of the path variable. | ||
log-lib | ||
|
||
# Specifies the name of the NDK library that | ||
# you want CMake to locate. | ||
log ) | ||
|
||
# Specifies libraries CMake should link to your target library. You | ||
# can link multiple libraries, such as libraries you define in this | ||
# build script, prebuilt third-party libraries, or system libraries. | ||
|
||
target_link_libraries( # Specifies the target library. | ||
native-lib | ||
|
||
# Links the target library to the log library | ||
# included in the NDK. | ||
${log-lib} ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.2" | ||
defaultConfig { | ||
applicationId "me.sfalexrog.imguidemo" | ||
minSdkVersion 14 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
externalNativeBuild { | ||
cmake { | ||
cppFlags "-std=c++11" | ||
targets "demo" | ||
} | ||
} | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
externalNativeBuild { | ||
cmake { | ||
path "src/main/cpp/CMakeLists.txt" | ||
} | ||
} | ||
|
||
sourceSets { | ||
main { | ||
// We're using SDLActivity from SDL sources, not copying that to our source tree | ||
java.srcDirs += ['src/main/cpp/deps/SDL/android-project/src'] | ||
// Instead of copying data files from the native project, we just add its data | ||
// as another asset directory | ||
assets.srcDirs += ['src/main/cpp/data'] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
testCompile 'junit:junit:4.12' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /opt/android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
ImguiDemoSdl/src/androidTest/java/me/sfalexrog/imguidemo/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.sfalexrog.imguidemo; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("me.sfalexrog.imguidemo", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
|
||
package="me.sfalexrog.imguidemo"> | ||
|
||
<uses-feature android:glEsVersion="0x00020000" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".DemoActivity" | ||
android:configChanges="orientation"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Cmake file for a sample cross-platform project with dear imgui. | ||
# The aim here is to have most of the stuff (including cmake files) | ||
# be the same throughout platforms. | ||
|
||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(imgui_demo) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
|
||
find_package(SDL2 REQUIRED) | ||
|
||
# This is an adaptation of the ImGui demo, with some geometry (a teapot) | ||
# rendered in order to check the ImGui implementation. Teapot is taken | ||
# from Google NDK samples. | ||
|
||
set(IMGUI_PATH deps/imgui) | ||
set(IMGUI_IMPL_PATH src/imgui_impl) | ||
|
||
# Since we're drawing something that's not just a triangle, we're gonna | ||
# want a library that deals with vectors and matrices. glm is the obvious | ||
# choice. | ||
|
||
add_subdirectory(deps/glm) | ||
|
||
# Use GLES2/GLES3 implementations for Android, GL3 for everything else | ||
|
||
if (ANDROID) | ||
set(GL_PROFILES "GL_PROFILE_GLES2" "GL_PROFILE_GLES3") | ||
else() | ||
set(GL_PROFILES "GL_PROFILE_GL3") | ||
endif() | ||
|
||
file(GLOB IMGUI_FILES | ||
${IMGUI_PATH}/*.cpp | ||
${IMGUI_IMPL_PATH}/*.cpp | ||
) | ||
|
||
file(GLOB DEMO_FILES | ||
src/*.cpp | ||
) | ||
|
||
if (NOT ANDROID) | ||
set(GLLOAD_PATH src/glload) | ||
file(GLOB GLLOAD_FILES | ||
${GLLOAD_PATH}/*.c) | ||
endif() | ||
|
||
|
||
set(DEMO_SOURCES ${IMGUI_FILES} ${DEMO_FILES} ${GLLOAD_FILES}) | ||
|
||
# Build as a library for Android, as an executable otherwise | ||
|
||
if (ANDROID) | ||
add_library(demo SHARED | ||
${DEMO_SOURCES} | ||
) | ||
else() | ||
add_executable(demo | ||
${DEMO_SOURCES} | ||
) | ||
endif() | ||
|
||
target_link_libraries(demo ${SDL2_LIBRARY} glm) | ||
target_include_directories(demo PRIVATE ${SDL2_INCLUDE_DIR}) | ||
target_include_directories(demo PRIVATE ${IMGUI_PATH}) | ||
target_include_directories(demo PRIVATE ${IMGUI_IMPL_PATH}) | ||
target_include_directories(demo PRIVATE ${GLLOAD_PATH}) | ||
target_compile_definitions(demo PRIVATE ${GL_PROFILES}) |
Oops, something went wrong.