diff --git a/.gitignore b/.gitignore index d4f4aad5ab1..c000a5911a5 100644 --- a/.gitignore +++ b/.gitignore @@ -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-*/ + + diff --git a/addons/ofxAndroid/Java/cc/openframeworks/OFAndroidVideoPlayer.java b/addons/ofxAndroid/Java/cc/openframeworks/OFAndroidVideoPlayer.java index a3ca3abd6c4..57969520528 100644 --- a/addons/ofxAndroid/Java/cc/openframeworks/OFAndroidVideoPlayer.java +++ b/addons/ofxAndroid/Java/cc/openframeworks/OFAndroidVideoPlayer.java @@ -1,24 +1,30 @@ package cc.openframeworks; import android.annotation.TargetApi; +import android.content.Context; import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture.OnFrameAvailableListener; import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnVideoSizeChangedListener; import android.media.MediaPlayer.OnCompletionListener; +import android.net.Uri; import android.os.Build; import android.util.FloatMath; import android.util.Log; import android.view.Surface; import androidx.annotation.Keep; +import java.io.FileNotFoundException; + +import android.content.res.AssetFileDescriptor; + @Keep @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public class OFAndroidVideoPlayer extends OFAndroidObject implements OnFrameAvailableListener { - + public OFAndroidVideoPlayer(){ - + bIsLoaded = false; bIsPlaying = false; bIsPaused = true; @@ -26,23 +32,23 @@ public OFAndroidVideoPlayer(){ bAutoResume = false; bIsMoviedone = false; bIsLooping = false; - + // TODO Get movie FPS to implement Frame methods // movieFPS = 16; // nFrames = 0; - + pan = 0.f; volume = leftVolume = rightVolume = 1; - + } - + public void setTexture(int texName) { surfaceTexture = new SurfaceTexture(texName); surfaceTexture.setOnFrameAvailableListener(this); surface = new Surface(surfaceTexture); mediaPlayer.setSurface(surface); } - + public void clearTextures() { if(surface != null) { surface.release(); @@ -54,7 +60,7 @@ public void clearTextures() { surfaceTexture = null; } } - + public boolean update() { synchronized(this){ if(bIsFrameNew) { @@ -67,11 +73,11 @@ public boolean update() { } } } - + public void getTextureMatrix(float[] mtx) { if(surfaceTexture != null) surfaceTexture.getTransformMatrix(mtx); } - + public void loadMovie(String fileName){ try { if(mediaPlayer == null) { @@ -102,38 +108,52 @@ public void onCompletion(MediaPlayer mp) { } else { mediaPlayer.reset(); } - mediaPlayer.setDataSource(fileName); - mediaPlayer.prepare(); - bIsLoaded = true; - //setVolume(volume); this.fileName = fileName; + boolean hasLoaded = false; + + try { + if (fileName.startsWith("/")) { + // Physical path (external storage) + mediaPlayer.setDataSource(fileName); + } else { + // Asset-based fallback + AssetFileDescriptor afd = OFAndroid.getContext().getAssets().openFd(fileName); + mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); + } + } catch (FileNotFoundException e) { + Log.e("OF","couldn't load " + fileName,e); + bIsLoaded = false; + mediaPlayer.reset(); + hasLoaded = false; + } + + if(mediaPlayer!= null && hasLoaded) { + mediaPlayer.prepareAsync(); + } + //setVolume(volume); } catch (Exception e) { Log.e("OF","couldn't load " + fileName,e); - } + } } - - public void play(){ + public void play(){ if(mediaPlayer==null) return; - if(!bIsLoaded){ Log.e("OF","ofxAndroidVideo::play - movie not loaded!"); return; } - mediaPlayer.start(); - bIsPlaying = true; bIsPaused = false; - + } - + public void stop(){ if(mediaPlayer==null) return; mediaPlayer.stop(); bIsPlaying = false; } - + void unloadMovie(){ if(mediaPlayer!=null){ mediaPlayer.setSurface(null); @@ -142,20 +162,20 @@ void unloadMovie(){ mediaPlayer = null; } clearTextures(); - + fileName = null; bIsLoaded = false; bIsMoviedone = false; bIsPlaying = false; bIsPaused = true; - + //nFrames = 0; - + } - + void setVolume(float vol){ volume = vol; - // calculates left/right volumes from pan-value (constant panning law) + // calculates left/right volumes from pan-value (constant panning law) // see: Curtis Roads: Computer Music Tutorial p 460 // thanks to jasch float angle = pan * 0.7853981633974483f; // in radians from -45. to +45. @@ -163,54 +183,56 @@ void setVolume(float vol){ float sinAngle = (float) Math.sin(angle); leftVolume = (float)((cosAngle - sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2 rightVolume = (float)((cosAngle + sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2 - if(mediaPlayer!=null)mediaPlayer.setVolume(leftVolume, rightVolume); + if(mediaPlayer!=null) mediaPlayer.setVolume(leftVolume, rightVolume); } - + float getVolume(){ return volume; } - + void setPaused(boolean bP){ - if(mediaPlayer==null) return; + if(bP) { if(bIsPlaying) { - mediaPlayer.pause(); + if(mediaPlayer!=null) + mediaPlayer.pause(); bIsPlaying = !bP; bIsPaused = bP; } } else { if(bIsPaused) { - mediaPlayer.start(); + if(mediaPlayer!=null) + mediaPlayer.start(); bIsPlaying = !bP; bIsPaused = bP; } } } - + void setLoopState(boolean bL){ + bIsLooping = bL; if(mediaPlayer==null) return; mediaPlayer.setLooping(bL); - bIsLooping = bL; } - + boolean getLoopState(){ - if(mediaPlayer==null) return false; + if (!bIsLoaded || mediaPlayer == null) return false; return mediaPlayer.isLooping(); } - + int getWidth(){ - if(mediaPlayer==null) return 0; + if (!bIsLoaded || mediaPlayer == null) return 0; return mediaPlayer.getVideoWidth(); } - + int getHeight(){ - if(mediaPlayer==null) return 0; + if (!bIsLoaded || mediaPlayer == null) return 0; return mediaPlayer.getVideoHeight(); } - + /* Needs movie frameRate to work int getCurrentFrame(){ - + float framePosInFloat = ((float)getTotalNumFrames() * (float)getPosition()); int framePosInInt = (int)framePosInFloat; float floatRemainder = (framePosInFloat - framePosInInt); @@ -220,83 +242,83 @@ int getCurrentFrame(){ } */ - + /* Needs movie frameRate to work int getTotalNumFrames(){ return nFrames; } */ - + public boolean isLoaded(){ return bIsLoaded; } - + public boolean isPaused(){ return bIsPaused; } - + public boolean isPlaying(){ return bIsPlaying; } - + boolean isMovieDone(){ return bIsMoviedone; } - - + + void setPosition(float pct){ if(mediaPlayer!=null) mediaPlayer.seekTo((int) (mediaPlayer.getDuration()*pct)); // 0 = start, 1 = end; } - + void setPositionMS(int ms){ if(mediaPlayer!=null) mediaPlayer.seekTo(ms); // 0 = start, 1 = end; } - + float getPosition(){ if(mediaPlayer!=null) return ((float)mediaPlayer.getCurrentPosition())/(float)mediaPlayer.getDuration(); else return 0; } - + int getPositionMS(){ if(mediaPlayer!=null) return mediaPlayer.getCurrentPosition(); else return 0; } - + float getDuration(){ if(mediaPlayer!=null) return (float)mediaPlayer.getDuration(); else return 0; } - + int getDurationMS(){ if(mediaPlayer!=null) return mediaPlayer.getDuration(); else return 0; } - - + + @Override protected void appPause() { int currMovieTime = getPositionMS(); stop(); String currFileName = fileName; - boolean currIsLoaded = bIsLoaded; + boolean currIsLoaded = bIsLoaded; boolean currIsPlaying = bIsPlaying; unloadMovie(); fileName = currFileName; - bIsLoaded = currIsLoaded; + bIsLoaded = currIsLoaded; bIsPlaying = currIsPlaying; - + bAutoResume = true; movieResumeTime = currMovieTime; - + } @Override @@ -310,18 +332,18 @@ protected void appResume() { protected void appStop() { appPause(); } - + @Override public void onFrameAvailable(SurfaceTexture arg0) { synchronized(this){ bIsFrameNew = true; } } - - - + + + private MediaPlayer mediaPlayer; - + private SurfaceTexture surfaceTexture; private Surface surface; private String fileName; @@ -334,12 +356,12 @@ public void onFrameAvailable(SurfaceTexture arg0) { private boolean bIsMoviedone; private boolean bIsFrameNew; private boolean bIsLooping; - + //private int movieFPS; //private int nFrames; - + private boolean bAutoResume; private int movieResumeTime; - - + + } diff --git a/examples/android/androidAccelerometerExample/src/main.cpp b/examples/android/androidAccelerometerExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidAccelerometerExample/src/main.cpp +++ b/examples/android/androidAccelerometerExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidAccelerometerExample/src/ofApp.cpp b/examples/android/androidAccelerometerExample/src/ofApp.cpp index 7b671ee47df..d27335d538e 100644 --- a/examples/android/androidAccelerometerExample/src/ofApp.cpp +++ b/examples/android/androidAccelerometerExample/src/ofApp.cpp @@ -120,3 +120,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidAccelerometerExample/src/ofApp.h b/examples/android/androidAccelerometerExample/src/ofApp.h index f9f7cde0a0e..7b0ae66ccb7 100644 --- a/examples/android/androidAccelerometerExample/src/ofApp.h +++ b/examples/android/androidAccelerometerExample/src/ofApp.h @@ -10,6 +10,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -33,6 +34,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofTrueTypeFont font; glm::vec3 accel, normAccel; string messages[3]; diff --git a/examples/android/androidAdvanced3DExample/src/Swarm.cpp b/examples/android/androidAdvanced3DExample/src/Swarm.cpp index 03b8d81d25b..c31f550ef73 100644 --- a/examples/android/androidAdvanced3DExample/src/Swarm.cpp +++ b/examples/android/androidAdvanced3DExample/src/Swarm.cpp @@ -12,7 +12,7 @@ Swarm::Swarm() { //constructor, let's set some defaults - nParticles = 0; + nParticles = 0; light.setAmbientColor(ofColor(0,0,0)); } @@ -24,23 +24,23 @@ void Swarm::init(int _nParticles, float positionDispersion, float velocityDisper // if (nParticles > 0) { - ofLog(OF_LOG_WARNING, "Swarm: Already initialised"); - + ofLog(OF_LOG_WARNING) << "Swarm: Already initialised"; + //delete[] = delete array from memory delete[] positions; delete[] velocities; delete[] colors; - + //superfluous line of code.. nParticles = 0; } /////////////////////////////////////////// - - + + //Swarm's internal variable set from argument - nParticles = _nParticles; - - + nParticles = _nParticles; + + /////////////////////////////////////////// // SETUP ARRAYS /////////////////////////////////////////// @@ -50,8 +50,8 @@ void Swarm::init(int _nParticles, float positionDispersion, float velocityDisper colors = new ofColor[nParticles]; // /////////////////////////////////////////// - - + + /////////////////////////////////////////// // INITIALISE VALUES /////////////////////////////////////////// @@ -61,11 +61,11 @@ void Swarm::init(int _nParticles, float positionDispersion, float velocityDisper positions[i].x = (ofRandom(1.0f)-0.5f) * positionDispersion; positions[i].y = (ofRandom(1.0f)-0.5f) * positionDispersion; positions[i].z = (ofRandom(1.0f)-0.5f) * positionDispersion; - + velocities[i].x = (ofRandom(1.0f)-0.5f) * velocityDispersion; velocities[i].y = (ofRandom(1.0f)-0.5f) * velocityDispersion; velocities[i].z = (ofRandom(1.0f)-0.5f) * velocityDispersion; - + colors[i].r = ofRandom(255.0f); colors[i].g = ofRandom(255.0f); colors[i].b = 150.0f; @@ -73,14 +73,14 @@ void Swarm::init(int _nParticles, float positionDispersion, float velocityDisper } // /////////////////////////////////////////// - + } void Swarm::customDraw() { ///we run the update ourselves manually update(); - + //we use the position of the first //particle as the position of the //light @@ -97,17 +97,17 @@ void Swarm::customDraw() { ofPushStyle(); ofSetColor(colors[i]); - + ofDrawSphere(positions[i], 1.0); - + ofPopStyle(); } // /////////////////////////////////////////// - + light.disable(); ofDisableLighting(); - + //render light as white sphere ofSetColor(255, 255, 255); ofDrawSphere(positions[0], 2.0); @@ -118,16 +118,16 @@ void Swarm::customDraw() void Swarm::update() { - + //calculate time past per frame float dt = ofGetElapsedTimef() - timeLastUpdate; timeLastUpdate = ofGetElapsedTimef(); - + //update positions, velocities for (int i=0; i< nParticles; i++) { //////////////////////////////// - // + // // MOTION MATHS // // 'Simple Harmonic Motion' @@ -159,7 +159,7 @@ void Swarm::update() //v = v + (dt * a) //v = v + (dt * -k * x) // - velocities[i] += - SPRING_CONSTANT * positions[i] * dt; + velocities[i] += - SPRING_CONSTANT * positions[i] * dt; // ///////////////////////////////// diff --git a/examples/android/androidAdvanced3DExample/src/main.cpp b/examples/android/androidAdvanced3DExample/src/main.cpp index 97fa554e6de..7292fddd18e 100644 --- a/examples/android/androidAdvanced3DExample/src/main.cpp +++ b/examples/android/androidAdvanced3DExample/src/main.cpp @@ -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; +std::shared_ptr 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(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 1; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidAdvanced3DExample/src/ofApp.cpp b/examples/android/androidAdvanced3DExample/src/ofApp.cpp index b13c166e904..8cd33ab9e8e 100644 --- a/examples/android/androidAdvanced3DExample/src/ofApp.cpp +++ b/examples/android/androidAdvanced3DExample/src/ofApp.cpp @@ -481,3 +481,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidAdvanced3DExample/src/ofApp.h b/examples/android/androidAdvanced3DExample/src/ofApp.h index 964f7527d31..0b8a7517817 100644 --- a/examples/android/androidAdvanced3DExample/src/ofApp.h +++ b/examples/android/androidAdvanced3DExample/src/ofApp.h @@ -31,6 +31,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -58,6 +59,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + //cameras (all these inherit from ofCamera) ofEasyCam camEasyCam; OrthoCamera camFront; diff --git a/examples/android/androidAssimpExample/src/main.cpp b/examples/android/androidAssimpExample/src/main.cpp index ef340ca94b8..7292fddd18e 100644 --- a/examples/android/androidAssimpExample/src/main.cpp +++ b/examples/android/androidAssimpExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 1; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidAssimpExample/src/ofApp.cpp b/examples/android/androidAssimpExample/src/ofApp.cpp index 4ee1c2e49d1..b7fd88a92c2 100644 --- a/examples/android/androidAssimpExample/src/ofApp.cpp +++ b/examples/android/androidAssimpExample/src/ofApp.cpp @@ -165,3 +165,24 @@ void ofApp::windowResized(int w, int h){ } +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} + diff --git a/examples/android/androidAssimpExample/src/ofApp.h b/examples/android/androidAssimpExample/src/ofApp.h index 62234ab0ce6..9aa492f4a28 100644 --- a/examples/android/androidAssimpExample/src/ofApp.h +++ b/examples/android/androidAssimpExample/src/ofApp.h @@ -10,6 +10,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -28,11 +29,15 @@ class ofApp : public ofxAndroidApp{ void stop(); void resume(); void reloadTextures(); - bool backPressed(); void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + bool bAnimate; bool bAnimateMouse; float animationPosition; diff --git a/examples/android/androidAudioExample/src/main.cpp b/examples/android/androidAudioExample/src/main.cpp index ef340ca94b8..7292fddd18e 100644 --- a/examples/android/androidAudioExample/src/main.cpp +++ b/examples/android/androidAudioExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 1; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidAudioExample/src/ofApp.cpp b/examples/android/androidAudioExample/src/ofApp.cpp index fe482d0e072..905404fe846 100644 --- a/examples/android/androidAudioExample/src/ofApp.cpp +++ b/examples/android/androidAudioExample/src/ofApp.cpp @@ -182,3 +182,25 @@ void ofApp::audioIn(ofSoundBuffer & buffer){ } } + + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} \ No newline at end of file diff --git a/examples/android/androidAudioExample/src/ofApp.h b/examples/android/androidAudioExample/src/ofApp.h index 2349014757b..5dec6522a34 100644 --- a/examples/android/androidAudioExample/src/ofApp.h +++ b/examples/android/androidAudioExample/src/ofApp.h @@ -9,6 +9,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -32,6 +33,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + void audioOut(ofSoundBuffer & buffer); void audioIn(ofSoundBuffer & buffer); diff --git a/examples/android/androidCameraExample/build.gradle b/examples/android/androidCameraExample/build.gradle deleted file mode 100644 index 7cbc7eb6714..00000000000 --- a/examples/android/androidCameraExample/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -ext { - //var = 'signExample.keystore' -}// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } - ext { - - } -} diff --git a/examples/android/androidCameraExample/gradle.properties b/examples/android/androidCameraExample/gradle.properties deleted file mode 100644 index 43f9ef9e1c3..00000000000 --- a/examples/android/androidCameraExample/gradle.properties +++ /dev/null @@ -1,10 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=false -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official -android.prefabVersion=1.0.+ -android.buildFeatures.prefab=true -#ndkBuild=false -# https://issuetracker.google.com/149575364 -android.enableParallelJsonGen=false -#googleplay=true \ No newline at end of file diff --git a/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.jar b/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372aef5e2..00000000000 Binary files a/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.properties b/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2dd5ee8c795..00000000000 --- a/examples/android/androidCameraExample/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jun 12 01:17:57 AEST 2023 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/android/androidCameraExample/gradlew b/examples/android/androidCameraExample/gradlew deleted file mode 100755 index 9d82f789151..00000000000 --- a/examples/android/androidCameraExample/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/examples/android/androidCameraExample/gradlew.bat b/examples/android/androidCameraExample/gradlew.bat deleted file mode 100644 index 8a0b282aa68..00000000000 --- a/examples/android/androidCameraExample/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/android/androidCameraExample/ofApp/build.gradle b/examples/android/androidCameraExample/ofApp/build.gradle deleted file mode 100644 index 50b511c1c1f..00000000000 --- a/examples/android/androidCameraExample/ofApp/build.gradle +++ /dev/null @@ -1,182 +0,0 @@ -plugins { - id 'com.android.application' -} - -def CMAKELIST_PATH = './src/main/cpp' -def CPP_SOURCE = './src/main/cpp' -def JAVA_SOURCE = './src/main/java' - -// pointing to cmake's source code for the same project -def PRJ_SRC_ROOT = './src/main' -def ofRoot(){ return '../../../../' } -final ofSource = ofRoot() + 'libs/openFrameworks' -final ofLibs = ofRoot() + 'libs' -final addons = ofRoot() + 'addons' -final ofLibOutput = ofRoot() + 'libs/openFrameworksCompiled/lib/android' -def OFX_ANDROID = ofRoot() + 'addons/ofxAndroid' -//def OF_ADDONS_ARGUMENTS = "${OF_ADDONS}" -def enableProguardInReleaseBuilds = true -def enableProguardInDebugBuilds = false - -task wrapper(type: Wrapper) { - gradleVersion = '7.3.3' -} -tasks.register("prepareKotlinBuildScriptModel"){ -} - -evaluationDependsOn(':openFrameworksProject') - -tasks.whenTaskAdded { task -> - if (task.name == 'assemble') { - task.dependsOn(':openFrameworksProject:assemble') - } -} - - -android { - compileSdkVersion 34 - buildToolsVersion '32.0.0' - //ndkPath "/Users/x/android-ndk-r21e" // Point to your own NDK if needed - ndkVersion '24.0.8215888' // use android studio side loaded ndk - buildFeatures { - prefab true - } - signingConfigs { - debug { - } - release { - storeFile new File("${System.properties['user.home']}/.android/debug.keystore") - storePassword 'android' - storeType "jks" - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - defaultConfig { - applicationId "cc.openframeworks.androidCameraExample" // IMPORTANT : THIS DEFINES THE ID OF THE APK - minSdkVersion 21 - targetSdkVersion 34 - versionCode 12 - versionName '12.0' - ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' //, 'x86_64' - - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - arguments "-DANDROID_STL=c++_shared", - "-DANDROID_ARM_NEON=TRUE", - "-DANDROID_TOOLCHAIN=clang", - //"${OF_ADDONS_ARGUMENTS}", - "-DTARGET_OPENGLES=TRUE" - - version '3.22.1' - } - } - } - multiDexEnabled false - } - buildTypes { - release { - signingConfig signingConfigs.release - jniDebuggable false - debuggable false - minifyEnabled false - shrinkResources false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - debug { - jniDebuggable true - debuggable true - minifyEnabled false - shrinkResources false - signingConfig signingConfigs.debug - } - } - flavorDimensions "version" - productFlavors { - playstore { - applicationIdSuffix "" - signingConfig signingConfigs.release - } -// humble { -// applicationIdSuffix ".humble" -// } -// amazon { -// applicationIdSuffix ".amazon" -// } -// samsung { -// applicationIdSuffix ".samsung" -// } -// oppo { -// applicationIdSuffix ".oppo" -// } - } - sourceSets { - main { - manifest.srcFile "${PRJ_SRC_ROOT}/AndroidManifest.xml" - java.srcDirs = ["${PRJ_SRC_ROOT}/java", - "${OFX_ANDROID}/Java"] - res.srcDirs = ["${PRJ_SRC_ROOT}/res"] -// jniLibs.srcDirs = ["${OF_ANDROID_OUTPUT}", "lib"] // Pre Android Studio 2022.2.1 - assets { - srcDirs 'src/main/assets', 'src/main/bin/data' - } - } - } - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - path "${CMAKELIST_PATH}/CMakeLists.txt" - } - } else { - ndkBuild { - path "${CMAKELIST_PATH}/Android.mk" - } - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - androidResources { - noCompress '' - } - dependenciesInfo { - includeInApk false - includeInBundle false - } -// testOptions { -// devices { -// pixel2api29 (com.android.build.api.dsl.ManagedVirtualDevice) { -// // Use device profiles you typically see in -// // Android Studio -// device = "Pixel 2" -// apiLevel = 29 -// // You can also specify "aosp" if you don’t require -// // Google Play Services. -// systemImageSource = "google" -// abi = "x86" -// } -// } -// } -} - - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "com.getkeepsafe.relinker:relinker:1.4.5" - implementation 'com.google.android.material:material:1.9.0' - if (project.hasProperty("googleplay")) { - implementation "com.google.android.gms:play-services-games:22.0.1" - implementation "com.google.android.gms:play-services-auth:20.0.1" - implementation "com.google.android.gms:play-services-base:18.0.1" - implementation "com.google.android.gms:play-services-basement:18.0.0" - implementation "com.google.android.gms:play-services-instantapps:18.0.1" - implementation "com.google.android.gms:play-services-appset:16.0.2" - } -} - diff --git a/examples/android/androidCameraExample/ofApp/proguard-rules.pro b/examples/android/androidCameraExample/ofApp/proguard-rules.pro deleted file mode 100644 index de8c62143ce..00000000000 --- a/examples/android/androidCameraExample/ofApp/proguard-rules.pro +++ /dev/null @@ -1,127 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - --dontoptimize --dontshrink -#-dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify -#-verbose -# --optimizationpasses 7 # use for final build --dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify --verbose - -# custom app activity proguard --keep public class cc.openframeworks.android.OFActivity { public ; } --keep public class cc.openframeworks.android.R { public ; } - - -#-dontobfuscate android classes --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference - -#-dontobfuscate openFrameworks android classes --keep public class cc.openframeworks.OFAndroid { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycleHelper { public ; } --keep public class cc.openframeworks.OFAndroidWindow { public ; } --keep public class cc.openframeworks.OFAndroidSoundPlayer { public ; } --keep public class cc.openframeworks.OFGLSurfaceView { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycle { public ; } --keep public class cc.openframeworks.OFActivity { public ; } --keep public class cc.openframeworks.ContextFactory { public ; } --keep public class cc.openframeworks.OFEGLConfigChooser { public ; } --keep public class cc.openframeworks.OFGestureListener { public ; } --keep public class cc.openframeworks.OFAndroidController { public ; } - -#-dontobfuscate GooglePlay Games android classes if used --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - -# note that means any method --keepclasseswithmembernames,includedescriptorclasses class * { - native ; -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} - - -# 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 - -# 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 \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/AndroidManifest.xml b/examples/android/androidCameraExample/ofApp/src/main/AndroidManifest.xml deleted file mode 100644 index d29c44958e7..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/AndroidManifest.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/cpp/CMakeLists.txt b/examples/android/androidCameraExample/ofApp/src/main/cpp/CMakeLists.txt deleted file mode 100644 index 5b160ffa42d..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,142 +0,0 @@ -# Sets the minimum version of CMake required to build the native -# library. -cmake_minimum_required(VERSION 3.22.1) - -project(ofapp LANGUAGES CXX) -set(TARGET_ANDROID TRUE) - -set(LOCAL_PATH ${CMAKE_SOURCE_DIR}) -set(PRJ_OF_ROOT ${LOCAL_PATH}/../../../../../../../) - -set(PURE_OF_ROOT ${LOCAL_PATH}/../../../../../../../) -set(CORE_OF_ROOT ${PURE_OF_ROOT}/libs/openFrameworks) -set(LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(PRJ_ADDONS_PATH ${PURE_OF_ROOT}/addons) -set(PRJ_SOURCE_PATH ${LIBS_ROOT}/openFrameworks) -set(PRJ_LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(OF_ANDROID ${PURE_OF_ROOT}/libs/openFrameworksCompiled/project/android) -set(OF_ANDROID_OUTPUT ${PURE_OF_ROOT}/libs/openFrameworksCompiled/lib/android) - -set(PRJ_OFX_ANDROID_PATH ${PRJ_ADDONS_PATH}/ofxAndroid) -set(PRJ_OFX_ANDROID_CPP_PATH ${PRJ_OFX_ANDROID_PATH}/src) - -macro(print_all_variables) - message(STATUS "print_all_variables------------------------------------------{") - get_cmake_property(_variableNames VARIABLES) - foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") - endforeach() - message(STATUS "print_all_variables------------------------------------------}") -endmacro() - -# Custom function to check if the library is built -function(check_library) - if (NOT TARGET openFrameworksAndroid) - message(STATUS "openFrameworksAndroid Library not found. Building library...") - - # Invoke the build process for the library - execute_process( - COMMAND ${CMAKE_COMMAND} --build ${OF_ANDROID}/ - RESULT_VARIABLE result - ) - if (result) - message(FATAL_ERROR "Failed to build the library.") - endif () - endif () -endfunction() - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) -set(TARGET_ANDROID ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -Oz -DNDEBUG -frtti --warn-uninitialized -fno-short-enums -Wextra -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_CPP_FLAGS "${CMAKE_C_FLAGS} -std=c++17 -Oz -DNDEBUG -stdlib=libc++ --warn-uninitialized -frtti -Wextra -fno-short-enums -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export-dynamic") - -print_all_variables() - -# Creates the project's shared lib: libnative-lib.so. -# The lib is loaded by this project's Java code in MainActivity.java: -# System.loadLibrary("native-lib"); -# The lib name in both places must match. -add_library( ofapp #name - SHARED # type of library - # src files for project (just c/cpp) - ${CMAKE_SOURCE_DIR}/main.cpp - ${CMAKE_SOURCE_DIR}/ofApp.cpp - ) - - -# Specifies a path to native header files -include_directories( - # openFrameworks headers - ${PRJ_SOURCE_PATH}/3d - ${PRJ_SOURCE_PATH}/app - ${PRJ_SOURCE_PATH}/communication - ${PRJ_SOURCE_PATH}/events - ${PRJ_SOURCE_PATH}/gl - ${PRJ_SOURCE_PATH}/graphics - ${PRJ_SOURCE_PATH}/math - ${PRJ_SOURCE_PATH}/sound - ${PRJ_SOURCE_PATH}/types - ${PRJ_SOURCE_PATH}/utils - ${PRJ_SOURCE_PATH}/video - ${PRJ_SOURCE_PATH} - # openFrameworks addons includes - ${PURE_OF_ROOT}/addons/ofxAndroid/src - ${PURE_OF_ROOT}/addons/ofxAccelerometer/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/libs - # openFrameworks Libs includes - ${PRJ_LIBS_ROOT}/FreeImage/include - ${PRJ_LIBS_ROOT}/freetype/include - ${PRJ_LIBS_ROOT}/freetype/include/freetype2 - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/config - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal/services - ${PRJ_LIBS_ROOT}/glm/include - ${PRJ_LIBS_ROOT}/pugixml/include - ${PRJ_LIBS_ROOT}/json/include - ${PRJ_LIBS_ROOT}/tess2/include - ${PRJ_LIBS_ROOT}/utf8/include - ${PRJ_LIBS_ROOT}/uriparser/include - ${CMAKE_SOURCE_DIR}/ - ${CMAKE_SOURCE_DIR}/ - ${OF_ANDROID} -) - -find_library(android-lib android) -find_library(log-lib log) -find_library(GLES2-lib GLESv2) - -#find_library(GLES1-lib GLESv1_CM) -#find_library(GLES3-lib GLESv3) - - -target_link_libraries(ofapp - EGL - GLESv2 - log - c - m - z - dl -# GLESv3 - ) - -target_link_libraries( ofapp - ${android-lib} ) -target_link_libraries( ofapp - ${GLES2-lib} ) -target_link_libraries( ofapp - ${log-lib} ) -#target_link_libraries( ofApp -# ${GLES3-lib} ) -#target_link_libraries( ofApp -# ${GLES1-lib} ) - -# Finally link in openFrameworks Library for each ABI -target_link_libraries( ofapp - ${OF_ANDROID_OUTPUT}/${ANDROID_ABI}/libopenFrameworksAndroid.so) diff --git a/examples/android/androidCameraExample/ofApp/src/main/ic_launcher-playstore.png b/examples/android/androidCameraExample/ofApp/src/main/ic_launcher-playstore.png deleted file mode 100644 index 2a0df19f5e0..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java b/examples/android/androidCameraExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java deleted file mode 100644 index 598ee50bbf1..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java +++ /dev/null @@ -1,201 +0,0 @@ -package cc.openframeworks.android; - -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager; - -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowCompat; -import androidx.core.view.WindowInsetsCompat; -import androidx.core.view.WindowInsetsControllerCompat; - -import cc.openframeworks.OFAndroid; -import cc.openframeworks.OFAndroidLifeCycle; - -import com.getkeepsafe.relinker.ReLinker; - - - -public class OFActivity extends cc.openframeworks.OFActivity { - - private static final String appName = "ofapp"; // modify this to target appName (ofApp etc) - private static final String LOG_TAG = appName + "::OFActivity"; - - private ReLinker.Logger logcatLogger = new ReLinker.Logger() { - @Override - public void log(String message) { - Log.d("ReLinker", message); - } - }; - private OFActivity thisActivity; - - - // Extremely important - public OFActivity() { - OFAndroidLifeCycle.coreLibraryLoaded = true; - - OFAndroid.maxSamples = 4; - OFAndroid.maximumFrameRate = 144; - - thisActivity = this; - ReLinker.log(logcatLogger) - .force() - .recursively() - .loadLibrary(this, appName, new ReLinker.LoadListener() { - @Override - public void success() { - Log.i(LOG_TAG, "loadLibrary success"); - OFAndroidLifeCycle.appLibraryLoaded = true; - Setup(); // very important - this will in turn call main - } - - @Override - public void failure(Throwable t) { - /* Boo */ - Log.i(LOG_TAG, "loadLibrary failure" + t.getMessage()); - } - }); - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - Log.i(LOG_TAG, "onCreate"); - super.onCreate(savedInstanceState); - - setFullscreen(); - hideSystemBars(); - } - - @Override - public void onStart() { - super.onStart(); - - } - - @Override - public void onDetachedFromWindow() { - - } - - // Menus - // http://developer.android.com/guide/topics/ui/menus.html - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Create settings menu options from here, one by one or infalting an xml - return super.onCreateOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // This passes the menu option string to OF - // you can add additional behavior from java modifying this method - // but keep the call to OFAndroid so OF is notified of menu events - if(OFAndroid.menuItemSelected(item.getItemId())){ - - return true; - } - return super.onOptionsItemSelected(item); - } - - - @Override - public boolean onPrepareOptionsMenu (Menu menu){ - // This method is called every time the menu is opened - // you can add or remove menu options from here - return super.onPrepareOptionsMenu(menu); - } - - public void onRestore() { - - if (!OFAndroidLifeCycle.appLibraryLoaded) return; - } - - private void hideSystemBars() { - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Configure the behavior of the hidden system bars - windowInsetsController.setSystemBarsBehavior( - WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE - ); - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - } - - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - - if (hasFocus) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - - setFullscreen(); - } else { - setFullscreen(); - } - } else { - - } - } - - private void handleException(Exception e, String details) { - Log.e(LOG_TAG, "Exception:", e); - - } - - public void setFullscreen() { - try { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - // No sticky immersive mode for devices pre-kitkat - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else { - View decorView = getWindow().getDecorView(); -// int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; - int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; - decorView.setSystemUiVisibility(uiOptions); - } - - WindowCompat.setDecorFitsSystemWindows(getWindow(), false); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - try { - View decorView = getWindow().getDecorView(); - int[] locations = new int[2]; - decorView.getLocationInWindow(locations); - int[] locations2 = new int[2]; - decorView.getLocationOnScreen(locations2); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.navigationBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()); - } - - -} - diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-hdpi/icon.png b/examples/android/androidCameraExample/ofApp/src/main/res/drawable-hdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-mdpi/icon.png b/examples/android/androidCameraExample/ofApp/src/main/res/drawable-mdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-xhdpi/icon.png b/examples/android/androidCameraExample/ofApp/src/main/res/drawable-xhdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/drawable/icon.png b/examples/android/androidCameraExample/ofApp/src/main/res/drawable/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/drawable/icon.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/layout/main_layout.xml b/examples/android/androidCameraExample/ofApp/src/main/res/layout/main_layout.xml deleted file mode 100644 index d1da461f079..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/layout/main_layout.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/menu/main_layout.xml b/examples/android/androidCameraExample/ofApp/src/main/res/menu/main_layout.xml deleted file mode 100644 index 7ddcfbee35e..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/menu/main_layout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 42b40d2fbec..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 648779fe415..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index a39d8826804..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 13e6dfef882..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 67b93c29890..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 93401eaf855..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 018f9b90738..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index fc64ec1c838..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 486c62f1f2a..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index cf6c612f8b1..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 07b98443e1b..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index b4024c5aa00..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 60b1a9e8332..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 45bd0178fee..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 1b64c2ce02d..00000000000 Binary files a/examples/android/androidCameraExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/strings.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/strings.xml deleted file mode 100644 index 34312396338..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofCameraEx - Menu - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/styles.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/styles.xml deleted file mode 100644 index febc4d0286b..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/strings.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/strings.xml deleted file mode 100644 index 34312396338..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofCameraEx - Menu - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/styles.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/styles.xml deleted file mode 100644 index 928e0fd3d72..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values/ic_launcher_background.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index c5d5899fdf0..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #FFFFFF - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values/strings.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values/strings.xml deleted file mode 100644 index 34312396338..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofCameraEx - Menu - \ No newline at end of file diff --git a/examples/android/androidCameraExample/ofApp/src/main/res/values/styles.xml b/examples/android/androidCameraExample/ofApp/src/main/res/values/styles.xml deleted file mode 100644 index 766a2c3f143..00000000000 --- a/examples/android/androidCameraExample/ofApp/src/main/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/android/androidCameraExample/proguard.cfg b/examples/android/androidCameraExample/proguard.cfg deleted file mode 100644 index faee26e7f2b..00000000000 --- a/examples/android/androidCameraExample/proguard.cfg +++ /dev/null @@ -1,59 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } - --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/examples/android/androidCameraExample/settings.gradle b/examples/android/androidCameraExample/settings.gradle deleted file mode 100644 index cb352f426c0..00000000000 --- a/examples/android/androidCameraExample/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':ofApp' - -// Define the relative path to the openFrameworks project -def openFrameworksProjectPath = '../../../libs/openFrameworksCompiled/project' - -// Convert the relative path to an absolute path -def openFrameworksProjectAbsolutePath = new File(rootDir, openFrameworksProjectPath).absolutePath - -// Include the openFrameworks project -include ':openFrameworksProject' -project(':openFrameworksProject').projectDir = new File(openFrameworksProjectAbsolutePath) diff --git a/examples/android/androidEmptyExample/ofApp/src/main/cpp/main.cpp b/examples/android/androidCameraExample/src/main.cpp similarity index 97% rename from examples/android/androidEmptyExample/ofApp/src/main/cpp/main.cpp rename to examples/android/androidCameraExample/src/main.cpp index f98043c5a8c..7292fddd18e 100644 --- a/examples/android/androidEmptyExample/ofApp/src/main/cpp/main.cpp +++ b/examples/android/androidCameraExample/src/main.cpp @@ -13,7 +13,7 @@ std::shared_ptr baseWindow; int main(int argc, char **argv) { baseWindow = std::make_shared(); ofxAndroidWindowSettings settings; - settings.glesVersion = 2; + settings.glesVersion = 1; settings.setSize(1920, 1080); settings.windowMode = OF_WINDOW; settings.preserveContextOnPause = true; diff --git a/examples/android/androidCameraExample/ofApp/src/main/cpp/ofApp.cpp b/examples/android/androidCameraExample/src/ofApp.cpp similarity index 100% rename from examples/android/androidCameraExample/ofApp/src/main/cpp/ofApp.cpp rename to examples/android/androidCameraExample/src/ofApp.cpp diff --git a/examples/android/androidCameraExample/ofApp/src/main/cpp/ofApp.h b/examples/android/androidCameraExample/src/ofApp.h similarity index 100% rename from examples/android/androidCameraExample/ofApp/src/main/cpp/ofApp.h rename to examples/android/androidCameraExample/src/ofApp.h diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/frabk.ttf b/examples/android/androidCompositeExample/bin/data/frabk.ttf similarity index 100% rename from examples/android/androidCompositeExample/ofApp/src/main/bin/data/frabk.ttf rename to examples/android/androidCompositeExample/bin/data/frabk.ttf diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/shaders/noise.frag b/examples/android/androidCompositeExample/bin/data/shaders/noise.frag similarity index 100% rename from examples/android/androidCompositeExample/ofApp/src/main/bin/data/shaders/noise.frag rename to examples/android/androidCompositeExample/bin/data/shaders/noise.frag diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/shaders/noise.vert b/examples/android/androidCompositeExample/bin/data/shaders/noise.vert similarity index 100% rename from examples/android/androidCompositeExample/ofApp/src/main/bin/data/shaders/noise.vert rename to examples/android/androidCompositeExample/bin/data/shaders/noise.vert diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/verdana.ttf b/examples/android/androidCompositeExample/bin/data/verdana.ttf similarity index 100% rename from examples/android/androidCompositeExample/ofApp/src/main/bin/data/verdana.ttf rename to examples/android/androidCompositeExample/bin/data/verdana.ttf diff --git a/examples/android/androidCompositeExample/build.gradle b/examples/android/androidCompositeExample/build.gradle deleted file mode 100644 index 7cbc7eb6714..00000000000 --- a/examples/android/androidCompositeExample/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -ext { - //var = 'signExample.keystore' -}// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } - ext { - - } -} diff --git a/examples/android/androidCompositeExample/gradle.properties b/examples/android/androidCompositeExample/gradle.properties deleted file mode 100644 index 43f9ef9e1c3..00000000000 --- a/examples/android/androidCompositeExample/gradle.properties +++ /dev/null @@ -1,10 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=false -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official -android.prefabVersion=1.0.+ -android.buildFeatures.prefab=true -#ndkBuild=false -# https://issuetracker.google.com/149575364 -android.enableParallelJsonGen=false -#googleplay=true \ No newline at end of file diff --git a/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.jar b/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372aef5e2..00000000000 Binary files a/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.properties b/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2dd5ee8c795..00000000000 --- a/examples/android/androidCompositeExample/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jun 12 01:17:57 AEST 2023 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/android/androidCompositeExample/ofApp/build.gradle b/examples/android/androidCompositeExample/ofApp/build.gradle deleted file mode 100644 index 5bf1e3663e4..00000000000 --- a/examples/android/androidCompositeExample/ofApp/build.gradle +++ /dev/null @@ -1,182 +0,0 @@ -plugins { - id 'com.android.application' -} - -def CMAKELIST_PATH = './src/main/cpp' -def CPP_SOURCE = './src/main/cpp' -def JAVA_SOURCE = './src/main/java' - -// pointing to cmake's source code for the same project -def PRJ_SRC_ROOT = './src/main' -def ofRoot(){ return '../../../../' } -final ofSource = ofRoot() + 'libs/openFrameworks' -final ofLibs = ofRoot() + 'libs' -final addons = ofRoot() + 'addons' -final ofLibOutput = ofRoot() + 'libs/openFrameworksCompiled/lib/android' -def OFX_ANDROID = ofRoot() + 'addons/ofxAndroid' -//def OF_ADDONS_ARGUMENTS = "${OF_ADDONS}" -def enableProguardInReleaseBuilds = true -def enableProguardInDebugBuilds = false - -task wrapper(type: Wrapper) { - gradleVersion = '7.3.3' -} -tasks.register("prepareKotlinBuildScriptModel"){ -} - -evaluationDependsOn(':openFrameworksProject') - -tasks.whenTaskAdded { task -> - if (task.name == 'assemble') { - task.dependsOn(':openFrameworksProject:assemble') - } -} - - -android { - compileSdkVersion 34 - buildToolsVersion '32.0.0' - //ndkPath "/Users/x/android-ndk-r21e" // Point to your own NDK if needed - ndkVersion '24.0.8215888' // use android studio side loaded ndk - buildFeatures { - prefab true - } - signingConfigs { - debug { - } - release { - storeFile new File("${System.properties['user.home']}/.android/debug.keystore") - storePassword 'android' - storeType "jks" - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - defaultConfig { - applicationId "cc.openframeworks.ofCompositeExample" - minSdkVersion 21 - targetSdkVersion 34 - versionCode 12 - versionName '12.0' - ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' //, 'x86_64' - - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - arguments "-DANDROID_STL=c++_shared", - "-DANDROID_ARM_NEON=TRUE", - "-DANDROID_TOOLCHAIN=clang", - //"${OF_ADDONS_ARGUMENTS}", - "-DTARGET_OPENGLES=TRUE" - - version '3.22.1' - } - } - } - multiDexEnabled false - } - buildTypes { - release { - signingConfig signingConfigs.release - jniDebuggable false - debuggable false - minifyEnabled false - shrinkResources false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - debug { - jniDebuggable true - debuggable true - minifyEnabled false - shrinkResources false - signingConfig signingConfigs.debug - } - } - flavorDimensions "version" - productFlavors { - playstore { - applicationIdSuffix "" - signingConfig signingConfigs.release - } -// humble { -// applicationIdSuffix ".humble" -// } -// amazon { -// applicationIdSuffix ".amazon" -// } -// samsung { -// applicationIdSuffix ".samsung" -// } -// oppo { -// applicationIdSuffix ".oppo" -// } - } - sourceSets { - main { - manifest.srcFile "${PRJ_SRC_ROOT}/AndroidManifest.xml" - java.srcDirs = ["${PRJ_SRC_ROOT}/java", - "${OFX_ANDROID}/Java"] - res.srcDirs = ["${PRJ_SRC_ROOT}/res"] -// jniLibs.srcDirs = ["${OF_ANDROID_OUTPUT}", "lib"] // Pre Android Studio 2022.2.1 - assets { - srcDirs 'src/main/assets', 'src/main/bin/data' - } - } - } - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - path "${CMAKELIST_PATH}/CMakeLists.txt" - } - } else { - ndkBuild { - path "${CMAKELIST_PATH}/Android.mk" - } - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - androidResources { - noCompress '' - } - dependenciesInfo { - includeInApk false - includeInBundle false - } -// testOptions { -// devices { -// pixel2api29 (com.android.build.api.dsl.ManagedVirtualDevice) { -// // Use device profiles you typically see in -// // Android Studio -// device = "Pixel 2" -// apiLevel = 29 -// // You can also specify "aosp" if you don’t require -// // Google Play Services. -// systemImageSource = "google" -// abi = "x86" -// } -// } -// } -} - - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "com.getkeepsafe.relinker:relinker:1.4.5" - implementation 'com.google.android.material:material:1.9.0' - if (project.hasProperty("googleplay")) { - implementation "com.google.android.gms:play-services-games:22.0.1" - implementation "com.google.android.gms:play-services-auth:20.0.1" - implementation "com.google.android.gms:play-services-base:18.0.1" - implementation "com.google.android.gms:play-services-basement:18.0.0" - implementation "com.google.android.gms:play-services-instantapps:18.0.1" - implementation "com.google.android.gms:play-services-appset:16.0.2" - } -} - diff --git a/examples/android/androidCompositeExample/ofApp/gradle.properties b/examples/android/androidCompositeExample/ofApp/gradle.properties deleted file mode 100644 index f96a9f246a0..00000000000 --- a/examples/android/androidCompositeExample/ofApp/gradle.properties +++ /dev/null @@ -1,11 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=true -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official -android.prefabVersion=1.0.+ -# Workaround bug in AGP where the prefab dependency is being resolved from a -# non-Gradle thread when enableParallelJsonGen is enabled. -# https://issuetracker.google.com/149575364 -android.enableParallelJsonGen=false -android.buildFeatures.prefab = true -vectorDrawables.useSupportLibrary = true \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.jar b/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e5832f09..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.properties b/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2e6e5897b52..00000000000 --- a/examples/android/androidCompositeExample/ofApp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/android/androidCompositeExample/ofApp/gradlew b/examples/android/androidCompositeExample/ofApp/gradlew deleted file mode 100755 index a69d9cb6c20..00000000000 --- a/examples/android/androidCompositeExample/ofApp/gradlew +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/examples/android/androidCompositeExample/ofApp/gradlew.bat b/examples/android/androidCompositeExample/ofApp/gradlew.bat deleted file mode 100644 index f127cfd49d4..00000000000 --- a/examples/android/androidCompositeExample/ofApp/gradlew.bat +++ /dev/null @@ -1,91 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/android/androidCompositeExample/ofApp/proguard-rules.pro b/examples/android/androidCompositeExample/ofApp/proguard-rules.pro deleted file mode 100644 index de8c62143ce..00000000000 --- a/examples/android/androidCompositeExample/ofApp/proguard-rules.pro +++ /dev/null @@ -1,127 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - --dontoptimize --dontshrink -#-dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify -#-verbose -# --optimizationpasses 7 # use for final build --dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify --verbose - -# custom app activity proguard --keep public class cc.openframeworks.android.OFActivity { public ; } --keep public class cc.openframeworks.android.R { public ; } - - -#-dontobfuscate android classes --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference - -#-dontobfuscate openFrameworks android classes --keep public class cc.openframeworks.OFAndroid { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycleHelper { public ; } --keep public class cc.openframeworks.OFAndroidWindow { public ; } --keep public class cc.openframeworks.OFAndroidSoundPlayer { public ; } --keep public class cc.openframeworks.OFGLSurfaceView { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycle { public ; } --keep public class cc.openframeworks.OFActivity { public ; } --keep public class cc.openframeworks.ContextFactory { public ; } --keep public class cc.openframeworks.OFEGLConfigChooser { public ; } --keep public class cc.openframeworks.OFGestureListener { public ; } --keep public class cc.openframeworks.OFAndroidController { public ; } - -#-dontobfuscate GooglePlay Games android classes if used --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - -# note that means any method --keepclasseswithmembernames,includedescriptorclasses class * { - native ; -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} - - -# 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 - -# 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 \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/AndroidManifest.xml b/examples/android/androidCompositeExample/ofApp/src/main/AndroidManifest.xml deleted file mode 100644 index 613fef8d108..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/AndroidManifest.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/1085.mp3 b/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/1085.mp3 deleted file mode 100644 index f4389d44b13..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/1085.mp3 and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/Violet.mp3 b/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/Violet.mp3 deleted file mode 100644 index 8968982ac9b..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/Violet.mp3 and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/beat.wav b/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/beat.wav deleted file mode 100644 index 3384984d617..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/beat.wav and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/synth.wav b/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/synth.wav deleted file mode 100644 index 481d3d1efbd..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/bin/data/sounds/synth.wav and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/cpp/CMakeLists.txt b/examples/android/androidCompositeExample/ofApp/src/main/cpp/CMakeLists.txt deleted file mode 100644 index 5b160ffa42d..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,142 +0,0 @@ -# Sets the minimum version of CMake required to build the native -# library. -cmake_minimum_required(VERSION 3.22.1) - -project(ofapp LANGUAGES CXX) -set(TARGET_ANDROID TRUE) - -set(LOCAL_PATH ${CMAKE_SOURCE_DIR}) -set(PRJ_OF_ROOT ${LOCAL_PATH}/../../../../../../../) - -set(PURE_OF_ROOT ${LOCAL_PATH}/../../../../../../../) -set(CORE_OF_ROOT ${PURE_OF_ROOT}/libs/openFrameworks) -set(LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(PRJ_ADDONS_PATH ${PURE_OF_ROOT}/addons) -set(PRJ_SOURCE_PATH ${LIBS_ROOT}/openFrameworks) -set(PRJ_LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(OF_ANDROID ${PURE_OF_ROOT}/libs/openFrameworksCompiled/project/android) -set(OF_ANDROID_OUTPUT ${PURE_OF_ROOT}/libs/openFrameworksCompiled/lib/android) - -set(PRJ_OFX_ANDROID_PATH ${PRJ_ADDONS_PATH}/ofxAndroid) -set(PRJ_OFX_ANDROID_CPP_PATH ${PRJ_OFX_ANDROID_PATH}/src) - -macro(print_all_variables) - message(STATUS "print_all_variables------------------------------------------{") - get_cmake_property(_variableNames VARIABLES) - foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") - endforeach() - message(STATUS "print_all_variables------------------------------------------}") -endmacro() - -# Custom function to check if the library is built -function(check_library) - if (NOT TARGET openFrameworksAndroid) - message(STATUS "openFrameworksAndroid Library not found. Building library...") - - # Invoke the build process for the library - execute_process( - COMMAND ${CMAKE_COMMAND} --build ${OF_ANDROID}/ - RESULT_VARIABLE result - ) - if (result) - message(FATAL_ERROR "Failed to build the library.") - endif () - endif () -endfunction() - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) -set(TARGET_ANDROID ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -Oz -DNDEBUG -frtti --warn-uninitialized -fno-short-enums -Wextra -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_CPP_FLAGS "${CMAKE_C_FLAGS} -std=c++17 -Oz -DNDEBUG -stdlib=libc++ --warn-uninitialized -frtti -Wextra -fno-short-enums -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export-dynamic") - -print_all_variables() - -# Creates the project's shared lib: libnative-lib.so. -# The lib is loaded by this project's Java code in MainActivity.java: -# System.loadLibrary("native-lib"); -# The lib name in both places must match. -add_library( ofapp #name - SHARED # type of library - # src files for project (just c/cpp) - ${CMAKE_SOURCE_DIR}/main.cpp - ${CMAKE_SOURCE_DIR}/ofApp.cpp - ) - - -# Specifies a path to native header files -include_directories( - # openFrameworks headers - ${PRJ_SOURCE_PATH}/3d - ${PRJ_SOURCE_PATH}/app - ${PRJ_SOURCE_PATH}/communication - ${PRJ_SOURCE_PATH}/events - ${PRJ_SOURCE_PATH}/gl - ${PRJ_SOURCE_PATH}/graphics - ${PRJ_SOURCE_PATH}/math - ${PRJ_SOURCE_PATH}/sound - ${PRJ_SOURCE_PATH}/types - ${PRJ_SOURCE_PATH}/utils - ${PRJ_SOURCE_PATH}/video - ${PRJ_SOURCE_PATH} - # openFrameworks addons includes - ${PURE_OF_ROOT}/addons/ofxAndroid/src - ${PURE_OF_ROOT}/addons/ofxAccelerometer/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/libs - # openFrameworks Libs includes - ${PRJ_LIBS_ROOT}/FreeImage/include - ${PRJ_LIBS_ROOT}/freetype/include - ${PRJ_LIBS_ROOT}/freetype/include/freetype2 - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/config - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal/services - ${PRJ_LIBS_ROOT}/glm/include - ${PRJ_LIBS_ROOT}/pugixml/include - ${PRJ_LIBS_ROOT}/json/include - ${PRJ_LIBS_ROOT}/tess2/include - ${PRJ_LIBS_ROOT}/utf8/include - ${PRJ_LIBS_ROOT}/uriparser/include - ${CMAKE_SOURCE_DIR}/ - ${CMAKE_SOURCE_DIR}/ - ${OF_ANDROID} -) - -find_library(android-lib android) -find_library(log-lib log) -find_library(GLES2-lib GLESv2) - -#find_library(GLES1-lib GLESv1_CM) -#find_library(GLES3-lib GLESv3) - - -target_link_libraries(ofapp - EGL - GLESv2 - log - c - m - z - dl -# GLESv3 - ) - -target_link_libraries( ofapp - ${android-lib} ) -target_link_libraries( ofapp - ${GLES2-lib} ) -target_link_libraries( ofapp - ${log-lib} ) -#target_link_libraries( ofApp -# ${GLES3-lib} ) -#target_link_libraries( ofApp -# ${GLES1-lib} ) - -# Finally link in openFrameworks Library for each ABI -target_link_libraries( ofapp - ${OF_ANDROID_OUTPUT}/${ANDROID_ABI}/libopenFrameworksAndroid.so) diff --git a/examples/android/androidCompositeExample/ofApp/src/main/ic_launcher-playstore.png b/examples/android/androidCompositeExample/ofApp/src/main/ic_launcher-playstore.png deleted file mode 100644 index 2a0df19f5e0..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java b/examples/android/androidCompositeExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java deleted file mode 100644 index f0a6dc8d4e8..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java +++ /dev/null @@ -1,204 +0,0 @@ -package cc.openframeworks.android; - -import android.app.Activity; -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager; - -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowCompat; -import androidx.core.view.WindowInsetsCompat; -import androidx.core.view.WindowInsetsControllerCompat; - -import cc.openframeworks.OFAndroid; -import cc.openframeworks.OFAndroidController; -import cc.openframeworks.OFAndroidLifeCycle; -import cc.openframeworks.OFAndroidLifeCycleHelper; - -import com.getkeepsafe.relinker.ReLinker; - - - -public class OFActivity extends cc.openframeworks.OFActivity { - - private static final String appName = "ofapp"; // modify this to target appName (ofApp etc) - private static final String LOG_TAG = appName + "::OFActivity"; - - private ReLinker.Logger logcatLogger = new ReLinker.Logger() { - @Override - public void log(String message) { - Log.d("ReLinker", message); - } - }; - private OFActivity thisActivity; - - - // Extremely important - public OFActivity() { - OFAndroidLifeCycle.coreLibraryLoaded = true; - - OFAndroid.maxSamples = 4; - OFAndroid.maximumFrameRate = 144; - - thisActivity = this; - ReLinker.log(logcatLogger) - .force() - .recursively() - .loadLibrary(this, appName, new ReLinker.LoadListener() { - @Override - public void success() { - Log.i(LOG_TAG, "loadLibrary success"); - OFAndroidLifeCycle.appLibraryLoaded = true; - Setup(); // very important - this will in turn call main - } - - @Override - public void failure(Throwable t) { - /* Boo */ - Log.i(LOG_TAG, "loadLibrary failure" + t.getMessage()); - } - }); - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - Log.i(LOG_TAG, "onCreate"); - super.onCreate(savedInstanceState); - - setFullscreen(); - hideSystemBars(); - } - - @Override - public void onStart() { - super.onStart(); - - } - - @Override - public void onDetachedFromWindow() { - - } - - // Menus - // http://developer.android.com/guide/topics/ui/menus.html - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Create settings menu options from here, one by one or infalting an xml - return super.onCreateOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // This passes the menu option string to OF - // you can add additional behavior from java modifying this method - // but keep the call to OFAndroid so OF is notified of menu events - if(OFAndroid.menuItemSelected(item.getItemId())){ - - return true; - } - return super.onOptionsItemSelected(item); - } - - - @Override - public boolean onPrepareOptionsMenu (Menu menu){ - // This method is called every time the menu is opened - // you can add or remove menu options from here - return super.onPrepareOptionsMenu(menu); - } - - public void onRestore() { - - if (!OFAndroidLifeCycle.appLibraryLoaded) return; - } - - private void hideSystemBars() { - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Configure the behavior of the hidden system bars - windowInsetsController.setSystemBarsBehavior( - WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE - ); - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - } - - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - - if (hasFocus) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - - setFullscreen(); - } else { - setFullscreen(); - } - } else { - - } - } - - private void handleException(Exception e, String details) { - Log.e(LOG_TAG, "Exception:", e); - - } - - public void setFullscreen() { - try { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - // No sticky immersive mode for devices pre-kitkat - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else { - View decorView = getWindow().getDecorView(); -// int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; - int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; - decorView.setSystemUiVisibility(uiOptions); - } - - WindowCompat.setDecorFitsSystemWindows(getWindow(), false); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - try { - View decorView = getWindow().getDecorView(); - int[] locations = new int[2]; - decorView.getLocationInWindow(locations); - int[] locations2 = new int[2]; - decorView.getLocationOnScreen(locations2); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.navigationBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()); - } - - -} - diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-hdpi/icon.png b/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-hdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-mdpi/icon.png b/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-mdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-xhdpi/icon.png b/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-xhdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable/icon.png b/examples/android/androidCompositeExample/ofApp/src/main/res/drawable/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/drawable/icon.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/layout/main_layout.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/layout/main_layout.xml deleted file mode 100644 index d1da461f079..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/layout/main_layout.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/menu/main_layout.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/menu/main_layout.xml deleted file mode 100644 index 7ddcfbee35e..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/menu/main_layout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 42b40d2fbec..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 648779fe415..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index a39d8826804..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 13e6dfef882..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 67b93c29890..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 93401eaf855..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 018f9b90738..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index fc64ec1c838..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 486c62f1f2a..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index cf6c612f8b1..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 07b98443e1b..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index b4024c5aa00..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 60b1a9e8332..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 45bd0178fee..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 1b64c2ce02d..00000000000 Binary files a/examples/android/androidCompositeExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/strings.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/strings.xml deleted file mode 100644 index 29c67ba8fc4..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofExample - Menu - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/styles.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/styles.xml deleted file mode 100644 index febc4d0286b..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/strings.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/strings.xml deleted file mode 100644 index 29c67ba8fc4..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofExample - Menu - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/styles.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/styles.xml deleted file mode 100644 index 928e0fd3d72..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values/ic_launcher_background.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index c5d5899fdf0..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #FFFFFF - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values/strings.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values/strings.xml deleted file mode 100644 index 29c67ba8fc4..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofExample - Menu - \ No newline at end of file diff --git a/examples/android/androidCompositeExample/ofApp/src/main/res/values/styles.xml b/examples/android/androidCompositeExample/ofApp/src/main/res/values/styles.xml deleted file mode 100644 index 766a2c3f143..00000000000 --- a/examples/android/androidCompositeExample/ofApp/src/main/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/android/androidCompositeExample/proguard.cfg b/examples/android/androidCompositeExample/proguard.cfg deleted file mode 100644 index faee26e7f2b..00000000000 --- a/examples/android/androidCompositeExample/proguard.cfg +++ /dev/null @@ -1,59 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } - --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/examples/android/androidCompositeExample/settings.gradle b/examples/android/androidCompositeExample/settings.gradle deleted file mode 100644 index cb352f426c0..00000000000 --- a/examples/android/androidCompositeExample/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':ofApp' - -// Define the relative path to the openFrameworks project -def openFrameworksProjectPath = '../../../libs/openFrameworksCompiled/project' - -// Convert the relative path to an absolute path -def openFrameworksProjectAbsolutePath = new File(rootDir, openFrameworksProjectPath).absolutePath - -// Include the openFrameworks project -include ':openFrameworksProject' -project(':openFrameworksProject').projectDir = new File(openFrameworksProjectAbsolutePath) diff --git a/examples/android/androidCameraExample/ofApp/src/main/cpp/main.cpp b/examples/android/androidCompositeExample/src/main.cpp similarity index 100% rename from examples/android/androidCameraExample/ofApp/src/main/cpp/main.cpp rename to examples/android/androidCompositeExample/src/main.cpp diff --git a/examples/android/androidCompositeExample/ofApp/src/main/cpp/ofApp.cpp b/examples/android/androidCompositeExample/src/ofApp.cpp similarity index 96% rename from examples/android/androidCompositeExample/ofApp/src/main/cpp/ofApp.cpp rename to examples/android/androidCompositeExample/src/ofApp.cpp index c1f43511792..fdb8b5a1ace 100644 --- a/examples/android/androidCompositeExample/ofApp/src/main/cpp/ofApp.cpp +++ b/examples/android/androidCompositeExample/src/ofApp.cpp @@ -277,18 +277,19 @@ void ofApp::audioIn(ofSoundBuffer & buffer){ } } +//-------------------------------------------------------------- void ofApp::deviceRefreshRateChanged(int refreshRate) { - } +//-------------------------------------------------------------- void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { - } +//-------------------------------------------------------------- void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { - } +//-------------------------------------------------------------- void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { - } + diff --git a/examples/android/androidCompositeExample/ofApp/src/main/cpp/ofApp.h b/examples/android/androidCompositeExample/src/ofApp.h similarity index 100% rename from examples/android/androidCompositeExample/ofApp/src/main/cpp/ofApp.h rename to examples/android/androidCompositeExample/src/ofApp.h diff --git a/examples/android/androidEmptyExample/build.gradle b/examples/android/androidEmptyExample/build.gradle deleted file mode 100644 index 7cbc7eb6714..00000000000 --- a/examples/android/androidEmptyExample/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -ext { - //var = 'signExample.keystore' -}// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } - ext { - - } -} diff --git a/examples/android/androidEmptyExample/gradle.properties b/examples/android/androidEmptyExample/gradle.properties deleted file mode 100644 index 43f9ef9e1c3..00000000000 --- a/examples/android/androidEmptyExample/gradle.properties +++ /dev/null @@ -1,10 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=false -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official -android.prefabVersion=1.0.+ -android.buildFeatures.prefab=true -#ndkBuild=false -# https://issuetracker.google.com/149575364 -android.enableParallelJsonGen=false -#googleplay=true \ No newline at end of file diff --git a/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.jar b/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372aef5e2..00000000000 Binary files a/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.properties b/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2dd5ee8c795..00000000000 --- a/examples/android/androidEmptyExample/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jun 12 01:17:57 AEST 2023 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/android/androidEmptyExample/gradlew b/examples/android/androidEmptyExample/gradlew deleted file mode 100755 index 9d82f789151..00000000000 --- a/examples/android/androidEmptyExample/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/examples/android/androidEmptyExample/gradlew.bat b/examples/android/androidEmptyExample/gradlew.bat deleted file mode 100644 index 8a0b282aa68..00000000000 --- a/examples/android/androidEmptyExample/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/android/androidEmptyExample/local.properties b/examples/android/androidEmptyExample/local.properties deleted file mode 100644 index 5ba01764b38..00000000000 --- a/examples/android/androidEmptyExample/local.properties +++ /dev/null @@ -1,8 +0,0 @@ -## This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# Location of the SDK. This is only used by Gradle. -# For customization when using a Version Control System, please read the -# header note. -#Wed May 08 13:54:16 CEST 2024 -sdk.dir=/Users/thierry/Library/Android/sdk diff --git a/examples/android/androidEmptyExample/ofApp/build.gradle b/examples/android/androidEmptyExample/ofApp/build.gradle deleted file mode 100644 index 4ac7015c9c9..00000000000 --- a/examples/android/androidEmptyExample/ofApp/build.gradle +++ /dev/null @@ -1,182 +0,0 @@ -plugins { - id 'com.android.application' -} - -def CMAKELIST_PATH = './src/main/cpp' -def CPP_SOURCE = './src/main/cpp' -def JAVA_SOURCE = './src/main/java' - -// pointing to cmake's source code for the same project -def PRJ_SRC_ROOT = './src/main' -def ofRoot(){ return '../../../../' } -final ofSource = ofRoot() + 'libs/openFrameworks' -final ofLibs = ofRoot() + 'libs' -final addons = ofRoot() + 'addons' -final ofLibOutput = ofRoot() + 'libs/openFrameworksCompiled/lib/android' -def OFX_ANDROID = ofRoot() + 'addons/ofxAndroid' -//def OF_ADDONS_ARGUMENTS = "${OF_ADDONS}" -def enableProguardInReleaseBuilds = true -def enableProguardInDebugBuilds = false - -task wrapper(type: Wrapper) { - gradleVersion = '7.3.3' -} -tasks.register("prepareKotlinBuildScriptModel"){ -} - -evaluationDependsOn(':openFrameworksProject') - -tasks.whenTaskAdded { task -> - if (task.name == 'assemble') { - task.dependsOn(':openFrameworksProject:assemble') - } -} - - -android { - compileSdkVersion 34 - buildToolsVersion '32.0.0' - //ndkPath "/Users/x/android-ndk-r21e" // Point to your own NDK if needed - ndkVersion '24.0.8215888' // use android studio side loaded ndk - buildFeatures { - prefab true - } - signingConfigs { - debug { - } - release { - storeFile new File("${System.properties['user.home']}/.android/debug.keystore") - storePassword 'android' - storeType "jks" - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - defaultConfig { - applicationId "cc.openframeworks.androidEmptyExample" // IMPORTANT : THIS DEFINES THE ID OF THE APK - minSdkVersion 21 - targetSdkVersion 34 - versionCode 12 - versionName '12.0' - ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' //, 'x86_64' - - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - arguments "-DANDROID_STL=c++_shared", - "-DANDROID_ARM_NEON=TRUE", - "-DANDROID_TOOLCHAIN=clang", - //"${OF_ADDONS_ARGUMENTS}", - "-DTARGET_OPENGLES=TRUE" - - version '3.22.1' - } - } - } - multiDexEnabled false - } - buildTypes { - release { - signingConfig signingConfigs.release - jniDebuggable false - debuggable false - minifyEnabled false - shrinkResources false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - debug { - jniDebuggable true - debuggable true - minifyEnabled false - shrinkResources false - signingConfig signingConfigs.debug - } - } - flavorDimensions "version" - productFlavors { - playstore { - applicationIdSuffix "" - signingConfig signingConfigs.release - } -// humble { -// applicationIdSuffix ".humble" -// } -// amazon { -// applicationIdSuffix ".amazon" -// } -// samsung { -// applicationIdSuffix ".samsung" -// } -// oppo { -// applicationIdSuffix ".oppo" -// } - } - sourceSets { - main { - manifest.srcFile "${PRJ_SRC_ROOT}/AndroidManifest.xml" - java.srcDirs = ["${PRJ_SRC_ROOT}/java", - "${OFX_ANDROID}/Java"] - res.srcDirs = ["${PRJ_SRC_ROOT}/res"] -// jniLibs.srcDirs = ["${OF_ANDROID_OUTPUT}", "lib"] // Pre Android Studio 2022.2.1 - assets { - srcDirs 'src/main/assets', 'src/main/bin/data' - } - } - } - externalNativeBuild { - if (!project.hasProperty("ndkBuild")) { - cmake { - path "${CMAKELIST_PATH}/CMakeLists.txt" - } - } else { - ndkBuild { - path "${CMAKELIST_PATH}/Android.mk" - } - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - androidResources { - noCompress '' - } - dependenciesInfo { - includeInApk false - includeInBundle false - } -// testOptions { -// devices { -// pixel2api29 (com.android.build.api.dsl.ManagedVirtualDevice) { -// // Use device profiles you typically see in -// // Android Studio -// device = "Pixel 2" -// apiLevel = 29 -// // You can also specify "aosp" if you don’t require -// // Google Play Services. -// systemImageSource = "google" -// abi = "x86" -// } -// } -// } -} - - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "com.getkeepsafe.relinker:relinker:1.4.5" - implementation 'com.google.android.material:material:1.9.0' - if (project.hasProperty("googleplay")) { - implementation "com.google.android.gms:play-services-games:22.0.1" - implementation "com.google.android.gms:play-services-auth:20.0.1" - implementation "com.google.android.gms:play-services-base:18.0.1" - implementation "com.google.android.gms:play-services-basement:18.0.0" - implementation "com.google.android.gms:play-services-instantapps:18.0.1" - implementation "com.google.android.gms:play-services-appset:16.0.2" - } -} - diff --git a/examples/android/androidEmptyExample/ofApp/gradle.properties b/examples/android/androidEmptyExample/ofApp/gradle.properties deleted file mode 100644 index f96a9f246a0..00000000000 --- a/examples/android/androidEmptyExample/ofApp/gradle.properties +++ /dev/null @@ -1,11 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=true -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -kotlin.code.style=official -android.prefabVersion=1.0.+ -# Workaround bug in AGP where the prefab dependency is being resolved from a -# non-Gradle thread when enableParallelJsonGen is enabled. -# https://issuetracker.google.com/149575364 -android.enableParallelJsonGen=false -android.buildFeatures.prefab = true -vectorDrawables.useSupportLibrary = true \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.jar b/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e5832f09..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.properties b/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2e6e5897b52..00000000000 --- a/examples/android/androidEmptyExample/ofApp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/android/androidEmptyExample/ofApp/proguard-rules.pro b/examples/android/androidEmptyExample/ofApp/proguard-rules.pro deleted file mode 100644 index de8c62143ce..00000000000 --- a/examples/android/androidEmptyExample/ofApp/proguard-rules.pro +++ /dev/null @@ -1,127 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - --dontoptimize --dontshrink -#-dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify -#-verbose -# --optimizationpasses 7 # use for final build --dontusemixedcaseclassnames -#-dontskipnonpubliclibraryclasses -#-dontpreverify --verbose - -# custom app activity proguard --keep public class cc.openframeworks.android.OFActivity { public ; } --keep public class cc.openframeworks.android.R { public ; } - - -#-dontobfuscate android classes --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference - -#-dontobfuscate openFrameworks android classes --keep public class cc.openframeworks.OFAndroid { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycleHelper { public ; } --keep public class cc.openframeworks.OFAndroidWindow { public ; } --keep public class cc.openframeworks.OFAndroidSoundPlayer { public ; } --keep public class cc.openframeworks.OFGLSurfaceView { public ; } --keep public class cc.openframeworks.OFAndroidLifeCycle { public ; } --keep public class cc.openframeworks.OFActivity { public ; } --keep public class cc.openframeworks.ContextFactory { public ; } --keep public class cc.openframeworks.OFEGLConfigChooser { public ; } --keep public class cc.openframeworks.OFGestureListener { public ; } --keep public class cc.openframeworks.OFAndroidController { public ; } - -#-dontobfuscate GooglePlay Games android classes if used --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - -# note that means any method --keepclasseswithmembernames,includedescriptorclasses class * { - native ; -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} - - -# 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 - -# 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 \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/AndroidManifest.xml b/examples/android/androidEmptyExample/ofApp/src/main/AndroidManifest.xml deleted file mode 100644 index aae67ceba1b..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/AndroidManifest.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/cpp/CMakeLists.txt b/examples/android/androidEmptyExample/ofApp/src/main/cpp/CMakeLists.txt deleted file mode 100644 index 5b160ffa42d..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,142 +0,0 @@ -# Sets the minimum version of CMake required to build the native -# library. -cmake_minimum_required(VERSION 3.22.1) - -project(ofapp LANGUAGES CXX) -set(TARGET_ANDROID TRUE) - -set(LOCAL_PATH ${CMAKE_SOURCE_DIR}) -set(PRJ_OF_ROOT ${LOCAL_PATH}/../../../../../../../) - -set(PURE_OF_ROOT ${LOCAL_PATH}/../../../../../../../) -set(CORE_OF_ROOT ${PURE_OF_ROOT}/libs/openFrameworks) -set(LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(PRJ_ADDONS_PATH ${PURE_OF_ROOT}/addons) -set(PRJ_SOURCE_PATH ${LIBS_ROOT}/openFrameworks) -set(PRJ_LIBS_ROOT ${PURE_OF_ROOT}/libs) - -set(OF_ANDROID ${PURE_OF_ROOT}/libs/openFrameworksCompiled/project/android) -set(OF_ANDROID_OUTPUT ${PURE_OF_ROOT}/libs/openFrameworksCompiled/lib/android) - -set(PRJ_OFX_ANDROID_PATH ${PRJ_ADDONS_PATH}/ofxAndroid) -set(PRJ_OFX_ANDROID_CPP_PATH ${PRJ_OFX_ANDROID_PATH}/src) - -macro(print_all_variables) - message(STATUS "print_all_variables------------------------------------------{") - get_cmake_property(_variableNames VARIABLES) - foreach (_variableName ${_variableNames}) - message(STATUS "${_variableName}=${${_variableName}}") - endforeach() - message(STATUS "print_all_variables------------------------------------------}") -endmacro() - -# Custom function to check if the library is built -function(check_library) - if (NOT TARGET openFrameworksAndroid) - message(STATUS "openFrameworksAndroid Library not found. Building library...") - - # Invoke the build process for the library - execute_process( - COMMAND ${CMAKE_COMMAND} --build ${OF_ANDROID}/ - RESULT_VARIABLE result - ) - if (result) - message(FATAL_ERROR "Failed to build the library.") - endif () - endif () -endfunction() - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) -set(TARGET_ANDROID ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -Oz -DNDEBUG -frtti --warn-uninitialized -fno-short-enums -Wextra -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_CPP_FLAGS "${CMAKE_C_FLAGS} -std=c++17 -Oz -DNDEBUG -stdlib=libc++ --warn-uninitialized -frtti -Wextra -fno-short-enums -fPIE -fPIC -fuse-ld=gold -fexceptions -ffunction-sections -fdata-sections -Wall -Wextra -Wfloat-equal -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wcast-qual -Wmissing-prototypes -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export-dynamic") - -print_all_variables() - -# Creates the project's shared lib: libnative-lib.so. -# The lib is loaded by this project's Java code in MainActivity.java: -# System.loadLibrary("native-lib"); -# The lib name in both places must match. -add_library( ofapp #name - SHARED # type of library - # src files for project (just c/cpp) - ${CMAKE_SOURCE_DIR}/main.cpp - ${CMAKE_SOURCE_DIR}/ofApp.cpp - ) - - -# Specifies a path to native header files -include_directories( - # openFrameworks headers - ${PRJ_SOURCE_PATH}/3d - ${PRJ_SOURCE_PATH}/app - ${PRJ_SOURCE_PATH}/communication - ${PRJ_SOURCE_PATH}/events - ${PRJ_SOURCE_PATH}/gl - ${PRJ_SOURCE_PATH}/graphics - ${PRJ_SOURCE_PATH}/math - ${PRJ_SOURCE_PATH}/sound - ${PRJ_SOURCE_PATH}/types - ${PRJ_SOURCE_PATH}/utils - ${PRJ_SOURCE_PATH}/video - ${PRJ_SOURCE_PATH} - # openFrameworks addons includes - ${PURE_OF_ROOT}/addons/ofxAndroid/src - ${PURE_OF_ROOT}/addons/ofxAccelerometer/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/src - ${PURE_OF_ROOT}/addons/ofxXmlSettings/libs - # openFrameworks Libs includes - ${PRJ_LIBS_ROOT}/FreeImage/include - ${PRJ_LIBS_ROOT}/freetype/include - ${PRJ_LIBS_ROOT}/freetype/include/freetype2 - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/config - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal - ${PRJ_LIBS_ROOT}/freetype/include/freetype2/freetype/internal/services - ${PRJ_LIBS_ROOT}/glm/include - ${PRJ_LIBS_ROOT}/pugixml/include - ${PRJ_LIBS_ROOT}/json/include - ${PRJ_LIBS_ROOT}/tess2/include - ${PRJ_LIBS_ROOT}/utf8/include - ${PRJ_LIBS_ROOT}/uriparser/include - ${CMAKE_SOURCE_DIR}/ - ${CMAKE_SOURCE_DIR}/ - ${OF_ANDROID} -) - -find_library(android-lib android) -find_library(log-lib log) -find_library(GLES2-lib GLESv2) - -#find_library(GLES1-lib GLESv1_CM) -#find_library(GLES3-lib GLESv3) - - -target_link_libraries(ofapp - EGL - GLESv2 - log - c - m - z - dl -# GLESv3 - ) - -target_link_libraries( ofapp - ${android-lib} ) -target_link_libraries( ofapp - ${GLES2-lib} ) -target_link_libraries( ofapp - ${log-lib} ) -#target_link_libraries( ofApp -# ${GLES3-lib} ) -#target_link_libraries( ofApp -# ${GLES1-lib} ) - -# Finally link in openFrameworks Library for each ABI -target_link_libraries( ofapp - ${OF_ANDROID_OUTPUT}/${ANDROID_ABI}/libopenFrameworksAndroid.so) diff --git a/examples/android/androidEmptyExample/ofApp/src/main/ic_launcher-playstore.png b/examples/android/androidEmptyExample/ofApp/src/main/ic_launcher-playstore.png deleted file mode 100644 index 2a0df19f5e0..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java b/examples/android/androidEmptyExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java deleted file mode 100644 index 598ee50bbf1..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/java/cc/openframeworks/android/OFActivity.java +++ /dev/null @@ -1,201 +0,0 @@ -package cc.openframeworks.android; - -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager; - -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowCompat; -import androidx.core.view.WindowInsetsCompat; -import androidx.core.view.WindowInsetsControllerCompat; - -import cc.openframeworks.OFAndroid; -import cc.openframeworks.OFAndroidLifeCycle; - -import com.getkeepsafe.relinker.ReLinker; - - - -public class OFActivity extends cc.openframeworks.OFActivity { - - private static final String appName = "ofapp"; // modify this to target appName (ofApp etc) - private static final String LOG_TAG = appName + "::OFActivity"; - - private ReLinker.Logger logcatLogger = new ReLinker.Logger() { - @Override - public void log(String message) { - Log.d("ReLinker", message); - } - }; - private OFActivity thisActivity; - - - // Extremely important - public OFActivity() { - OFAndroidLifeCycle.coreLibraryLoaded = true; - - OFAndroid.maxSamples = 4; - OFAndroid.maximumFrameRate = 144; - - thisActivity = this; - ReLinker.log(logcatLogger) - .force() - .recursively() - .loadLibrary(this, appName, new ReLinker.LoadListener() { - @Override - public void success() { - Log.i(LOG_TAG, "loadLibrary success"); - OFAndroidLifeCycle.appLibraryLoaded = true; - Setup(); // very important - this will in turn call main - } - - @Override - public void failure(Throwable t) { - /* Boo */ - Log.i(LOG_TAG, "loadLibrary failure" + t.getMessage()); - } - }); - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - Log.i(LOG_TAG, "onCreate"); - super.onCreate(savedInstanceState); - - setFullscreen(); - hideSystemBars(); - } - - @Override - public void onStart() { - super.onStart(); - - } - - @Override - public void onDetachedFromWindow() { - - } - - // Menus - // http://developer.android.com/guide/topics/ui/menus.html - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Create settings menu options from here, one by one or infalting an xml - return super.onCreateOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // This passes the menu option string to OF - // you can add additional behavior from java modifying this method - // but keep the call to OFAndroid so OF is notified of menu events - if(OFAndroid.menuItemSelected(item.getItemId())){ - - return true; - } - return super.onOptionsItemSelected(item); - } - - - @Override - public boolean onPrepareOptionsMenu (Menu menu){ - // This method is called every time the menu is opened - // you can add or remove menu options from here - return super.onPrepareOptionsMenu(menu); - } - - public void onRestore() { - - if (!OFAndroidLifeCycle.appLibraryLoaded) return; - } - - private void hideSystemBars() { - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Configure the behavior of the hidden system bars - windowInsetsController.setSystemBarsBehavior( - WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE - ); - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - } - - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - - if (hasFocus) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - - setFullscreen(); - } else { - setFullscreen(); - } - } else { - - } - } - - private void handleException(Exception e, String details) { - Log.e(LOG_TAG, "Exception:", e); - - } - - public void setFullscreen() { - try { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - // No sticky immersive mode for devices pre-kitkat - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else { - View decorView = getWindow().getDecorView(); -// int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; - int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; - decorView.setSystemUiVisibility(uiOptions); - } - - WindowCompat.setDecorFitsSystemWindows(getWindow(), false); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - try { - View decorView = getWindow().getDecorView(); - int[] locations = new int[2]; - decorView.getLocationInWindow(locations); - int[] locations2 = new int[2]; - decorView.getLocationOnScreen(locations2); - - } catch (Exception ex) { - handleException(ex, "setFullscreen exception"); - } - - WindowInsetsControllerCompat windowInsetsController = - ViewCompat.getWindowInsetsController(getWindow().getDecorView()); - if (windowInsetsController == null) { - return; - } - // Hide both the status bar and the navigation bar - windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.navigationBars()); - windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()); - } - - -} - diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-hdpi/icon.png b/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-hdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-mdpi/icon.png b/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-mdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-xhdpi/icon.png b/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-xhdpi/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable/icon.png b/examples/android/androidEmptyExample/ofApp/src/main/res/drawable/icon.png deleted file mode 100644 index 70b562fba01..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/drawable/icon.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/layout/main_layout.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/layout/main_layout.xml deleted file mode 100644 index d1da461f079..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/layout/main_layout.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/menu/main_layout.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/menu/main_layout.xml deleted file mode 100644 index 7ddcfbee35e..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/menu/main_layout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09bc5fd..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 42b40d2fbec..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 648779fe415..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index a39d8826804..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 13e6dfef882..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 67b93c29890..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 93401eaf855..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 018f9b90738..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index fc64ec1c838..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 486c62f1f2a..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index cf6c612f8b1..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 07b98443e1b..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index b4024c5aa00..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 60b1a9e8332..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 45bd0178fee..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 1b64c2ce02d..00000000000 Binary files a/examples/android/androidEmptyExample/ofApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/strings.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/strings.xml deleted file mode 100644 index 5822f1306d1..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofEmptyEx - Menu - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/styles.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/styles.xml deleted file mode 100644 index febc4d0286b..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/strings.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/strings.xml deleted file mode 100644 index 5822f1306d1..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofEmptyEx - Menu - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/styles.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/styles.xml deleted file mode 100644 index 928e0fd3d72..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values/ic_launcher_background.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values/ic_launcher_background.xml deleted file mode 100644 index c5d5899fdf0..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #FFFFFF - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values/strings.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values/strings.xml deleted file mode 100644 index 5822f1306d1..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - ofEmptyEx - Menu - \ No newline at end of file diff --git a/examples/android/androidEmptyExample/ofApp/src/main/res/values/styles.xml b/examples/android/androidEmptyExample/ofApp/src/main/res/values/styles.xml deleted file mode 100644 index 766a2c3f143..00000000000 --- a/examples/android/androidEmptyExample/ofApp/src/main/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/android/androidEmptyExample/proguard.cfg b/examples/android/androidEmptyExample/proguard.cfg deleted file mode 100644 index faee26e7f2b..00000000000 --- a/examples/android/androidEmptyExample/proguard.cfg +++ /dev/null @@ -1,59 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keep class com.google.android.gms.games.leaderboard.** { *; } --keep class com.google.android.gms.games.snapshot.** { *; } --keep class com.google.android.gms.games.achievement.** { *; } --keep class com.google.android.gms.games.event.** { *; } --keep class com.google.android.gms.games.stats.** { *; } --keep class com.google.android.gms.games.video.** { *; } --keep class com.google.android.gms.games.* { *; } - --keep class com.google.android.gms.signin.** { *; } --keep class com.google.android.gms.dynamic.** { *; } --keep class com.google.android.gms.dynamite.** { *; } --keep class com.google.android.gms.tasks.** { *; } --keep class com.google.android.gms.security.** { *; } --keep class com.google.android.gms.base.** { *; } --keep class com.google.android.gms.actions.** { *; } --keep class com.google.games.bridge.** { *; } --keep class com.google.android.gms.common.api.** { *; } --keep class com.google.android.gms.games.quest.** { *; } --keep class com.google.android.gms.nearby.** { *; } --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/examples/android/androidEmptyExample/settings.gradle b/examples/android/androidEmptyExample/settings.gradle deleted file mode 100644 index cb352f426c0..00000000000 --- a/examples/android/androidEmptyExample/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':ofApp' - -// Define the relative path to the openFrameworks project -def openFrameworksProjectPath = '../../../libs/openFrameworksCompiled/project' - -// Convert the relative path to an absolute path -def openFrameworksProjectAbsolutePath = new File(rootDir, openFrameworksProjectPath).absolutePath - -// Include the openFrameworks project -include ':openFrameworksProject' -project(':openFrameworksProject').projectDir = new File(openFrameworksProjectAbsolutePath) diff --git a/examples/android/androidCompositeExample/ofApp/src/main/cpp/main.cpp b/examples/android/androidEmptyExample/src/main.cpp similarity index 97% rename from examples/android/androidCompositeExample/ofApp/src/main/cpp/main.cpp rename to examples/android/androidEmptyExample/src/main.cpp index f98043c5a8c..7292fddd18e 100644 --- a/examples/android/androidCompositeExample/ofApp/src/main/cpp/main.cpp +++ b/examples/android/androidEmptyExample/src/main.cpp @@ -13,7 +13,7 @@ std::shared_ptr baseWindow; int main(int argc, char **argv) { baseWindow = std::make_shared(); ofxAndroidWindowSettings settings; - settings.glesVersion = 2; + settings.glesVersion = 1; settings.setSize(1920, 1080); settings.windowMode = OF_WINDOW; settings.preserveContextOnPause = true; diff --git a/examples/android/androidEmptyExample/ofApp/src/main/cpp/ofApp.cpp b/examples/android/androidEmptyExample/src/ofApp.cpp similarity index 100% rename from examples/android/androidEmptyExample/ofApp/src/main/cpp/ofApp.cpp rename to examples/android/androidEmptyExample/src/ofApp.cpp diff --git a/examples/android/androidEmptyExample/ofApp/src/main/cpp/ofApp.h b/examples/android/androidEmptyExample/src/ofApp.h similarity index 100% rename from examples/android/androidEmptyExample/ofApp/src/main/cpp/ofApp.h rename to examples/android/androidEmptyExample/src/ofApp.h diff --git a/examples/android/androidFontExample/src/main.cpp b/examples/android/androidFontExample/src/main.cpp index 596b934783a..f98043c5a8c 100644 --- a/examples/android/androidFontExample/src/main.cpp +++ b/examples/android/androidFontExample/src/main.cpp @@ -1,28 +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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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); } -#endif +// 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 diff --git a/examples/android/androidFontExample/src/ofApp.cpp b/examples/android/androidFontExample/src/ofApp.cpp index 398c39b8fa7..94e77ba6f91 100644 --- a/examples/android/androidFontExample/src/ofApp.cpp +++ b/examples/android/androidFontExample/src/ofApp.cpp @@ -2,7 +2,7 @@ //-------------------------------------------------------------- void ofApp::setup(){ - font.load("frabk.ttf",14); + font.load("frabk.ttf",58); ofBackground(255,255,255); ofSetColor(0,0,0); } @@ -15,18 +15,18 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - font.drawString("hello world!!",20,20); + font.drawString("hello world!!",128,128); //ofDrawBitmapString(ofToString(ofGetFrameRate()),20,30); } //-------------------------------------------------------------- -void ofApp::keyPressed (int key){ - +void ofApp::keyPressed (int key){ + } //-------------------------------------------------------------- -void ofApp::keyReleased(int key){ - +void ofApp::keyReleased(int key){ + } //-------------------------------------------------------------- @@ -98,3 +98,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidFontExample/src/ofApp.h b/examples/android/androidFontExample/src/ofApp.h index fe4100361f3..084e9089c18 100644 --- a/examples/android/androidFontExample/src/ofApp.h +++ b/examples/android/androidFontExample/src/ofApp.h @@ -8,6 +8,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -27,6 +28,11 @@ class ofApp : public ofxAndroidApp{ void resume(); void reloadTextures(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + bool backPressed(); void okPressed(); void cancelPressed(); diff --git a/examples/android/androidGuiExample/src/main.cpp b/examples/android/androidGuiExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidGuiExample/src/main.cpp +++ b/examples/android/androidGuiExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidGuiExample/src/ofApp.cpp b/examples/android/androidGuiExample/src/ofApp.cpp index 89629a9779d..9f2e467d802 100644 --- a/examples/android/androidGuiExample/src/ofApp.cpp +++ b/examples/android/androidGuiExample/src/ofApp.cpp @@ -1,10 +1,10 @@ #include "ofApp.h" - + //-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); - + // we add this listener before setting up so the initial circle resolution is correct circleResolution.addListener(this, &ofApp::circleResolutionChanged); ringButton.addListener(this,&ofApp::ringButtonPressed); @@ -24,7 +24,7 @@ void ofApp::setup(){ gui.add(twoCircles.setup("twoCircles")); gui.add(ringButton.setup("ring")); gui.add(screenSize.set("screenSize", ofToString(ofGetWidth()) + "x" + ofToString(ofGetHeight()))); - + bHide = true; ring.load("ring.wav"); @@ -52,7 +52,7 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ ofBackgroundGradient(ofColor::white, ofColor::gray); - + if( filled ){ ofFill(); }else{ @@ -66,7 +66,7 @@ void ofApp::draw(){ }else{ ofCircle(center->x, center->y, radius ); } - + if( bHide ){ gui.draw(); } @@ -90,12 +90,12 @@ void ofApp::keyPressed(int key){ //-------------------------------------------------------------- void ofApp::keyReleased(int key){ - + } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ - + } //-------------------------------------------------------------- @@ -104,12 +104,12 @@ void ofApp::mouseDragged(int x, int y, int button){ //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ - + } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ - + } //-------------------------------------------------------------- @@ -129,10 +129,26 @@ void ofApp::windowResized(int w, int h){ //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ - + +} + +//-------------------------------------------------------------- +void ofApp::dragEvent(ofDragInfo dragInfo){ + +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { } //-------------------------------------------------------------- -void ofApp::dragEvent(ofDragInfo dragInfo){ - +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { } diff --git a/examples/android/androidGuiExample/src/ofApp.h b/examples/android/androidGuiExample/src/ofApp.h index be449b747fc..d7e5bb49e19 100644 --- a/examples/android/androidGuiExample/src/ofApp.h +++ b/examples/android/androidGuiExample/src/ofApp.h @@ -5,41 +5,54 @@ class ofApp : public ofBaseApp{ -public: - void setup(); - void update(); - void draw(); - - void exit(); - - void keyPressed(int key); - void keyReleased(int key); - void mouseMoved(int x, int y ); - void mouseDragged(int x, int y, int button); - void mousePressed(int x, int y, int button); - void mouseReleased(int x, int y, int button); - void mouseEntered(int x, int y); - void mouseExited(int x, int y); - void windowResized(int w, int h); - void dragEvent(ofDragInfo dragInfo); - void gotMessage(ofMessage msg); - - void circleResolutionChanged(int & circleResolution); - void ringButtonPressed(); - - bool bHide; - - ofParameter radius; - ofParameter color; - ofParameter center; - ofParameter circleResolution; - ofParameter filled; - ofxButton twoCircles; - ofxButton ringButton; - ofParameter screenSize; - - ofxPanel gui; - - ofSoundPlayer ring; + public: + void setup(); + void exit(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void mouseMoved(int x, int y ); + void mouseDragged(int x, int y, int button); + void mousePressed(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void mouseEntered(int x, int y); + void mouseExited(int x, int y); + void windowResized(int w, int h); + void dragEvent(ofDragInfo dragInfo); + void gotMessage(ofMessage msg); + + void circleResolutionChanged(int & circleResolution); + void ringButtonPressed(); + + void pause(); + void stop(); + void resume(); + void reloadTextures(); + + bool backPressed(); + void okPressed(); + void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + + bool bHide; + + ofParameter radius; + ofParameter color; + ofParameter center; + ofParameter circleResolution; + ofParameter filled; + ofxButton twoCircles; + ofxButton ringButton; + ofParameter screenSize; + + ofxPanel gui; + + ofSoundPlayer ring; }; diff --git a/examples/android/androidImageExample/src/main.cpp b/examples/android/androidImageExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidImageExample/src/main.cpp +++ b/examples/android/androidImageExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidImageExample/src/ofApp.cpp b/examples/android/androidImageExample/src/ofApp.cpp index 4fadb67f7c0..d544f06b119 100644 --- a/examples/android/androidImageExample/src/ofApp.cpp +++ b/examples/android/androidImageExample/src/ofApp.cpp @@ -13,72 +13,60 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - image.draw(20,20); + image.draw(20,20); } //-------------------------------------------------------------- -void ofApp::keyPressed (int key){ - +void ofApp::keyPressed(int key){ + } //-------------------------------------------------------------- -void ofApp::keyReleased(int key){ - +void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ - } //-------------------------------------------------------------- void ofApp::touchDown(int x, int y, int id){ - } //-------------------------------------------------------------- void ofApp::touchMoved(int x, int y, int id){ - } //-------------------------------------------------------------- void ofApp::touchUp(int x, int y, int id){ - } //-------------------------------------------------------------- void ofApp::touchDoubleTap(int x, int y, int id){ - } //-------------------------------------------------------------- void ofApp::touchCancelled(int x, int y, int id){ - } //-------------------------------------------------------------- void ofApp::swipe(ofxAndroidSwipeDir swipeDir, int id){ - } //-------------------------------------------------------------- void ofApp::pause(){ - } //-------------------------------------------------------------- void ofApp::stop(){ - } //-------------------------------------------------------------- void ofApp::resume(){ - } //-------------------------------------------------------------- void ofApp::reloadTextures(){ - } //-------------------------------------------------------------- @@ -88,10 +76,31 @@ bool ofApp::backPressed(){ //-------------------------------------------------------------- void ofApp::okPressed(){ - } //-------------------------------------------------------------- void ofApp::cancelPressed(){ +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { } + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} + + diff --git a/examples/android/androidImageExample/src/ofApp.h b/examples/android/androidImageExample/src/ofApp.h index 40fa3cf93e2..eed01be49bf 100644 --- a/examples/android/androidImageExample/src/ofApp.h +++ b/examples/android/androidImageExample/src/ofApp.h @@ -4,10 +4,11 @@ #include "ofxAndroid.h" class ofApp : public ofxAndroidApp{ - + public: - + void setup(); + void exit(); void update(); void draw(); @@ -31,5 +32,10 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); - ofImage image; + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + + ofImage image; }; diff --git a/examples/android/androidJavaOnlyActivityExample/srcJava/cc/openframeworks/androidNativeActivityExample/FirstActivity.java b/examples/android/androidJavaOnlyActivityExample/ofApp/src/java/cc/openframeworks/androidNativeActivityExample/FirstActivity.java similarity index 100% rename from examples/android/androidJavaOnlyActivityExample/srcJava/cc/openframeworks/androidNativeActivityExample/FirstActivity.java rename to examples/android/androidJavaOnlyActivityExample/ofApp/src/java/cc/openframeworks/androidNativeActivityExample/FirstActivity.java diff --git a/examples/android/androidJavaOnlyActivityExample/src/ofApp.cpp b/examples/android/androidJavaOnlyActivityExample/src/ofApp.cpp index 717100d35b5..1df79f0d908 100644 --- a/examples/android/androidJavaOnlyActivityExample/src/ofApp.cpp +++ b/examples/android/androidJavaOnlyActivityExample/src/ofApp.cpp @@ -99,3 +99,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidJavaOnlyActivityExample/src/ofApp.h b/examples/android/androidJavaOnlyActivityExample/src/ofApp.h index fe4100361f3..7f2d40ec9c7 100644 --- a/examples/android/androidJavaOnlyActivityExample/src/ofApp.h +++ b/examples/android/androidJavaOnlyActivityExample/src/ofApp.h @@ -8,6 +8,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -31,5 +32,10 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofTrueTypeFont font; }; diff --git a/examples/android/androidMultiOFActivitiesExample/src/ofApp.cpp b/examples/android/androidMultiOFActivitiesExample/src/ofApp.cpp index 11c82a69b8d..88572811956 100644 --- a/examples/android/androidMultiOFActivitiesExample/src/ofApp.cpp +++ b/examples/android/androidMultiOFActivitiesExample/src/ofApp.cpp @@ -123,3 +123,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidMultiOFActivitiesExample/src/ofApp.h b/examples/android/androidMultiOFActivitiesExample/src/ofApp.h index 5d1997a012e..b1793a22612 100644 --- a/examples/android/androidMultiOFActivitiesExample/src/ofApp.h +++ b/examples/android/androidMultiOFActivitiesExample/src/ofApp.h @@ -13,6 +13,7 @@ class ofApp : public ofxAndroidApp{ ~ofApp(); void setup(); + void exit(); void update(); void draw(); @@ -35,4 +36,9 @@ class ofApp : public ofxAndroidApp{ bool backPressed(); void okPressed(); void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); }; diff --git a/examples/android/androidOpenCVExample/src/main.cpp b/examples/android/androidOpenCVExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidOpenCVExample/src/main.cpp +++ b/examples/android/androidOpenCVExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidOpenCVExample/src/ofApp.cpp b/examples/android/androidOpenCVExample/src/ofApp.cpp index 7c647e17125..5dda46c7a98 100644 --- a/examples/android/androidOpenCVExample/src/ofApp.cpp +++ b/examples/android/androidOpenCVExample/src/ofApp.cpp @@ -125,4 +125,25 @@ void ofApp::okPressed(){ //-------------------------------------------------------------- void ofApp::cancelPressed(){ +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + } \ No newline at end of file diff --git a/examples/android/androidOpenCVExample/src/ofApp.h b/examples/android/androidOpenCVExample/src/ofApp.h index c0ef6a4b43b..efe3356b864 100644 --- a/examples/android/androidOpenCVExample/src/ofApp.h +++ b/examples/android/androidOpenCVExample/src/ofApp.h @@ -10,6 +10,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -33,6 +34,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofVideoGrabber grabber; ofxCvGrayscaleImage gray, bg;//, diff; ofxCvContourFinder contourFinder; diff --git a/examples/android/androidOpenCVFaceExample/src/main.cpp b/examples/android/androidOpenCVFaceExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidOpenCVFaceExample/src/main.cpp +++ b/examples/android/androidOpenCVFaceExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidOpenCVFaceExample/src/ofApp.cpp b/examples/android/androidOpenCVFaceExample/src/ofApp.cpp index 275bfcd9a9a..6db893bc731 100644 --- a/examples/android/androidOpenCVFaceExample/src/ofApp.cpp +++ b/examples/android/androidOpenCVFaceExample/src/ofApp.cpp @@ -142,3 +142,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidOpenCVFaceExample/src/ofApp.h b/examples/android/androidOpenCVFaceExample/src/ofApp.h index 8128b7390b6..72e7e96a80f 100644 --- a/examples/android/androidOpenCVFaceExample/src/ofApp.h +++ b/examples/android/androidOpenCVFaceExample/src/ofApp.h @@ -11,6 +11,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -34,6 +35,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofVideoGrabber grabber; ofxCvColorImage colorCv; ofxCvColorImage colorCvSmall; diff --git a/examples/android/androidPolygonExample/src/main.cpp b/examples/android/androidPolygonExample/src/main.cpp index ef340ca94b8..7292fddd18e 100644 --- a/examples/android/androidPolygonExample/src/main.cpp +++ b/examples/android/androidPolygonExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 1; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidPolygonExample/src/ofApp.cpp b/examples/android/androidPolygonExample/src/ofApp.cpp index c2880aba625..535d21279a6 100644 --- a/examples/android/androidPolygonExample/src/ofApp.cpp +++ b/examples/android/androidPolygonExample/src/ofApp.cpp @@ -3,15 +3,15 @@ //-------------------------------------------------------------- void ofApp::setup(){ //ofSetOrientation(OF_ORIENTATION_90_RIGHT); - + //this is to scale down the example for the iphone screen appIphoneScale = 0.5; - ofBackground(255,255,255); + ofBackground(255,255,255); ofSetFrameRate(60); - + nCurveVertices = 7; - + curveVertices[0].x = 326; curveVertices[0].y = 209; curveVertices[1].x = 306; @@ -26,7 +26,7 @@ void ofApp::setup(){ curveVertices[5].y = 309; curveVertices[6].x = 345; curveVertices[6].y = 279; - + for (int i = 0; i < nCurveVertices; i++){ curveVertices[i].bOver = false; curveVertices[i].bBeingDragged = false; @@ -51,14 +51,14 @@ void ofApp::draw(){ ofSetHexColor(0xe0be21); //------(a)-------------------------------------- - // + // // draw a star // // use poly winding odd, the default rule // // info about the winding rules is here: // http://glprogramming.com/red/images/Image128.gif - // + // ofSetPolyMode(OF_POLY_WINDING_ODD); // this is the normal mode ofBeginShape(); ofVertex(200,135); @@ -67,17 +67,17 @@ void ofApp::draw(){ ofVertex(105,200); ofVertex(50,25); ofEndShape(); - - + + //------(b)-------------------------------------- - // + // // draw a star // // use poly winding nonzero // // info about the winding rules is here: // http://glprogramming.com/red/images/Image128.gif - // + // ofSetHexColor(0xb5de10); ofSetPolyMode(OF_POLY_WINDING_NONZERO); ofBeginShape(); @@ -88,11 +88,11 @@ void ofApp::draw(){ ofVertex(250,25); ofEndShape(); //------------------------------------- - - - + + + //------(c)-------------------------------------- - // + // // draw a star dynamically // // use the mouse position as a pct @@ -108,7 +108,7 @@ void ofApp::draw(){ float origx = 525; float origy = 100; float angle = 0; - + ofSetHexColor(0xa16bca); ofBeginShape(); for (int i = 0; i < nStarPts; i++){ @@ -127,14 +127,14 @@ void ofApp::draw(){ } ofEndShape(); //------------------------------------- - + //------(d)-------------------------------------- - // + // // poylgon of random points // // lots of self intersection, 500 pts is a good stress test - // - // + // + // ofSetHexColor(0x0cb0b6); ofSetPolyMode(OF_POLY_WINDING_ODD); ofBeginShape(); @@ -143,10 +143,10 @@ void ofApp::draw(){ } ofEndShape(); //------------------------------------- - - + + //------(e)-------------------------------------- - // + // // use sin cos and time to make some spirally shape // ofPushMatrix(); @@ -155,42 +155,42 @@ void ofApp::draw(){ ofFill(); ofSetPolyMode(OF_POLY_WINDING_ODD); ofBeginShape(); - float angleStep = glm::two_pi()/(100.0f + std::sin(ofGetElapsedTimef()/5.0f) * 60); + float angleStep = glm::two_pi()/(100.0f + std::sin(ofGetElapsedTimef()/5.0f) * 60); float radiusAdder = 0.5f; float radius = 0; for (int i = 0; i < 200; i++){ float anglef = (i) * angleStep; float x = radius * std::cos(anglef); - float y = radius * std::sin(anglef); + float y = radius * std::sin(anglef); ofVertex(x,y); - radius += radiusAdder; + radius += radiusAdder; } ofEndShape(OF_CLOSE); ofPopMatrix(); //------------------------------------- - + //------(f)-------------------------------------- - // + // // ofCurveVertex - // - // because it uses catmul rom splines, we need to repeat the first and last + // + // because it uses catmul rom splines, we need to repeat the first and last // items so the curve actually goes through those points // ofSetHexColor(0x2bdbe6); ofBeginShape(); - + for (int i = 0; i < nCurveVertices; i++){ - - + + // sorry about all the if/states here, but to do catmull rom curves - // we need to duplicate the start and end points so the curve acutally + // we need to duplicate the start and end points so the curve acutally // goes through them. - + // for i == 0, we just call the vertex twice // for i == nCurveVertices-1 (last point) we call vertex 0 twice // otherwise just normal ofCurveVertex call - + if (i == 0){ ofCurveVertex(curveVertices[0].x, curveVertices[0].y); // we need to duplicate 0 for the curve to start at point 0 ofCurveVertex(curveVertices[0].x, curveVertices[0].y); // we need to duplicate 0 for the curve to start at point 0 @@ -202,10 +202,10 @@ void ofApp::draw(){ ofCurveVertex(curveVertices[i].x, curveVertices[i].y); } } - + ofEndShape(); - - + + // show a faint the non-curve version of the same polygon: ofEnableAlphaBlending(); ofNoFill(); @@ -215,8 +215,8 @@ void ofApp::draw(){ ofVertex(curveVertices[i].x, curveVertices[i].y); } ofEndShape(true); - - + + ofSetColor(0,0,0,80); for (int i = 0; i < nCurveVertices; i++){ if (curveVertices[i].bOver == true) ofFill(); @@ -225,17 +225,17 @@ void ofApp::draw(){ } ofDisableAlphaBlending(); //------------------------------------- - - + + //------(g)-------------------------------------- - // + // // ofBezierVertex - // + // // with ofBezierVertex we can draw a curve from the current vertex // through the the next three vertices we pass in. // (two control points and the final bezier point) - // - + // + float x0 = 500; float y0 = 300; float x1 = 550+50*cos(ofGetElapsedTimef()*1.0f); @@ -244,17 +244,17 @@ void ofApp::draw(){ float y2 = 300+100*sin(ofGetElapsedTimef()); float x3 = 650; float y3 = 300; - - - + + + ofFill(); ofSetHexColor(0xFF9933); ofBeginShape(); ofVertex(x0,y0); ofBezierVertex(x1,y1,x2,y2,x3,y3); ofEndShape(); - - + + ofEnableAlphaBlending(); ofFill(); ofSetColor(0,0,0,40); @@ -263,99 +263,99 @@ void ofApp::draw(){ ofCircle(x2,y2,4); ofCircle(x3,y3,4); ofDisableAlphaBlending(); - - - + + + //------(h)-------------------------------------- - // + // // holes / ofNextContour - // + // // with ofNextContour we can create multi-contour shapes - // this allows us to draw holes, for example... + // this allows us to draw holes, for example... // ofFill(); ofSetHexColor(0xd3ffd3); ofDrawRectangle(80,480,140,70); ofSetHexColor(0xff00ff); - + ofBeginShape(); - + ofVertex(100,500); ofVertex(180,550); ofVertex(100,600); - + ofNextContour(true); - + ofVertex(120,520); ofVertex(160,550); ofVertex(120,580); - + ofEndShape(true); //------------------------------------- - - + + //------(i)-------------------------------------- - // + // // CSG / ofNextContour - // - // with different winding rules, you can even use ofNextContour to - // perform constructive solid geometry - // + // + // with different winding rules, you can even use ofNextContour to + // perform constructive solid geometry + // // be careful, the clockwiseness or counter clockwisenss of your multiple // contours matters with these winding rules. // // for csg ideas, see : http://glprogramming.com/red/chapter11.html - // + // // info about the winding rules is here: // http://glprogramming.com/red/images/Image128.gif - // + // ofNoFill(); - - + + ofPushMatrix(); - + ofSetPolyMode(OF_POLY_WINDING_ODD); - + ofBeginShape(); - + ofVertex(300,500); ofVertex(380,550); ofVertex(300,600); - + ofNextContour(true); - + for (int i = 0; i < 20; i++){ float anglef = ((float)i / 19.0f) * glm::two_pi(); float x = 340 + 30 * std::cos(anglef); - float y = 550 + 30 * std::sin(anglef); + float y = 550 + 30 * std::sin(anglef); ofVertex(x,y); - radius += radiusAdder; + radius += radiusAdder; } - + ofEndShape(true); - + ofTranslate(100,0,0); - - ofSetPolyMode(OF_POLY_WINDING_NONZERO); + + ofSetPolyMode(OF_POLY_WINDING_NONZERO); ofBeginShape(); - + ofVertex(300,500); ofVertex(380,550); ofVertex(300,600); - + ofNextContour(true); - + for (int i = 0; i < 20; i++){ float anglef = ((float)i / 19.0f) * glm::two_pi(); float x = 340 + 30 * std::cos(anglef); - float y = 550 + 30 * std::sin(anglef); + float y = 550 + 30 * std::sin(anglef); ofVertex(x,y); - radius += radiusAdder; + radius += radiusAdder; } - + ofEndShape(true); - + ofTranslate(100,0,0); ofSetPolyMode(OF_POLY_WINDING_ABS_GEQ_TWO); ofBeginShape(); @@ -363,50 +363,50 @@ void ofApp::draw(){ ofVertex(380,550); ofVertex(300,600); ofNextContour(true); - + for (int i = 0; i < 20; i++){ float anglef = ((float)i / 19.0f) * glm::two_pi(); float x = 340 + 30 * cos(anglef); - float y = 550 + 30 * sin(anglef); + float y = 550 + 30 * sin(anglef); ofVertex(x,y); - radius += radiusAdder; + radius += radiusAdder; } - - + + ofEndShape(true); - + ofPopMatrix(); //------------------------------------- - - + + ofSetHexColor(0x000000); ofDrawBitmapString("(a) star\nwinding rule odd", 20,210); - + ofSetHexColor(0x000000); ofDrawBitmapString("(b) star\nwinding rule nonzero", 220,210); - + ofSetHexColor(0x000000); ofDrawBitmapString("(c) dynamically\ncreated shape", 420,210); - + ofSetHexColor(0x000000); ofDrawBitmapString("(d) random points\npoly", 670,210); - + ofSetHexColor(0x000000); ofDrawBitmapString("(e) fun with sin/cos", 20,410); - + ofSetHexColor(0x000000); ofDrawBitmapString("(f) ofCurveVertex\nuses catmull rom\nto make curved shapes", 220,410); - + ofSetHexColor(0x000000); ofDrawBitmapString("(g) ofBezierVertex\nuses bezier to draw curves", 460,410); - - + + ofSetHexColor(0x000000); ofDrawBitmapString("(h) ofNextContour\nallows for holes", 20,610); - + ofSetHexColor(0x000000); ofDrawBitmapString("(i) ofNextContour\ncan even be used for CSG operations\nsuch as union and intersection", 260,620); - + } //-------------------------------------------------------------- @@ -510,3 +510,25 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} + diff --git a/examples/android/androidPolygonExample/src/ofApp.h b/examples/android/androidPolygonExample/src/ofApp.h index 1476d7dcc5d..ee4dbc15f45 100644 --- a/examples/android/androidPolygonExample/src/ofApp.h +++ b/examples/android/androidPolygonExample/src/ofApp.h @@ -10,41 +10,48 @@ typedef struct { bool bBeingDragged; bool bOver; float radius; - + } draggableVertex; class ofApp : public ofxAndroidApp { - -public: - void setup(); - void update(); - void draw(); - - void keyPressed(int key); - void keyReleased(int key); - void windowResized(int w, int h); - - void touchDown(int x, int y, int id); - void touchMoved(int x, int y, int id); - void touchUp(int x, int y, int id); - void touchDoubleTap(int x, int y, int id); - void touchCancelled(int x, int y, int id); - void swipe(ofxAndroidSwipeDir swipeDir, int id); - - void pause(); - void stop(); - void resume(); - void reloadTextures(); - - bool backPressed(); - void okPressed(); - void cancelPressed(); - - int nCurveVertices; - draggableVertex curveVertices[7]; - draggableVertex bezierVertices[4]; - - float appIphoneScale; + + public: + void setup(); + void exit(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void windowResized(int w, int h); + + void touchDown(int x, int y, int id); + void touchMoved(int x, int y, int id); + void touchUp(int x, int y, int id); + void touchDoubleTap(int x, int y, int id); + void touchCancelled(int x, int y, int id); + void swipe(ofxAndroidSwipeDir swipeDir, int id); + + void pause(); + void stop(); + void resume(); + void reloadTextures(); + + bool backPressed(); + void okPressed(); + void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + + + int nCurveVertices; + draggableVertex curveVertices[7]; + draggableVertex bezierVertices[4]; + + float appIphoneScale; }; diff --git a/examples/android/androidShaderExample/src/main.cpp b/examples/android/androidShaderExample/src/main.cpp index 949d8e9b991..f98043c5a8c 100644 --- a/examples/android/androidShaderExample/src/main.cpp +++ b/examples/android/androidShaderExample/src/main.cpp @@ -1,28 +1,49 @@ #include "ofMain.h" #include "ofApp.h" + +#ifdef TARGET_ANDROID + +#include "ofWindowSettings.h" #include "ofGLProgrammableRenderer.h" -int main(){ - ofGLESWindowSettings settings; - settings.setGLESVersion(2); - ofCreateWindow(settings); // <-------- setup the GL context +shared_ptr *ofapp; +std::shared_ptr baseWindow; - // this kicks off the running of my app - // can be OF_WINDOW or OF_FULLSCREEN - // pass in width and height too: - return ofRunApp( new ofApp() ); +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidShaderExample/src/ofApp.cpp b/examples/android/androidShaderExample/src/ofApp.cpp index 671c51e4ae6..0c2ffc668d1 100644 --- a/examples/android/androidShaderExample/src/ofApp.cpp +++ b/examples/android/androidShaderExample/src/ofApp.cpp @@ -136,3 +136,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ }; + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidShaderExample/src/ofApp.h b/examples/android/androidShaderExample/src/ofApp.h index e7163b7d3e7..ac8d62dd845 100644 --- a/examples/android/androidShaderExample/src/ofApp.h +++ b/examples/android/androidShaderExample/src/ofApp.h @@ -10,6 +10,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -33,6 +34,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofPath text; ofTrueTypeFont font; diff --git a/examples/android/androidSoundPlayerExample/src/main.cpp b/examples/android/androidSoundPlayerExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidSoundPlayerExample/src/main.cpp +++ b/examples/android/androidSoundPlayerExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidSoundPlayerExample/src/ofApp.cpp b/examples/android/androidSoundPlayerExample/src/ofApp.cpp index c560f92d8f6..baa48965511 100644 --- a/examples/android/androidSoundPlayerExample/src/ofApp.cpp +++ b/examples/android/androidSoundPlayerExample/src/ofApp.cpp @@ -163,3 +163,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidSoundPlayerExample/src/ofApp.h b/examples/android/androidSoundPlayerExample/src/ofApp.h index c0180a2a39d..e87e3a0cf0a 100644 --- a/examples/android/androidSoundPlayerExample/src/ofApp.h +++ b/examples/android/androidSoundPlayerExample/src/ofApp.h @@ -7,6 +7,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -30,6 +31,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofSoundPlayer beats; ofSoundPlayer synth; ofSoundPlayer vocals; diff --git a/examples/android/androidSwipeExample/src/main.cpp b/examples/android/androidSwipeExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidSwipeExample/src/main.cpp +++ b/examples/android/androidSwipeExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidSwipeExample/src/ofApp.cpp b/examples/android/androidSwipeExample/src/ofApp.cpp index 32a2ad3cacb..0b1b74ff352 100644 --- a/examples/android/androidSwipeExample/src/ofApp.cpp +++ b/examples/android/androidSwipeExample/src/ofApp.cpp @@ -87,3 +87,24 @@ void ofApp::touchCancelled(int x, int y, int id){ void ofApp::swipe(ofxAndroidSwipeDir swipeDir, int id){ ofLogNotice() << "swipes " << swipeDir << id; } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidSwipeExample/src/ofApp.h b/examples/android/androidSwipeExample/src/ofApp.h index 7317b425a46..9392f172b13 100644 --- a/examples/android/androidSwipeExample/src/ofApp.h +++ b/examples/android/androidSwipeExample/src/ofApp.h @@ -8,8 +8,9 @@ class ofApp : public ofxAndroidApp{ public: - + void setup(); + void exit(); void update(); void draw(); @@ -29,6 +30,20 @@ class ofApp : public ofxAndroidApp{ void touchDoubleTap(int x, int y, int id); void touchCancelled(int x, int y, int id); void swipe(ofxAndroidSwipeDir swipeDir, int id); + + void pause(); + void stop(); + void resume(); + void reloadTextures(); + + bool backPressed(); + void okPressed(); + void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); }; #endif diff --git a/examples/android/androidTouchExample/src/main.cpp b/examples/android/androidTouchExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidTouchExample/src/main.cpp +++ b/examples/android/androidTouchExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidTouchExample/src/ofApp.cpp b/examples/android/androidTouchExample/src/ofApp.cpp index 0db697263a8..b170a5b81b1 100644 --- a/examples/android/androidTouchExample/src/ofApp.cpp +++ b/examples/android/androidTouchExample/src/ofApp.cpp @@ -102,3 +102,24 @@ void ofApp::cancelPressed(){ } +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} + diff --git a/examples/android/androidTouchExample/src/ofApp.h b/examples/android/androidTouchExample/src/ofApp.h index 51e1ea0d5c2..fa6dd35acec 100644 --- a/examples/android/androidTouchExample/src/ofApp.h +++ b/examples/android/androidTouchExample/src/ofApp.h @@ -10,31 +10,36 @@ class ofApp : public ofxAndroidApp { -public: - - void setup(); - void update(); - void draw(); - void keyPressed(int key); - void keyReleased(int key); - void windowResized(int w, int h); - - void touchDown(int x, int y, int id); - void touchMoved(int x, int y, int id); - void touchUp(int x, int y, int id); - void touchDoubleTap(int x, int y, int id); - void touchCancelled(int x, int y, int id); - void swipe(ofxAndroidSwipeDir swipeDir, int id); - - void pause(); - void stop(); - void resume(); - void reloadTextures(); - - bool backPressed(); - void okPressed(); - void cancelPressed(); - + public: + + void setup(); + void exit(); + void update(); + void draw(); + void keyPressed(int key); + void keyReleased(int key); + void windowResized(int w, int h); + + void touchDown(int x, int y, int id); + void touchMoved(int x, int y, int id); + void touchUp(int x, int y, int id); + void touchDoubleTap(int x, int y, int id); + void touchCancelled(int x, int y, int id); + void swipe(ofxAndroidSwipeDir swipeDir, int id); + + void pause(); + void stop(); + void resume(); + void reloadTextures(); + + bool backPressed(); + void okPressed(); + void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); Ball balls[NUM_POINTS]; }; diff --git a/examples/android/androidVBOExample/src/main.cpp b/examples/android/androidVBOExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidVBOExample/src/main.cpp +++ b/examples/android/androidVBOExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidVBOExample/src/ofApp.cpp b/examples/android/androidVBOExample/src/ofApp.cpp index f20dc8ed4b4..86ed68625b3 100644 --- a/examples/android/androidVBOExample/src/ofApp.cpp +++ b/examples/android/androidVBOExample/src/ofApp.cpp @@ -191,3 +191,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidVBOExample/src/ofApp.h b/examples/android/androidVBOExample/src/ofApp.h index 7d4a14d7177..18de3f3cb8f 100644 --- a/examples/android/androidVBOExample/src/ofApp.h +++ b/examples/android/androidVBOExample/src/ofApp.h @@ -9,39 +9,45 @@ class ofApp : public ofxAndroidApp { -public: - void setup(); - void update(); - void draw(); - - void keyPressed(int key); - void keyReleased(int key); - void windowResized(int w, int h); - - void touchDown(int x, int y, int id); - void touchMoved(int x, int y, int id); - void touchUp(int x, int y, int id); - void touchDoubleTap(int x, int y, int id); - void touchCancelled(int x, int y, int id); - void swipe(ofxAndroidSwipeDir swipeDir, int id); - - void pause(); - void stop(); - void resume(); - void reloadTextures(); - - bool backPressed(); - void okPressed(); - void cancelPressed(); - - ofVbo vbo; - glm::vec3 pos[GRID_WIDTH*GRID_HEIGHT*LENGTH]; - glm::vec3 center; - - float restLength; - int total; - int space; - int count; - bool bPause; - int zoom, zoomTarget; + public: + void setup(); + void exit(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void windowResized(int w, int h); + + void touchDown(int x, int y, int id); + void touchMoved(int x, int y, int id); + void touchUp(int x, int y, int id); + void touchDoubleTap(int x, int y, int id); + void touchCancelled(int x, int y, int id); + void swipe(ofxAndroidSwipeDir swipeDir, int id); + + void pause(); + void stop(); + void resume(); + void reloadTextures(); + + bool backPressed(); + void okPressed(); + void cancelPressed(); + + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + + ofVbo vbo; + glm::vec3 pos[GRID_WIDTH*GRID_HEIGHT*LENGTH]; + glm::vec3 center; + + float restLength; + int total; + int space; + int count; + bool bPause; + int zoom, zoomTarget; }; diff --git a/examples/android/androidVibratorExample/src/main.cpp b/examples/android/androidVibratorExample/src/main.cpp index ef340ca94b8..f98043c5a8c 100644 --- a/examples/android/androidVibratorExample/src/main.cpp +++ b/examples/android/androidVibratorExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 2; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidVibratorExample/src/ofApp.cpp b/examples/android/androidVibratorExample/src/ofApp.cpp index 4353b01bf0e..f1f3b83ed29 100644 --- a/examples/android/androidVibratorExample/src/ofApp.cpp +++ b/examples/android/androidVibratorExample/src/ofApp.cpp @@ -122,3 +122,24 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidVibratorExample/src/ofApp.h b/examples/android/androidVibratorExample/src/ofApp.h index 62103a7d72d..cbd7b8e90c4 100644 --- a/examples/android/androidVibratorExample/src/ofApp.h +++ b/examples/android/androidVibratorExample/src/ofApp.h @@ -8,6 +8,7 @@ class ofApp : public ofxAndroidApp{ public: void setup(); + void exit(); void update(); void draw(); @@ -31,6 +32,11 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + vector areas; bool inside; }; diff --git a/examples/android/androidVideoExample/src/main.cpp b/examples/android/androidVideoExample/src/main.cpp index ef340ca94b8..7292fddd18e 100644 --- a/examples/android/androidVideoExample/src/main.cpp +++ b/examples/android/androidVideoExample/src/main.cpp @@ -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; +std::shared_ptr baseWindow; + +//-------------------------------------------------------------- +int main(int argc, char **argv) { + baseWindow = std::make_shared(); + ofxAndroidWindowSettings settings; + settings.glesVersion = 1; + settings.setSize(1920, 1080); + settings.windowMode = OF_WINDOW; + settings.preserveContextOnPause = true; + baseWindow = ofCreateWindow(settings); + ofapp = new shared_ptr(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 diff --git a/examples/android/androidVideoExample/src/ofApp.cpp b/examples/android/androidVideoExample/src/ofApp.cpp index 36ef5e8601c..bd6d9239c5c 100644 --- a/examples/android/androidVideoExample/src/ofApp.cpp +++ b/examples/android/androidVideoExample/src/ofApp.cpp @@ -3,7 +3,18 @@ //-------------------------------------------------------------- void ofApp::setup(){ - player.load("hands.mp4"); + ofLogNotice() << "Resolved path: " << ofToDataPath("hands.mp4", true); + + + ofDirectory dir(ofToDataPath("", true)); + dir.listDir(); + + ofLogNotice() << "Listing of: " << dir.getAbsolutePath(); + for (size_t i = 0; i < dir.size(); ++i) { + ofLogNotice() << " " << dir.getFile(i).getFileName(); + } + + player.load("hands.mp4"); player.play(); } @@ -23,13 +34,13 @@ void ofApp::draw(){ } //-------------------------------------------------------------- -void ofApp::keyPressed (int key){ - +void ofApp::keyPressed (int key){ + } //-------------------------------------------------------------- -void ofApp::keyReleased(int key){ - +void ofApp::keyReleased(int key){ + } //-------------------------------------------------------------- @@ -101,3 +112,23 @@ void ofApp::okPressed(){ void ofApp::cancelPressed(){ } + +void ofApp::deviceRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChanged(int refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::deviceHighestRefreshRateChangedEvent(int &refreshRate) { +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} diff --git a/examples/android/androidVideoExample/src/ofApp.h b/examples/android/androidVideoExample/src/ofApp.h index 3927bdb480a..6c99f943f0b 100644 --- a/examples/android/androidVideoExample/src/ofApp.h +++ b/examples/android/androidVideoExample/src/ofApp.h @@ -3,20 +3,14 @@ #include "ofMain.h" #include "ofxAndroid.h" -// This example and in general ofVideoPlayer on -// android will only work with ice cream sandwich -// or later versions since the calls required to get -// an openGL texture from the video frames are only -// available from that version - class ofApp : public ofxAndroidApp{ - + public: - void setup(); + void exit(); void update(); void draw(); - + void keyPressed(int key); void keyReleased(int key); void windowResized(int w, int h); @@ -37,6 +31,10 @@ class ofApp : public ofxAndroidApp{ void okPressed(); void cancelPressed(); - ofVideoPlayer player; + void deviceRefreshRateChanged(int refreshRate); + void deviceHighestRefreshRateChanged(int refreshRate); + void deviceRefreshRateChangedEvent(int &refreshRate); + void deviceHighestRefreshRateChangedEvent(int & refreshRate); + ofVideoPlayer player; }; diff --git a/libs/openFrameworksCompiled/project/android/cmake.sh b/libs/openFrameworksCompiled/project/android/cmake.sh index d5db289b62e..02bf05db114 100755 --- a/libs/openFrameworksCompiled/project/android/cmake.sh +++ b/libs/openFrameworksCompiled/project/android/cmake.sh @@ -107,6 +107,7 @@ for ARCHE in $ARCH; do -DANDROID_TOOLCHAIN=clang \ -DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT \ -DANDROID_ABI=${ARCHE} \ + -DANDROID=TRUE \ -DANDROID_API=${ANDROID_API} \ -DCMAKE_MAKE_PROGRAM="${NINJA_PATH}" \ -DCMAKE_CXX_FLAGS="-DUSE_PTHREADS=1 -fvisibility-inlines-hidden -std=c++${CPP_STANDARD} -frtti" \ diff --git a/libs/openFrameworksCompiled/project/android/openframeworksAndroid/CMakeLists.txt b/libs/openFrameworksCompiled/project/android/openframeworksAndroid/CMakeLists.txt index a74d89d1658..93dd0f4961d 100644 --- a/libs/openFrameworksCompiled/project/android/openframeworksAndroid/CMakeLists.txt +++ b/libs/openFrameworksCompiled/project/android/openframeworksAndroid/CMakeLists.txt @@ -117,6 +117,8 @@ include_directories( ${PRJ_LIBS_ROOT}/curl/include ) +add_definitions(-DANDROID) + find_library(ANDROID_LIB NAMES android) find_library(LOG_LIB NAMES log) find_library(GLES1_LIB NAMES GLESv1_CM) @@ -131,6 +133,17 @@ target_link_libraries(openFrameworksAndroid dl ) +find_library(atomic_lib atomic) +if(atomic_lib) + target_link_libraries(openFrameworksAndroid ${atomic_lib}) +endif() + +find_library(mediandk_lib mediandk) + +target_link_libraries(openFrameworksAndroid + ${mediandk_lib} +) + target_link_libraries(openFrameworksAndroid ${ANDROID_LIB} ${GLES2_LIB} @@ -139,7 +152,6 @@ target_link_libraries(openFrameworksAndroid ${LOG_LIB} ) - target_link_libraries(openFrameworksAndroid ${PRJ_LIBS_ROOT}/brotli/lib/android/${ANDROID_ABI}/libbrotlicommon.a ${PRJ_LIBS_ROOT}/brotli/lib/android/${ANDROID_ABI}/libbrotlidec.a diff --git a/scripts/templates/android/build.gradle b/scripts/templates/android/build.gradle index 4b345aba2d9..e2f1d82ba6a 100644 --- a/scripts/templates/android/build.gradle +++ b/scripts/templates/android/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.9.0' + classpath 'com.android.tools.build:gradle:8.9.3' } } @@ -30,7 +30,7 @@ final ofLibProject = ofMainRoot() + 'libs/openFrameworksCompiled/project/android task printPaths { doLast { - println "🔍 Checking Paths..." + println "Checking Paths..." println "OF Source: ${file(ofSource).absolutePath}" println "OF Lib Output: ${file(ofLibProject).absolutePath}" println "Current Working Directory: ${projectDir.absolutePath}" @@ -40,16 +40,16 @@ task printPaths { task checkGradleDir { doLast { def gradleDir = file(ofLibProject).absoluteFile - println "🔍 Checking directory: ${gradleDir}" - println "✅ Exists? ${gradleDir.exists()}" - println "📂 List contents: ${gradleDir.listFiles()}" + println "Checking directory: ${gradleDir}" + println "Exists? ${gradleDir.exists()}" + println "List contents: ${gradleDir.listFiles()}" } } task setupGradle { doLast { - println "🔍 Checking Gradle setup..." + println "Checking Gradle setup..." def gradleDir = file(ofLibProject).absoluteFile def gradleWrapper = new File(gradleDir, "gradlew") diff --git a/scripts/templates/android/gradle/wrapper/gradle-wrapper.jar b/scripts/templates/android/gradle/wrapper/gradle-wrapper.jar index a4b76b9530d..13372aef5e2 100644 Binary files a/scripts/templates/android/gradle/wrapper/gradle-wrapper.jar and b/scripts/templates/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/scripts/templates/android/gradle/wrapper/gradle-wrapper.properties b/scripts/templates/android/gradle/wrapper/gradle-wrapper.properties index e2847c82004..cca506a19f5 100644 --- a/scripts/templates/android/gradle/wrapper/gradle-wrapper.properties +++ b/scripts/templates/android/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ +#Fri Feb 11 01:53:09 AEDT 2025 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/scripts/templates/android/gradlew b/scripts/templates/android/gradlew deleted file mode 100755 index f5feea6d6b1..00000000000 --- a/scripts/templates/android/gradlew +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/scripts/templates/android/gradlew.bat b/scripts/templates/android/gradlew.bat deleted file mode 100644 index 9d21a21834d..00000000000 --- a/scripts/templates/android/gradlew.bat +++ /dev/null @@ -1,94 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/scripts/templates/android/ofApp/build.gradle b/scripts/templates/android/ofApp/build.gradle index 49249d61b92..04f60c08f17 100644 --- a/scripts/templates/android/ofApp/build.gradle +++ b/scripts/templates/android/ofApp/build.gradle @@ -18,64 +18,161 @@ def enableProguardInReleaseBuilds = true def enableProguardInDebugBuilds = false task wrapper(type: Wrapper) { - gradleVersion = '8.9.0' + gradleVersion = '8.14.3' } tasks.register("prepareKotlinBuildScriptModel"){ } def projectRoot = rootProject.projectDir.absolutePath def addonFile = new File(projectRoot, "addons.make") +println "projectRoot = ${projectRoot}" +println "addonFile = ${addonFile.absolutePath}" + + // Get all addon paths from addons.make + +def ofRoot = "/../../../" + def addonPaths = [] if (addonFile.exists()) { addonFile.eachLine { line -> - def addonPath = ofRoot + "addons/" + line - if (new File(addonPath).exists()) { + def addonRelPath = ofRoot + "/addons/" + line.trim() + def addonPath = new File(projectRoot, addonRelPath).canonicalFile + println "Resolved addon path: ${addonPath}" + if (addonPath.exists()) { addonPaths.add(addonPath) + } else { + println "Missing addon path: ${addonPath}" } } } +println "Checking path: ${addonPaths}" + + def addonIncludeDirs = [] +def addonSourceFiles = [] def addonLibs = [] // Collect include directories and libraries for each addon addonPaths.each { addon -> + // Add addon/src def includePath = new File(addon, "src") if (includePath.exists()) { addonIncludeDirs.add(includePath.absolutePath) + includePath.eachFileRecurse { file -> + if (file.name.endsWith(".cpp") || file.name.endsWith(".c")) { + println "Found C/CPP source: ${file}" + addonSourceFiles.add(file.absolutePath) + } + } + def javaDirs = [ + new File(addon, "java"), + new File(addon, "kotlin"), + new File(addon, "srcJava"), + new File(addon, "src") + ] + javaDirs.each { dir -> + if (dir.exists()) { + dir.eachFileRecurse { file -> + if (file.name.endsWith(".java") || file.name.endsWith(".kt")) { + println "Found Java/Kotlin source: ${file}" + addonSourceFiles.add(file.absolutePath) + } + } + } + } + } + // Add libs/*/include/ + def libsDir = new File(addon, "libs") + if (libsDir.exists()) { + libsDir.eachDir { subLib -> + def includeDir = new File(subLib, "include").canonicalFile + if (includeDir.exists()) { + println "Found sublib include: ${includeDir}" + addonIncludeDirs.add(includeDir.absolutePath) + } + } } } - // Define supported Android ABIs def supportedAbis = ["arm64-v8a", "armeabi-v7a", "x86_64"] +def currentAbis = [] +if (android.defaultConfig.ndk.abiFilters != null && !android.defaultConfig.ndk.abiFilters.isEmpty()) { + currentAbis = android.defaultConfig.ndk.abiFilters.toList() +} else { + currentAbis = supportedAbis +} +println "abiFilters type: ${android.defaultConfig.ndk.abiFilters?.getClass()}" +println "abiFilters value: ${android.defaultConfig.ndk.abiFilters}" +println "currentAbis value: ${currentAbis}" + +def addonLibMap = [:].withDefault { [] } +supportedAbis.each { abi -> addonLibMap[abi] = [] } addonPaths.each { addon -> - supportedAbis.each { abi -> - def libPath = new File(addon, "libs/android/${abi}") - if (libPath.exists()) { - def libFiles = libPath.listFiles()?.findAll { it.name.endsWith(".so") || it.name.endsWith(".a") } - if (libFiles) { - addonLibs.addAll(libFiles*.absolutePath) + def libsDir = new File(addon, "libs") + if (libsDir.exists() && libsDir.isDirectory()) { + libsDir.eachDir { subLib -> + def libRoot = new File(subLib, "lib/android") + supportedAbis.each { abi -> + def archDir = new File(libRoot, abi).canonicalFile + if (archDir.exists() && archDir.isDirectory()) { + def libFiles = archDir.listFiles()?.findAll { + it.name.endsWith(".so") || it.name.endsWith(".a") + } + if (libFiles) { + addonLibMap[abi].addAll(libFiles*.absolutePath) + } + } } } } } -println "Addon Libraries found: ${addonLibs}" + +addonPaths.each { addon -> + def libsDir = new File(addon, "libs") + if (libsDir.exists() && libsDir.isDirectory()) { + libsDir.eachDir { subLib -> + def libRoot = new File(subLib, "lib/android") + supportedAbis.each { abi -> + def archDir = new File(libRoot, abi).canonicalFile + println "Checking: ${archDir}" + if (archDir.exists() && archDir.isDirectory()) { + def libFiles = archDir.listFiles()?.findAll { + it.name.endsWith(".so") || it.name.endsWith(".a") + } + if (libFiles && !libFiles.isEmpty()) { + println "Found ${libFiles.size()} libraries in ${archDir}:" + libFiles.each { lib -> println " - ${lib.absolutePath}" } + addonLibs.addAll(libFiles*.absolutePath) + } else { + println "No libs found in ${archDir}" + } + } + } + } + } else { + println "No 'libs/' folder in ${addon.name}" + } +} +println "Addon Libraries found: [${addonLibs}]" // Convert lists to CMake arguments -def cmakeIncludeArgs = "-DADDON_INCLUDE_DIRS=" + addonIncludeDirs.join(";") -def cmakeLibArgs = "-DADDON_LIBS=" + addonLibs.join(";") +def cmakeIncludeArgs = "-DADDON_INCLUDE_DIRS=\"" + addonIncludeDirs.join(";") + "\"" +def cmakeLibArgs = "-DADDON_LIBS=\"" + addonLibs.join(";") + "\"" +def cmakeSrcArgs = "-DADDON_SOURCES=" + addonSourceFiles.join(";") println "Found addons: " + addonPaths println "Include directories: " + addonIncludeDirs -println "Libraries: " + addonLibs + + android { compileSdkVersion 34 buildToolsVersion '35.0.0' //ndkPath "/Users/x/android-ndk-r21e" // Point to your own NDK if needed - ndkVersion '28.0.13004108' // use android studio side loaded ndk + ndkVersion '28.2.13676358' // use android studio side loaded ndk buildFeatures { prefab true } @@ -91,30 +188,27 @@ android { } } defaultConfig { - applicationId "cc.openframeworks.emptyExample" // IMPORTANT : THIS DEFINES THE ID OF THE APK + applicationId "cc.openframeworks.androidAssimpExample" // IMPORTANT : THIS DEFINES THE ID OF THE APK minSdkVersion 24 targetSdkVersion 34 versionCode 12 versionName '12.0' ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' + def androidSTL = "-DANDROID_STL=c++_shared" + if (project.hasProperty("OF_STATIC") && project.OF_STATIC.toBoolean()) { + androidSTL "-DANDROID_STL=c++_static" + } + externalNativeBuild { cmake { arguments "-DANDROID_TOOLCHAIN=clang", - "-DTARGET_OPENGLES=TRUE" - - // Use c++_static if building OpenFrameworks as a STATIC library - if (project.hasProperty("OF_STATIC") && project.OF_STATIC.toBoolean()) { - arguments "-DANDROID_STL=c++_static" - } else { - arguments "-DANDROID_STL=c++_shared" - } - - // Enable NEON only for ARM architectures - if (android.defaultConfig.ndk.abiFilters.contains("armeabi-v7a") || android.defaultConfig.ndk.abiFilters.contains("arm64-v8a")) { - arguments "-DANDROID_ARM_NEON=TRUE" - } - + "-DTARGET_OPENGLES=TRUE", + "-DCMAKE_VERBOSE_MAKEFILE=ON", + cmakeIncludeArgs, + cmakeLibArgs, + cmakeSrcArgs, + androidSTL abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' version '3.22.1' } @@ -164,16 +258,15 @@ android { java.srcDirs = ["${PRJ_SRC_ROOT}/java", "${OFX_ANDROID}/Java"] res.srcDirs = ["${PRJ_SRC_ROOT}/res"] - assets { - srcDirs 'src/main/assets', 'src/main/bin/data' - } + assets { + srcDirs 'src/main/assets', '../bin/data' + } } } externalNativeBuild { cmake { path "${CMAKELIST_PATH}/CMakeLists.txt" } - } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/scripts/templates/android/ofApp/src/CMakeLists.txt b/scripts/templates/android/ofApp/src/CMakeLists.txt index 5eb2c9c1efd..694a5de3815 100644 --- a/scripts/templates/android/ofApp/src/CMakeLists.txt +++ b/scripts/templates/android/ofApp/src/CMakeLists.txt @@ -50,8 +50,9 @@ set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(TARGET_ANDROID ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ferror-limit=0 -std=c17 -Oz -Wall -fno-short-enums -fPIE -fPIC -fexceptions -ffunction-sections -fdata-sections") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ferror-limit=0 -std=c++23 -Oz -stdlib=libc++ -Wall -fno-short-enums -fPIE -fPIC -fexceptions -ffunction-sections -fdata-sections") +add_definitions(-DANDROID) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ferror-limit=0 -std=c17 -O3 -Wall -fno-short-enums -fPIE -fPIC -ffunction-sections -fdata-sections") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ferror-limit=0 -std=c++23 -O3 -stdlib=libc++ -Wall -fno-short-enums -fPIE -fPIC -fexceptions -ffunction-sections -fdata-sections") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export-dynamic") print_all_variables() set(OF_LIBRARY_TYPE "SHARED") # or "STATIC" @@ -68,6 +69,9 @@ add_library( ${PROJECT_NAME} ${OF_APP_SRC_PATH}/ofApp.cpp ) +file(GLOB_RECURSE APP_SRC CONFIGURE_DEPENDS "${OF_APP_SRC_PATH}/*.cpp") +target_sources(${PROJECT_NAME} PRIVATE ${APP_SRC}) + include_directories( ${PRJ_SOURCE_PATH}/3d ${PRJ_SOURCE_PATH}/app @@ -110,16 +114,45 @@ include_directories( ) # Load add-on include directories from Gradle + +if(DEFINED ADDON_SOURCES) + message(STATUS "Adding addon sources: ${ADDON_SOURCES}") + foreach(SRC ${ADDON_SOURCES}) + message(STATUS " - ${SRC}") + list(APPEND ADDON_SRC_LIST ${SRC}) + endforeach() + target_sources(${PROJECT_NAME} PRIVATE ${ADDON_SRC_LIST}) +endif() + + +if(NOT DEFINED ADDON_INCLUDE_DIRS AND DEFINED ENV{ADDON_INCLUDE_DIRS}) + set(ADDON_INCLUDE_DIRS $ENV{ADDON_INCLUDE_DIRS}) + message(STATUS "ADDON_INCLUDE_DIRS not defined, falling back to ENV: ${ADDON_INCLUDE_DIRS}") +endif() + if(DEFINED ADDON_INCLUDE_DIRS) + message(STATUS "Adding addon include dirs: ${ADDON_INCLUDE_DIRS}") foreach(DIR ${ADDON_INCLUDE_DIRS}) + message(STATUS "Adding addon include DIR: ${DIR}") include_directories(${DIR}) endforeach() endif() + +if(NOT DEFINED ADDON_LIBS AND DEFINED ENV{ADDON_LIBS}) + set(ADDON_LIBS $ENV{ADDON_LIBS}) + message(STATUS "ADDON_LIBS not defined, falling back to ENV: ${ADDON_LIBS}") +endif() + if(DEFINED ADDON_LIBS) - message(STATUS "Adding addon libraries: ${ADDON_LIBS}") + message(STATUS "Original ADDON_LIBS: ${ADDON_LIBS}") + set(FILTERED_ADDON_LIBS "") foreach(LIB ${ADDON_LIBS}) - target_link_libraries(${PROJECT_NAME} ${LIB}) + if("${LIB}" MATCHES "${ANDROID_ABI}") + list(APPEND FILTERED_ADDON_LIBS ${LIB}) + endif() endforeach() + message(STATUS "Filtered ADDON_LIBS for ABI '${ANDROID_ABI}': ${FILTERED_ADDON_LIBS}") + target_link_libraries(${PROJECT_NAME} ${FILTERED_ADDON_LIBS}) endif() find_library(ANDROID_LIB NAMES android) diff --git a/scripts/templates/android/ofApp/src/java/cc/openframeworks/android/OFActivity.java b/scripts/templates/android/ofApp/src/java/cc/openframeworks/android/OFActivity.java index a2d8b5f69a5..5ca7e903da8 100644 --- a/scripts/templates/android/ofApp/src/java/cc/openframeworks/android/OFActivity.java +++ b/scripts/templates/android/ofApp/src/java/cc/openframeworks/android/OFActivity.java @@ -1,30 +1,67 @@ package cc.openframeworks.android; +import androidx.annotation.Keep; +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowCompat; +import androidx.core.view.WindowInsetsCompat; +import androidx.core.view.WindowInsetsControllerCompat; + +import android.app.Activity; +import android.app.KeyguardManager; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.res.AssetManager; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.util.Log; +import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; -import androidx.core.view.ViewCompat; -import androidx.core.view.WindowCompat; -import androidx.core.view.WindowInsetsCompat; -import androidx.core.view.WindowInsetsControllerCompat; - import cc.openframeworks.OFAndroid; import cc.openframeworks.OFAndroidLifeCycle; import com.getkeepsafe.relinker.ReLinker; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import java.io.File; +import java.io.IOException; + +import cc.openframeworks.OFAndroid; +import cc.openframeworks.OFAndroidLifeCycle; +import cc.openframeworks.OFAndroidLifeCycleHelper; public class OFActivity extends cc.openframeworks.OFActivity { - private static final String appName = "ofApp"; // modify this to target appName (ofApp etc) + public static String appName = "ofApp"; // modify this to target appName (ofApp etc) private static final String LOG_TAG = appName + "::OFActivity"; + private static String dataPath=""; + private static SharedPreferences settings; + private boolean hasCreated = false; + private int frameRate = 0; + + boolean keep = false; + private ReLinker.Logger logcatLogger = new ReLinker.Logger() { + @Override + public void log(String message) { + Log.d("ReLinker", message); + } + }; // Extremely important public OFActivity() { @@ -59,26 +96,235 @@ public void failure(Throwable t) { }); } + private static final int BUFFER_SIZE = 5192; + + @Override - public void onCreate(Bundle savedInstanceState) - { + public void onCreate(Bundle savedInstanceState) { Log.i(LOG_TAG, "onCreate"); super.onCreate(savedInstanceState); - setFullscreen(); + setDataPath(this); + OFAndroidLifeCycleHelper.setCopyAssets(true); + ///OFAndroidLifeCycleHelper.setCopyOldAssets(true, ""); // old location was in error in a data folder. must move to keep in sync + + + setFullscreen(); hideSystemBars(); + if (!isTaskRoot()) { + Log.w(LOG_TAG, "isNotTask Root Detected. Closing new Activity. Due to launching resumed app from App Drawer / Play Games Link. Will continue normal activity"); + finish(); + return; + } else{ + Log.w(LOG_TAG, "isNotTask Root not Detected. Will continue with splash activity"); + } + getWindow().setTitle(getString(R.string.APP_NAME)); + OFAndroid.packageName = getPackageName(); + OFAndroidLifeCycle.reset(); // Reset STATIC + + settings = getSharedPreferences("OFActivity_settings", 0); + final String packageName = getPackageName(); + setDataPath(this); + + boolean isAssetsCopied = false; //settings.getBoolean("isAssetsCopied", false); + + + if(!isAssetsCopied) + { + Log.i(LOG_TAG, "No assets found, copying from app"); + if(copyAssetsToDataPath(this)){ // copy all assets + File settingsFile = null; + settingsFile = new File(dataPath); + boolean assetsAvailable = settingsFile != null && settingsFile.exists(); + assetsAvailable = settingsFile.exists(); // lets double check + if(assetsAvailable) { + Log.i(LOG_TAG, "Asset assets"); + SharedPreferences.Editor editor = settings.edit(); + editor.putBoolean("isAssetsCopied", true); + editor.commit(); + //StartoFApp(); + } else{ + Log.e(LOG_TAG, "Assets have not been copied correctly :("); + } + } else { + Log.e(LOG_TAG, "Assets have not been copied correctly :("); + } + } else { + //StartoFApp(); + } + + hasCreated = true; } - @Override - public void onStart() { - super.onStart(); + private void StartoFApp() { + Log.i(LOG_TAG, "StartoFApp"); + Intent intent = new Intent(); + //intent.setClassName(SplashScreenActivity.this, "cc.openframeworks.android.OFActivity"); + //startActivity(intent); + finish(); + } + + private static boolean copyAssetsToDataPath(Activity activity) { + OFAndroid.packageName = activity.getPackageName(); + Log.i(LOG_TAG,"starting resources extractor deploying to " + dataPath); + boolean copydata = false; + String[] files = new String[0]; + AssetManager am = activity.getApplicationContext().getAssets(); + try { + SharedPreferences preferences = activity.getPreferences(Context.MODE_PRIVATE); + long lastInstalled = preferences.getLong("installed", 0); + PackageManager pm = activity.getPackageManager(); + ApplicationInfo appInfo = pm.getApplicationInfo(OFAndroid.packageName, 0); + String appFile = appInfo.sourceDir; + long installed = new File(appFile).lastModified(); + //if(installed>lastInstalled){ + SharedPreferences.Editor editor = preferences.edit(); + editor.putLong("installed", installed); + editor.apply(); + copydata = true; + //} + files = am.list(""); + } catch (PackageManager.NameNotFoundException e1) { + copydata = false; + } catch (IOException e) { + e.printStackTrace(); + } + try { + if(copydata){ + for (String file : files) { + try { + if(DoCopyFile(file)) { + String unzipLocation = dataPath; + // Unzip assets.zip + // boolean succeed = false; //unpackZip(dataPath, "data.zip", dataPath); + //unzipFromAssets(activity, file, dataPath); + Log.i(LOG_TAG, "DoCopyFile: "+ file); + copyAssetFolder(am, file, dataPath+"/"+file); + // Store defaults + } else { + Log.i(LOG_TAG, "Dont CopyFile: "+ file); + } + } catch (Exception e) { + Log.e(LOG_TAG, "error copying file", e); + } + } + return true; + }else{ + return true; + } + } catch (Exception e) { + Log.e(LOG_TAG,"error retrieving app name",e); + } + return false; + } + + private static boolean DoCopyFile(String file) { + return file != null; + } + + private static void copyAssetFolder(AssetManager am, String src, String dest) throws IOException { + InputStream srcIS = null; + File destfh; + // this is the only way we can tell if this is a file or a + // folder - we have to open the asset, and if the open fails, + // it's a folder... + boolean isDir = false; + try { + srcIS = am.open(src); + } catch (FileNotFoundException e) { + isDir = true; + } + destfh = new File(dest); + if(isDir) { + Log.i("Copy ",src); + if( !destfh.exists() ){ + destfh.mkdir(); + } + String assets[] = am.list(src); + for(String asset : assets) { + copyAssetFolder(am, src + "/" + asset, dest + "/" + asset); + } - } + } else { + if(!destfh.exists()) { + Log.i("Copy ", src); + int count, buffer_len = 4096; + byte[] data = new byte[buffer_len]; + // copy the file from the assets subsystem to the filesystem + FileOutputStream destOS = new FileOutputStream(destfh); + while ((count = srcIS.read(data, 0, buffer_len)) != -1) { + destOS.write(data, 0, count); + } + // and close the two files + srcIS.close(); + destOS.close(); + data = null; + } else { + Log.i("Skipping Copy ", src); + } + } + destfh = null; + } + + public static void unzipFromAssets(Context context, String zipFile, String destination) { + try { + if (destination == null || destination.length() == 0) + destination = context.getFilesDir().getAbsolutePath(); + InputStream stream = context.getAssets().open(zipFile); + unzip(stream, destination); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void unzip(InputStream stream, String destination) { + dirChecker(destination, ""); + byte[] buffer = new byte[BUFFER_SIZE]; + try { + ZipInputStream zin = new ZipInputStream(stream); + ZipEntry ze = null; + while ((ze = zin.getNextEntry()) != null) { + Log.v(LOG_TAG, "Unzipping " + ze.getName()); + if (ze.isDirectory()) { + dirChecker(destination, ze.getName()); + } else { + File f = new File(destination, ze.getName()); + if (!f.exists()) { + boolean success = f.createNewFile(); + if (!success) { + Log.w(LOG_TAG, "Failed to create file " + f.getName()); + continue; + } + FileOutputStream fout = new FileOutputStream(f); + int count; + while ((count = zin.read(buffer)) != -1) { + fout.write(buffer, 0, count); + } + zin.closeEntry(); + fout.close(); + } + } - @Override - public void onDetachedFromWindow() { + } + zin.close(); + } catch (Exception e) { + Log.e(LOG_TAG, "unzip", e); + } - } + } + + private static boolean dirChecker(String destination, String dir) { + File f = new File(destination, dir); + + if (!f.isDirectory()) { + boolean success = f.mkdirs(); + if (!success) { + Log.w(LOG_TAG, "Failed to create folder " + f.getName()); + } + return success; + } + return false; + } // Menus // http://developer.android.com/guide/topics/ui/menus.html @@ -147,6 +393,109 @@ private void handleException(Exception e, String details) { Log.e(LOG_TAG, "Exception:", e); } + @Override + public void onDetachedFromWindow() { + super.onDetachedFromWindow(); + } + + @Override + public void onPause() { + super.onPause(); + } + + @Override + public void onStart() { + super.onStart(); + if(!keep){ + KeepScreen(); + } + } + + @Override + public void onStop() { + Log.d(LOG_TAG, "onStop"); + keep=false; + super.onStop(); + } + + @Override + public void onRestart() { + Log.d(LOG_TAG, "onRestart"); + super.onRestart(); + } + + @Override + public void onResume() { + Log.d(LOG_TAG, "onResume"); + super.onResume(); + final SharedPreferences settings = getSharedPreferences("settings", 0); + boolean isFirstLaunch = settings.getBoolean("is_first_launch", true); + if(isFirstLaunch) { + SharedPreferences.Editor editor = settings.edit(); + editor.putBoolean("is_first_launch", false); + editor.commit(); + } + if(!keep){ + KeepScreen(); + } + } + + private void KeepScreen() { + this.runOnUiThread(new Runnable() { + + public void run() { + DisableDeviceToTurnOffScreenWhenIdle(); + keep= true; + } + }); + }; + + public void DisableDeviceToTurnOffScreenWhenIdle() { + Log.i(LOG_TAG, "DisableDeviceToTurnOffScreenWhenIdle FLAG_KEEP_SCREEN_ON"); + Activity thisActivity = this; // box + runOnUiThread(new Runnable() { + public void run() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { + try { + setShowWhenLocked(false); + KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); + keyguardManager.requestDismissKeyguard(thisActivity, null); + } catch (Exception ex) { + Log.e(LOG_TAG, "Enable setTurnScreenOn and setShowWhenLocked is not present on device!"); + } + } + try { + OFAndroid.lockScreenSleep(); + Log.i(LOG_TAG, "Window addFlags: FLAG_TURN_SCREEN_ON"); + + } catch (Exception ex) { + Log.e(LOG_TAG, "AllowDeviceToTurnOffScreenWhenIdle " + ex.getMessage()); + } + } + }); + } + + public void AllowDeviceToTurnOffScreenWhenIdle() { + Log.i(LOG_TAG, "AllowDeviceToTurnOffScreenWhenIdle clearFlags FLAG_KEEP_SCREEN_ON"); + Activity thisActivity = this; // box + runOnUiThread(new Runnable() { + public void run() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { + try { + setShowWhenLocked(true); + } catch (Exception ex) { + Log.e(LOG_TAG, "Enable setTurnScreenOn and setShowWhenLocked is not present on device!"); + } + } + try { + OFAndroid.unlockScreenSleep(); + Log.i(LOG_TAG, "Window Clear Flags: FLAG_TURN_SCREEN_ON"); + } catch (Exception ex) { + Log.e(LOG_TAG, "AllowDeviceToTurnOffScreenWhenIdle " + ex.getMessage()); + } + } + }); + } public void setFullscreen() { try { @@ -165,13 +514,11 @@ public void setFullscreen() { | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; decorView.setSystemUiVisibility(uiOptions); } - WindowCompat.setDecorFitsSystemWindows(getWindow(), false); } catch (Exception ex) { handleException(ex, "setFullscreen exception"); } - try { View decorView = getWindow().getDecorView(); int[] locations = new int[2]; @@ -194,6 +541,76 @@ public void setFullscreen() { windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()); } + private static void setDataPath(Activity activity) { + dataPath=""; + try{ + Log.i(LOG_TAG, "sd mounted: " + OFAndroid.checkSDCardMounted()); + OFAndroid.initAppDataDirectory(activity); + dataPath = OFAndroid.getAppDataDirectory(); + + Log.i(LOG_TAG,"creating app directory: " + dataPath); + try{ + File dir = new File(dataPath); + if(!dir.isDirectory()){ + if(!dir.mkdirs()){ + Log.e(LOG_TAG,"error creating dir " + dataPath); + return; + } + } + } catch(Exception e){ + Log.e(LOG_TAG,"error creating dir " + dataPath,e); + } + + + } catch(Exception e){ + Log.e(LOG_TAG,"couldn't move app resources to data directory " + dataPath,e); + } + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + + if(LOG_ENGINE) Log.i(LOG_TAG, "onConfigurationChanged() " + getRequestedOrientation() + " newConfig dpi:" + newConfig.densityDpi + " screenLayout:" + newConfig.screenLayout + " screenWidthDp:" + newConfig.screenWidthDp + " screenHeightDp:" + newConfig.screenHeightDp + " hasPaused:" + hasPaused); + + super.onConfigurationChanged(newConfig); -} + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if(LOG_ENGINE) Log.i(LOG_TAG, "onConfigurationChanged() " + getRequestedOrientation() + " newConfig dpi:" + newConfig.densityDpi + " screenLayout:" + newConfig.screenLayout + " screenWidthDp:" + newConfig.screenWidthDp + " screenHeightDp:" + newConfig.screenHeightDp + " isScreenWideColorGamut:" + newConfig.isScreenWideColorGamut()); + } else { + if(LOG_ENGINE) Log.i(LOG_TAG, "onConfigurationChanged() " + getRequestedOrientation() + " newConfig dpi:" + newConfig.densityDpi + " screenLayout:" + newConfig.screenLayout + " screenWidthDp:" + newConfig.screenWidthDp + " screenHeightDp:" + newConfig.screenHeightDp + " isScreenWideColorGamut:" + false); + } + } + + SharedPreferences getPreferences() { + try { + if(getApplicationContext() != null) { + SharedPreferences settings = getApplicationContext().getSharedPreferences("settings", 0); + return settings; + } else { + Log.e(LOG_TAG, "getPreferences() getApplicationContext == null"); + return null; + } + } catch(Exception ex) { + Log.e(LOG_TAG, ex.getMessage()); + return null; + } + } + + SharedPreferences getSavePreferences() { + try { + if(getApplicationContext() != null) { + SharedPreferences scores = getApplicationContext().getSharedPreferences("settings", 0); + return scores; + } else { + Log.e(LOG_TAG, "getSavePreferences() getApplicationContext == null"); + return null; + } + } catch(Exception ex) { + Log.e(LOG_TAG, ex.getMessage()); + return null; + } + } + + +}