SIGN IN SIGN UP

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.

0 0 1 C++
#include "ofMain.h"
#include "ofApp.h"
#ifdef TARGET_ANDROID
#include "ofWindowSettings.h"
#include "ofGLProgrammableRenderer.h"
shared_ptr<ofApp> *ofapp;
std::shared_ptr<ofAppBaseWindow> baseWindow;
//--------------------------------------------------------------
int main(int argc, char **argv) {
baseWindow = std::make_shared<ofAppAndroidWindow>();
ofxAndroidWindowSettings settings;
settings.glesVersion = 2;
settings.setSize(1920, 1080);
settings.windowMode = OF_WINDOW;
settings.preserveContextOnPause = true;
baseWindow = ofCreateWindow(settings);
ofapp = new shared_ptr<ofApp>(new ofApp());
ofRunApp(baseWindow, *ofapp);
return 0;
}
void ofAndroidApplicationInit()
2015-10-15 14:59:57 +03:00
{
//application scope init
2015-10-15 14:59:57 +03:00
}
void ofAndroidActivityInit()
2015-10-15 14:59:57 +03:00
{
//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