diff --git a/HelloLua/Classes/AppDelegate.cpp b/HelloLua/Classes/AppDelegate.cpp index af983e2c1f..fa95b19729 100644 --- a/HelloLua/Classes/AppDelegate.cpp +++ b/HelloLua/Classes/AppDelegate.cpp @@ -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()); diff --git a/HelloLua/Resource/app.icf b/HelloLua/Resource/app.icf new file mode 100644 index 0000000000..f880030bf1 --- /dev/null +++ b/HelloLua/Resource/app.icf @@ -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 diff --git a/HelloLua/Resource/fonts/arial.ttf.REMOVED.git-id b/HelloLua/Resource/fonts/arial.ttf.REMOVED.git-id new file mode 100644 index 0000000000..0e6ab72e71 --- /dev/null +++ b/HelloLua/Resource/fonts/arial.ttf.REMOVED.git-id @@ -0,0 +1 @@ +abc899cd55086105f439df7a6d01db84168aebb5 \ No newline at end of file diff --git a/HelloLua/marmalade/HelloLua.mkb b/HelloLua/marmalade/HelloLua.mkb new file mode 100644 index 0000000000..e8625d6df7 --- /dev/null +++ b/HelloLua/marmalade/HelloLua.mkb @@ -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" +} + diff --git a/template/airplay/Source/Main.cpp b/HelloLua/marmalade/Main.cpp old mode 100755 new mode 100644 similarity index 100% rename from template/airplay/Source/Main.cpp rename to HelloLua/marmalade/Main.cpp diff --git a/template/airplay/Source/Main.h b/HelloLua/marmalade/Main.h old mode 100755 new mode 100644 similarity index 100% rename from template/airplay/Source/Main.h rename to HelloLua/marmalade/Main.h diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 0ec6f99e91..5143964850 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -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; diff --git a/cocos2dx/include/CCLabelBMFont.h b/cocos2dx/include/CCLabelBMFont.h index 9e730de79a..d424eedaa0 100755 --- a/cocos2dx/include/CCLabelBMFont.h +++ b/cocos2dx/include/CCLabelBMFont.h @@ -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 + 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* 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 */ diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 910e02d91c..c4d93af278 100755 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -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 diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 9f55591b0a..91b699186d 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -107,9 +107,19 @@ namespace cocos2d{ this->parseConfigFile(FNTfile); return true; } + + CCBMFontConfiguration::CCBMFontConfiguration() + : m_pBitmapFontArray(new std::map) + , 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::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 diff --git a/cocos2dx/platform/marmalade/CCEGLView_marmalade.cpp b/cocos2dx/platform/marmalade/CCEGLView_marmalade.cpp index 17393b5a40..2f72d08d2b 100644 --- a/cocos2dx/platform/marmalade/CCEGLView_marmalade.cpp +++ b/cocos2dx/platform/marmalade/CCEGLView_marmalade.cpp @@ -32,9 +32,11 @@ #include "CCTouch.h" #include "CCTouchDispatcher.h" #include "CCKeypadDispatcher.h" +#include "CCIMEDispatcher.h" #include "ccMacros.h" #include +#include 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 ) { diff --git a/cocos2dx/platform/marmalade/CCEGLView_marmalade.h b/cocos2dx/platform/marmalade/CCEGLView_marmalade.h index a89a0f441d..9f0f508cee 100644 --- a/cocos2dx/platform/marmalade/CCEGLView_marmalade.h +++ b/cocos2dx/platform/marmalade/CCEGLView_marmalade.h @@ -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; diff --git a/cocos2dx/proj.marmalade/cocos2dx.mkf b/cocos2dx/proj.marmalade/cocos2dx.mkf index fee1228109..51f72a9489 100644 --- a/cocos2dx/proj.marmalade/cocos2dx.mkf +++ b/cocos2dx/proj.marmalade/cocos2dx.mkf @@ -144,6 +144,10 @@ files "*.cpp" "*.h" + ("../text_input_node") + [text_input_node] + "*.cpp" + ("../textures") [textures] "*.cpp" diff --git a/template/airplay/README.txt b/template/marmalade/README.txt similarity index 100% rename from template/airplay/README.txt rename to template/marmalade/README.txt diff --git a/template/airplay/Source/AppDelegate.cpp b/template/marmalade/Source/AppDelegate.cpp similarity index 100% rename from template/airplay/Source/AppDelegate.cpp rename to template/marmalade/Source/AppDelegate.cpp diff --git a/template/airplay/Source/AppDelegate.h b/template/marmalade/Source/AppDelegate.h similarity index 100% rename from template/airplay/Source/AppDelegate.h rename to template/marmalade/Source/AppDelegate.h diff --git a/template/marmalade/Source/Main.cpp b/template/marmalade/Source/Main.cpp new file mode 100755 index 0000000000..e93da5d647 --- /dev/null +++ b/template/marmalade/Source/Main.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; +} diff --git a/template/marmalade/Source/Main.h b/template/marmalade/Source/Main.h new file mode 100755 index 0000000000..8b5463f838 --- /dev/null +++ b/template/marmalade/Source/Main.h @@ -0,0 +1,4 @@ +#ifndef MAIN_H +#define MAIN_H + +#endif diff --git a/template/airplay/Source/MyScene.cpp b/template/marmalade/Source/MyScene.cpp similarity index 100% rename from template/airplay/Source/MyScene.cpp rename to template/marmalade/Source/MyScene.cpp diff --git a/template/airplay/Source/MyScene.h b/template/marmalade/Source/MyScene.h similarity index 100% rename from template/airplay/Source/MyScene.h rename to template/marmalade/Source/MyScene.h diff --git a/template/airplay/___PROJECTNAME___.mkb b/template/marmalade/___PROJECTNAME___.mkb similarity index 59% rename from template/airplay/___PROJECTNAME___.mkb rename to template/marmalade/___PROJECTNAME___.mkb index bb96e5251d..cb48395fd5 100755 --- a/template/airplay/___PROJECTNAME___.mkb +++ b/template/marmalade/___PROJECTNAME___.mkb @@ -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 diff --git a/template/msvc/CCAppWiz.win32/CCAppWiz.win32.ico b/template/msvc/CCAppWiz.win32/CCAppWiz.win32.ico index 36d6903a9d..20fa6f3009 100644 Binary files a/template/msvc/CCAppWiz.win32/CCAppWiz.win32.ico and b/template/msvc/CCAppWiz.win32/CCAppWiz.win32.ico differ diff --git a/template/msvc/CCAppWiz.win32/Templates/1033/win32/res/root.ico b/template/msvc/CCAppWiz.win32/Templates/1033/win32/res/root.ico index c397deb49d..feaf932a74 100644 Binary files a/template/msvc/CCAppWiz.win32/Templates/1033/win32/res/root.ico and b/template/msvc/CCAppWiz.win32/Templates/1033/win32/res/root.ico differ diff --git a/template/msvc/CCAppWiz.wophone/CCAppWiz.wophone.ico b/template/msvc/CCAppWiz.wophone/CCAppWiz.wophone.ico index 36d6903a9d..20fa6f3009 100644 Binary files a/template/msvc/CCAppWiz.wophone/CCAppWiz.wophone.ico and b/template/msvc/CCAppWiz.wophone/CCAppWiz.wophone.ico differ diff --git a/tests/Res/fonts/bitmapFontChinese.png.REMOVED.git-id b/tests/Res/fonts/bitmapFontChinese.png.REMOVED.git-id new file mode 100644 index 0000000000..53ce8980e1 --- /dev/null +++ b/tests/Res/fonts/bitmapFontChinese.png.REMOVED.git-id @@ -0,0 +1 @@ +9d2adf428a20b8facb57c0b3dc8dd782c74e27ea \ No newline at end of file diff --git a/tests/test.marmalade/test.mkb b/tests/test.marmalade/test.mkb index 1888dfccb9..febb16d664 100644 --- a/tests/test.marmalade/test.mkb +++ b/tests/test.marmalade/test.mkb @@ -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" diff --git a/tests/tests/Box2DTestBed/Box2dView.cpp b/tests/tests/Box2DTestBed/Box2dView.cpp index 801860f31e..79cda0e504 100644 --- a/tests/tests/Box2DTestBed/Box2dView.cpp +++ b/tests/tests/Box2DTestBed/Box2dView.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) ); diff --git a/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp b/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp index c60525e25f..79bb0bf939 100644 --- a/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp @@ -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); diff --git a/tests/tests/LabelTest/LabelTest.cpp b/tests/tests/LabelTest/LabelTest.cpp index 2322d4ecec..ad865225fd 100644 --- a/tests/tests/LabelTest/LabelTest.cpp +++ b/tests/tests/LabelTest/LabelTest.cpp @@ -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"; +} diff --git a/tests/tests/LabelTest/LabelTest.h b/tests/tests/LabelTest/LabelTest.h index 281badf733..3c17c237b6 100644 --- a/tests/tests/LabelTest/LabelTest.h +++ b/tests/tests/LabelTest/LabelTest.h @@ -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 diff --git a/tests/tests/controller.cpp b/tests/tests/controller.cpp index 042f77c7b5..21fdea3833 100644 --- a/tests/tests/controller.cpp +++ b/tests/tests/controller.cpp @@ -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); diff --git a/tests/tests/testBasic.cpp b/tests/tests/testBasic.cpp index ed349cc35a..cf2c8f6357 100644 --- a/tests/tests/testBasic.cpp +++ b/tests/tests/testBasic.cpp @@ -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); diff --git a/tests/tests/tests.h b/tests/tests/tests.h index 1ac167ee06..6ea470900b 100644 --- a/tests/tests/tests.h +++ b/tests/tests/tests.h @@ -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"