mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' into moveSel2CCObject
This commit is contained in:
commit
57eee38f4e
|
@ -79,7 +79,7 @@ bool AppDelegate::initInstance()
|
|||
|
||||
#endif // CC_PLATFORM_WOPHONE
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
// MaxAksenov said it's NOT a very elegant solution. I agree, haha
|
||||
CCDirector::sharedDirector()->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
|
||||
#endif
|
||||
|
@ -126,7 +126,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
|
||||
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeScriptFile(path.c_str());
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# This file is for configuration settings for your
|
||||
# application.
|
||||
#
|
||||
# The syntax is similar to windows .ini files ie
|
||||
#
|
||||
# [GroupName]
|
||||
# Setting = Value
|
||||
#
|
||||
# Which can be read by your application using
|
||||
# e.g s3eConfigGetString("GroupName", "Setting", string)
|
||||
#
|
||||
# All settings must be documented in .config.txt files.
|
||||
# New settings specific to this application should be
|
||||
# documented in app.config.txt
|
||||
#
|
||||
# Some conditional operations are also permitted, see the
|
||||
# S3E documentation for details.
|
||||
|
||||
[S3E]
|
||||
MemSize=12000000
|
|
@ -0,0 +1 @@
|
|||
abc899cd55086105f439df7a6d01db84168aebb5
|
|
@ -0,0 +1,52 @@
|
|||
options
|
||||
{
|
||||
s3e-data-dir="../Resource"
|
||||
|
||||
module_path="../../cocos2dx/proj.marmalade/"
|
||||
module_path="../../CocosDenshion/proj.marmalade/"
|
||||
}
|
||||
|
||||
includepaths
|
||||
{
|
||||
../Classes
|
||||
../../lua/tolua
|
||||
../../lua/cocos2dx_support
|
||||
../../lua/CocosDenshion_support
|
||||
}
|
||||
|
||||
package lua
|
||||
|
||||
subprojects
|
||||
{
|
||||
IwGL
|
||||
cocos2dx
|
||||
CocosDenshion
|
||||
lua
|
||||
}
|
||||
|
||||
|
||||
files
|
||||
{
|
||||
[Main]
|
||||
|
||||
Main.h
|
||||
Main.cpp
|
||||
|
||||
("../Classes")
|
||||
[Classes]
|
||||
AppDelegate.h
|
||||
AppDelegate.cpp
|
||||
|
||||
("../../lua/cocos2dx_support")
|
||||
[Classes/cocos2dx_support]
|
||||
"*.cpp"
|
||||
|
||||
("../../lua/CocosDenshion_support")
|
||||
[Classes/CocosDenshion_support]
|
||||
"*.cpp"
|
||||
|
||||
(../../lua/tolua)
|
||||
[tolua]
|
||||
"*.c"
|
||||
}
|
||||
|
|
@ -48,9 +48,9 @@ THE SOFTWARE.
|
|||
#include "CCAnimationCache.h"
|
||||
#include "CCTouch.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
//#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
#include "CCUserDefault.h"
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
#include "support/CCProfiling.h"
|
||||
|
@ -623,9 +623,9 @@ void CCDirector::purgeDirector()
|
|||
CCScheduler::purgeSharedScheduler();
|
||||
CCTextureCache::purgeSharedTextureCache();
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
//#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
CCUserDefault::purgeSharedUserDefault();
|
||||
#endif
|
||||
//#endif
|
||||
// OpenGL view
|
||||
m_pobOpenGLView->release();
|
||||
m_pobOpenGLView = NULL;
|
||||
|
|
|
@ -33,6 +33,8 @@ Use any of these editors to generate BMFonts:
|
|||
#ifndef __CCBITMAP_FONT_ATLAS_H__
|
||||
#define __CCBITMAP_FONT_ATLAS_H__
|
||||
#include "CCSpriteBatchNode.h"
|
||||
#include <map>
|
||||
|
||||
namespace cocos2d{
|
||||
|
||||
struct _KerningHashElement;
|
||||
|
@ -69,10 +71,6 @@ namespace cocos2d{
|
|||
int bottom;
|
||||
} ccBMFontPadding;
|
||||
|
||||
enum {
|
||||
// how many characters are supported
|
||||
kCCBMFontMaxChars = 2048, //256,
|
||||
};
|
||||
|
||||
/** @brief CCBMFontConfiguration has parsed configuration of the the .fnt file
|
||||
@since v0.8
|
||||
|
@ -82,7 +80,8 @@ namespace cocos2d{
|
|||
// XXX: Creating a public interface so that the bitmapFontArray[] is accesible
|
||||
public://@public
|
||||
//! The characters building up the font
|
||||
ccBMFontDef m_pBitmapFontArray[kCCBMFontMaxChars];
|
||||
std::map<unsigned int, ccBMFontDef>* m_pBitmapFontArray;
|
||||
|
||||
//! FNTConfig: Common Height
|
||||
unsigned int m_uCommonHeight;
|
||||
//! Padding
|
||||
|
@ -92,10 +91,7 @@ namespace cocos2d{
|
|||
//! values for kerning
|
||||
struct _KerningHashElement *m_pKerningDictionary;
|
||||
public:
|
||||
CCBMFontConfiguration()
|
||||
: m_uCommonHeight(0)
|
||||
, m_pKerningDictionary(NULL)
|
||||
{}
|
||||
CCBMFontConfiguration();
|
||||
virtual ~CCBMFontConfiguration();
|
||||
char * description();
|
||||
/** allocates a CCBMFontConfiguration with a FNT file */
|
||||
|
|
|
@ -89,8 +89,8 @@ THE SOFTWARE.
|
|||
#include "CCDrawingPrimitives.h"
|
||||
#include "CCScheduler.h"
|
||||
|
||||
// havn't implement on wophone and marmalade
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
// havn't implement on wophone
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WOPHONE)
|
||||
#include "CCTextFieldTTF.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -107,9 +107,19 @@ namespace cocos2d{
|
|||
this->parseConfigFile(FNTfile);
|
||||
return true;
|
||||
}
|
||||
|
||||
CCBMFontConfiguration::CCBMFontConfiguration()
|
||||
: m_pBitmapFontArray(new std::map<unsigned int, ccBMFontDef>)
|
||||
, m_uCommonHeight(0)
|
||||
, m_pKerningDictionary(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCBMFontConfiguration::~CCBMFontConfiguration()
|
||||
{
|
||||
CCLOGINFO( "cocos2d: deallocing CCBMFontConfiguration" );
|
||||
CC_SAFE_DELETE(m_pBitmapFontArray);
|
||||
this->purgeKerningDictionary();
|
||||
m_sAtlasName.clear();
|
||||
}
|
||||
|
@ -191,7 +201,7 @@ namespace cocos2d{
|
|||
this->parseCharacterDefinition(line, &characterDefinition);
|
||||
|
||||
// Add the CharDef returned to the charArray
|
||||
m_pBitmapFontArray[ characterDefinition.charID ] = characterDefinition;
|
||||
(*m_pBitmapFontArray)[ characterDefinition.charID ] = characterDefinition;
|
||||
}
|
||||
else if(line.substr(0,strlen("kernings count")) == "kernings count")
|
||||
{
|
||||
|
@ -279,7 +289,7 @@ namespace cocos2d{
|
|||
int index2 = line.find(' ', index);
|
||||
std::string value = line.substr(index, index2-index);
|
||||
sscanf(value.c_str(), "id=%u", &characterDefinition->charID);
|
||||
CCAssert(characterDefinition->charID < kCCBMFontMaxChars, "BitmpaFontAtlas: CharID bigger than supported");
|
||||
|
||||
// Character x
|
||||
index = line.find("x=");
|
||||
index2 = line.find(' ', index);
|
||||
|
@ -433,6 +443,183 @@ namespace cocos2d{
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cc_wcslen(const unsigned short* str)
|
||||
{
|
||||
int i=0;
|
||||
while(*str++) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Code from GLIB gutf8.c starts here. */
|
||||
|
||||
#define UTF8_COMPUTE(Char, Mask, Len) \
|
||||
if (Char < 128) \
|
||||
{ \
|
||||
Len = 1; \
|
||||
Mask = 0x7f; \
|
||||
} \
|
||||
else if ((Char & 0xe0) == 0xc0) \
|
||||
{ \
|
||||
Len = 2; \
|
||||
Mask = 0x1f; \
|
||||
} \
|
||||
else if ((Char & 0xf0) == 0xe0) \
|
||||
{ \
|
||||
Len = 3; \
|
||||
Mask = 0x0f; \
|
||||
} \
|
||||
else if ((Char & 0xf8) == 0xf0) \
|
||||
{ \
|
||||
Len = 4; \
|
||||
Mask = 0x07; \
|
||||
} \
|
||||
else if ((Char & 0xfc) == 0xf8) \
|
||||
{ \
|
||||
Len = 5; \
|
||||
Mask = 0x03; \
|
||||
} \
|
||||
else if ((Char & 0xfe) == 0xfc) \
|
||||
{ \
|
||||
Len = 6; \
|
||||
Mask = 0x01; \
|
||||
} \
|
||||
else \
|
||||
Len = -1;
|
||||
|
||||
#define UTF8_LENGTH(Char) \
|
||||
((Char) < 0x80 ? 1 : \
|
||||
((Char) < 0x800 ? 2 : \
|
||||
((Char) < 0x10000 ? 3 : \
|
||||
((Char) < 0x200000 ? 4 : \
|
||||
((Char) < 0x4000000 ? 5 : 6)))))
|
||||
|
||||
|
||||
#define UTF8_GET(Result, Chars, Count, Mask, Len) \
|
||||
(Result) = (Chars)[0] & (Mask); \
|
||||
for ((Count) = 1; (Count) < (Len); ++(Count)) \
|
||||
{ \
|
||||
if (((Chars)[(Count)] & 0xc0) != 0x80) \
|
||||
{ \
|
||||
(Result) = -1; \
|
||||
break; \
|
||||
} \
|
||||
(Result) <<= 6; \
|
||||
(Result) |= ((Chars)[(Count)] & 0x3f); \
|
||||
}
|
||||
|
||||
#define UNICODE_VALID(Char) \
|
||||
((Char) < 0x110000 && \
|
||||
(((Char) & 0xFFFFF800) != 0xD800) && \
|
||||
((Char) < 0xFDD0 || (Char) > 0xFDEF) && \
|
||||
((Char) & 0xFFFE) != 0xFFFE)
|
||||
|
||||
|
||||
static const char utf8_skip_data[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5,
|
||||
5, 5, 5, 6, 6, 1, 1
|
||||
};
|
||||
|
||||
static const char *const g_utf8_skip = utf8_skip_data;
|
||||
|
||||
#define cc_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(unsigned char *)(p)])
|
||||
|
||||
/*
|
||||
* g_utf8_strlen:
|
||||
* @p: pointer to the start of a UTF-8 encoded string.
|
||||
* @max: the maximum number of bytes to examine. If @max
|
||||
* is less than 0, then the string is assumed to be
|
||||
* nul-terminated. If @max is 0, @p will not be examined and
|
||||
* may be %NULL.
|
||||
*
|
||||
* Returns the length of the string in characters.
|
||||
*
|
||||
* Return value: the length of the string in characters
|
||||
**/
|
||||
static long
|
||||
cc_utf8_strlen (const char * p, int max)
|
||||
{
|
||||
long len = 0;
|
||||
const char *start = p;
|
||||
|
||||
if (!(p != NULL || max == 0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (max < 0)
|
||||
{
|
||||
while (*p)
|
||||
{
|
||||
p = cc_utf8_next_char (p);
|
||||
++len;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (max == 0 || !*p)
|
||||
return 0;
|
||||
|
||||
p = cc_utf8_next_char (p);
|
||||
|
||||
while (p - start < max && *p)
|
||||
{
|
||||
++len;
|
||||
p = cc_utf8_next_char (p);
|
||||
}
|
||||
|
||||
/* only do the last len increment if we got a complete
|
||||
* char (don't count partial chars)
|
||||
*/
|
||||
if (p - start == max)
|
||||
++len;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* g_utf8_get_char:
|
||||
* @p: a pointer to Unicode character encoded as UTF-8
|
||||
*
|
||||
* Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
|
||||
* If @p does not point to a valid UTF-8 encoded character, results are
|
||||
* undefined. If you are not sure that the bytes are complete
|
||||
* valid Unicode characters, you should use g_utf8_get_char_validated()
|
||||
* instead.
|
||||
*
|
||||
* Return value: the resulting character
|
||||
**/
|
||||
static unsigned int
|
||||
cc_utf8_get_char (const char * p)
|
||||
{
|
||||
int i, mask = 0, len;
|
||||
unsigned int result;
|
||||
unsigned char c = (unsigned char) *p;
|
||||
|
||||
UTF8_COMPUTE (c, mask, len);
|
||||
if (len == -1)
|
||||
return (unsigned int) - 1;
|
||||
UTF8_GET (result, p, i, mask, len);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void CCLabelBMFont::createFontChars()
|
||||
{
|
||||
int nextFontPositionX = 0;
|
||||
|
@ -447,16 +634,33 @@ namespace cocos2d{
|
|||
|
||||
unsigned int quantityOfLines = 1;
|
||||
|
||||
unsigned int stringLen = m_sString.length();
|
||||
|
||||
if (0 == stringLen)
|
||||
if (0 == m_sString.length())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int utf8len = cc_utf8_strlen(m_sString.c_str(), -1);
|
||||
if (utf8len == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned short* pUniStr = new unsigned short[utf8len+1];
|
||||
pUniStr[utf8len] = 0;
|
||||
|
||||
const char* p = m_sString.c_str();
|
||||
|
||||
for (int i = 0; i < utf8len; ++i)
|
||||
{
|
||||
pUniStr[i] = cc_utf8_get_char(p);
|
||||
p = cc_utf8_next_char (p);
|
||||
}
|
||||
|
||||
unsigned int stringLen = cc_wcslen(pUniStr);
|
||||
|
||||
for (unsigned int i = 0; i < stringLen - 1; ++i)
|
||||
{
|
||||
unsigned short c = m_sString[i];
|
||||
unsigned short c = pUniStr[i];
|
||||
if (c == '\n')
|
||||
{
|
||||
quantityOfLines++;
|
||||
|
@ -468,8 +672,7 @@ namespace cocos2d{
|
|||
|
||||
for (unsigned int i= 0; i < stringLen; i++)
|
||||
{
|
||||
unsigned short c = m_sString[i];
|
||||
CCAssert( c < kCCBMFontMaxChars, "LabelBMFont: character outside bounds");
|
||||
unsigned short c = pUniStr[i];
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
|
@ -477,10 +680,13 @@ namespace cocos2d{
|
|||
nextFontPositionY -= m_pConfiguration->m_uCommonHeight;
|
||||
continue;
|
||||
}
|
||||
|
||||
std::map<unsigned int, ccBMFontDef>::iterator it = m_pConfiguration->m_pBitmapFontArray->find(c);
|
||||
CCAssert(it != m_pConfiguration->m_pBitmapFontArray->end(), "LabelBMFont: character is not supported");
|
||||
|
||||
kerningAmount = this->kerningAmountForFirst(prev, c);
|
||||
|
||||
const ccBMFontDef& fontDef = m_pConfiguration->m_pBitmapFontArray[c];
|
||||
const ccBMFontDef& fontDef = (*(m_pConfiguration->m_pBitmapFontArray))[c];
|
||||
|
||||
CCRect rect = fontDef.rect;
|
||||
|
||||
|
@ -511,7 +717,7 @@ namespace cocos2d{
|
|||
// NSLog(@"position.y: %f", fontChar.position.y);
|
||||
|
||||
// update kerning
|
||||
nextFontPositionX += m_pConfiguration->m_pBitmapFontArray[c].xAdvance + kerningAmount;
|
||||
nextFontPositionX += (*(m_pConfiguration->m_pBitmapFontArray))[c].xAdvance + kerningAmount;
|
||||
prev = c;
|
||||
|
||||
// Apply label properties
|
||||
|
@ -536,6 +742,8 @@ namespace cocos2d{
|
|||
tmpSize.height = (float) totalHeight;
|
||||
|
||||
this->setContentSizeInPixels(tmpSize);
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(pUniStr);
|
||||
}
|
||||
|
||||
//LabelBMFont - CCLabelProtocol protocol
|
||||
|
|
|
@ -32,9 +32,11 @@
|
|||
#include "CCTouch.h"
|
||||
#include "CCTouchDispatcher.h"
|
||||
#include "CCKeypadDispatcher.h"
|
||||
#include "CCIMEDispatcher.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <s3eOSReadString.h>
|
||||
|
||||
NS_CC_BEGIN;
|
||||
|
||||
|
@ -83,7 +85,8 @@ CCEGLView::CCEGLView()
|
|||
}
|
||||
|
||||
// Register keyboard event handler
|
||||
s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this);
|
||||
// s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this);
|
||||
// s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, &CharEventHandler, this);
|
||||
}
|
||||
|
||||
void CCEGLView::setFrameWidthAndHeight(int width, int height)
|
||||
|
@ -235,21 +238,27 @@ CCTouch* CCEGLView::findTouch(int id)
|
|||
|
||||
void CCEGLView::setKeyTouch(void* systemData)
|
||||
{
|
||||
s3eKeyboardEvent* event = (s3eKeyboardEvent*)systemData;
|
||||
if (event->m_Pressed)
|
||||
{
|
||||
if (event->m_Key!=m_Key)
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeMenuClicked);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeBackClicked);
|
||||
|
||||
}
|
||||
m_Key =event->m_Key;
|
||||
}
|
||||
// s3eKeyboardEvent* event = (s3eKeyboardEvent*)systemData;
|
||||
// if (event->m_Pressed)
|
||||
// {
|
||||
// if (event->m_Key!=m_Key)
|
||||
// {
|
||||
// CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeMenuClicked);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeBackClicked);
|
||||
//
|
||||
// }
|
||||
// m_Key =event->m_Key;
|
||||
// }
|
||||
}
|
||||
|
||||
void CCEGLView::setCharTouch( void* systemData )
|
||||
{
|
||||
// s3eKeyboardCharEvent* event = (s3eKeyboardCharEvent*)systemData;
|
||||
// s3eWChar c = event->m_Char ;
|
||||
// CCIMEDispatcher::sharedDispatcher()->dispatchInsertText((const char *)&c, 1);
|
||||
}
|
||||
|
||||
bool CCEGLView::isOpenGLReady()
|
||||
|
@ -272,7 +281,8 @@ void CCEGLView::release()
|
|||
s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler);
|
||||
}
|
||||
|
||||
s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler);
|
||||
// s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler);
|
||||
// s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &CharEventHandler);
|
||||
|
||||
if (IwGLIsInitialised())
|
||||
IwGLTerminate();
|
||||
|
@ -346,6 +356,16 @@ void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
|||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||
{
|
||||
if(bOpen && s3eOSReadStringAvailable() == S3E_TRUE) {
|
||||
const char* inputText = s3eOSReadStringUTF8("") ;
|
||||
if( inputText!=0 ) {
|
||||
CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(inputText, strlen(inputText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCEGLView& CCEGLView::sharedOpenGLView()
|
||||
{
|
||||
if( !m_pInstance ) {
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
void setContentScaleFactor(float contentScaleFactor);
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
|
||||
|
@ -98,7 +99,8 @@ private:
|
|||
void setMultiTouch(void* systemData);
|
||||
void setMultiMotionTouch(void* systemData);
|
||||
void setKeyTouch(void* systemData);
|
||||
|
||||
void setCharTouch(void* systemData);
|
||||
|
||||
CCTouch* findTouch(int id);
|
||||
CCTouch* touchSet[S3E_POINTER_TOUCH_MAX];
|
||||
|
||||
|
@ -131,6 +133,12 @@ private:
|
|||
((CCEGLView*)userData)->setKeyTouch(systemData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 CharEventHandler(void* systemData, void* userData)
|
||||
{
|
||||
((CCEGLView*)userData)->setCharTouch(systemData);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
NS_CC_END;
|
||||
|
|
|
@ -144,6 +144,10 @@ files
|
|||
"*.cpp"
|
||||
"*.h"
|
||||
|
||||
("../text_input_node")
|
||||
[text_input_node]
|
||||
"*.cpp"
|
||||
|
||||
("../textures")
|
||||
[textures]
|
||||
"*.cpp"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Application main file.
|
||||
|
||||
#include "Main.h"
|
||||
#include "AppDelegate.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
AppDelegate* app;
|
||||
int nRet = 0;
|
||||
|
||||
app = new AppDelegate;
|
||||
nRet = cocos2d::CCApplication::sharedApplication().Run();;
|
||||
delete app;
|
||||
return nRet;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#endif
|
|
@ -6,10 +6,10 @@ options
|
|||
|
||||
# paths to modules of cocos2d-x - uncomment and customize if you need additional modules
|
||||
|
||||
module_path="../../cocos2dx/proj.airplay/"
|
||||
# module_path="../../Box2D/proj.airplay/"
|
||||
# module_path="../../chipmunk/proj.airplay/"
|
||||
# module_path="../../CocosDenshion/proj.airplay/"
|
||||
module_path="../../cocos2dx/proj.marmalade/"
|
||||
# module_path="../../Box2D/proj.marmalade/"
|
||||
# module_path="../../chipmunk/proj.marmalade/"
|
||||
# module_path="../../CocosDenshion/proj.marmalade/"
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ includepaths
|
|||
}
|
||||
subprojects
|
||||
{
|
||||
# required module of Airplay SDK
|
||||
# required module of Marmalade
|
||||
|
||||
IwGL
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 66 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 46 KiB |
Binary file not shown.
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 66 KiB |
|
@ -0,0 +1 @@
|
|||
9d2adf428a20b8facb57c0b3dc8dd782c74e27ea
|
|
@ -130,6 +130,11 @@ files
|
|||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
[Tests/InputTest]
|
||||
("../tests/TextInputTest")
|
||||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
[Tests/KeypadTest]
|
||||
("../tests/KeypadTest")
|
||||
"*.h"
|
||||
|
@ -201,7 +206,7 @@ files
|
|||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
[Tests/Texture2dTest]
|
||||
[Tests/Texture2dTest]
|
||||
("../tests/Texture2dTest")
|
||||
"*.h"
|
||||
"*.cpp"
|
||||
|
|
|
@ -57,11 +57,11 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
view->setScale(15);
|
||||
view->setAnchorPoint( ccp(0,0) );
|
||||
view->setPosition( ccp(s.width/2, s.height/3) );
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString(view->title().c_str(), "fonts/arial16.fnt");
|
||||
#else
|
||||
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
// CCLabelBMFont* label = CCLabelBMFont::labelWithString(view->title().c_str(), "fonts/arial16.fnt");
|
||||
//#else
|
||||
CCLabelTTF* label = CCLabelTTF::labelWithString(view->title().c_str(), "Arial", 28);
|
||||
#endif
|
||||
//#endif
|
||||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
|
|
|
@ -56,11 +56,11 @@ m_nSoundId(0)
|
|||
|
||||
for (int i = 0; i < m_nTestCount; ++i)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString(testItems[i].c_str(), "fonts/arial16.fnt");
|
||||
#else
|
||||
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
// CCLabelBMFont* label = CCLabelBMFont::labelWithString(testItems[i].c_str(), "fonts/arial16.fnt");
|
||||
//#else
|
||||
CCLabelTTF* label = CCLabelTTF::labelWithString(testItems[i].c_str(), "Arial", 24);
|
||||
#endif
|
||||
//#endif
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(CocosDenshionTest::menuCallback));
|
||||
|
||||
m_pItmeMenu->addChild(pMenuItem, i + 10000);
|
||||
|
|
|
@ -40,7 +40,7 @@ CCLayer* restartAtlasAction();
|
|||
|
||||
static int sceneIdx = -1;
|
||||
|
||||
#define MAX_LAYER 17
|
||||
#define MAX_LAYER 18
|
||||
|
||||
CCLayer* createAtlasLayer(int nIndex)
|
||||
{
|
||||
|
@ -65,6 +65,7 @@ CCLayer* createAtlasLayer(int nIndex)
|
|||
case 14: return new LabelTTFTest();
|
||||
case 15: return new LabelTTFMultiline();
|
||||
case 16: return new LabelTTFChinese();
|
||||
case 17: return new LabelBMFontChinese();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -706,7 +707,7 @@ BitmapFontMultiLine::BitmapFontMultiLine()
|
|||
CCSize s;
|
||||
|
||||
// Left
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString("Multi line\nLeft", "fonts/bitmapFontTest3.fnt");
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString(" Multi line\nLeft", "fonts/bitmapFontTest3.fnt");
|
||||
label1->setAnchorPoint(ccp(0,0));
|
||||
addChild(label1, 0, kTagBitmapAtlas1);
|
||||
|
||||
|
@ -964,3 +965,16 @@ string LabelTTFChinese::title()
|
|||
{
|
||||
return "Testing CCLabelTTF with Chinese character";
|
||||
}
|
||||
|
||||
LabelBMFontChinese::LabelBMFontChinese()
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLabelBMFont* pLable = CCLabelBMFont::labelWithString("中国", "fonts/bitmapFontChinese.fnt");
|
||||
pLable->setPosition(ccp(size.width / 2, size.height /2));
|
||||
this->addChild(pLable);
|
||||
}
|
||||
|
||||
string LabelBMFontChinese::title()
|
||||
{
|
||||
return "Testing CCLabelBMFont with Chinese character";
|
||||
}
|
||||
|
|
|
@ -185,6 +185,13 @@ public:
|
|||
virtual std::string title();
|
||||
};
|
||||
|
||||
class LabelBMFontChinese : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
LabelBMFontChinese();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
// we don't support linebreak mode
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,10 +65,8 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
#endif
|
||||
case TEST_LABEL:
|
||||
pScene = new AtlasTestScene(); break;
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
case TEST_TEXT_INPUT:
|
||||
pScene = new TextInputTestScene(); break;
|
||||
#endif
|
||||
case TEST_SPRITE:
|
||||
pScene = new SpriteTestScene(); break;
|
||||
case TEST_SCHEDULER:
|
||||
|
@ -142,11 +140,11 @@ TestController::TestController()
|
|||
m_pItmeMenu = CCMenu::menuWithItems(NULL);
|
||||
for (int i = 0; i < TESTS_COUNT; ++i)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString(g_aTestNames[i].c_str(), "fonts/arial16.fnt");
|
||||
#else
|
||||
// #if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
// CCLabelBMFont* label = CCLabelBMFont::labelWithString(g_aTestNames[i].c_str(), "fonts/arial16.fnt");
|
||||
// #else
|
||||
CCLabelTTF* label = CCLabelTTF::labelWithString(g_aTestNames[i].c_str(), "Arial", 24);
|
||||
#endif
|
||||
// #endif
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(TestController::menuCallback));
|
||||
|
||||
m_pItmeMenu->addChild(pMenuItem, i + 10000);
|
||||
|
|
|
@ -17,11 +17,11 @@ void TestScene::onEnter()
|
|||
CCScene::onEnter();
|
||||
|
||||
//add the menu item for back to main menu
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString("MainMenu", "fonts/arial16.fnt");
|
||||
#else
|
||||
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
// CCLabelBMFont* label = CCLabelBMFont::labelWithString("MainMenu", "fonts/arial16.fnt");
|
||||
//#else
|
||||
CCLabelTTF* label = CCLabelTTF::labelWithString("MainMenu", "Arial", 20);
|
||||
#endif
|
||||
//#endif
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(TestScene::MainMenuCallback));
|
||||
|
||||
CCMenu* pMenu =CCMenu::menuWithItems(pMenuItem, NULL);
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include "IntervalTest/IntervalTest.h"
|
||||
#include "LabelTest/LabelTest.h"
|
||||
// havn't implement on marmalade
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
//#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
#include "TextInputTest/TextInputTest.h"
|
||||
#endif
|
||||
//#endif
|
||||
#include "SpriteTest/SpriteTest.h"
|
||||
#include "SchedulerTest/SchedulerTest.h"
|
||||
#include "RenderTextureTest/RenderTextureTest.h"
|
||||
|
|
Loading…
Reference in New Issue