mirror of https://github.com/axmolengine/axmol.git
change orientation to Portrait on CCB Stop
This commit is contained in:
parent
ece710c4d8
commit
374c456749
|
@ -5,16 +5,21 @@
|
||||||
#include "platform/android/jni/JniHelper.h"
|
#include "platform/android/jni/JniHelper.h"
|
||||||
#include "cocoa/CCString.h"
|
#include "cocoa/CCString.h"
|
||||||
#include "Java_org_cocos2dx_cocosplayer_CocosPlayerSocket.h"
|
#include "Java_org_cocos2dx_cocosplayer_CocosPlayerSocket.h"
|
||||||
|
#include "jsapi.h"
|
||||||
|
|
||||||
#define LOG_TAG "Java_org_cocos2dx_cocosplayer_CocosPlayerSocket.cpp"
|
#define LOG_TAG "Java_org_cocos2dx_cocosplayer_CocosPlayerSocket.cpp"
|
||||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||||
|
|
||||||
#define SOCKET_CLASS_NAME "org/cocos2dx/cocosplayer/CocosPlayerSocket"
|
#define SOCKET_CLASS_NAME "org/cocos2dx/cocosplayer/CocosPlayerSocket"
|
||||||
|
#define MAIN_CLASS_NAME "org/cocos2dx/cocosplayer/CocosPlayer"
|
||||||
#define STREAM_CLASS_NAME "org/cocos2dx/cocosplayer/CCBStreamHandler"
|
#define STREAM_CLASS_NAME "org/cocos2dx/cocosplayer/CCBStreamHandler"
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
const int SCREEN_ORIENTATION_PORTRAIT = 1;
|
||||||
|
const int SCREEN_ORIENTATION_LANDSCAPE = 0;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void updatePairing(const char *code) {
|
void updatePairing(const char *code) {
|
||||||
int pairingCode = 0;
|
int pairingCode = 0;
|
||||||
|
@ -30,6 +35,21 @@ extern "C" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setOrientationJNI(int orient) {
|
||||||
|
JniMethodInfo t;
|
||||||
|
if (JniHelper::getStaticMethodInfo(t, MAIN_CLASS_NAME, "setOrientation", "(I)V")) {
|
||||||
|
t.env->CallStaticVoidMethod(t.classID, t.methodID, orient);
|
||||||
|
t.env->DeleteLocalRef(t.classID);
|
||||||
|
}
|
||||||
|
handle_set_orient(orient == SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void runJSApp() {
|
||||||
|
handle_ccb_run();
|
||||||
|
setOrientationJNI(SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cleanCacheDirJNI() {
|
void cleanCacheDirJNI() {
|
||||||
JniMethodInfo t;
|
JniMethodInfo t;
|
||||||
if (JniHelper::getStaticMethodInfo(t, SOCKET_CLASS_NAME, "cleanCache", "()V")) {
|
if (JniHelper::getStaticMethodInfo(t, SOCKET_CLASS_NAME, "cleanCache", "()V")) {
|
||||||
|
|
|
@ -32,7 +32,10 @@ extern "C" {
|
||||||
[server sendLog:[str stringByAppendingString:@"\n"]];
|
[server sendLog:[str stringByAppendingString:@"\n"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runJSApp() {
|
||||||
|
[server runJSApp];
|
||||||
|
}
|
||||||
|
|
||||||
void updatePairing(const char *pairing) {
|
void updatePairing(const char *pairing) {
|
||||||
NSString *code;
|
NSString *code;
|
||||||
|
|
Loading…
Reference in New Issue