issue #2103 add more test lua

This commit is contained in:
samuele3hu 2013-05-24 11:42:27 +08:00
parent 9a36d8080a
commit 338c7c8d67
54 changed files with 2091 additions and 77 deletions

View File

@ -100,7 +100,7 @@ STATICLIBS += -lnacl_io
endif endif
SOUNDLIBS := -lalut -lopenal -lvorbisfile -lvorbis -logg SOUNDLIBS := -lalut -lopenal -lvorbisfile -lvorbis -logg
STATICLIBS += $(SOUNDLIBS) -lfreetype -lxml2 -lwebp -lpng -ljpeg -ltiff -llua STATICLIBS += $(SOUNDLIBS) -lfreetype -lxml2 -lwebp -lpng -ljpeg -ltiff -llua -lchipmunk
STATICLIBS += -lppapi_gles2 -lppapi -lppapi_cpp -lnosys STATICLIBS += -lppapi_gles2 -lppapi -lppapi_cpp -lnosys
SHAREDLIBS += -lpthread -lcocosdenshion -lcocos2d -lz SHAREDLIBS += -lpthread -lcocosdenshion -lcocos2d -lz

View File

@ -42,7 +42,7 @@ CCNotificationCenter::CCNotificationCenter()
CCNotificationCenter::~CCNotificationCenter() CCNotificationCenter::~CCNotificationCenter()
{ {
unregisterScriptObserver(); // unregisterScriptObserver(NULL);
m_observers->release(); m_observers->release();
} }
@ -135,19 +135,43 @@ int CCNotificationCenter::removeAllObservers(CCObject *target)
return toRemove->count(); return toRemove->count();
} }
void CCNotificationCenter::registerScriptObserver(int handler) void CCNotificationCenter::registerScriptObserver( CCObject *target, int handler,const char* name)
{ {
unregisterScriptObserver(); // unregisterScriptObserver(name);
m_scriptHandler = handler; // m_scriptHandler = handler;
if (this->observerExisted(target, name))
return;
CCNotificationObserver *observer = new CCNotificationObserver(target, NULL, name, NULL);
if (!observer)
return;
observer->setHandler(handler);
observer->autorelease();
m_observers->addObject(observer);
} }
void CCNotificationCenter::unregisterScriptObserver(void) void CCNotificationCenter::unregisterScriptObserver(CCObject *target,const char* name)
{ {
if (m_scriptHandler) // if (m_scriptHandler)
{ {
CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(m_scriptHandler); // CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(m_scriptHandler);
CCObject* obj = NULL;
CCARRAY_FOREACH(m_observers, obj)
{
CCNotificationObserver* observer = (CCNotificationObserver*) obj;
if (!observer)
continue;
if ( !strcmp(observer->getName(),name) && observer->getTarget() == target)
{
m_observers->removeObject(observer);
}
}
} }
m_scriptHandler = 0; // m_scriptHandler = 0;
} }
void CCNotificationCenter::postNotification(const char *name, CCObject *object) void CCNotificationCenter::postNotification(const char *name, CCObject *object)
@ -162,13 +186,17 @@ void CCNotificationCenter::postNotification(const char *name, CCObject *object)
continue; continue;
if (!strcmp(name,observer->getName()) && (observer->getObject() == object || observer->getObject() == NULL || object == NULL)) if (!strcmp(name,observer->getName()) && (observer->getObject() == object || observer->getObject() == NULL || object == NULL))
observer->performSelector(object); {
} if (0 != observer->getHandler())
{
if (m_scriptHandler) CCScriptEngineProtocol* engine = CCScriptEngineManager::sharedManager()->getScriptEngine();
{ engine->executeNotificationEvent(this, name);
CCScriptEngineProtocol* engine = CCScriptEngineManager::sharedManager()->getScriptEngine(); }
engine->executeNotificationEvent(this, name); else
{
observer->performSelector(object);
}
}
} }
} }
@ -177,6 +205,30 @@ void CCNotificationCenter::postNotification(const char *name)
this->postNotification(name,NULL); this->postNotification(name,NULL);
} }
int CCNotificationCenter::getObserverHandlerByName(const char* name)
{
if (NULL == name || strlen(name) == 0)
{
return -1;
}
CCObject* obj = NULL;
CCARRAY_FOREACH(m_observers, obj)
{
CCNotificationObserver* observer = (CCNotificationObserver*) obj;
if (NULL == observer)
continue;
if ( 0 == strcmp(observer->getName(),name) )
{
return observer->getHandler();
break;
}
}
return -1;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// ///
/// CCNotificationObserver /// CCNotificationObserver
@ -196,6 +248,7 @@ CCNotificationObserver::CCNotificationObserver(CCObject *target,
string orig (name); string orig (name);
orig.copy(m_name,strlen(name),0); orig.copy(m_name,strlen(name),0);
m_nHandler = 0;
} }
CCNotificationObserver::~CCNotificationObserver() CCNotificationObserver::~CCNotificationObserver()
@ -235,4 +288,14 @@ CCObject *CCNotificationObserver::getObject()
return m_object; return m_object;
} }
int CCNotificationObserver::getHandler()
{
return m_nHandler;
}
void CCNotificationObserver::setHandler(int var)
{
m_nHandler = var;
}
NS_CC_END NS_CC_END

View File

@ -72,10 +72,10 @@ public:
* @note Only supports Lua Binding now. * @note Only supports Lua Binding now.
* @param handler The lua handler. * @param handler The lua handler.
*/ */
void registerScriptObserver(int handler); void registerScriptObserver(CCObject *target,int handler,const char* name);
/** Unregisters script observer */ /** Unregisters script observer */
void unregisterScriptObserver(void); void unregisterScriptObserver(CCObject *target,const char* name);
/** @brief Posts one notification event by name. /** @brief Posts one notification event by name.
* @param name The name of this notification. * @param name The name of this notification.
@ -93,6 +93,12 @@ public:
* @return The script handle. * @return The script handle.
*/ */
inline int getScriptHandler() { return m_scriptHandler; }; inline int getScriptHandler() { return m_scriptHandler; };
/** @brief Gets observer script handler.
* @param name The name of this notification.
* @return The observer script handle.
*/
int getObserverHandlerByName(const char* name);
private: private:
// internal functions // internal functions
@ -129,6 +135,7 @@ private:
CC_PROPERTY_READONLY(SEL_CallFuncO, m_selector, Selector); CC_PROPERTY_READONLY(SEL_CallFuncO, m_selector, Selector);
CC_PROPERTY_READONLY(char *, m_name, Name); CC_PROPERTY_READONLY(char *, m_name, Name);
CC_PROPERTY_READONLY(CCObject *, m_object, Object); CC_PROPERTY_READONLY(CCObject *, m_object, Object);
CC_PROPERTY(int, m_nHandler,Handler);
}; };
NS_CC_END NS_CC_END

View File

@ -78,7 +78,9 @@ bool CCControl::init()
this->setTouchPriority(1); this->setTouchPriority(1);
// Initialise the tables // Initialise the tables
m_pDispatchTable = new CCDictionary(); m_pDispatchTable = new CCDictionary();
// Initialise the mapHandleOfControlEvents
m_mapHandleOfControlEvent.clear();
return true; return true;
} }
else else
@ -125,6 +127,14 @@ void CCControl::sendActionsForControlEvents(CCControlEvent controlEvents)
CCInvocation* invocation = (CCInvocation*)pObj; CCInvocation* invocation = (CCInvocation*)pObj;
invocation->invoke(this); invocation->invoke(this);
} }
//Call ScriptFunc
if (kScriptTypeNone != m_eScriptType)
{
int nHandler = this->getHandleOfControlEvent(controlEvents);
if (-1 != nHandler) {
CCScriptEngineManager::sharedManager()->getScriptEngine()->executeEvent(nHandler,"",this);
}
}
} }
} }
} }
@ -326,4 +336,29 @@ bool CCControl::hasVisibleParents()
return true; return true;
} }
void CCControl::addHandleOfControlEvent(int nFunID,CCControlEvent controlEvent)
{
m_mapHandleOfControlEvent[controlEvent] = nFunID;
}
void CCControl::removeHandleOfControlEvent(CCControlEvent controlEvent)
{
std::map<int,int>::iterator Iter = m_mapHandleOfControlEvent.find(controlEvent);
if (m_mapHandleOfControlEvent.end() != Iter)
{
m_mapHandleOfControlEvent.erase(Iter);
}
}
int CCControl::getHandleOfControlEvent(CCControlEvent controlEvent)
{
std::map<int,int>::iterator Iter = m_mapHandleOfControlEvent.find(controlEvent);
if (m_mapHandleOfControlEvent.end() != Iter)
return Iter->second;
return -1;
}
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -254,7 +254,13 @@ protected:
void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent); void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
static CCControl* create(); static CCControl* create();
public:
void addHandleOfControlEvent(int nFunID,CCControlEvent controlEvent);
void removeHandleOfControlEvent(CCControlEvent controlEvent);
private:
int getHandleOfControlEvent(CCControlEvent controlEvent);
private:
std::map<int,int> m_mapHandleOfControlEvent;
}; };
// end of GUI group // end of GUI group

View File

@ -35,7 +35,7 @@
#define __CCCONTROL_UTILS_H__ #define __CCCONTROL_UTILS_H__
#include "sprite_nodes/CCSprite.h" #include "sprite_nodes/CCSprite.h"
#include "ExtensionMacros.h" #include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -31,7 +31,7 @@
#define __CCINVOCATION_H__ #define __CCINVOCATION_H__
#include "cocoa/CCObject.h" #include "cocoa/CCObject.h"
#include "ExtensionMacros.h" #include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#define __CCScale9Sprite_H__ #define __CCScale9Sprite_H__
#include "cocos2d.h" #include "cocos2d.h"
#include "ExtensionMacros.h" #include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -34,18 +34,20 @@ CCEditBox::CCEditBox(void)
, m_eEditBoxInputMode(kEditBoxInputModeSingleLine) , m_eEditBoxInputMode(kEditBoxInputModeSingleLine)
, m_eEditBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) , m_eEditBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters)
, m_eKeyboardReturnType(kKeyboardReturnTypeDefault) , m_eKeyboardReturnType(kKeyboardReturnTypeDefault)
, m_nFontSize(-1)
, m_nPlaceholderFontSize(-1)
, m_colText(ccWHITE) , m_colText(ccWHITE)
, m_colPlaceHolder(ccGRAY) , m_colPlaceHolder(ccGRAY)
, m_nMaxLength(0) , m_nMaxLength(0)
, m_fAdjustHeight(0.0f) , m_fAdjustHeight(0.0f)
, m_nPlaceholderFontSize(-1) , m_nScriptEditBoxHandler(0)
, m_nFontSize(-1)
{ {
} }
CCEditBox::~CCEditBox(void) CCEditBox::~CCEditBox(void)
{ {
CC_SAFE_DELETE(m_pEditBoxImpl); CC_SAFE_DELETE(m_pEditBoxImpl);
unregisterScriptEditBoxHandler();
} }
@ -382,5 +384,20 @@ void CCEditBox::keyboardDidHide(CCIMEKeyboardNotificationInfo& info)
} }
void CCEditBox::registerScriptEditBoxHandler(int handler)
{
unregisterScriptEditBoxHandler();
m_nScriptEditBoxHandler = handler;
}
void CCEditBox::unregisterScriptEditBoxHandler(void)
{
if (0 != m_nScriptEditBoxHandler)
{
CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(m_nScriptEditBoxHandler);
m_nScriptEditBoxHandler = 0;
}
}
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -199,7 +199,40 @@ public:
* Set the delegate for edit box. * Set the delegate for edit box.
*/ */
void setDelegate(CCEditBoxDelegate* pDelegate); void setDelegate(CCEditBoxDelegate* pDelegate);
/**
* Registers a script function that will be called for EditBox events.
*
* This handler will be removed automatically after onExit() called.
* @code
* -- lua sample
* local function editboxEventHandler(eventType)
* if eventType == "began" then
* -- triggered when an edit box gains focus after keyboard is shown
* elseif eventType == "ended" then
* -- triggered when an edit box loses focus after keyboard is hidden.
* elseif eventType == "changed" then
* -- triggered when the edit box text was changed.
* elseif eventType == "return" then
* -- triggered when the return button was pressed or the outside area of keyboard was touched.
* end
* end
*
* local editbox = CCEditBox:create(CCSize(...), CCScale9Sprite:create(...))
* editbox = registerScriptEditBoxHandler(editboxEventHandler)
* @endcode
*
* @param handler A number that indicates a lua function.
*/
void registerScriptEditBoxHandler(int handler);
/**
* Unregisters a script function that will be called for EditBox events.
*/
void unregisterScriptEditBoxHandler(void);
/**
* get a script Handler
*/
int getScriptEditBoxHandler(void){ return m_nScriptEditBoxHandler ;}
/** /**
* Set the text entered in the edit box. * Set the text entered in the edit box.
* @param pText The given text. * @param pText The given text.
@ -346,6 +379,7 @@ protected:
int m_nMaxLength; int m_nMaxLength;
float m_fAdjustHeight; float m_fAdjustHeight;
int m_nScriptEditBoxHandler;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -36,7 +36,7 @@ NS_CC_EXT_BEGIN
class CCEditBoxImpl class CCEditBoxImpl
{ {
public: public:
CCEditBoxImpl(CCEditBox* pEditBox) : m_pEditBox(pEditBox), m_pDelegate(NULL) {} CCEditBoxImpl(CCEditBox* pEditBox) : m_pDelegate(NULL),m_pEditBox(pEditBox) {}
virtual ~CCEditBoxImpl() {} virtual ~CCEditBoxImpl() {}
virtual bool initWithSize(const CCSize& size) = 0; virtual bool initWithSize(const CCSize& size) = 0;

View File

@ -255,6 +255,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox()); thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox()); thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
} }
CCEditBox* pEditBox = thiz->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
}
} }
void CCEditBoxImplAndroid::openKeyboard() void CCEditBoxImplAndroid::openKeyboard()
@ -263,6 +272,12 @@ void CCEditBoxImplAndroid::openKeyboard()
{ {
m_pDelegate->editBoxEditingDidBegin(m_pEditBox); m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
} }
CCEditBox* pEditBox = this->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
}
showEditTextDialogJNI( m_strPlaceHolder.c_str(), showEditTextDialogJNI( m_strPlaceHolder.c_str(),
m_strText.c_str(), m_strText.c_str(),

View File

@ -153,6 +153,13 @@ static const int CC_EDIT_BOX_PADDING = 5;
{ {
pDelegate->editBoxEditingDidBegin(getEditBoxImplIOS()->getCCEditBox()); pDelegate->editBoxEditingDidBegin(getEditBoxImplIOS()->getCCEditBox());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplIOS()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
}
return YES; return YES;
} }
@ -168,6 +175,14 @@ static const int CC_EDIT_BOX_PADDING = 5;
pDelegate->editBoxEditingDidEnd(getEditBoxImplIOS()->getCCEditBox()); pDelegate->editBoxEditingDidEnd(getEditBoxImplIOS()->getCCEditBox());
pDelegate->editBoxReturn(getEditBoxImplIOS()->getCCEditBox()); pDelegate->editBoxReturn(getEditBoxImplIOS()->getCCEditBox());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplIOS()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
}
if(editBox_ != nil) if(editBox_ != nil)
{ {
@ -210,6 +225,14 @@ static const int CC_EDIT_BOX_PADDING = 5;
{ {
pDelegate->editBoxTextChanged(getEditBoxImplIOS()->getCCEditBox(), getEditBoxImplIOS()->getText()); pDelegate->editBoxTextChanged(getEditBoxImplIOS()->getCCEditBox(), getEditBoxImplIOS()->getText());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplIOS()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
}
} }
@end @end

View File

@ -146,6 +146,13 @@
{ {
pDelegate->editBoxEditingDidBegin(getEditBoxImplMac()->getCCEditBox()); pDelegate->editBoxEditingDidBegin(getEditBoxImplMac()->getCCEditBox());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplMac()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
}
return YES; return YES;
} }
@ -158,6 +165,14 @@
pDelegate->editBoxEditingDidEnd(getEditBoxImplMac()->getCCEditBox()); pDelegate->editBoxEditingDidEnd(getEditBoxImplMac()->getCCEditBox());
pDelegate->editBoxReturn(getEditBoxImplMac()->getCCEditBox()); pDelegate->editBoxReturn(getEditBoxImplMac()->getCCEditBox());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplMac()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
}
return YES; return YES;
} }
@ -194,6 +209,13 @@
{ {
pDelegate->editBoxTextChanged(getEditBoxImplMac()->getCCEditBox(), getEditBoxImplMac()->getText()); pDelegate->editBoxTextChanged(getEditBoxImplMac()->getCCEditBox(), getEditBoxImplMac()->getText());
} }
cocos2d::extension::CCEditBox* pEditBox= getEditBoxImplMac()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
}
} }
@end @end

View File

@ -0,0 +1,14 @@
#include "CCEditBox.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID ) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS ) && (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) && (CC_TARGET_PLATFORM != CC_PLATFORM_TIZEN)
NS_CC_EXT_BEGIN
CCEditBoxImpl* __createSystemEditBox(CCEditBox* pEditBox)
{
return NULL;
}
NS_CC_EXT_END
#endif /* #if (..) */

View File

@ -253,6 +253,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox()); thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox()); thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
} }
CCEditBox* pEditBox = thiz->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
}
} }
void CCEditBoxImplTizen::openKeyboard() void CCEditBoxImplTizen::openKeyboard()
@ -261,6 +270,12 @@ void CCEditBoxImplTizen::openKeyboard()
{ {
m_pDelegate->editBoxEditingDidBegin(m_pEditBox); m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
} }
CCEditBox* pEditBox = this->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
}
} }
void CCEditBoxImplTizen::closeKeyboard() void CCEditBoxImplTizen::closeKeyboard()

View File

@ -234,6 +234,15 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox()); thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox()); thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
} }
CCEditBox* pEditBox = thiz->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
}
} }
void CCEditBoxImplWin::openKeyboard() void CCEditBoxImplWin::openKeyboard()
@ -242,7 +251,14 @@ void CCEditBoxImplWin::openKeyboard()
{ {
m_pDelegate->editBoxEditingDidBegin(m_pEditBox); m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
} }
CCEditBox* pEditBox = this->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
}
std::string placeHolder = m_pLabelPlaceHolder->getString(); std::string placeHolder = m_pLabelPlaceHolder->getString();
if (placeHolder.length() == 0) if (placeHolder.length() == 0)
placeHolder = "Enter value"; placeHolder = "Enter value";

View File

@ -9,6 +9,7 @@ INCLUDES = -I$(COCOS_ROOT)/external \
-I../CCBReader \ -I../CCBReader \
-I../GUI/CCControlExtension \ -I../GUI/CCControlExtension \
-I../network -I../network
-I../GUI/CCEditBox \
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
DEFINES += -D__CC_PLATFORM_IMAGE_CPP__ DEFINES += -D__CC_PLATFORM_IMAGE_CPP__
@ -53,6 +54,8 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../GUI/CCControlExtension/CCScale9Sprite.cpp \ ../GUI/CCControlExtension/CCScale9Sprite.cpp \
../GUI/CCControlExtension/CCControlPotentiometer.cpp \ ../GUI/CCControlExtension/CCControlPotentiometer.cpp \
../GUI/CCControlExtension/CCControlStepper.cpp \ ../GUI/CCControlExtension/CCControlStepper.cpp \
../GUI/CCEditBox/CCEditBox.cpp \
../GUI/CCEditBox/CCEditBoxImplNone.cpp \
../physics_nodes/CCPhysicsDebugNode.cpp \ ../physics_nodes/CCPhysicsDebugNode.cpp \
../physics_nodes/CCPhysicsSprite.cpp ../physics_nodes/CCPhysicsSprite.cpp

View File

@ -8,6 +8,7 @@ INCLUDES = -I$(COCOS_ROOT)/external \
-I.. \ -I.. \
-I../CCBReader \ -I../CCBReader \
-I../GUI/CCControlExtension \ -I../GUI/CCControlExtension \
-I../GUI/CCEditBox \
-I../network -I../network
SOURCES = ../CCBReader/CCBFileLoader.cpp \ SOURCES = ../CCBReader/CCBFileLoader.cpp \
@ -50,6 +51,8 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../GUI/CCControlExtension/CCScale9Sprite.cpp \ ../GUI/CCControlExtension/CCScale9Sprite.cpp \
../GUI/CCControlExtension/CCControlPotentiometer.cpp \ ../GUI/CCControlExtension/CCControlPotentiometer.cpp \
../GUI/CCControlExtension/CCControlStepper.cpp \ ../GUI/CCControlExtension/CCControlStepper.cpp \
../GUI/CCEditBox/CCEditBox.cpp \
../GUI/CCEditBox/CCEditBoxImplNone.cpp \
../network/HttpClient.cpp \ ../network/HttpClient.cpp \
../physics_nodes/CCPhysicsDebugNode.cpp \ ../physics_nodes/CCPhysicsDebugNode.cpp \
../physics_nodes/CCPhysicsSprite.cpp \ ../physics_nodes/CCPhysicsSprite.cpp \

View File

@ -34,8 +34,9 @@ files
["GUI/CCEditBox"] ["GUI/CCEditBox"]
("../GUI/CCEditBox") ("../GUI/CCEditBox")
# "CCEditBox.h" "CCEditBox.h"
# "CCEditBox.cpp" "CCEditBox.cpp"
“CCEditBoxImplNone.cpp”
["GUI/CCScrollView"] ["GUI/CCScrollView"]
("../GUI/CCScrollView") ("../GUI/CCScrollView")

View File

@ -38,6 +38,8 @@ EXTENSIONS_SOURCES = ../CCBReader/CCBFileLoader.cpp \
../GUI/CCControlExtension/CCScale9Sprite.cpp \ ../GUI/CCControlExtension/CCScale9Sprite.cpp \
../GUI/CCControlExtension/CCControlPotentiometer.cpp \ ../GUI/CCControlExtension/CCControlPotentiometer.cpp \
../GUI/CCControlExtension/CCControlStepper.cpp \ ../GUI/CCControlExtension/CCControlStepper.cpp \
../GUI/CCEditBox/CCEditBox.cpp \
../GUI/CCEditBox/CCEditBoxImplNone.cpp \
../physics_nodes/CCPhysicsDebugNode.cpp \ ../physics_nodes/CCPhysicsDebugNode.cpp \
../physics_nodes/CCPhysicsSprite.cpp \ ../physics_nodes/CCPhysicsSprite.cpp \
../spine/Animation.cpp \ ../spine/Animation.cpp \

View File

@ -109,7 +109,7 @@ void EditBoxTest::editBoxTextChanged(cocos2d::extension::CCEditBox* editBox, con
void EditBoxTest::editBoxReturn(CCEditBox* editBox) void EditBoxTest::editBoxReturn(CCEditBox* editBox)
{ {
CCLog("editBox %p was returned !"); CCLog("editBox %p was returned !",editBox);
if (m_pEditName == editBox) if (m_pEditName == editBox)
{ {

View File

@ -14,9 +14,11 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_lua_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_lua_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx) $(call import-module,cocos2dx)
$(call import-module,CocosDenshion/android) $(call import-module,CocosDenshion/android)
$(call import-module,scripting/lua/proj.android) $(call import-module,scripting/lua/proj.android)
$(call import-module,extensions)

View File

@ -4,7 +4,8 @@ COCOS_ROOT = ../../../..
INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \ INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \
-I$(COCOS_ROOT)/scripting/lua/lua \ -I$(COCOS_ROOT)/scripting/lua/lua \
-I$(COCOS_ROOT)/scripting/lua/tolua \ -I$(COCOS_ROOT)/scripting/lua/tolua \
-I$(COCOS_ROOT)/scripting/lua/cocos2dx_support -I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \
-I$(COCOS_ROOT)/extensions \
SOURCES = main.cpp ../Classes/AppDelegate.cpp SOURCES = main.cpp ../Classes/AppDelegate.cpp

View File

@ -4,11 +4,12 @@ COCOS_ROOT = ../../../..
INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \ INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \
-I$(COCOS_ROOT)/scripting/lua/lua \ -I$(COCOS_ROOT)/scripting/lua/lua \
-I$(COCOS_ROOT)/scripting/lua/tolua \ -I$(COCOS_ROOT)/scripting/lua/tolua \
-I$(COCOS_ROOT)/scripting/lua/cocos2dx_support -I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \
-I$(COCOS_ROOT)/extensions \
SOURCES = main.cpp ../Classes/AppDelegate.cpp SOURCES = main.cpp ../Classes/AppDelegate.cpp
SHAREDLIBS += -lcocos2d -lcocosdenshion -llua SHAREDLIBS += -lcocos2d -lcocosdenshion -llua -lextension
COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so $(LIB_DIR)/liblua.so COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so $(LIB_DIR)/liblua.so
include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk

View File

@ -1,6 +1,6 @@
options options
{ {
module_path="../../../../cocos2dx/proj.marmalade/;../../../../CocosDenshion/proj.marmalade/;../../../../scripting/lua/proj.marmalade/" module_path="../../../../cocos2dx/proj.marmalade/;../../../../CocosDenshion/proj.marmalade/;../../../../scripting/lua/proj.marmalade/;../../../extensions/proj.marmalade/"
s3e-data-dir = "../Resources/" s3e-data-dir = "../Resources/"
} }

View File

@ -8,6 +8,9 @@ INCLUDES = -I.. \
-I$(COCOS_ROOT)/scripting/lua/tolua \ -I$(COCOS_ROOT)/scripting/lua/tolua \
-I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \ -I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \
-I$(NACL_SDK_ROOT)/include \ -I$(NACL_SDK_ROOT)/include \
-I$(COCOS_ROOT)/external/chipmunk/include/chipmunk \
-I$(COCOS_ROOT)/extensions \
SOURCES = main.cpp \ SOURCES = main.cpp \
@ -18,8 +21,13 @@ SOURCES = main.cpp \
$(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \ $(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \
$(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c $(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c
include $(COCOS2DX_PATH)/../extensions/proj.nacl/Makefile
SOURCES += $(addprefix $(COCOS_ROOT)/extensions/, $(EXTENSIONS_SOURCES))
include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
CXXFLAGS += -Wno-multichar
APP_NAME = HelloLua APP_NAME = HelloLua
TARGET = $(BIN_DIR)/$(APP_NAME)_$(NACL_ARCH).nexe TARGET = $(BIN_DIR)/$(APP_NAME)_$(NACL_ARCH).nexe
NMF = $(BIN_DIR)/$(APP_NAME).nmf NMF = $(BIN_DIR)/$(APP_NAME).nmf

View File

@ -0,0 +1,70 @@
local function AccelerometerMainLayer()
local function title()
return "AccelerometerTest"
end
local pLayer = CCLayer:create()
pLayer:setAccelerometerEnabled(true)
local pLabel = CCLabelTTF:create(title(), "Arial", 32)
pLayer:addChild(pLabel, 1)
pLabel:setPosition( ccp(VisibleRect:center().x, VisibleRect:top().y - 50) )
local pBall = CCSprite:create("Images/ball.png")
pBall:setPosition(ccp(VisibleRect:center().x, VisibleRect:center().y))
pLayer:addChild(pBall)
pBall:retain()
local function didAccelerate(x,y,z,timestamp)
local pDir = CCDirector:sharedDirector()
if nil == pBall then
return
end
local szBall = pBall:getContentSize()
local ptNowX,ptNowY = pBall:getPosition()
local ptTmp = pDir:convertToUI(CCPointMake(ptNowX,ptNowY))
ptTmp.x = ptTmp.x + x * 9.81
ptTmp.y = ptTmp.y - y * 9.81
local ptNext = pDir:convertToGL(CCPointMake(ptTmp.x,ptTmp.y))
local nMinX = math.floor(VisibleRect:left().x + szBall.width / 2.0)
local nMaxX = math.floor(VisibleRect:right().x - szBall.width / 2.0)
if ptNext.x < nMinX then
ptNext.x = nMinX
elseif ptNext.x > nMaxX then
ptNext.x = nMaxX
end
local nMinY = math.floor(VisibleRect:bottom().y + szBall.height / 2.0)
local nMaxY = math.floor(VisibleRect:top().y - szBall.height / 2.0)
if ptNext.y < nMinY then
ptNext.y = nMinY
elseif ptNext.y > nMaxY then
ptNext.y = nMaxY
end
pBall:setPosition(CCPointMake(ptNext.x,ptNext.y))
end
pLayer:registerScriptAccelerateHandler(didAccelerate)
return pLayer
end
function AccelerometerMain()
cclog("AccelerometerMain")
local scene = CCScene:create()
scene:addChild(AccelerometerMainLayer())
scene:addChild(CreateBackMenuItem())
return scene
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
local function KeypadMainLayer()
local pLayer = CCLayer:create()
local s = CCDirector:sharedDirector():getWinSize()
local label = CCLabelTTF:create("Keypad Test", "Arial", 28)
pLayer:addChild(label, 0)
label:setPosition( ccp(s.width/2, s.height-50) )
pLayer:setKeypadEnabled(true)
-- create a label to display the tip string
local pLabelTip = CCLabelTTF:create("Please press any key...", "Arial", 22)
pLabelTip:setPosition(ccp(s.width / 2, s.height / 2))
pLayer:addChild(pLabelTip, 0)
pLabelTip:retain()
local function KeypadHandler(strEvent)
if "backClicked" == strEvent then
pLabelTip:setString("BACK clicked!");
elseif "menuClicked" == strEvent then
pLabelTip:setString("MENU clicked!");
end
end
pLayer:registerScriptKeypadHandler(KeypadHandler)
return pLayer
end
function KeypadTestMain()
cclog("KeypadTestMain")
local scene = CCScene:create()
scene:addChild(KeypadMainLayer())
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -32,7 +32,9 @@ require "luaScript/EffectsAdvancedTest/EffectsAdvancedTest"
require "luaScript/UserDefaultTest/UserDefaultTest" require "luaScript/UserDefaultTest/UserDefaultTest"
require "luaScript/CurrentLanguageTest/CurrentLanguageTest" require "luaScript/CurrentLanguageTest/CurrentLanguageTest"
require "luaScript/BugsTest/BugsTest" require "luaScript/BugsTest/BugsTest"
------------------------ require "luaScript/ExtensionTest/ExtensionTest"
require "luaScript/AccelerometerTest/AccelerometerTest"
require "luaScript/KeypadTest/KeypadTest"
local LINE_SPACE = 40 local LINE_SPACE = 40
@ -72,8 +74,8 @@ local _allTests = {
{ isSupported = false, name = "Box2dTest" , create_func= Box2dTestMain }, { isSupported = false, name = "Box2dTest" , create_func= Box2dTestMain },
{ isSupported = false, name = "Box2dTestBed" , create_func= Box2dTestBedMain }, { isSupported = false, name = "Box2dTestBed" , create_func= Box2dTestBedMain },
{ isSupported = true, name = "EffectAdvancedTest" , create_func = EffectAdvancedTestMain }, { isSupported = true, name = "EffectAdvancedTest" , create_func = EffectAdvancedTestMain },
{ isSupported = false, name = "Accelerometer" , create_func= AccelerometerMain }, { isSupported = true, name = "Accelerometer" , create_func= AccelerometerMain },
{ isSupported = false, name = "KeypadTest" , create_func= KeypadTestMain }, { isSupported = true, name = "KeypadTest" , create_func= KeypadTestMain },
{ isSupported = true, name = "CocosDenshionTest" , create_func = CocosDenshionTestMain }, { isSupported = true, name = "CocosDenshionTest" , create_func = CocosDenshionTestMain },
{ isSupported = true, name = "PerformanceTest" , create_func= PerformanceTestMain }, { isSupported = true, name = "PerformanceTest" , create_func= PerformanceTestMain },
{ isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain }, { isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain },
@ -83,7 +85,7 @@ local _allTests = {
{ isSupported = true, name = "FontTest" , create_func = FontTestMain }, { isSupported = true, name = "FontTest" , create_func = FontTestMain },
{ isSupported = true, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain }, { isSupported = true, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain },
{ isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain }, { isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain },
{ isSupported = false, name = "ExtensionsTest" , create_func= ExtensionsTestMain }, { isSupported = true, name = "ExtensionsTest" , create_func= ExtensionsTestMain },
{ isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain }, { isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain },
{ isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain } { isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain }
} }

View File

@ -8,6 +8,8 @@ INCLUDES = -I.. \
-I$(COCOS_ROOT)/scripting/lua/tolua \ -I$(COCOS_ROOT)/scripting/lua/tolua \
-I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \ -I$(COCOS_ROOT)/scripting/lua/cocos2dx_support \
-I$(NACL_SDK_ROOT)/include \ -I$(NACL_SDK_ROOT)/include \
-I$(COCOS_ROOT)/external/chipmunk/include/chipmunk \
-I$(COCOS_ROOT)/extensions \
SOURCES = main.cpp \ SOURCES = main.cpp \
@ -18,8 +20,12 @@ SOURCES = main.cpp \
$(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \ $(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \
$(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c $(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c
include $(COCOS2DX_PATH)/../extensions/proj.nacl/Makefile
SOURCES += $(addprefix $(COCOS_ROOT)/extensions/, $(EXTENSIONS_SOURCES))
include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
CXXFLAGS += -Wno-multichar
STATICLIBS += -llua -lnosys STATICLIBS += -llua -lnosys
APP_NAME = TestLua APP_NAME = TestLua

View File

@ -146,18 +146,10 @@
</PreBuildEvent> </PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\CCLuaEngine.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\Cocos2dxLuaLoader.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\LuaCocos2d.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\tolua_fix.h" />
<ClInclude Include="..\Classes\AppDelegate.h" /> <ClInclude Include="..\Classes\AppDelegate.h" />
<ClInclude Include="main.h" /> <ClInclude Include="main.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\CCLuaEngine.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\Cocos2dxLuaLoader.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\LuaCocos2d.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\tolua_fix.c" />
<ClCompile Include="..\Classes\AppDelegate.cpp" /> <ClCompile Include="..\Classes\AppDelegate.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>

View File

@ -15,10 +15,6 @@
<ClInclude Include="main.h"> <ClInclude Include="main.h">
<Filter>win32</Filter> <Filter>win32</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\CCLuaEngine.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\Cocos2dxLuaLoader.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\LuaCocos2d.h" />
<ClInclude Include="..\..\..\..\scripting\lua\cocos2dx_support\tolua_fix.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\Classes\AppDelegate.cpp"> <ClCompile Include="..\Classes\AppDelegate.cpp">
@ -27,9 +23,5 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>win32</Filter> <Filter>win32</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\CCLuaEngine.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\Cocos2dxLuaLoader.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\LuaCocos2d.cpp" />
<ClCompile Include="..\..\..\..\scripting\lua\cocos2dx_support\tolua_fix.c" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -144,7 +144,7 @@ int CCLuaEngine::executeMenuItemEvent(CCMenuItem* pMenuItem)
int CCLuaEngine::executeNotificationEvent(CCNotificationCenter* pNotificationCenter, const char* pszName) int CCLuaEngine::executeNotificationEvent(CCNotificationCenter* pNotificationCenter, const char* pszName)
{ {
int nHandler = pNotificationCenter->getScriptHandler(); int nHandler = pNotificationCenter->getObserverHandlerByName(pszName);
if (!nHandler) return 0; if (!nHandler) return 0;
m_stack->pushString(pszName); m_stack->pushString(pszName);

View File

@ -1 +1 @@
ecb0cba17e5d79f232ef864d0279ab9648b5089b 352d74db80e699c44ee80106a30fe1eb3e350d9c

View File

@ -1,21 +1,13 @@
#ifndef __LUACOCOS2D_H_ #ifndef __LUACOCOS2D_H_
#define __LUACOCOS2D_H_ #define __LUACOCOS2D_H_
#ifdef __cplusplus
extern "C" { extern "C" {
#endif
#include "tolua++.h" #include "tolua++.h"
#include "tolua_fix.h" #ifdef __cplusplus
} }
#endif
#include <map>
#include <string>
#include "tolua_fix.h"
#include "cocos2d.h"
#include "CCLuaEngine.h"
#include "SimpleAudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;
TOLUA_API int tolua_Cocos2d_open(lua_State* tolua_S); TOLUA_API int tolua_Cocos2d_open(lua_State* tolua_S);

View File

@ -31,7 +31,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \
$(LOCAL_PATH)/../../../cocos2dx/platform \ $(LOCAL_PATH)/../../../cocos2dx/platform \
$(LOCAL_PATH)/../../../cocos2dx/platform/android \ $(LOCAL_PATH)/../../../cocos2dx/platform/android \
$(LOCAL_PATH)/../../../cocos2dx/kazmath/include \ $(LOCAL_PATH)/../../../cocos2dx/kazmath/include \
$(LOCAL_PATH)/../../../CocosDenshion/include $(LOCAL_PATH)/../../../CocosDenshion/include \
$(LOCAL_PATH)/../../../extensions
LOCAL_WHOLE_STATIC_LIBRARIES := luajit_static LOCAL_WHOLE_STATIC_LIBRARIES := luajit_static

View File

@ -1,7 +1,7 @@
TARGET = liblua.so TARGET = liblua.so
INCLUDES += -I.. -I../lua -I../tolua \ INCLUDES += -I.. -I../lua -I../tolua \
-I../Classes -I../../../CocosDenshion/include -I../Classes -I../../../CocosDenshion/include -I../../../extensions
SOURCES = ../lua/lapi.o \ SOURCES = ../lua/lapi.o \
../lua/lauxlib.c \ ../lua/lauxlib.c \

View File

@ -1,7 +1,7 @@
TARGET = liblua.so TARGET = liblua.so
INCLUDES += -I.. -I../lua -I../tolua \ INCLUDES += -I.. -I../lua -I../tolua \
-I../Classes -I../../../CocosDenshion/include -I../Classes -I../../../CocosDenshion/include -I../../../extensions -I../../../external/chipmunk/include/chipmunk
SOURCES = ../lua/lapi.o \ SOURCES = ../lua/lapi.o \
../lua/lauxlib.c \ ../lua/lauxlib.c \
@ -49,6 +49,7 @@ SOURCES = ../lua/lapi.o \
include ../../../cocos2dx/proj.linux/cocos2dx.mk include ../../../cocos2dx/proj.linux/cocos2dx.mk
TARGET := $(LIB_DIR)/$(TARGET) TARGET := $(LIB_DIR)/$(TARGET)
SHAREDLIBS += -lextension
all: $(TARGET) all: $(TARGET)

View File

@ -3,6 +3,7 @@ includepaths
../lua/ ../lua/
../tolua/ ../tolua/
../cocos2dx_support/ ../cocos2dx_support/
../../../extensions
} }
files files

View File

@ -1,4 +1,4 @@
INCLUDES = -I.. -I../lua INCLUDES = -I.. -I../lua -I../../../extensions -I../../../external/chipmunk/include/chipmunk
SOURCES = ../lua/lapi.c \ SOURCES = ../lua/lapi.c \
../lua/lauxlib.c \ ../lua/lauxlib.c \

View File

@ -63,7 +63,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\tolua;$(ProjectDir)..\luajit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\tolua;$(ProjectDir)..\luajit\include;$(ProjectDir)..\..\..\extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -94,7 +94,7 @@ xcopy /Y /Q "$(ProjectDir)..\luajit\win32\*.*" "$(OutDir)"</Command>
<ClCompile> <ClCompile>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\tolua;$(ProjectDir)..\luajit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\tolua;$(ProjectDir)..\luajit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -0,0 +1,65 @@
enum CCControlEvent
{
CCControlEventTouchDown = 1 << 0,
CCControlEventTouchDragInside = 1 << 1,
CCControlEventTouchDragOutside = 1 << 2,
CCControlEventTouchDragEnter = 1 << 3,
CCControlEventTouchDragExit = 1 << 4,
CCControlEventTouchUpInside = 1 << 5,
CCControlEventTouchUpOutside = 1 << 6,
CCControlEventTouchCancel = 1 << 7,
CCControlEventValueChanged = 1 << 8
};
typedef unsigned int CCControlEvent;
enum CCControlState
{
CCControlStateNormal = 1 << 0,
CCControlStateHighlighted = 1 << 1,
CCControlStateDisabled = 1 << 2,
CCControlStateSelected = 1 << 3
};
typedef unsigned int CCControlState;
class CCControl:public CCLayerRGBA
{
virtual CCControlState getState() const;
virtual void setEnabled(bool bEnabled);
virtual bool isEnabled();
virtual void setSelected(bool bSelected);
virtual bool isSelected();
virtual void setHighlighted(bool bHighlighted);
virtual bool isHighlighted();
bool hasVisibleParents();
virtual void needsLayout();
virtual bool isOpacityModifyRGB();
virtual void setOpacityModifyRGB(bool bOpacityModifyRGB);
CCControl();
virtual bool init(void);
virtual ~CCControl();
virtual void onEnter();
virtual void onExit();
virtual void registerWithTouchDispatcher();
virtual void sendActionsForControlEvents(CCControlEvent controlEvents);
virtual void addTargetWithActionForControlEvents(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvents);
virtual void removeTargetWithActionForControlEvents(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvents);
virtual CCPoint getTouchLocation(CCTouch* touch);
virtual bool isTouchInside(CCTouch * touch);
void addHandleOfControlEvent(LUA_FUNCTION nFunID,CCControlEvent controlEvents);
void removeHandleOfControlEvent(CCControlEvent controlEvents);
};

View File

@ -0,0 +1,111 @@
#define CCControlButtonMarginLR 8
#define CCControlButtonMarginTB 2
class CCControlButton : public CCControl
{
CCControlButton();
virtual ~CCControlButton();
virtual void needsLayout(void);
virtual void setEnabled(bool enabled);
virtual void setSelected(bool enabled);
virtual void setHighlighted(bool enabled);
virtual CCString* getCurrentTitle();
virtual const ccColor3B& getCurrentTitleColor() const;
bool doesAdjustBackgroundImage();
void setAdjustBackgroundImage(bool adjustBackgroundImage);
virtual CCNode* getTitleLabel();
virtual void setTitleLabel(CCNode* var);
virtual CCScale9Sprite* getBackgroundSprite();
virtual void setBackgroundSprite(CCScale9Sprite* var);
virtual CCSize getPreferredSize();
virtual void setPreferredSize(CCSize var);
virtual bool getZoomOnTouchDown();
virtual void setZoomOnTouchDown(bool var);
virtual CCPoint getLabelAnchorPoint();
virtual void setLabelAnchorPoint(CCPoint var);
virtual GLubyte getOpacity(void);
virtual void setOpacity(GLubyte var);
bool isPushed();
virtual CCDictionary* getTitleDispatchTable();
virtual void setTitleDispatchTable(CCDictionary* var);
virtual CCDictionary* getTitleColorDispatchTable();
virtual void setTitleColorDispatchTable(CCDictionary* var);
virtual CCDictionary* getTitleLabelDispatchTable();
virtual void setTitleLabelDispatchTable(CCDictionary* var);
virtual CCDictionary* getBackgroundSpriteDispatchTable();
virtual void setBackgroundSpriteDispatchTable(CCDictionary* var);
virtual int getVerticalMargin() const;
virtual int getHorizontalOrigin() const;
virtual void setMargins(int marginH, int marginV);
virtual bool init();
virtual bool initWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite);
static CCControlButton* create(CCNode* label, CCScale9Sprite* backgroundSprite);
virtual bool initWithTitleAndFontNameAndFontSize(std::string title, const char * fontName, float fontSize);
static CCControlButton* create(std::string title, const char * fontName, float fontSize);
virtual bool initWithBackgroundSprite(CCScale9Sprite* sprite);
static CCControlButton* create(CCScale9Sprite* sprite);
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
virtual CCString* getTitleForState(CCControlState state);
virtual void setTitleForState(CCString* title, CCControlState state);
virtual const ccColor3B getTitleColorForState(CCControlState state);
virtual void setTitleColorForState(ccColor3B color, CCControlState state);
virtual CCNode* getTitleLabelForState(CCControlState state);
virtual void setTitleLabelForState(CCNode* label, CCControlState state);
virtual void setTitleTTFForState(const char * fntFile, CCControlState state);
virtual const char * getTitleTTFForState(CCControlState state);
virtual void setTitleTTFSizeForState(float size, CCControlState state);
virtual float getTitleTTFSizeForState(CCControlState state);
virtual void setTitleBMFontForState(const char * fntFile, CCControlState state);
virtual const char * getTitleBMFontForState(CCControlState state);
virtual CCScale9Sprite* getBackgroundSpriteForState(CCControlState state);
virtual void setBackgroundSpriteForState(CCScale9Sprite* sprite, CCControlState state);
virtual void setBackgroundSpriteFrameForState(CCSpriteFrame * spriteFrame, CCControlState state);
static CCControlButton* create();
};

View File

@ -0,0 +1,23 @@
class CCControlColourPicker : public CCControl
{
CCControlColourPicker();
virtual ~CCControlColourPicker();
virtual void setColor(const ccColor3B& colorValue);
virtual void setEnabled(bool bEnabled);
virtual CCControlSaturationBrightnessPicker* getcolourPicker() const;
virtual void setcolourPicker(CCControlSaturationBrightnessPicker* var);
virtual CCControlHuePicker* getHuePicker() const;
virtual void setHuePicker(CCControlHuePicker* var);
virtual CCSprite* getBackground() const;
virtual void setBackground(CCSprite* var);
static CCControlColourPicker* create();
virtual bool init();
void hueSliderValueChanged(CCObject * sender, CCControlEvent controlEvent);
void colourSliderValueChanged(CCObject * sender, CCControlEvent controlEvent);
};

View File

@ -0,0 +1,42 @@
class CCControlPotentiometer : public CCControl
{
CCControlPotentiometer();
virtual ~CCControlPotentiometer();
static CCControlPotentiometer* create(const char* backgroundFile, const char* progressFile, const char* thumbFile);
bool initWithTrackSprite_ProgressTimer_ThumbSprite(CCSprite* trackSprite, CCProgressTimer* progressTimer, CCSprite* thumbSprite);
void setValue(float value);
float getValue();
void setMinimumValue(float minimumValue);
float getMinimumValue();
void setMaximumValue(float maximumValue);
float getMaximumValue();
void setEnabled(bool enabled);
virtual bool isTouchInside(CCTouch * touch);
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual CCSprite* getThumbSprite() const;
virtual void setThumbSprite(CCSprite* var);
virtual CCProgressTimer* getProgressTimer() const;
virtual void setProgressTimer(CCProgressTimer* var);
virtual CCPoint getPreviousLocation() const;
virtual void setPreviousLocation(CCPoint var);
void potentiometerBegan(CCPoint location);
void potentiometerMoved(CCPoint location);
void potentiometerEnded(CCPoint location);
float distanceBetweenPointAndPoint(CCPoint point1, CCPoint point2);
float angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(CCPoint beginLineA, CCPoint endLineA,CCPoint beginLineB,CCPoint endLineB);
};

View File

@ -0,0 +1,39 @@
class CCControlSlider : public CCControl
{
virtual float getValue() const;
virtual void setValue(float val);
virtual float getMinimumValue() const;
virtual void setMinimumValue(float val);
virtual float getMaximumValue() const;
virtual void setMaximumValue(float val);
virtual void setMaximumValue(float val);
virtual void setEnabled(bool enabled);
virtual bool isTouchInside(CCTouch * touch);
CCPoint locationFromTouch(CCTouch* touch);
virtual float getMinimumAllowedValue() const;
virtual void setMinimumAllowedValue(float val);
virtual float getMaximumAllowedValue() const;
virtual void setMaximumAllowedValue(float val);
virtual CCSprite* getThumbSprite() const;
virtual void setThumbSprite(CCSprite* val);
virtual CCSprite* getProgressSprite() const;
virtual void setProgressSprite(CCSprite* val);
virtual CCSprite* getBackgroundSprite() const;
virtual void setBackgroundSprite(CCSprite* val);
CCControlSlider();
virtual ~CCControlSlider();
virtual bool initWithSprites(CCSprite * backgroundSprite, CCSprite* progressSprite, CCSprite* thumbSprite);
static CCControlSlider* create(const char* bgFile, const char* progressFile, const char* thumbFile);
static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite);
virtual void needsLayout();
};

View File

@ -0,0 +1,47 @@
enum CCControlStepperPart
{
kCCControlStepperPartMinus,
kCCControlStepperPartPlus,
kCCControlStepperPartNone,
};
class CCControlStepper : public CCControl
{
CCControlStepper();
virtual ~CCControlStepper();
bool initWithMinusSpriteAndPlusSprite(CCSprite *minusSprite, CCSprite *plusSprite);
static CCControlStepper* create(CCSprite *minusSprite, CCSprite *plusSprite);
virtual void setWraps(bool wraps);
virtual void setMinimumValue(double minimumValue);
virtual void setMaximumValue(double maximumValue);
virtual void setValue(double value);
virtual double getValue();
virtual void setStepValue(double stepValue);
virtual void setValueWithSendingEvent(double value, bool send);
virtual bool isContinuous();
void update(float dt);
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual CCSprite* getMinusSprite() const;
virtual void setMinusSprite(CCSprite* var);
virtual CCSprite* getPlusSprite() const;
virtual void setPlusSprite(CCSprite* var);
virtual CCLabelTTF* getMinusLabel() const;
virtual void setMinusLabel(CCLabelTTF* var);
virtual CCLabelTTF* getPlusLabel() const;
virtual void setPlusLabel(CCLabelTTF* var);
void updateLayoutUsingTouchLocation(CCPoint location);
void startAutorepeat();
void stopAutorepeat();
};

View File

@ -0,0 +1,26 @@
class CCControlSwitch : public CCControl
{
CCControlSwitch();
virtual ~CCControlSwitch();
bool initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
static CCControlSwitch* create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
bool initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
static CCControlSwitch* create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
void setOn(bool isOn, bool animated);
void setOn(bool isOn);
bool isOn(void) { return m_bOn; }
bool hasMoved() { return m_bMoved; }
virtual void setEnabled(bool enabled);
CCPoint locationFromTouch(CCTouch* touch);
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
};

103
tools/tolua++/CCEditBox.pkg Normal file
View File

@ -0,0 +1,103 @@
enum KeyboardReturnType {
kKeyboardReturnTypeDefault = 0,
kKeyboardReturnTypeDone,
kKeyboardReturnTypeSend,
kKeyboardReturnTypeSearch,
kKeyboardReturnTypeGo
};
enum EditBoxInputMode
{
kEditBoxInputModeAny = 0,
kEditBoxInputModeEmailAddr,
kEditBoxInputModeNumeric,
kEditBoxInputModePhoneNumber,
kEditBoxInputModeUrl,
kEditBoxInputModeDecimal,
kEditBoxInputModeSingleLine
};
enum EditBoxInputFlag
{
kEditBoxInputFlagPassword = 0,
kEditBoxInputFlagSensitive,
kEditBoxInputFlagInitialCapsWord,
kEditBoxInputFlagInitialCapsSentence,
kEditBoxInputFlagInitialCapsAllCharacters
};
class CCEditBox: public CCControlButton
{
public:
CCEditBox(void);
virtual ~CCEditBox(void);
static CCEditBox* create(const CCSize& size, CCScale9Sprite* pNormal9SpriteBg, CCScale9Sprite* pPressed9SpriteBg = NULL, CCScale9Sprite* pDisabled9SpriteBg = NULL);
bool initWithSizeAndBackgroundSprite(const CCSize& size, CCScale9Sprite* pNormal9SpriteBg);
void registerScriptEditBoxHandler(LUA_FUNCTION handler);
void unregisterScriptEditBoxHandler(void);
int getScriptEditBoxHandler(void);
void setText(const char* pText);
const char* getText(void);
void setFont(const char* pFontName, int fontSize);
void setFontName(const char* pFontName);
void setFontSize(int fontSize);
void setFontColor(const ccColor3B& color);
void setPlaceholderFont(const char* pFontName, int fontSize);
void setPlaceholderFontName(const char* pFontName);
void setPlaceholderFontSize(int fontSize);
void setPlaceholderFontColor(const ccColor3B& color);
void setPlaceHolder(const char* pText);
const char* getPlaceHolder(void);
void setInputMode(EditBoxInputMode inputMode);
void setMaxLength(int maxLength);
int getMaxLength();
void setInputFlag(EditBoxInputFlag inputFlag);
void setReturnType(KeyboardReturnType returnType);
virtual void setPosition(const CCPoint& pos);
virtual void setVisible(bool visible);
virtual void setContentSize(const CCSize& size);
virtual void setAnchorPoint(const CCPoint& anchorPoint);
virtual void visit(void);
virtual void onEnter(void);
virtual void onExit(void);
void touchDownAction(CCObject *sender, CCControlEvent controlEvent);
};

View File

@ -1,8 +1,25 @@
class CCNotificationCenter : public CCObject class CCNotificationCenter : public CCObject
{ {
CCNotificationCenter();
~CCNotificationCenter();
static CCNotificationCenter *sharedNotificationCenter(void); static CCNotificationCenter *sharedNotificationCenter(void);
void registerScriptObserver(LUA_FUNCTION handler);
void unregisterScriptObserver(void); static void purgeNotificationCenter(void);
int removeAllObservers(CCObject *target);
void registerScriptObserver(CCObject *target,LUA_FUNCTION funcID,const char* name);
void unregisterScriptObserver(CCObject *target,const char* name);
void postNotification(const char *name); void postNotification(const char *name);
void postNotification(const char *name, CCObject *object);
int getScriptHandler();
int getObserverHandlerByName(const char* name);
}; };

View File

@ -0,0 +1,92 @@
class CCScale9Sprite : public CCNodeRGBA
{
CCScale9Sprite();
virtual ~CCScale9Sprite();
CCSize getOriginalSize(void) const;
CCSize getPreferredSize();
void setPreferredSize(CCSize sz);
CCRect getCapInsets();
void setCapInsets(CCRect rt);
float getInsetLeft();
void setInsetLeft(float fLeft);
float getInsetTop();
void setInsetTop(float fTop);
float getInsetRight();
void setInsetRight(float fRight);
float getInsetBottom();
void setInsetBottom(float fBottom);
virtual void setContentSize(const CCSize & size);
virtual void visit();
virtual bool init();
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets);
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets);
virtual bool initWithFile(const char* file, CCRect rect, CCRect capInsets);
static CCScale9Sprite* create(const char* file, CCRect rect, CCRect capInsets);
virtual bool initWithFile(const char* file, CCRect rect);
static CCScale9Sprite* create(const char* file, CCRect rect);
virtual bool initWithFile(CCRect capInsets, const char* file);
static CCScale9Sprite* create(CCRect capInsets, const char* file);
virtual bool initWithFile(const char* file);
static CCScale9Sprite* create(const char* file);
virtual bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets);
static CCScale9Sprite* createWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets);
virtual bool initWithSpriteFrame(CCSpriteFrame* spriteFrame);
static CCScale9Sprite* createWithSpriteFrame(CCSpriteFrame* spriteFrame);
virtual bool initWithSpriteFrameName(const char*spriteFrameName, CCRect capInsets);
static CCScale9Sprite* createWithSpriteFrameName(const char*spriteFrameName, CCRect capInsets);
virtual bool initWithSpriteFrameName(const char*spriteFrameName);
static CCScale9Sprite* createWithSpriteFrameName(const char*spriteFrameName);
CCScale9Sprite* resizableSpriteWithCapInsets(CCRect capInsets);
static CCScale9Sprite* create();
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
virtual void setOpacity(GLubyte opacity);
virtual void setColor(const ccColor3B& color);
virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets);
virtual void setSpriteFrame(CCSpriteFrame * spriteFrame);
};

View File

@ -272,7 +272,22 @@ function post_output_hook(package)
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/]]) ****************************************************************************/
extern "C" {
#include "tolua_fix.h"
}
#include <map>
#include <string>
#include "cocos2d.h"
#include "CCLuaEngine.h"
#include "SimpleAudioEngine.h"
#include "cocos-ext.h"
using namespace cocos2d;
using namespace cocos2d::extension;
using namespace CocosDenshion;]])
replace([[/* Exported function */ replace([[/* Exported function */
TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);]], [[]]) TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);]], [[]])