Skip to content

Android examples #8418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -140,6 +140,28 @@ Desktop.ini
.csettings
/libs/openFrameworksCompiled/project/android/paths.make

/libs/openFrameworksCompiled/project/android/**/build/
/libs/openFrameworksCompiled/project/android/**/.cxx/
/libs/openFrameworksCompiled/project/android/build*

examples/android/**/build.gradle
examples/android/**/gradle.properties
examples/android/**/proguard.cfg
examples/android/**/proguard-rules.pro
examples/android/**/template.config
examples/android/**/AndroidManifest.xml
examples/android/**/OFActivity.java

# Ignore compiled output or build dirs
examples/android/**/build/
examples/android/**/.cxx/

# Ignore launcher icons or PNGs
examples/android/**/*.png

# Ignore CMake files if autogenerated
examples/android/**/CMakeLists.txt

# Android Studio
*.iml

@@ -170,3 +192,5 @@ libs/openFrameworksCompiled/project/vs2019/openframeworksLib.vcxproj.user
scripts/templates/vs/bin/emptyExample_debug.exe
scripts/templates/vs2019/emptyExample.vcxproj.user
libs/openFrameworksCompiled/project/android/build-*/


51 changes: 37 additions & 14 deletions examples/android/androidAccelerometerExample/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
#include "ofMain.h"
#include "ofApp.h"

int main(){
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new ofApp() );
return 0;
}
#ifdef TARGET_ANDROID

#include "ofWindowSettings.h"
#include "ofGLProgrammableRenderer.h"

shared_ptr<ofApp> *ofapp;
std::shared_ptr<ofAppBaseWindow> baseWindow;

//--------------------------------------------------------------
int main(int argc, char **argv) {
baseWindow = std::make_shared<ofAppAndroidWindow>();
ofxAndroidWindowSettings settings;
settings.glesVersion = 2;
settings.setSize(1920, 1080);
settings.windowMode = OF_WINDOW;
settings.preserveContextOnPause = true;
baseWindow = ofCreateWindow(settings);
ofapp = new shared_ptr<ofApp>(new ofApp());
ofRunApp(baseWindow, *ofapp);
return 0;
}

#ifdef TARGET_ANDROID
void ofAndroidApplicationInit()
{
//application scope init
//application scope init
}

void ofAndroidActivityInit()
{
//activity scope init
main();
//activity scope init - call main
main(0, nullptr);
}

// Callbacks from Android Layer
extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
{
ofAndroidApplicationInit();
}

extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
{
ofAndroidActivityInit();
}

#endif
47 changes: 34 additions & 13 deletions examples/android/androidAdvanced3DExample/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
#include "ofMain.h"
#include "ofApp.h"

#ifdef TARGET_ANDROID

#include "ofWindowSettings.h"
#include "ofGLProgrammableRenderer.h"

int main(){
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
shared_ptr<ofApp> *ofapp;
std::shared_ptr<ofAppBaseWindow> baseWindow;

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new ofApp() );
return 0;
//--------------------------------------------------------------
int main(int argc, char **argv) {
baseWindow = std::make_shared<ofAppAndroidWindow>();
ofxAndroidWindowSettings settings;
settings.glesVersion = 2;
settings.setSize(1920, 1080);
settings.windowMode = OF_WINDOW;
settings.preserveContextOnPause = true;
baseWindow = ofCreateWindow(settings);
ofapp = new shared_ptr<ofApp>(new ofApp());
ofRunApp(baseWindow, *ofapp);
return 0;
}


#ifdef TARGET_ANDROID
void ofAndroidApplicationInit()
{
//application scope init
//application scope init
}

void ofAndroidActivityInit()
{
//activity scope init
main();
//activity scope init - call main
main(0, nullptr);
}

// Callbacks from Android Layer
extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
{
ofAndroidApplicationInit();
}

extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
{
ofAndroidActivityInit();
}

#endif
51 changes: 37 additions & 14 deletions examples/android/androidAssimpExample/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
#include "ofMain.h"
#include "ofApp.h"

int main(){
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new ofApp() );
return 0;
}
#ifdef TARGET_ANDROID

#include "ofWindowSettings.h"
#include "ofGLProgrammableRenderer.h"

shared_ptr<ofApp> *ofapp;
std::shared_ptr<ofAppBaseWindow> baseWindow;

//--------------------------------------------------------------
int main(int argc, char **argv) {
baseWindow = std::make_shared<ofAppAndroidWindow>();
ofxAndroidWindowSettings settings;
settings.glesVersion = 2;
settings.setSize(1920, 1080);
settings.windowMode = OF_WINDOW;
settings.preserveContextOnPause = true;
baseWindow = ofCreateWindow(settings);
ofapp = new shared_ptr<ofApp>(new ofApp());
ofRunApp(baseWindow, *ofapp);
return 0;
}

#ifdef TARGET_ANDROID
void ofAndroidApplicationInit()
{
//application scope init
//application scope init
}

void ofAndroidActivityInit()
{
//activity scope init
main();
//activity scope init - call main
main(0, nullptr);
}

// Callbacks from Android Layer
extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
{
ofAndroidApplicationInit();
}

extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
{
ofAndroidActivityInit();
}

#endif
51 changes: 37 additions & 14 deletions examples/android/androidAudioExample/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
#include "ofMain.h"
#include "ofApp.h"

int main(){
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new ofApp() );
return 0;
}
#ifdef TARGET_ANDROID

#include "ofWindowSettings.h"
#include "ofGLProgrammableRenderer.h"

shared_ptr<ofApp> *ofapp;
std::shared_ptr<ofAppBaseWindow> baseWindow;

//--------------------------------------------------------------
int main(int argc, char **argv) {
baseWindow = std::make_shared<ofAppAndroidWindow>();
ofxAndroidWindowSettings settings;
settings.glesVersion = 2;
settings.setSize(1920, 1080);
settings.windowMode = OF_WINDOW;
settings.preserveContextOnPause = true;
baseWindow = ofCreateWindow(settings);
ofapp = new shared_ptr<ofApp>(new ofApp());
ofRunApp(baseWindow, *ofapp);
return 0;
}

#ifdef TARGET_ANDROID
void ofAndroidApplicationInit()
{
//application scope init
//application scope init
}

void ofAndroidActivityInit()
{
//activity scope init
main();
//activity scope init - call main
main(0, nullptr);
}

// Callbacks from Android Layer
extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
{
ofAndroidApplicationInit();
}

extern "C" JNIEXPORT void JNICALL
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
{
ofAndroidActivityInit();
}

#endif
22 changes: 0 additions & 22 deletions examples/android/androidCameraExample/build.gradle

This file was deleted.

10 changes: 0 additions & 10 deletions examples/android/androidCameraExample/gradle.properties

This file was deleted.

Binary file not shown.

This file was deleted.

Loading
Loading