Initialize global variables in android device before android_app->running
This commit is contained in:
parent
6c5a33fa5c
commit
4a8306fca5
@ -122,11 +122,11 @@ AndroidApplicationInfo CIrrDeviceAndroid::ApplicationInfo;
|
||||
// Execution of android_main() function is a kind of "onCreate" event, so this
|
||||
// function should be used there to make sure that global window state variables
|
||||
// have their default values on startup.
|
||||
void CIrrDeviceAndroid::onCreate()
|
||||
extern "C" void IrrDeviceAndroid_onCreate()
|
||||
{
|
||||
IsPaused = true;
|
||||
IsFocused = false;
|
||||
IsStarted = false;
|
||||
CIrrDeviceAndroid::IsPaused = true;
|
||||
CIrrDeviceAndroid::IsFocused = false;
|
||||
CIrrDeviceAndroid::IsStarted = false;
|
||||
}
|
||||
|
||||
JNIEnv* CIrrDeviceAndroid::m_jni_env = NULL;
|
||||
|
@ -41,6 +41,9 @@ namespace irr
|
||||
class CIrrDeviceAndroid : public CIrrDeviceStub, video::IImagePresenter
|
||||
{
|
||||
public:
|
||||
static bool IsPaused;
|
||||
static bool IsFocused;
|
||||
static bool IsStarted;
|
||||
//! constructor
|
||||
CIrrDeviceAndroid(const SIrrlichtCreationParameters& param);
|
||||
|
||||
@ -105,10 +108,6 @@ namespace irr
|
||||
bool GyroscopeActive;
|
||||
static AndroidApplicationInfo ApplicationInfo;
|
||||
|
||||
static bool IsPaused;
|
||||
static bool IsFocused;
|
||||
static bool IsStarted;
|
||||
|
||||
bool HasTouchDevice;
|
||||
float GamepadAxisX;
|
||||
float GamepadAxisY;
|
||||
|
@ -206,6 +206,9 @@ static void process_cmd(struct android_app* app, struct android_poll_source* sou
|
||||
android_app_post_exec_cmd(app, cmd);
|
||||
}
|
||||
|
||||
// From CIrrDeviceAndroid.h
|
||||
extern void IrrDeviceAndroid_onCreate();
|
||||
|
||||
static void* android_app_entry(void* param) {
|
||||
struct android_app* android_app = (struct android_app*)param;
|
||||
|
||||
@ -226,6 +229,9 @@ static void* android_app_entry(void* param) {
|
||||
&android_app->cmdPollSource);
|
||||
android_app->looper = looper;
|
||||
|
||||
// Initialize global variables in android device before android_app->running
|
||||
IrrDeviceAndroid_onCreate();
|
||||
|
||||
pthread_mutex_lock(&android_app->mutex);
|
||||
android_app->running = 1;
|
||||
pthread_cond_broadcast(&android_app->cond);
|
||||
|
@ -186,10 +186,7 @@ void android_main(struct android_app* app)
|
||||
|
||||
global_android_app = app;
|
||||
global_android_activity = app->activity;
|
||||
|
||||
// Initialize global Android window state variables
|
||||
CIrrDeviceAndroid::onCreate();
|
||||
|
||||
|
||||
app_dummy();
|
||||
override_default_params_for_mobile();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user