[android] Boilerplate code to launch stk main
This commit is contained in:
parent
f484e7ef6b
commit
0dc59b9e4a
@ -177,7 +177,7 @@ LOCAL_CPP_FEATURES += rtti
|
|||||||
LOCAL_PATH:= jni
|
LOCAL_PATH:= jni
|
||||||
|
|
||||||
# Irrlicht
|
# Irrlicht
|
||||||
LOCAL_SRC_FILES := $(wildcard jni/irrlicht/source/Irrlicht/*.cpp) $(wildcard jni/irrlicht/source/Irrlicht/Android/*.cpp) jni/irrexample.cpp
|
LOCAL_SRC_FILES := $(wildcard jni/irrlicht/source/Irrlicht/*.cpp) $(wildcard jni/irrlicht/source/Irrlicht/Android/*.cpp)
|
||||||
LOCAL_PATH:=.
|
LOCAL_PATH:=.
|
||||||
LOCAL_MODULE := irrlicht
|
LOCAL_MODULE := irrlicht
|
||||||
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
|
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
|
||||||
@ -191,7 +191,7 @@ LOCAL_CPP_FEATURES += rtti exceptions
|
|||||||
|
|
||||||
|
|
||||||
# STK
|
# STK
|
||||||
LOCAL_SRC_FILES := $(wildcard jni/src/*.cpp) $(wildcard jni/src/*/*.cpp) $(wildcard jni/src/*/*/*.cpp)
|
LOCAL_SRC_FILES := $(wildcard jni/src/*.cpp) $(wildcard jni/src/*/*.cpp) $(wildcard jni/src/*/*/*.cpp) jni/irrexample.cpp
|
||||||
LOCAL_PATH:=.
|
LOCAL_PATH:=.
|
||||||
LOCAL_MODULE := stk
|
LOCAL_MODULE := stk
|
||||||
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2 -lGLESv3
|
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2 -lGLESv3
|
||||||
|
@ -32,13 +32,21 @@ using namespace irr;
|
|||||||
#pragma comment(lib, "Irrlicht.lib")
|
#pragma comment(lib, "Irrlicht.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void* global_android_app;
|
||||||
|
|
||||||
|
void stk_main ();
|
||||||
|
void stk_run ();
|
||||||
#ifndef _IRR_ANDROID_PLATFORM_
|
#ifndef _IRR_ANDROID_PLATFORM_
|
||||||
int main()
|
int main()
|
||||||
#else
|
#else
|
||||||
extern "C" void android_main2(struct android_app* app)
|
extern "C" void android_main2(struct android_app* app)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "The value of 1 + 1 is %d", 1+1);
|
global_android_app = app;
|
||||||
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "Launching stk main…");
|
||||||
|
stk_main ();
|
||||||
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "Main launched, now the mainloop…");
|
||||||
|
stk_run ();
|
||||||
#ifdef _IRR_ANDROID_PLATFORM_
|
#ifdef _IRR_ANDROID_PLATFORM_
|
||||||
const bool shadows = false;
|
const bool shadows = false;
|
||||||
video::E_DRIVER_TYPE driverType=video::EDT_OGLES2;
|
video::E_DRIVER_TYPE driverType=video::EDT_OGLES2;
|
||||||
|
@ -290,7 +290,7 @@ void android_main(struct android_app* state) {
|
|||||||
dlstk = dlopen("/data/data/com.example.native_activity/lib/libstk.so", RTLD_NOW);*/
|
dlstk = dlopen("/data/data/com.example.native_activity/lib/libstk.so", RTLD_NOW);*/
|
||||||
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libenet.so", RTLD_NOW);
|
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libenet.so", RTLD_NOW);
|
||||||
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libbullet.so", RTLD_NOW);
|
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libbullet.so", RTLD_NOW);
|
||||||
//dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libstkmain.so", RTLD_NOW);
|
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libstk.so", RTLD_NOW);
|
||||||
if(dlhandle == NULL)
|
if(dlhandle == NULL)
|
||||||
LOGW("Can't open libirrlicht.so. %s", dlerror());
|
LOGW("Can't open libirrlicht.so. %s", dlerror());
|
||||||
if(dlstk == NULL)
|
if(dlstk == NULL)
|
||||||
@ -298,7 +298,9 @@ void android_main(struct android_app* state) {
|
|||||||
//plug_main_loop_interation = (void(*)(void))dlsym(dlstk, "main_loop_interation");
|
//plug_main_loop_interation = (void(*)(void))dlsym(dlstk, "main_loop_interation");
|
||||||
//if(plug_main_loop_interation == NULL)
|
//if(plug_main_loop_interation == NULL)
|
||||||
// LOGW("Can't open plug_main_loop");
|
// LOGW("Can't open plug_main_loop");
|
||||||
plug_android_main_2 = (void(*)(void))dlsym(dlhandle, "android_main2");
|
plug_android_main_2 = (void(*)(void))dlsym(dlstk, "android_main2");
|
||||||
|
if(plug_android_main_2 == NULL)
|
||||||
|
LOGW("Can't find android_main2 %s", dlerror());
|
||||||
LOGW("----------------------------------------------------------- lanchit");
|
LOGW("----------------------------------------------------------- lanchit");
|
||||||
app_dummy();
|
app_dummy();
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d %d", __LINE__, ((struct android_app *)(state))->window);
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d %d", __LINE__, ((struct android_app *)(state))->window);
|
||||||
|
Loading…
Reference in New Issue
Block a user