mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' of https://github.com/cocos2d/cocos2d-x into 489
This commit is contained in:
commit
b940676cab
|
@ -121,7 +121,7 @@ void SoundPlayer::Release()
|
|||
|
||||
void SoundPlayer::Pause()
|
||||
{
|
||||
if (m_pPlayer && m_pPlayer->GetCurrentStatus() == PLAYER_STATUS_PLAYING)
|
||||
if (m_pPlayer && PLAYER_STATUS_PAUSED != m_pPlayer->GetCurrentStatus())
|
||||
{
|
||||
m_pPlayer->Pause();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void SoundPlayer::Pause()
|
|||
|
||||
void SoundPlayer::Resume()
|
||||
{
|
||||
if (m_pPlayer && m_pPlayer->GetCurrentStatus() == PLAYER_STATUS_PAUSED)
|
||||
if (m_pPlayer && PLAYER_STATUS_PLAYING != m_pPlayer->GetCurrentStatus())
|
||||
{
|
||||
m_pPlayer->Resume();
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
|
||||
// pDirector->enableRetinaDisplay(true);
|
||||
|
||||
// sets opengl landscape mode
|
||||
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayFPS(true);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<application android:label="@string/app_name" android:debuggable="true">
|
||||
<activity android:name=".ApplicationDemo"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -14,4 +14,8 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:largeScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:anyDensity="true"
|
||||
android:normalScreens="true"/>
|
||||
</manifest>
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ApplicationDemo extends Cocos2dxActivity{
|
|||
|
||||
// get the packageName,it's used to set the resource path
|
||||
String packageName = getApplication().getPackageName();
|
||||
super.setPackgeName(packageName);
|
||||
super.setPackageName(packageName);
|
||||
|
||||
setContentView(R.layout.helloworld_demo);
|
||||
mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.helloworld_gl_surfaceview);
|
||||
|
|
|
@ -199,7 +199,7 @@ public class Cocos2dxActivity extends Activity{
|
|||
pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
protected void setPackgeName(String packageName) {
|
||||
protected void setPackageName(String packageName) {
|
||||
Cocos2dxActivity.packageName = packageName;
|
||||
|
||||
String apkFilePath = "";
|
||||
|
|
|
@ -2,21 +2,20 @@ package org.cocos2dx.lib;
|
|||
|
||||
import android.content.Context;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.inputmethod.CompletionInfo;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.ExtractedText;
|
||||
import android.view.inputmethod.ExtractedTextRequest;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
class Cocos2dxInputConnection implements InputConnection {
|
||||
class Cocos2dxInputConnection extends BaseInputConnection {
|
||||
|
||||
private boolean mDebug = false;
|
||||
private static final boolean mDebug = false;
|
||||
void LogD(String msg) {
|
||||
if (mDebug) {
|
||||
Log.d("Cocos2dxInputConnection", msg);
|
||||
|
@ -26,59 +25,19 @@ class Cocos2dxInputConnection implements InputConnection {
|
|||
private Cocos2dxGLSurfaceView mView;
|
||||
|
||||
Cocos2dxInputConnection(Cocos2dxGLSurfaceView view) {
|
||||
super(view, false);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean beginBatchEdit() {
|
||||
LogD("beginBatchEdit");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearMetaKeyStates(int states) {
|
||||
LogD("clearMetaKeyStates: " + states);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commitCompletion(CompletionInfo text) {
|
||||
LogD("commitCompletion: " + text.getText().toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
super.commitText(text, newCursorPosition);
|
||||
if (null != mView) {
|
||||
final String insertText = text.toString();
|
||||
mView.insertText(insertText);
|
||||
LogD("commitText: " + insertText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSurroundingText(int leftLength, int rightLength) {
|
||||
LogD("deleteSurroundingText: " + leftLength + "," + rightLength);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean endBatchEdit() {
|
||||
LogD("endBatchEdit");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finishComposingText() {
|
||||
LogD("finishComposingText");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorCapsMode(int reqModes) {
|
||||
LogD("getCursorCapsMode: " + reqModes);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,24 +47,6 @@ class Cocos2dxInputConnection implements InputConnection {
|
|||
return new ExtractedText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTextAfterCursor(int n, int flags) {
|
||||
LogD("getTextAfterCursor: " + n + "," + flags);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTextBeforeCursor(int n, int flags) {
|
||||
LogD("getTextBeforeCursor: " + n + "," + flags);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performContextMenuAction(int id) {
|
||||
Log.d("Cocos2dxInputConnection", "performContextMenuAction");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performEditorAction(int editorAction) {
|
||||
LogD("performEditorAction: " + editorAction);
|
||||
|
@ -113,45 +54,24 @@ class Cocos2dxInputConnection implements InputConnection {
|
|||
final String insertText = "\n";
|
||||
mView.insertText(insertText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performPrivateCommand(String action, Bundle data) {
|
||||
LogD("performPrivateCommand: " + action + "," + data.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reportFullscreenMode(boolean enabled) {
|
||||
LogD("reportFullscreenMode: " + enabled);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
LogD("sendKeyEvent: " + event.toString());
|
||||
super.sendKeyEvent(event);
|
||||
if (null != mView) {
|
||||
switch (event.getKeyCode()) {
|
||||
|
||||
case KeyEvent.KEYCODE_DEL:
|
||||
mView.deleteBackward();
|
||||
if (KeyEvent.ACTION_UP == event.getAction()) {
|
||||
mView.deleteBackward();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setComposingText(CharSequence text, int newCursorPosition) {
|
||||
LogD("setComposingText: " + text.toString() + "," + newCursorPosition);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSelection(int start, int end) {
|
||||
LogD("setSelection: " + start + "," + end);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +103,7 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
|||
mainView = this;
|
||||
}
|
||||
|
||||
public void onPause(){
|
||||
public void onPause(){
|
||||
queueEvent(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -231,34 +151,22 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
|||
}
|
||||
imm.hideSoftInputFromWindow(mainView.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
if (null == mainView)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Cocos2dxInputConnection ic;
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
if (onCheckIsTextEditor()) {
|
||||
outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT;
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI; //IME_ACTION_DONE
|
||||
outAttrs.initialSelStart = -1;
|
||||
outAttrs.initialSelEnd = -1;
|
||||
outAttrs.initialCapsMode = 1;
|
||||
|
||||
outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT;
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;
|
||||
outAttrs.initialSelStart = -1;
|
||||
outAttrs.initialSelEnd = -1;
|
||||
outAttrs.initialCapsMode = 1;
|
||||
|
||||
if (null == ic)
|
||||
{
|
||||
ic = new Cocos2dxInputConnection(this);
|
||||
}
|
||||
return ic;
|
||||
}
|
||||
return null;
|
||||
if (null == ic)
|
||||
{
|
||||
ic = new Cocos2dxInputConnection(this);
|
||||
}
|
||||
|
||||
return ic;
|
||||
}
|
||||
|
||||
public void insertText(final String text) {
|
||||
|
|
|
@ -44,7 +44,10 @@ void CCLog(const char * pszFormat, ...)
|
|||
va_start(ap, pszFormat);
|
||||
vsprintf_s(szBuf, MAX_LEN, pszFormat, ap);
|
||||
va_end(ap);
|
||||
OutputDebugStringA(szBuf);
|
||||
|
||||
WCHAR wszBuf[MAX_LEN] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf));
|
||||
OutputDebugStringW(wszBuf);
|
||||
OutputDebugStringA("\n");
|
||||
}
|
||||
|
||||
|
@ -96,7 +99,6 @@ void CCLog(const char * pszFormat, ...)
|
|||
strcat(s_szLogFilePath, "Cocos2dxLog.txt");
|
||||
}
|
||||
|
||||
SS_printf("Cocos2d: ");
|
||||
char szBuf[MAX_LEN];
|
||||
|
||||
va_list ap;
|
||||
|
@ -108,11 +110,12 @@ void CCLog(const char * pszFormat, ...)
|
|||
#endif
|
||||
va_end(ap);
|
||||
|
||||
SS_printf("%s", szBuf);
|
||||
#ifdef _TRANZDA_VM_
|
||||
SS_printf("\n");
|
||||
WCHAR wszBuf[MAX_LEN] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf));
|
||||
OutputDebugStringW(wszBuf);
|
||||
OutputDebugStringA("\n");
|
||||
#else
|
||||
SS_printf("\r\n");
|
||||
FILE * pf = fopen(s_szLogFilePath, "a+");
|
||||
if (! pf)
|
||||
{
|
||||
|
|
|
@ -110,13 +110,20 @@ string CCFileUtils::getWriteablePath()
|
|||
// the path is: /data/data/ + package name
|
||||
string dir("/data/data/");
|
||||
char* tmp = getPackageNameJNI();
|
||||
dir += tmp;
|
||||
dir += "/";
|
||||
|
||||
// release memory
|
||||
delete tmp;
|
||||
if (tmp)
|
||||
{
|
||||
dir.append(tmp).append("/");
|
||||
|
||||
return dir;
|
||||
// release memory
|
||||
delete [] tmp;
|
||||
|
||||
return dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END;
|
||||
|
|
|
@ -46,9 +46,9 @@ class BitmapDC
|
|||
{
|
||||
public:
|
||||
BitmapDC()
|
||||
: m_pBitmap(NULL),
|
||||
m_pPaint(NULL)
|
||||
:m_pPaint(NULL)
|
||||
{
|
||||
m_pBitmap = new SkBitmap();
|
||||
}
|
||||
|
||||
~BitmapDC(void)
|
||||
|
@ -94,27 +94,15 @@ public:
|
|||
|
||||
bool prepareBitmap(int nWidth, int nHeight)
|
||||
{
|
||||
// release bitmap
|
||||
if (m_pBitmap)
|
||||
{
|
||||
delete m_pBitmap;
|
||||
m_pBitmap = NULL;
|
||||
}
|
||||
m_pBitmap->reset();
|
||||
|
||||
if (nWidth > 0 && nHeight > 0)
|
||||
{
|
||||
/* create and init bitmap */
|
||||
m_pBitmap = new SkBitmap();
|
||||
if (! m_pBitmap)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* use rgba8888 and alloc memory */
|
||||
m_pBitmap->setConfig(SkBitmap::kARGB_8888_Config, nWidth, nHeight);
|
||||
|
||||
if (! m_pBitmap->allocPixels())
|
||||
{
|
||||
CC_SAFE_DELETE(m_pBitmap);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ THE SOFTWARE.
|
|||
#include "CCAccelerometer.h"
|
||||
#include "CCApplication.h"
|
||||
#include "CCIMEDispatcher.h"
|
||||
#include "platform/android/CCAccelerometer_android.h"
|
||||
#include "CCAccelerometer_android.h"
|
||||
#include <android/log.h>
|
||||
|
||||
#if 0
|
||||
|
@ -395,7 +395,7 @@ extern "C"
|
|||
// copy byte array into char[]
|
||||
if (alen > 0)
|
||||
{
|
||||
rtn = (char*)malloc(alen + 1);
|
||||
rtn = new char[alen + 1];
|
||||
memcpy(rtn, ba, alen);
|
||||
rtn[alen] = 0;
|
||||
}
|
||||
|
|
|
@ -343,7 +343,9 @@ namespace cocos2d {
|
|||
// save to document folder
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||
return [documentsDirectory UTF8String];
|
||||
std::string strRet = [documentsDirectory UTF8String];
|
||||
strRet.append("/");
|
||||
return strRet;
|
||||
}
|
||||
|
||||
}//namespace cocos2d
|
||||
|
|
|
@ -105,7 +105,7 @@ const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const
|
|||
std::string relativeFile = pszRelativeFile;
|
||||
CCString *pRet = new CCString();
|
||||
pRet->autorelease();
|
||||
pRet->m_sString = relativeFile.substr(0, relativeFile.rfind('/')+1);
|
||||
pRet->m_sString = relativeFile.substr(0, relativeFile.find_last_of("/\\") + 1);
|
||||
pRet->m_sString += pszFilename;
|
||||
return pRet->m_sString.c_str();
|
||||
}
|
||||
|
|
|
@ -28,9 +28,10 @@ static long long getTimeOfDayMicroSecond()
|
|||
#endif
|
||||
|
||||
CCApplication::CCApplication()
|
||||
: m_bRunning(FALSE)
|
||||
, m_bNeedStop(FALSE)
|
||||
, m_bInBackground(FALSE)
|
||||
: m_bRunning(false)
|
||||
, m_bNeedStop(false)
|
||||
, m_bInBackground(false)
|
||||
, m_bEnterBackgroundCalled(false)
|
||||
{
|
||||
memset(&m_tMsg, 0, sizeof(m_tMsg));
|
||||
SS_GetCurrentGTID(&m_tMsg.gtid);
|
||||
|
@ -108,9 +109,14 @@ Boolean CCApplication::EventHandler(EventType* pEvent)
|
|||
case EVENT_AppActiveNotify:
|
||||
if (pEvent->sParam1 == 0)
|
||||
{
|
||||
CCLOG("EVENT_AppActiveNotify false");
|
||||
if (!m_bInBackground)
|
||||
{
|
||||
applicationDidEnterBackground();
|
||||
if (! m_bEnterBackgroundCalled)
|
||||
{
|
||||
applicationDidEnterBackground();
|
||||
m_bEnterBackgroundCalled = true;
|
||||
}
|
||||
m_bInBackground = true;
|
||||
}
|
||||
|
||||
|
@ -125,15 +131,17 @@ Boolean CCApplication::EventHandler(EventType* pEvent)
|
|||
CfgTurnOnBackLightEx(SYS_BACK_LIGHT_MODE_TIME_LONG);
|
||||
CCLOG("AppActiveNotify::TurnOnBackLight:MODE_TIME_LONG");
|
||||
}
|
||||
|
||||
// EnableKeyLock();
|
||||
// CCLOG("AppActiveNotify::InBackground");
|
||||
}
|
||||
else if (pEvent->sParam1 > 0)
|
||||
{
|
||||
CCLOG("EVENT_AppActiveNotify true");
|
||||
if (m_bInBackground)
|
||||
{
|
||||
applicationWillEnterForeground();
|
||||
if (m_bEnterBackgroundCalled)
|
||||
{
|
||||
applicationWillEnterForeground();
|
||||
m_bEnterBackgroundCalled = false;
|
||||
}
|
||||
m_bInBackground = false;
|
||||
}
|
||||
|
||||
|
@ -147,13 +155,6 @@ Boolean CCApplication::EventHandler(EventType* pEvent)
|
|||
CfgTurnOnBackLightDelay(0x7fffffff);
|
||||
CCLOG("AppActiveNotify::TurnOnBackLight:0x7fffffff");
|
||||
}
|
||||
|
||||
// if KeyLock disactived, disable it.
|
||||
// if (! CfgKeyLock_GetActive())
|
||||
// {
|
||||
// DisableKeyLock();
|
||||
// CCLOG("AppActiveNotify::DisableKeyLock");
|
||||
// }
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -208,12 +209,12 @@ void CCApplication::switchNotify(int nTurnOn)
|
|||
|
||||
if (! nTurnOn) // turn off screen
|
||||
{
|
||||
// CCDirector::sharedDirector()->pause();
|
||||
applicationDidEnterBackground();
|
||||
if (! m_bEnterBackgroundCalled)
|
||||
{
|
||||
applicationDidEnterBackground();
|
||||
m_bEnterBackgroundCalled = true;
|
||||
}
|
||||
StopMainLoop();
|
||||
|
||||
// EnableKeyLock();
|
||||
// CCLOG("BLswitchNotify::EnableKeyLock");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -223,15 +224,11 @@ void CCApplication::switchNotify(int nTurnOn)
|
|||
CfgTurnOnBackLightDelay(0x7fffffff);
|
||||
CCLOG("AppActiveNotify::TurnOnBackLight:0x7fffffff");
|
||||
|
||||
// // if KeyLock disactived, disable it.
|
||||
// if (! CfgKeyLock_GetActive())
|
||||
// {
|
||||
// DisableKeyLock();
|
||||
// CCLOG("BLswitchNotify::DisableKeyLock");
|
||||
// }
|
||||
//
|
||||
// CCDirector::sharedDirector()->resume();
|
||||
applicationWillEnterForeground();
|
||||
if (m_bEnterBackgroundCalled)
|
||||
{
|
||||
applicationWillEnterForeground();
|
||||
m_bEnterBackgroundCalled = false;
|
||||
}
|
||||
StartMainLoop();
|
||||
}
|
||||
} while (0);
|
||||
|
@ -244,13 +241,13 @@ bool CCApplication::isInBackground()
|
|||
|
||||
void CCApplication::StartMainLoop()
|
||||
{
|
||||
m_bNeedStop = FALSE;
|
||||
if (m_bRunning)
|
||||
{
|
||||
m_bNeedStop = FALSE;
|
||||
return;
|
||||
}
|
||||
CCLOG("Post StartMainLoop");
|
||||
Sys_PostMessage2(MESSAGE_PRIOR_LOWEST, &m_tMsg);
|
||||
m_bRunning = TRUE;
|
||||
}
|
||||
|
||||
void CCApplication::StopMainLoop()
|
||||
|
@ -262,15 +259,17 @@ Int32 CCApplication::_OnAppIdle(MESSAGE_t * pMsg, UInt32 uData)
|
|||
{
|
||||
CCApplication& rThis = (CCApplication&) CCApplication::sharedApplication();
|
||||
CCEGLView * pView = CCDirector::sharedDirector()->getOpenGLView();
|
||||
if (pView && rThis.m_bRunning)
|
||||
if (pView)
|
||||
{
|
||||
if (rThis.m_bNeedStop)
|
||||
{
|
||||
CCLOG("_OnAppIdle: Stop");
|
||||
rThis.m_bNeedStop = FALSE;
|
||||
rThis.m_bRunning = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rThis.m_bRunning = TRUE;
|
||||
#ifdef _TRANZDA_VM_
|
||||
LARGE_INTEGER nNow;
|
||||
QueryPerformanceCounter(&nNow);
|
||||
|
|
|
@ -109,6 +109,7 @@ protected:
|
|||
bool m_bRunning;
|
||||
bool m_bNeedStop;
|
||||
bool m_bInBackground;
|
||||
bool m_bEnterBackgroundCalled;
|
||||
char m_AppDataPath[EOS_FILE_MAX_PATH];
|
||||
char m_AppWritablePath[EOS_FILE_MAX_PATH];
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "SimpleAudioEngine.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace CocosDenshion;
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
{
|
||||
|
@ -95,10 +96,12 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CCDirector::sharedDirector()->pause();
|
||||
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CCDirector::sharedDirector()->resume();
|
||||
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,12 @@
|
|||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:largeScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:anyDensity="true"
|
||||
android:normalScreens="true"/>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
|
|
|
@ -199,7 +199,7 @@ public class Cocos2dxActivity extends Activity{
|
|||
pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
protected void setPackgeName(String packageName) {
|
||||
protected void setPackageName(String packageName) {
|
||||
Cocos2dxActivity.packageName = packageName;
|
||||
|
||||
String apkFilePath = "";
|
||||
|
|
|
@ -151,34 +151,22 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
|||
}
|
||||
imm.hideSoftInputFromWindow(mainView.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
if (null == mainView)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Cocos2dxInputConnection ic;
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
if (onCheckIsTextEditor()) {
|
||||
outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT;
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI; //IME_ACTION_DONE
|
||||
outAttrs.initialSelStart = -1;
|
||||
outAttrs.initialSelEnd = -1;
|
||||
outAttrs.initialCapsMode = 1;
|
||||
|
||||
outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT;
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI; //IME_ACTION_DONE
|
||||
outAttrs.initialSelStart = -1;
|
||||
outAttrs.initialSelEnd = -1;
|
||||
outAttrs.initialCapsMode = 1;
|
||||
|
||||
if (null == ic)
|
||||
{
|
||||
ic = new Cocos2dxInputConnection(this);
|
||||
}
|
||||
return ic;
|
||||
}
|
||||
return null;
|
||||
if (null == ic)
|
||||
{
|
||||
ic = new Cocos2dxInputConnection(this);
|
||||
}
|
||||
|
||||
return ic;
|
||||
}
|
||||
|
||||
public void insertText(final String text) {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class TestsDemo extends Cocos2dxActivity{
|
|||
|
||||
// get the packageName,it's used to set the resource path
|
||||
String packageName = getApplication().getPackageName();
|
||||
super.setPackgeName(packageName);
|
||||
super.setPackageName(packageName);
|
||||
|
||||
setContentView(R.layout.test_demo);
|
||||
mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.test_demo_gl_surfaceview);
|
||||
|
|
Loading…
Reference in New Issue