Merge branch 'master' of https://github.com/gzito/cocos2d-x into gzito

This commit is contained in:
dumganhar 2012-01-17 10:04:51 +08:00
commit d37664934f
25 changed files with 179 additions and 51 deletions

View File

@ -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());

20
HelloLua/Resource/app.icf Normal file
View File

@ -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

View File

@ -0,0 +1 @@
abc899cd55086105f439df7a6d01db84168aebb5

View File

@ -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"
}

View File

View File

View File

@ -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"
@ -621,9 +621,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;

View 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

View File

@ -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 ) {

View File

@ -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;

View File

@ -144,6 +144,10 @@ files
"*.cpp"
"*.h"
("../text_input_node")
[text_input_node]
"*.cpp"
("../textures")
[textures]
"*.cpp"

View File

@ -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;
}

View File

@ -0,0 +1,4 @@
#ifndef MAIN_H
#define MAIN_H
#endif

View File

@ -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

View File

@ -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"

View File

@ -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) );

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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"