mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' into #3457
This commit is contained in:
commit
91edad5152
|
@ -5,15 +5,13 @@ LOCAL_MODULE := cocos_gui_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libgui
|
||||
|
||||
LOCAL_SRC_FILES := UIRootWidget.cpp \
|
||||
LOCAL_SRC_FILES := \
|
||||
UIWidget.cpp \
|
||||
UILayout.cpp \
|
||||
UILayoutParameter.cpp \
|
||||
UILayoutDefine.cpp \
|
||||
CocosGUI.cpp \
|
||||
UIHelper.cpp \
|
||||
UIInputManager.cpp \
|
||||
UILayer.cpp \
|
||||
UIListView.cpp \
|
||||
UIPageView.cpp \
|
||||
UIScrollView.cpp \
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
set(GUI_SRC
|
||||
UIRootWidget.cpp
|
||||
UIWidget.cpp
|
||||
UILayout.cpp
|
||||
UILayoutParameter.cpp
|
||||
UILayoutDefine.cpp
|
||||
CocosGUI.cpp
|
||||
UIHelper.cpp
|
||||
UIInputManager.cpp
|
||||
UILayer.cpp
|
||||
UIListView.cpp
|
||||
UIPageView.cpp
|
||||
UIScrollView.cpp
|
||||
|
|
|
@ -38,7 +38,7 @@ Widget* UIHelper::seekWidgetByTag(Widget* root, int tag)
|
|||
{
|
||||
return root;
|
||||
}
|
||||
Vector<Node*> arrayRootChildren = root->getChildren();
|
||||
const auto& arrayRootChildren = root->getChildren();
|
||||
int length = arrayRootChildren.size();
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
|
@ -62,11 +62,10 @@ Widget* UIHelper::seekWidgetByName(Widget* root, const char *name)
|
|||
{
|
||||
return root;
|
||||
}
|
||||
Vector<Node*> arrayRootChildren = root->getChildren();
|
||||
int length = arrayRootChildren.size();
|
||||
for (int i=0;i<length;i++)
|
||||
const auto& arrayRootChildren = root->getChildren();
|
||||
for (auto& subWidget : arrayRootChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(arrayRootChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
Widget* res = seekWidgetByName(child,name);
|
||||
if (res != nullptr)
|
||||
{
|
||||
|
@ -82,11 +81,10 @@ Widget* UIHelper::seekWidgetByRelativeName(Widget *root, const char *name)
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
Vector<Node*> arrayRootChildren = root->getChildren();
|
||||
int length = arrayRootChildren.size();
|
||||
for (int i=0;i<length;i++)
|
||||
const auto& arrayRootChildren = root->getChildren();
|
||||
for (auto& subWidget : arrayRootChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(arrayRootChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
RelativeLayoutParameter* layoutParameter = dynamic_cast<RelativeLayoutParameter*>(child->getLayoutParameter(LAYOUT_PARAMETER_RELATIVE));
|
||||
if (layoutParameter && strcmp(layoutParameter->getRelativeName(), name) == 0)
|
||||
{
|
||||
|
@ -107,11 +105,10 @@ Widget* UIHelper::seekActionWidgetByActionTag(Widget* root, int tag)
|
|||
{
|
||||
return root;
|
||||
}
|
||||
Vector<Node*> arrayRootChildren = root->getChildren();
|
||||
int length = arrayRootChildren.size();
|
||||
for (int i=0;i<length;i++)
|
||||
const auto& arrayRootChildren = root->getChildren();
|
||||
for (auto& subWidget : arrayRootChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(arrayRootChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
Widget* res = seekActionWidgetByActionTag(child,tag);
|
||||
if (res != nullptr)
|
||||
{
|
||||
|
|
|
@ -709,6 +709,11 @@ LayoutType Layout::getLayoutType() const
|
|||
{
|
||||
return _layoutType;
|
||||
}
|
||||
|
||||
void Layout::requestDoLayout()
|
||||
{
|
||||
_doLayoutDirty = true;
|
||||
}
|
||||
|
||||
void Layout::doLayout()
|
||||
{
|
||||
|
@ -722,12 +727,12 @@ void Layout::doLayout()
|
|||
break;
|
||||
case LAYOUT_LINEAR_VERTICAL:
|
||||
{
|
||||
int length = _widgetChildren.size();
|
||||
Size layoutSize = getSize();
|
||||
float topBoundary = layoutSize.height;
|
||||
for (int i=0; i<length; ++i)
|
||||
|
||||
for (auto& subWidget : _widgetChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(_widgetChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
LinearLayoutParameter* layoutParameter = dynamic_cast<LinearLayoutParameter*>(child->getLayoutParameter(LAYOUT_PARAMETER_LINEAR));
|
||||
|
||||
if (layoutParameter)
|
||||
|
@ -762,12 +767,11 @@ void Layout::doLayout()
|
|||
}
|
||||
case LAYOUT_LINEAR_HORIZONTAL:
|
||||
{
|
||||
int length = _widgetChildren.size();
|
||||
Size layoutSize = getSize();
|
||||
float leftBoundary = 0.0f;
|
||||
for (int i=0; i<length; ++i)
|
||||
for (auto& subWidget : _widgetChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(_widgetChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
LinearLayoutParameter* layoutParameter = dynamic_cast<LinearLayoutParameter*>(child->getLayoutParameter(LAYOUT_PARAMETER_LINEAR));
|
||||
|
||||
if (layoutParameter)
|
||||
|
@ -802,22 +806,19 @@ void Layout::doLayout()
|
|||
}
|
||||
case LAYOUT_RELATIVE:
|
||||
{
|
||||
int length = _widgetChildren.size();
|
||||
int unlayoutChildCount = length;
|
||||
int unlayoutChildCount = _widgetChildren.size();
|
||||
Size layoutSize = getSize();
|
||||
|
||||
for (int i=0; i<length; i++)
|
||||
for (auto& subWidget : _widgetChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(_widgetChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
RelativeLayoutParameter* layoutParameter = dynamic_cast<RelativeLayoutParameter*>(child->getLayoutParameter(LAYOUT_PARAMETER_RELATIVE));
|
||||
layoutParameter->_put = false;
|
||||
}
|
||||
|
||||
while (unlayoutChildCount > 0)
|
||||
{
|
||||
for (int i=0; i<length; i++)
|
||||
for (auto& subWidget : _widgetChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(_widgetChildren.at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
RelativeLayoutParameter* layoutParameter = dynamic_cast<RelativeLayoutParameter*>(child->getLayoutParameter(LAYOUT_PARAMETER_RELATIVE));
|
||||
|
||||
if (layoutParameter)
|
||||
|
|
|
@ -212,6 +212,8 @@ public:
|
|||
virtual void visit();
|
||||
|
||||
virtual void sortAllChildren() override;
|
||||
|
||||
void requestDoLayout();
|
||||
protected:
|
||||
//override "init" method of widget.
|
||||
virtual bool init() override;
|
||||
|
|
|
@ -90,9 +90,8 @@ void ListView::updateInnerContainerSize()
|
|||
{
|
||||
int length = _items.size();
|
||||
float totalHeight = (length - 1) * _itemsMargin;
|
||||
for (int i=0; i<length; i++)
|
||||
for (auto& item : _items)
|
||||
{
|
||||
Widget* item = _items.at(i);
|
||||
totalHeight += item->getSize().height;
|
||||
}
|
||||
float finalWidth = _size.width;
|
||||
|
@ -104,9 +103,8 @@ void ListView::updateInnerContainerSize()
|
|||
{
|
||||
int length = _items.size();
|
||||
float totalWidth = (length - 1) * _itemsMargin;
|
||||
for (int i=0; i<length; i++)
|
||||
for (auto& item : _items)
|
||||
{
|
||||
Widget* item = _items.at(i);
|
||||
totalWidth += item->getSize().width;
|
||||
}
|
||||
float finalWidth = totalWidth;
|
||||
|
@ -362,6 +360,11 @@ void ListView::setDirection(SCROLLVIEW_DIR dir)
|
|||
}
|
||||
ScrollView::setDirection(dir);
|
||||
}
|
||||
|
||||
void ListView::requestRefreshView()
|
||||
{
|
||||
_refreshViewDirty = true;
|
||||
}
|
||||
|
||||
void ListView::refreshView()
|
||||
{
|
||||
|
@ -441,12 +444,9 @@ Widget* ListView::createCloneInstance()
|
|||
|
||||
void ListView::copyClonedWidgetChildren(Widget* model)
|
||||
{
|
||||
Vector<Widget*> arrayItems = getItems();
|
||||
|
||||
int length = arrayItems.size();
|
||||
for (int i=0; i<length; i++)
|
||||
auto& arrayItems = getItems();
|
||||
for (auto& item : arrayItems)
|
||||
{
|
||||
Widget* item = arrayItems.at(i);
|
||||
pushBackCustomItem(item->clone());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,6 +165,8 @@ public:
|
|||
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
void requestRefreshView();
|
||||
|
||||
protected:
|
||||
virtual void addChild(Node* child) override{ScrollView::addChild(child);};
|
||||
virtual void addChild(Node * child, int zOrder) override{ScrollView::addChild(child, zOrder);};
|
||||
|
|
|
@ -181,7 +181,7 @@ void PageView::insertPage(Layout* page, int idx)
|
|||
page->setSize(pvSize);
|
||||
}
|
||||
int length = _pages.size();
|
||||
for (int i=(idx+1); i<length; i++) {
|
||||
for (int i=(idx+1); i<length; i++){
|
||||
Widget* behindPage = _pages.at(i);
|
||||
Point formerPos = behindPage->getPosition();
|
||||
behindPage->setPosition(Point(formerPos.x+getSize().width, 0));
|
||||
|
@ -268,10 +268,8 @@ void PageView::onSizeChanged()
|
|||
void PageView::updateChildrenSize()
|
||||
{
|
||||
Size selfSize = getSize();
|
||||
int length = _pages.size();
|
||||
for (long i=0; i<length; i++)
|
||||
for (auto& page : _pages)
|
||||
{
|
||||
Layout* page = _pages.at(i);
|
||||
page->setSize(selfSize);
|
||||
}
|
||||
}
|
||||
|
@ -410,13 +408,11 @@ void PageView::onTouchCancelled(Touch *touch, Event *unusedEvent)
|
|||
|
||||
void PageView::movePages(float offset)
|
||||
{
|
||||
int length = _pages.size();
|
||||
for (int i = 0; i < length; i++)
|
||||
for (auto& page : _pages)
|
||||
{
|
||||
Widget* child = _pages.at(i);
|
||||
_movePagePoint.x = child->getPosition().x + offset;
|
||||
_movePagePoint.y = child->getPosition().y;
|
||||
child->setPosition(_movePagePoint);
|
||||
_movePagePoint.x = page->getPosition().x + offset;
|
||||
_movePagePoint.y = page->getPosition().y;
|
||||
page->setPosition(_movePagePoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,11 +602,9 @@ Widget* PageView::createCloneInstance()
|
|||
|
||||
void PageView::copyClonedWidgetChildren(Widget* model)
|
||||
{
|
||||
Vector<Layout*> modelPages = dynamic_cast<PageView*>(model)->getPages();
|
||||
int length = modelPages.size();
|
||||
for (int i=0; i<length; i++)
|
||||
auto& modelPages = dynamic_cast<PageView*>(model)->getPages();
|
||||
for (auto& page : modelPages)
|
||||
{
|
||||
Layout* page = modelPages.at(i);
|
||||
addPage(dynamic_cast<Layout*>(page->clone()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -977,10 +977,11 @@ Widget* Widget::createCloneInstance()
|
|||
|
||||
void Widget::copyClonedWidgetChildren(Widget* model)
|
||||
{
|
||||
int length = model->getChildren().size();
|
||||
for (int i=0; i<length; i++)
|
||||
auto& modelChildren = model->getChildren();
|
||||
|
||||
for (auto& subWidget : modelChildren)
|
||||
{
|
||||
Widget* child = static_cast<Widget*>(model->getChildren().at(i));
|
||||
Widget* child = static_cast<Widget*>(subWidget);
|
||||
addChild(child->clone());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit afd23aedea6035df78b877da9f6b672c0a0fe346
|
||||
Subproject commit 56286dddefb8d5775ac508b371d0452c08bfd191
|
|
@ -1 +1 @@
|
|||
9af2a4febb0a58cf084fc9adfb24c1ac8138cd27
|
||||
f6783c2706a67552d6f361fa099b647158bc79ba
|
|
@ -299,8 +299,8 @@ JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
|
||||
}
|
||||
|
||||
extern JSObject* jsb_CCBReader_prototype;
|
||||
extern JSObject* jsb_CCBAnimationManager_prototype;
|
||||
extern JSObject* jsb_cocosbuilder_CCBReader_prototype;
|
||||
extern JSObject* jsb_cocosbuilder_CCBAnimationManager_prototype;
|
||||
|
||||
void register_CCBuilderReader(JSContext *cx, JSObject *obj) {
|
||||
JS::RootedValue nsval(cx);
|
||||
|
@ -319,6 +319,6 @@ void register_CCBuilderReader(JSContext *cx, JSObject *obj) {
|
|||
JS_DefineFunction(cx, tmpObj, "create", js_CocosBuilder_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, tmpObj, "loadScene", js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_CCBAnimationManager_prototype, "setCompletedAnimationCallback", js_cocos2dx_CCBAnimationManager_animationCompleteCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocosbuilder_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocosbuilder_CCBAnimationManager_prototype, "setCompletedAnimationCallback", js_cocos2dx_CCBAnimationManager_animationCompleteCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
}
|
||||
|
|
|
@ -227,14 +227,14 @@ static JSBool jsb_Animation_addArmatureFileInfoAsyncCallFunc(JSContext *cx, uint
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
extern JSObject* jsb_ArmatureAnimation_prototype;
|
||||
extern JSObject* jsb_ArmatureDataManager_prototype;
|
||||
extern JSObject* jsb_cocostudio_ArmatureAnimation_prototype;
|
||||
extern JSObject* jsb_cocostudio_ArmatureDataManager_prototype;
|
||||
|
||||
void register_all_cocos2dx_studio_manual(JSContext* cx, JSObject* global)
|
||||
{
|
||||
JS_DefineFunction(cx, jsb_ArmatureAnimation_prototype, "setMovementEventCallFunc", js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocostudio_ArmatureAnimation_prototype, "setMovementEventCallFunc", js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_ArmatureAnimation_prototype, "setFrameEventCallFunc", js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocostudio_ArmatureAnimation_prototype, "setFrameEventCallFunc", js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_ArmatureDataManager_prototype, "addArmatureFileInfoAsync", jsb_Animation_addArmatureFileInfoAsyncCallFunc, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocostudio_ArmatureDataManager_prototype, "addArmatureFileInfoAsync", jsb_Animation_addArmatureFileInfoAsyncCallFunc, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
}
|
|
@ -781,19 +781,19 @@ static JSBool js_cocos2dx_CCControl_removeTargetWithActionForControlEvents(JSCon
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
extern JSObject* jsb_ScrollView_prototype;
|
||||
extern JSObject* jsb_TableView_prototype;
|
||||
extern JSObject* jsb_EditBox_prototype;
|
||||
extern JSObject* jsb_Control_prototype;
|
||||
extern JSObject* jsb_cocos2d_extension_ScrollView_prototype;
|
||||
extern JSObject* jsb_cocos2d_extension_TableView_prototype;
|
||||
extern JSObject* jsb_cocos2d_extension_EditBox_prototype;
|
||||
extern JSObject* jsb_cocos2d_extension_Control_prototype;
|
||||
|
||||
void register_all_cocos2dx_extension_manual(JSContext* cx, JSObject* global)
|
||||
{
|
||||
JS_DefineFunction(cx, jsb_ScrollView_prototype, "setDelegate", js_cocos2dx_CCScrollView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_TableView_prototype, "setDelegate", js_cocos2dx_CCTableView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_TableView_prototype, "setDataSource", js_cocos2dx_CCTableView_setDataSource, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_EditBox_prototype, "setDelegate", js_cocos2dx_CCEditBox_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_Control_prototype, "addTargetWithActionForControlEvents", js_cocos2dx_CCControl_addTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_Control_prototype, "removeTargetWithActionForControlEvents", js_cocos2dx_CCControl_removeTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_ScrollView_prototype, "setDelegate", js_cocos2dx_CCScrollView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_TableView_prototype, "setDelegate", js_cocos2dx_CCTableView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_TableView_prototype, "setDataSource", js_cocos2dx_CCTableView_setDataSource, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_EditBox_prototype, "setDelegate", js_cocos2dx_CCEditBox_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_Control_prototype, "addTargetWithActionForControlEvents", js_cocos2dx_CCControl_addTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_extension_Control_prototype, "removeTargetWithActionForControlEvents", js_cocos2dx_CCControl_removeTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JSObject *tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, global, "(function () { return cc.TableView; })()"));
|
||||
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_CCTableView_create, 3, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
|
|
@ -81,7 +81,7 @@ static JSBool js_cocos2dx_UIWidget_addTouchEventListener(JSContext *cx, uint32_t
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UIWidget* cobj = (gui::UIWidget *)(proxy ? proxy->ptr : NULL);
|
||||
gui::Widget* cobj = (gui::Widget *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -106,7 +106,7 @@ static JSBool js_cocos2dx_UICheckBox_addEventListener(JSContext *cx, uint32_t ar
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UICheckBox* cobj = (gui::UICheckBox *)(proxy ? proxy->ptr : NULL);
|
||||
gui::CheckBox* cobj = (gui::CheckBox *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -131,7 +131,7 @@ static JSBool js_cocos2dx_UISlider_addEventListener(JSContext *cx, uint32_t argc
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UISlider* cobj = (gui::UISlider *)(proxy ? proxy->ptr : NULL);
|
||||
gui::Slider* cobj = (gui::Slider *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -156,7 +156,7 @@ static JSBool js_cocos2dx_UITextField_addEventListener(JSContext *cx, uint32_t a
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UITextField* cobj = (gui::UITextField *)(proxy ? proxy->ptr : NULL);
|
||||
gui::TextField* cobj = (gui::TextField *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -181,7 +181,7 @@ static JSBool js_cocos2dx_UIPageView_addEventListener(JSContext *cx, uint32_t ar
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UIPageView* cobj = (gui::UIPageView *)(proxy ? proxy->ptr : NULL);
|
||||
gui::PageView* cobj = (gui::PageView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -206,7 +206,7 @@ static JSBool js_cocos2dx_UIListView_addEventListener(JSContext *cx, uint32_t ar
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UIListView* cobj = (gui::UIListView *)(proxy ? proxy->ptr : NULL);
|
||||
gui::ListView* cobj = (gui::ListView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -231,7 +231,7 @@ static JSBool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UILayoutParameter* cobj = (gui::UILayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
gui::LayoutParameter* cobj = (gui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 1) {
|
||||
|
@ -253,7 +253,7 @@ static JSBool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc
|
|||
|
||||
JSB_PRECONDITION3(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
cobj->setMargin(gui::UIMargin(left,top,right,bottom));
|
||||
cobj->setMargin(gui::Margin(left,top,right,bottom));
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_ReportError(cx, "Invalid number of arguments");
|
||||
|
@ -264,13 +264,13 @@ static JSBool js_cocos2dx_LayoutParameter_getMargin(JSContext *cx, uint32_t argc
|
|||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
gui::UILayoutParameter* cobj = (gui::UILayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
gui::LayoutParameter* cobj = (gui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
|
||||
if (argc == 0) {
|
||||
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!tmp) return JS_FALSE;
|
||||
gui::UIMargin margin = cobj->getMargin();
|
||||
gui::Margin margin = cobj->getMargin();
|
||||
JSBool ok = JS_DefineProperty(cx, tmp, "left", DOUBLE_TO_JSVAL(margin.left), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
|
||||
JS_DefineProperty(cx, tmp, "top", DOUBLE_TO_JSVAL(margin.top), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
|
||||
JS_DefineProperty(cx, tmp, "right", DOUBLE_TO_JSVAL(margin.right), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
|
||||
|
@ -289,29 +289,29 @@ static JSBool js_cocos2dx_LayoutParameter_getMargin(JSContext *cx, uint32_t argc
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
extern JSObject* jsb_UIWidget_prototype;
|
||||
extern JSObject* jsb_UICheckBox_prototype;
|
||||
extern JSObject* jsb_UISlider_prototype;
|
||||
extern JSObject* jsb_UITextField_prototype;
|
||||
extern JSObject* jsb_UILayoutParameter_prototype;
|
||||
extern JSObject* jsb_UIPageView_prototype;
|
||||
extern JSObject* jsb_UIListView_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_Widget_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_CheckBox_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_Slider_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_TextField_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_LayoutParameter_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_PageView_prototype;
|
||||
extern JSObject* jsb_cocos2d_gui_ListView_prototype;
|
||||
|
||||
void register_all_cocos2dx_gui_manual(JSContext* cx, JSObject* global)
|
||||
{
|
||||
JS_DefineFunction(cx, jsb_UIWidget_prototype, "addTouchEventListener", js_cocos2dx_UIWidget_addTouchEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_Widget_prototype, "addTouchEventListener", js_cocos2dx_UIWidget_addTouchEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UICheckBox_prototype, "addEventListenerCheckBox", js_cocos2dx_UICheckBox_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_CheckBox_prototype, "addEventListenerCheckBox", js_cocos2dx_UICheckBox_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UISlider_prototype, "addEventListenerSlider", js_cocos2dx_UISlider_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_Slider_prototype, "addEventListenerSlider", js_cocos2dx_UISlider_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UITextField_prototype, "addEventListenerTextField", js_cocos2dx_UITextField_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_TextField_prototype, "addEventListenerTextField", js_cocos2dx_UITextField_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UIPageView_prototype, "addEventListenerPageView", js_cocos2dx_UIPageView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_PageView_prototype, "addEventListenerPageView", js_cocos2dx_UIPageView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UIListView_prototype, "addEventListenerListView", js_cocos2dx_UIListView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_ListView_prototype, "addEventListenerListView", js_cocos2dx_UIListView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UILayoutParameter_prototype, "setMargin", js_cocos2dx_LayoutParameter_setMargin, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_LayoutParameter_prototype, "setMargin", js_cocos2dx_LayoutParameter_setMargin, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, jsb_UILayoutParameter_prototype, "getMargin", js_cocos2dx_LayoutParameter_getMargin, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, jsb_cocos2d_gui_LayoutParameter_prototype, "getMargin", js_cocos2dx_LayoutParameter_getMargin, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
}
|
|
@ -89,7 +89,7 @@ JSBool js_cocos2dx_GLNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
extern JSObject* jsb_Node_prototype;
|
||||
extern JSObject* jsb_cocos2d_Node_prototype;
|
||||
|
||||
void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global) {
|
||||
js_cocos2dx_GLNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
|
@ -120,7 +120,7 @@ void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global) {
|
|||
|
||||
js_cocos2dx_GLNode_prototype = JS_InitClass(
|
||||
cx, global,
|
||||
jsb_Node_prototype,
|
||||
jsb_cocos2d_Node_prototype,
|
||||
js_cocos2dx_GLNode_class,
|
||||
js_cocos2dx_GLNode_constructor, 0, // constructor
|
||||
properties,
|
||||
|
@ -140,7 +140,7 @@ void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global) {
|
|||
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
|
||||
p->jsclass = js_cocos2dx_GLNode_class;
|
||||
p->proto = js_cocos2dx_GLNode_prototype;
|
||||
p->parentProto = jsb_Node_prototype;
|
||||
p->parentProto = jsb_cocos2d_Node_prototype;
|
||||
_js_global_type_map.insert(std::make_pair(typeName, p));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,24 +63,24 @@ void LuaCocoStudioEventListener::eventCallbackFunc(Object* sender,int eventType)
|
|||
}
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UIWidget_addTouchEventListener(lua_State* L)
|
||||
static int lua_cocos2dx_Widget_addTouchEventListener(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UIWidget* self = nullptr;
|
||||
Widget* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UIWidget",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"Widget",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UIWidget*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<Widget*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UIWidget_addTouchEventListener'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -112,7 +112,7 @@ static int lua_cocos2dx_UIWidget_addTouchEventListener(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addTouchEventListener' function of UIWidget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addTouchEventListener' function of Widget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -122,35 +122,35 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void extendUIWidget(lua_State* L)
|
||||
static void extendWidget(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UIWidget");
|
||||
lua_pushstring(L, "Widget");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addTouchEventListener", lua_cocos2dx_UIWidget_addTouchEventListener);
|
||||
tolua_function(L, "addTouchEventListener", lua_cocos2dx_Widget_addTouchEventListener);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UICheckBox_addEventListenerCheckBox(lua_State* L)
|
||||
static int lua_cocos2dx_CheckBox_addEventListenerCheckBox(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UICheckBox* self = nullptr;
|
||||
CheckBox* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UICheckBox",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"CheckBox",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UICheckBox*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<CheckBox*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UICheckBox_addEventListenerCheckBox'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_CheckBox_addEventListenerCheckBox'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -180,7 +180,7 @@ static int lua_cocos2dx_UICheckBox_addEventListenerCheckBox(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListenerCheckBox' function of UICheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addEventListenerCheckBox' function of CheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -191,35 +191,35 @@ tolua_lerror:
|
|||
}
|
||||
|
||||
|
||||
static void extendUICheckBox(lua_State* L)
|
||||
static void extendCheckBox(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UICheckBox");
|
||||
lua_pushstring(L, "CheckBox");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addEventListenerCheckBox", lua_cocos2dx_UICheckBox_addEventListenerCheckBox);
|
||||
tolua_function(L, "addEventListenerCheckBox", lua_cocos2dx_CheckBox_addEventListenerCheckBox);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UISlider_addEventListenerSlider(lua_State* L)
|
||||
static int lua_cocos2dx_Slider_addEventListenerSlider(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UISlider* self = nullptr;
|
||||
Slider* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UISlider",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"Slider",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UISlider*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<Slider*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UISlider_addEventListenerSlider'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Slider_addEventListenerSlider'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -249,7 +249,7 @@ static int lua_cocos2dx_UISlider_addEventListenerSlider(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListenerSlider' function of UISlider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addEventListenerSlider' function of Slider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -260,35 +260,35 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void extendUISlider(lua_State* L)
|
||||
static void extendSlider(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UISlider");
|
||||
lua_pushstring(L, "Slider");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addEventListenerSlider", lua_cocos2dx_UISlider_addEventListenerSlider);
|
||||
tolua_function(L, "addEventListenerSlider", lua_cocos2dx_Slider_addEventListenerSlider);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UITextField_addEventListenerTextField(lua_State* L)
|
||||
static int lua_cocos2dx_TextField_addEventListenerTextField(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UITextField* self = nullptr;
|
||||
TextField* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UITextField",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"TextField",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UITextField*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UITextField_addEventListenerTextField'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListenerTextField'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -318,7 +318,7 @@ static int lua_cocos2dx_UITextField_addEventListenerTextField(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListenerTextField' function of UITextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addEventListenerTextField' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -329,35 +329,35 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void extendUITextField(lua_State* L)
|
||||
static void extendTextField(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UITextField");
|
||||
lua_pushstring(L, "TextField");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addEventListenerTextField", lua_cocos2dx_UITextField_addEventListenerTextField);
|
||||
tolua_function(L, "addEventListenerTextField", lua_cocos2dx_TextField_addEventListenerTextField);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UIPageView_addEventListenerPageView(lua_State* L)
|
||||
static int lua_cocos2dx_PageView_addEventListenerPageView(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UIPageView* self = nullptr;
|
||||
PageView* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UIPageView",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"PageView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UIPageView*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UIPageView_addEventListenerPageView'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListenerPageView'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -387,7 +387,7 @@ static int lua_cocos2dx_UIPageView_addEventListenerPageView(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListenerPageView' function of UIPageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addEventListenerPageView' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -398,35 +398,35 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void extendUIPageView(lua_State* L)
|
||||
static void extendPageView(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UIPageView");
|
||||
lua_pushstring(L, "PageView");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addEventListenerPageView", lua_cocos2dx_UIPageView_addEventListenerPageView);
|
||||
tolua_function(L, "addEventListenerPageView", lua_cocos2dx_PageView_addEventListenerPageView);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UIListView_addEventListenerListView(lua_State* L)
|
||||
static int lua_cocos2dx_ListView_addEventListenerListView(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UIListView* self = nullptr;
|
||||
ListView* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UIListView",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"ListView",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UIListView*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<ListView*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UIListView_addEventListenerListView'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addEventListenerListView'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -456,7 +456,7 @@ static int lua_cocos2dx_UIListView_addEventListenerListView(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'addEventListenerListView' function of UIListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'addEventListenerListView' function of ListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -467,35 +467,35 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static void extendUIListView(lua_State* L)
|
||||
static void extendListView(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UIListView");
|
||||
lua_pushstring(L, "ListView");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "addEventListenerListView", lua_cocos2dx_UIListView_addEventListenerListView);
|
||||
tolua_function(L, "addEventListenerListView", lua_cocos2dx_ListView_addEventListenerListView);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UILayoutParameter_setMargin(lua_State* L)
|
||||
static int lua_cocos2dx_LayoutParameter_setMargin(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UILayoutParameter* self = nullptr;
|
||||
LayoutParameter* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"UILayoutParameter",0,&tolua_err)) goto tolua_lerror;
|
||||
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UILayoutParameter*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UILayoutParameter_setMargin'\n", NULL);
|
||||
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_setMargin'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -510,7 +510,7 @@ static int lua_cocos2dx_UILayoutParameter_setMargin(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
|
||||
UIMargin margin;
|
||||
Margin margin;
|
||||
lua_pushstring(L, "left");
|
||||
lua_gettable(L,2);
|
||||
margin.left = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
|
||||
|
@ -535,7 +535,7 @@ static int lua_cocos2dx_UILayoutParameter_setMargin(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'setMargin' function of UILayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
CCLOG("'setMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -546,20 +546,20 @@ tolua_lerror:
|
|||
#endif
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_UILayoutParameter_getMargin(lua_State* L)
|
||||
static int lua_cocos2dx_LayoutParameter_getMargin(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = 0;
|
||||
UILayoutParameter* self = nullptr;
|
||||
LayoutParameter* self = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
self = static_cast<UILayoutParameter*>(tolua_tousertype(L,1,0));
|
||||
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (nullptr == self) {
|
||||
|
@ -571,7 +571,7 @@ static int lua_cocos2dx_UILayoutParameter_getMargin(lua_State* L)
|
|||
|
||||
if (0 == argc)
|
||||
{
|
||||
UIMargin margin = self->getMargin();
|
||||
Margin margin = self->getMargin();
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
|
@ -607,12 +607,12 @@ tolua_lerror:
|
|||
|
||||
static void extendLayoutParameter(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "UILayoutParameter");
|
||||
lua_pushstring(L, "LayoutParameter");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
tolua_function(L, "setMargin", lua_cocos2dx_UILayoutParameter_setMargin);
|
||||
tolua_function(L, "getMargin", lua_cocos2dx_UILayoutParameter_getMargin);
|
||||
tolua_function(L, "setMargin", lua_cocos2dx_LayoutParameter_setMargin);
|
||||
tolua_function(L, "getMargin", lua_cocos2dx_LayoutParameter_getMargin);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
@ -911,12 +911,12 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L)
|
|||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
extendUIWidget(L);
|
||||
extendUICheckBox(L);
|
||||
extendUISlider(L);
|
||||
extendUITextField(L);
|
||||
extendUIPageView(L);
|
||||
extendUIListView(L);
|
||||
extendWidget(L);
|
||||
extendCheckBox(L);
|
||||
extendSlider(L);
|
||||
extendTextField(L);
|
||||
extendPageView(L);
|
||||
extendListView(L);
|
||||
extendLayoutParameter(L);
|
||||
extendArmatureAnimation(L);
|
||||
extendArmatureDataManager(L);
|
||||
|
|
|
@ -65,21 +65,18 @@ Classes/ExtensionsTest/CocoStudioGUITest/UIScene.cpp \
|
|||
Classes/ExtensionsTest/CocoStudioGUITest/UISceneManager.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIDragPanelTest/UIDragPanelTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelAtlasTest/UILabelAtlasTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelBMFontTest/UILabelBMFontTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelTest/UILabelTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UINodeContainerTest/UINodeContainerTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIPanelTest/UIPanelTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextAreaTest/UITextAreaTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextButtonTest/UITextButtonTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp \
|
||||
Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp \
|
||||
|
|
|
@ -65,21 +65,18 @@ set(SAMPLE_SRC
|
|||
Classes/ExtensionsTest/CocoStudioGUITest/UISceneManager.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIDragPanelTest/UIDragPanelTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelAtlasTest/UILabelAtlasTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelBMFontTest/UILabelBMFontTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILabelTest/UILabelTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UINodeContainerTest/UINodeContainerTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIPanelTest/UIPanelTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextAreaTest/UITextAreaTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextButtonTest/UITextButtonTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest.cpp
|
||||
Classes/ExtensionsTest/CocoStudioGUITest/CocosGUIScene.cpp
|
||||
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp
|
||||
Classes/NewRendererTest/NewRendererTest.cpp
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "Box2dView.h"
|
||||
#include "GLES-Render.h"
|
||||
#include "Test.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
||||
#define kAccelerometerFrequency 30
|
||||
#define FRAMES_BETWEEN_PRESSES_FOR_DOUBLE_CLICK 10
|
||||
|
@ -210,15 +212,22 @@ void Box2DView::draw()
|
|||
{
|
||||
Layer::draw();
|
||||
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(Box2DView::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
}
|
||||
|
||||
void Box2DView::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
GL::enableVertexAttribs( cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
m_test->m_world->DrawDebugData();
|
||||
|
||||
kmGLPopMatrix();
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
Box2DView::~Box2DView()
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
//virtual void accelerometer(UIAccelerometer* accelerometer, Acceleration* acceleration);
|
||||
|
||||
static Box2DView* viewWithEntryID(int entryId);
|
||||
protected:
|
||||
void onDraw();
|
||||
};
|
||||
|
||||
class Box2dTestBedScene : public TestScene
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "ClippingNodeTest.h"
|
||||
#include "../testResource.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
||||
enum {
|
||||
kTagTitleLabel = 1,
|
||||
|
@ -596,8 +598,14 @@ void RawStencilBufferTest::draw()
|
|||
|
||||
auto planeSize = winPoint * (1.0 / _planeCount);
|
||||
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
Renderer *renderer = Director::getInstance()->getRenderer();
|
||||
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(RawStencilBufferTest::onEnableStencil, this);
|
||||
renderer->addCommand(cmd);
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < _planeCount; i++) {
|
||||
|
||||
|
@ -608,21 +616,21 @@ void RawStencilBufferTest::draw()
|
|||
spritePoint.x += planeSize.x / 2;
|
||||
spritePoint.y = 0;
|
||||
_sprite->setPosition( spritePoint );
|
||||
|
||||
this->setupStencilForClippingOnPlane(i);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
DrawPrimitives::drawSolidRect(Point::ZERO, stencilPoint, Color4F(1, 1, 1, 1));
|
||||
|
||||
cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawClip, this, i, stencilPoint);
|
||||
renderer->addCommand(cmd);
|
||||
|
||||
kmGLPushMatrix();
|
||||
this->transform();
|
||||
_sprite->visit();
|
||||
kmGLPopMatrix();
|
||||
|
||||
this->setupStencilForDrawingOnPlane(i);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
DrawPrimitives::drawSolidRect(Point::ZERO, winPoint, _planeColor[i]);
|
||||
cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawSprite, this, i, winPoint);
|
||||
renderer->addCommand(cmd);
|
||||
|
||||
kmGLPushMatrix();
|
||||
this->transform();
|
||||
|
@ -630,10 +638,40 @@ void RawStencilBufferTest::draw()
|
|||
kmGLPopMatrix();
|
||||
}
|
||||
|
||||
cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(RawStencilBufferTest::onDisableStencil, this);
|
||||
renderer->addCommand(cmd);
|
||||
|
||||
}
|
||||
|
||||
void RawStencilBufferTest::onEnableStencil()
|
||||
{
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void RawStencilBufferTest::onDisableStencil()
|
||||
{
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Point& pt)
|
||||
{
|
||||
this->setupStencilForClippingOnPlane(planeIndex);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
DrawPrimitives::drawSolidRect(Point::ZERO, pt, Color4F(1, 1, 1, 1));
|
||||
}
|
||||
|
||||
void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Point& pt)
|
||||
{
|
||||
this->setupStencilForDrawingOnPlane(planeIndex);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
DrawPrimitives::drawSolidRect(Point::ZERO, pt, _planeColor[planeIndex]);
|
||||
}
|
||||
|
||||
void RawStencilBufferTest::setupStencilForClippingOnPlane(GLint plane)
|
||||
{
|
||||
GLint planeMask = 0x1 << plane;
|
||||
|
|
|
@ -156,6 +156,11 @@ public:
|
|||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||
|
||||
protected:
|
||||
void onEnableStencil();
|
||||
void onDisableStencil();
|
||||
void onBeforeDrawClip(int planeIndex, const Point& pt);
|
||||
void onBeforeDrawSprite(int planeIndex, const Point& pt);
|
||||
protected:
|
||||
Sprite* _sprite;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "LabelTestNew.h"
|
||||
#include "../testResource.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
||||
enum {
|
||||
kTagTileMap = 1,
|
||||
|
@ -300,9 +302,24 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
|||
|
||||
void LabelFNTSpriteActions::draw()
|
||||
{
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(LabelFNTSpriteActions::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
|
||||
}
|
||||
|
||||
void LabelFNTSpriteActions::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
DrawPrimitives::drawLine( Point(0, s.height/2), Point(s.width, s.height/2) );
|
||||
DrawPrimitives::drawLine( Point(s.width/2, 0), Point(s.width/2, s.height) );
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
void LabelFNTSpriteActions::step(float dt)
|
||||
|
@ -897,6 +914,18 @@ std::string LabelFNTBounds::subtitle() const
|
|||
|
||||
void LabelFNTBounds::draw()
|
||||
{
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(LabelFNTBounds::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
}
|
||||
|
||||
void LabelFNTBounds::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
auto labelSize = label1->getContentSize();
|
||||
auto origin = Director::getInstance()->getWinSize();
|
||||
|
||||
|
@ -911,6 +940,8 @@ void LabelFNTBounds::draw()
|
|||
Point(origin.width, labelSize.height + origin.height)
|
||||
};
|
||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
LabelTTFLongLineWrapping::LabelTTFLongLineWrapping()
|
||||
|
|
|
@ -60,6 +60,8 @@ public:
|
|||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
protected:
|
||||
void onDraw();
|
||||
};
|
||||
|
||||
class LabelFNTPadding : public AtlasDemoNew
|
||||
|
@ -223,6 +225,8 @@ public:
|
|||
virtual std::string subtitle() const override;
|
||||
private:
|
||||
Label *label1;
|
||||
protected:
|
||||
void onDraw();
|
||||
};
|
||||
|
||||
class LabelTTFLongLineWrapping : public AtlasDemoNew
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "TileMapTest.h"
|
||||
#include "../testResource.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -597,6 +599,18 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
|
|||
|
||||
void TMXOrthoObjectsTest::draw()
|
||||
{
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(TMXOrthoObjectsTest::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
}
|
||||
|
||||
void TMXOrthoObjectsTest::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
auto map = static_cast<TMXTiledMap*>( getChildByTag(kTagTileMap) );
|
||||
auto group = map->getObjectGroup("Object Group 1");
|
||||
|
||||
|
@ -620,6 +634,8 @@ void TMXOrthoObjectsTest::draw()
|
|||
|
||||
glLineWidth(1);
|
||||
}
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
std::string TMXOrthoObjectsTest::title() const
|
||||
|
@ -657,6 +673,18 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
|
|||
|
||||
void TMXIsoObjectsTest::draw()
|
||||
{
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(TMXIsoObjectsTest::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
}
|
||||
|
||||
void TMXIsoObjectsTest::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
auto map = (TMXTiledMap*) getChildByTag(kTagTileMap);
|
||||
auto group = map->getObjectGroup("Object Group 1");
|
||||
|
||||
|
@ -678,6 +706,8 @@ void TMXIsoObjectsTest::draw()
|
|||
|
||||
glLineWidth(1);
|
||||
}
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
std::string TMXIsoObjectsTest::title() const
|
||||
|
@ -1445,9 +1475,21 @@ TMXGIDObjectsTest::TMXGIDObjectsTest()
|
|||
|
||||
void TMXGIDObjectsTest::draw()
|
||||
{
|
||||
CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand();
|
||||
cmd->init(0, _vertexZ);
|
||||
cmd->func = CC_CALLBACK_0(TMXGIDObjectsTest::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(cmd);
|
||||
}
|
||||
|
||||
void TMXGIDObjectsTest::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
auto map = (TMXTiledMap*)getChildByTag(kTagTileMap);
|
||||
auto group = map->getObjectGroup("Object Layer 1");
|
||||
|
||||
|
||||
auto& objects = group->getObjects();
|
||||
for (auto& obj : objects)
|
||||
{
|
||||
|
@ -1457,16 +1499,18 @@ void TMXGIDObjectsTest::draw()
|
|||
float y = dict["y"].asFloat();
|
||||
float width = dict["width"].asFloat();
|
||||
float height = dict["height"].asFloat();
|
||||
|
||||
|
||||
glLineWidth(3);
|
||||
|
||||
|
||||
DrawPrimitives::drawLine(Point(x, y), Point(x + width, y));
|
||||
DrawPrimitives::drawLine(Point(x + width, y), Point(x + width, y + height));
|
||||
DrawPrimitives::drawLine(Point(x + width,y + height), Point(x,y + height));
|
||||
DrawPrimitives::drawLine(Point(x,y + height), Point(x,y));
|
||||
|
||||
|
||||
glLineWidth(1);
|
||||
}
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
std::string TMXGIDObjectsTest::title() const
|
||||
|
|
|
@ -135,6 +135,8 @@ public:
|
|||
|
||||
virtual void draw();
|
||||
virtual std::string subtitle() const override;
|
||||
protected:
|
||||
void onDraw();
|
||||
};
|
||||
|
||||
class TMXIsoObjectsTest : public TileDemo
|
||||
|
@ -145,6 +147,8 @@ public:
|
|||
|
||||
virtual void draw();
|
||||
virtual std::string subtitle() const override;
|
||||
protected:
|
||||
void onDraw();
|
||||
};
|
||||
|
||||
class TMXResizeTest : public TileDemo
|
||||
|
@ -279,6 +283,10 @@ public:
|
|||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
virtual void draw();
|
||||
|
||||
protected:
|
||||
void onDraw();
|
||||
|
||||
};
|
||||
|
||||
class TileMapTestScene : public TestScene
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8777403545dbc9a131a8ae12ad6293194bd331d6
|
||||
Subproject commit 6e880d8843dd51fb5c4094f2672c7c846bb85401
|
|
@ -7,6 +7,9 @@ prefix = cocos2dx_gui
|
|||
# all classes will be embedded in that namespace
|
||||
target_namespace = ccs
|
||||
|
||||
# the native namespace in which this module locates, this parameter is used for avoid conflict of the same class name in different modules, as "cocos2d::Label" <-> "cocos2d::gui::Label".
|
||||
cpp_namespace = cocos2d::gui
|
||||
|
||||
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
|
||||
android_flags = -D_SIZE_T_DEFINED_
|
||||
|
||||
|
@ -27,7 +30,7 @@ headers = %(cocosdir)s/cocos/gui/CocosGUI.h
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = UIHelper UILayout UIWidget UILayer UIButton UICheckBox UIImageView UILabel UILabelAtlas UILabelBMFont UILoadingBar UISlider UISwitch UITextField UIScrollView UIPageView UIListView UILayoutParameter UILinearLayoutParameter UIRelativeLayoutParameter
|
||||
classes = Helper Layout Widget Layer Button CheckBox ImageView Label LabelAtlas LabelBMFont LoadingBar Slider Switch TextField ScrollView PageView ListView LayoutParameter LinearLayoutParameter RelativeLayoutParameter
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
@ -37,10 +40,10 @@ classes = UIHelper UILayout UIWidget UILayer UIButton UICheckBox UIImageView UIL
|
|||
# functions from all classes.
|
||||
|
||||
skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener (s|g)etBlendFunc ccTouch.*],
|
||||
UIWidget::[(s|g)etUserObject],
|
||||
UILayer::[getInputManager],
|
||||
UILayoutParameter::[(s|g)etMargin],
|
||||
UIImageView::[doubleClickEvent checkDoubleClick]
|
||||
Widget::[(s|g)etUserObject],
|
||||
Layer::[getInputManager],
|
||||
LayoutParameter::[(s|g)etMargin],
|
||||
ImageView::[doubleClickEvent checkDoubleClick]
|
||||
|
||||
rename_functions =
|
||||
|
||||
|
@ -50,14 +53,14 @@ rename_classes =
|
|||
remove_prefix =
|
||||
|
||||
# classes for which there will be no "parent" lookup
|
||||
classes_have_no_parents = UIHelper
|
||||
classes_have_no_parents = Helper
|
||||
|
||||
# base classes which will be skipped when their sub-classes found them.
|
||||
base_classes_to_skip = Object
|
||||
|
||||
# classes that create no constructor
|
||||
# Set is special and we will use a hand-written constructor
|
||||
abstract_classes = UIHelper
|
||||
abstract_classes = Helper
|
||||
|
||||
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
|
||||
script_control_cpp = no
|
||||
|
|
|
@ -7,6 +7,9 @@ prefix = cocos2dx_studio
|
|||
# all classes will be embedded in that namespace
|
||||
target_namespace = ccs
|
||||
|
||||
# the native namespace in which this module locates, this parameter is used for avoid conflict of the same class name in different modules, as "cocos2d::Label" <-> "cocos2d::gui::Label".
|
||||
cpp_namespace = cocos2d::gui cocostudio
|
||||
|
||||
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
|
||||
android_flags = -D_SIZE_T_DEFINED_
|
||||
|
||||
|
@ -27,7 +30,7 @@ headers = %(cocosdir)s/cocos/gui/CocosGUI.h %(cocosdir)s/cocos/editor-support/co
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ UIWidget UILayout UIRootWidget UIButton UICheckBox UIImageView UILabel UICCLabelAtlas UILabelAtlas UILoadingBar UIScrollView UISlider UICCTextField UITextField UIListView UILabelBMFont UIPageView UIHelper UILayer UILayoutParameter GUIReader UILinearLayoutParameter UIRelativeLayoutParameter SceneReader ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode
|
||||
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ Widget Layout RootWidget Button CheckBox ImageView Label CCLabelAtlas LabelAtlas LoadingBar ScrollView Slider CCTextField TextField ListView LabelBMFont PageView Helper Layer LayoutParameter GReader LinearLayoutParameter RelativeLayoutParameter SceneReader ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
@ -42,11 +45,11 @@ skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*
|
|||
Skin::[(s|g)etSkinData],
|
||||
ArmatureAnimation::[updateHandler updateFrameData frameEvent setMovementEventCallFunc setFrameEventCallFunc],
|
||||
Bone::[(s|g)etIgnoreMovementBoneData],
|
||||
UILayer::[getInputManager],
|
||||
UILayoutParameter::[(s|g)etMargin],
|
||||
UIHelper::[init],
|
||||
GUIReader::[setPropsForImageButtonFromJsonDictionary],
|
||||
UIImageView::[doubleClickEvent]
|
||||
Layer::[getInputManager],
|
||||
LayoutParameter::[(s|g)etMargin],
|
||||
Helper::[init],
|
||||
GReader::[setPropsForImageButtonFromJsonDictionary],
|
||||
ImageView::[doubleClickEvent]
|
||||
|
||||
rename_functions = GUIReader::[shareReader=getInstance purgeGUIReader=destroyInstance],
|
||||
ActionManagerEx::[shareManager=getInstance purgeActionManager=destroyInstance],
|
||||
|
|
Loading…
Reference in New Issue