Skip to content

Commit 3940916

Browse files
committed
Android Update main and remove old files
1 parent 7184309 commit 3940916

File tree

20 files changed

+475
-400
lines changed

20 files changed

+475
-400
lines changed
Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
11
#include "ofMain.h"
22
#include "ofApp.h"
33

4-
int main(){
5-
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
6-
7-
// this kicks off the running of my app
8-
// can be OF_WINDOW or OF_FULLSCREEN
9-
// pass in width and height too:
10-
ofRunApp( new ofApp() );
11-
return 0;
12-
}
4+
#ifdef TARGET_ANDROID
135

6+
#include "ofWindowSettings.h"
7+
#include "ofGLProgrammableRenderer.h"
8+
9+
shared_ptr<ofApp> *ofapp;
10+
std::shared_ptr<ofAppBaseWindow> baseWindow;
11+
12+
//--------------------------------------------------------------
13+
int main(int argc, char **argv) {
14+
baseWindow = std::make_shared<ofAppAndroidWindow>();
15+
ofxAndroidWindowSettings settings;
16+
settings.glesVersion = 2;
17+
settings.setSize(1920, 1080);
18+
settings.windowMode = OF_WINDOW;
19+
settings.preserveContextOnPause = true;
20+
baseWindow = ofCreateWindow(settings);
21+
ofapp = new shared_ptr<ofApp>(new ofApp());
22+
ofRunApp(baseWindow, *ofapp);
23+
return 0;
24+
}
1425

15-
#ifdef TARGET_ANDROID
1626
void ofAndroidApplicationInit()
1727
{
18-
//application scope init
28+
//application scope init
1929
}
20-
2130
void ofAndroidActivityInit()
2231
{
23-
//activity scope init
24-
main();
32+
//activity scope init - call main
33+
main(0, nullptr);
2534
}
35+
36+
// Callbacks from Android Layer
37+
extern "C" JNIEXPORT void JNICALL
38+
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
39+
{
40+
ofAndroidApplicationInit();
41+
}
42+
43+
extern "C" JNIEXPORT void JNICALL
44+
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
45+
{
46+
ofAndroidActivityInit();
47+
}
48+
2649
#endif
Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
#include "ofMain.h"
22
#include "ofApp.h"
33

4+
#ifdef TARGET_ANDROID
45

6+
#include "ofWindowSettings.h"
7+
#include "ofGLProgrammableRenderer.h"
58

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

9-
// this kicks off the running of my app
10-
// can be OF_WINDOW or OF_FULLSCREEN
11-
// pass in width and height too:
12-
ofRunApp( new ofApp() );
13-
return 0;
12+
//--------------------------------------------------------------
13+
int main(int argc, char **argv) {
14+
baseWindow = std::make_shared<ofAppAndroidWindow>();
15+
ofxAndroidWindowSettings settings;
16+
settings.glesVersion = 2;
17+
settings.setSize(1920, 1080);
18+
settings.windowMode = OF_WINDOW;
19+
settings.preserveContextOnPause = true;
20+
baseWindow = ofCreateWindow(settings);
21+
ofapp = new shared_ptr<ofApp>(new ofApp());
22+
ofRunApp(baseWindow, *ofapp);
23+
return 0;
1424
}
1525

16-
17-
#ifdef TARGET_ANDROID
1826
void ofAndroidApplicationInit()
1927
{
20-
//application scope init
28+
//application scope init
2129
}
22-
2330
void ofAndroidActivityInit()
2431
{
25-
//activity scope init
26-
main();
32+
//activity scope init - call main
33+
main(0, nullptr);
2734
}
35+
36+
// Callbacks from Android Layer
37+
extern "C" JNIEXPORT void JNICALL
38+
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
39+
{
40+
ofAndroidApplicationInit();
41+
}
42+
43+
extern "C" JNIEXPORT void JNICALL
44+
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
45+
{
46+
ofAndroidActivityInit();
47+
}
48+
2849
#endif
Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
11
#include "ofMain.h"
22
#include "ofApp.h"
33

4-
int main(){
5-
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
6-
7-
// this kicks off the running of my app
8-
// can be OF_WINDOW or OF_FULLSCREEN
9-
// pass in width and height too:
10-
ofRunApp( new ofApp() );
11-
return 0;
12-
}
4+
#ifdef TARGET_ANDROID
135

6+
#include "ofWindowSettings.h"
7+
#include "ofGLProgrammableRenderer.h"
8+
9+
shared_ptr<ofApp> *ofapp;
10+
std::shared_ptr<ofAppBaseWindow> baseWindow;
11+
12+
//--------------------------------------------------------------
13+
int main(int argc, char **argv) {
14+
baseWindow = std::make_shared<ofAppAndroidWindow>();
15+
ofxAndroidWindowSettings settings;
16+
settings.glesVersion = 2;
17+
settings.setSize(1920, 1080);
18+
settings.windowMode = OF_WINDOW;
19+
settings.preserveContextOnPause = true;
20+
baseWindow = ofCreateWindow(settings);
21+
ofapp = new shared_ptr<ofApp>(new ofApp());
22+
ofRunApp(baseWindow, *ofapp);
23+
return 0;
24+
}
1425

15-
#ifdef TARGET_ANDROID
1626
void ofAndroidApplicationInit()
1727
{
18-
//application scope init
28+
//application scope init
1929
}
20-
2130
void ofAndroidActivityInit()
2231
{
23-
//activity scope init
24-
main();
32+
//activity scope init - call main
33+
main(0, nullptr);
2534
}
35+
36+
// Callbacks from Android Layer
37+
extern "C" JNIEXPORT void JNICALL
38+
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
39+
{
40+
ofAndroidApplicationInit();
41+
}
42+
43+
extern "C" JNIEXPORT void JNICALL
44+
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
45+
{
46+
ofAndroidActivityInit();
47+
}
48+
2649
#endif
Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
11
#include "ofMain.h"
22
#include "ofApp.h"
33

4-
int main(){
5-
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
6-
7-
// this kicks off the running of my app
8-
// can be OF_WINDOW or OF_FULLSCREEN
9-
// pass in width and height too:
10-
ofRunApp( new ofApp() );
11-
return 0;
12-
}
4+
#ifdef TARGET_ANDROID
135

6+
#include "ofWindowSettings.h"
7+
#include "ofGLProgrammableRenderer.h"
8+
9+
shared_ptr<ofApp> *ofapp;
10+
std::shared_ptr<ofAppBaseWindow> baseWindow;
11+
12+
//--------------------------------------------------------------
13+
int main(int argc, char **argv) {
14+
baseWindow = std::make_shared<ofAppAndroidWindow>();
15+
ofxAndroidWindowSettings settings;
16+
settings.glesVersion = 2;
17+
settings.setSize(1920, 1080);
18+
settings.windowMode = OF_WINDOW;
19+
settings.preserveContextOnPause = true;
20+
baseWindow = ofCreateWindow(settings);
21+
ofapp = new shared_ptr<ofApp>(new ofApp());
22+
ofRunApp(baseWindow, *ofapp);
23+
return 0;
24+
}
1425

15-
#ifdef TARGET_ANDROID
1626
void ofAndroidApplicationInit()
1727
{
18-
//application scope init
28+
//application scope init
1929
}
20-
2130
void ofAndroidActivityInit()
2231
{
23-
//activity scope init
24-
main();
32+
//activity scope init - call main
33+
main(0, nullptr);
2534
}
35+
36+
// Callbacks from Android Layer
37+
extern "C" JNIEXPORT void JNICALL
38+
Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jclass clazz)
39+
{
40+
ofAndroidApplicationInit();
41+
}
42+
43+
extern "C" JNIEXPORT void JNICALL
44+
Java_cc_openframeworks_OFAndroid_onCreate( JNIEnv* env, jclass clazz)
45+
{
46+
ofAndroidActivityInit();
47+
}
48+
2649
#endif

examples/android/androidCameraExample/build.gradle

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/android/androidCameraExample/proguard.cfg

Lines changed: 0 additions & 59 deletions
This file was deleted.

examples/android/androidCompositeExample/proguard.cfg

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)