mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop
This commit is contained in:
commit
ab4841e774
|
@ -1 +1 @@
|
||||||
14c85247a5f8b18ac4e064c8afb58f55b58911f7
|
b8bc5839895bfc413816baa425d43a2b8e48205d
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio Express 2012 for Windows Desktop
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
||||||
|
@ -29,6 +29,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-t
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.win32\libGUI.vcxproj", "{7E06E92C-537A-442B-9E4A-4761C84F8A1A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.win32\libGUI.vcxproj", "{7E06E92C-537A-442B-9E4A-4761C84F8A1A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-test", "..\tests\cpp-empty-test\proj.win32\cpp-empty-test.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-empty-test", "..\tests\lua-empty-test\project\proj.win32\lua-empty-test.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
|
@ -91,6 +95,14 @@ Global
|
||||||
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Debug|Win32.Build.0 = Debug|Win32
|
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Release|Win32.ActiveCfg = Release|Win32
|
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Release|Win32.Build.0 = Release|Win32
|
{7E06E92C-537A-442B-9E4A-4761C84F8A1A}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
71a61fb97a4db05adaabc4cc03035fe419cc35d6
|
bbf0323293cba3d7ee58ef36706831a8761692d8
|
|
@ -1 +1 @@
|
||||||
08fd638cd925dfad54a49df207a72130942102d3
|
66526d30a3e76bb1b54c7615a18c467845798e78
|
|
@ -66,7 +66,7 @@ Label* Label::createWithFontDefinition(const std::string& text, const FontDefini
|
||||||
|
|
||||||
Label* Label::create(const std::string& text, const std::string& fontName, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */)
|
Label* Label::create(const std::string& text, const std::string& fontName, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */)
|
||||||
{
|
{
|
||||||
auto ret = new Label(nullptr,hAlignment);
|
auto ret = new Label(nullptr,hAlignment,vAlignment);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,8 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,bool useA8Shader)
|
Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
|
||||||
|
TextVAlignment vAlignment /* = TextVAlignment::TOP */,bool useDistanceField /* = false */,bool useA8Shader /* = false */)
|
||||||
: _reusedLetter(nullptr)
|
: _reusedLetter(nullptr)
|
||||||
, _commonLineHeight(0.0f)
|
, _commonLineHeight(0.0f)
|
||||||
, _lineBreakWithoutSpaces(false)
|
, _lineBreakWithoutSpaces(false)
|
||||||
|
@ -259,7 +260,8 @@ Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,b
|
||||||
, _labelWidth(0)
|
, _labelWidth(0)
|
||||||
, _labelHeight(0)
|
, _labelHeight(0)
|
||||||
, _labelDimensions(Size::ZERO)
|
, _labelDimensions(Size::ZERO)
|
||||||
, _hAlignment(alignment)
|
, _hAlignment(hAlignment)
|
||||||
|
, _vAlignment(vAlignment)
|
||||||
, _currentUTF16String(nullptr)
|
, _currentUTF16String(nullptr)
|
||||||
, _originalUTF16String(nullptr)
|
, _originalUTF16String(nullptr)
|
||||||
, _horizontalKernings(nullptr)
|
, _horizontalKernings(nullptr)
|
||||||
|
@ -970,7 +972,7 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent
|
||||||
|
|
||||||
if (_textSprite)
|
if (_textSprite)
|
||||||
{
|
{
|
||||||
_textSprite->visit();
|
_textSprite->visit(renderer, _modelViewTransform, dirty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1147,7 +1149,10 @@ void Label::setColor(const Color3B& color)
|
||||||
{
|
{
|
||||||
updateContent();
|
updateContent();
|
||||||
}
|
}
|
||||||
_reusedLetter->setColor(color);
|
if (_reusedLetter)
|
||||||
|
{
|
||||||
|
_reusedLetter->setColor(color);
|
||||||
|
}
|
||||||
SpriteBatchNode::setColor(color);
|
SpriteBatchNode::setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef struct _ttfConfig
|
||||||
bool distanceFieldEnabled;
|
bool distanceFieldEnabled;
|
||||||
int outlineSize;
|
int outlineSize;
|
||||||
|
|
||||||
_ttfConfig(const char* filePath = "",int size = 36, const GlyphCollection& glyphCollection = GlyphCollection::NEHE,
|
_ttfConfig(const char* filePath = "",int size = 36, const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC,
|
||||||
const char *customGlyphCollection = nullptr,bool useDistanceField = false,int outline = 0)
|
const char *customGlyphCollection = nullptr,bool useDistanceField = false,int outline = 0)
|
||||||
:fontFilePath(filePath)
|
:fontFilePath(filePath)
|
||||||
,fontSize(size)
|
,fontSize(size)
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE static Label* createWithTTF(const std::string& label, const std::string& fontFilePath,
|
CC_DEPRECATED_ATTRIBUTE static Label* createWithTTF(const std::string& label, const std::string& fontFilePath,
|
||||||
int fontSize, int lineSize = 0, TextHAlignment alignment = TextHAlignment::LEFT,
|
int fontSize, int lineSize = 0, TextHAlignment alignment = TextHAlignment::LEFT,
|
||||||
GlyphCollection glyphs = GlyphCollection::NEHE, const char *customGlyphs = 0, bool useDistanceField = false);
|
GlyphCollection glyphs = GlyphCollection::DYNAMIC, const char *customGlyphs = 0, bool useDistanceField = false);
|
||||||
|
|
||||||
/** create a label with TTF configuration
|
/** create a label with TTF configuration
|
||||||
* It will generate texture of character by freetype.
|
* It will generate texture of character by freetype.
|
||||||
|
@ -251,7 +251,8 @@ protected:
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
Label(FontAtlas *atlas = nullptr, TextHAlignment alignment = TextHAlignment::LEFT, bool useDistanceField = false,bool useA8Shader = false);
|
Label(FontAtlas *atlas = nullptr, TextHAlignment hAlignment = TextHAlignment::LEFT,
|
||||||
|
TextVAlignment vAlignment = TextVAlignment::TOP,bool useDistanceField = false,bool useA8Shader = false);
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
|
|
@ -598,17 +598,6 @@ void Node::setTag(int var)
|
||||||
_tag = var;
|
_tag = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
//name getter
|
|
||||||
std::string& Node::getName()
|
|
||||||
{
|
|
||||||
return _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
//name setter
|
|
||||||
void Node::setName(const std::string& name)
|
|
||||||
{
|
|
||||||
_name = name;
|
|
||||||
}
|
|
||||||
/// userData setter
|
/// userData setter
|
||||||
void Node::setUserData(void *var)
|
void Node::setUserData(void *var)
|
||||||
{
|
{
|
||||||
|
@ -713,26 +702,6 @@ Node* Node::getChildByTag(int tag)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* Node::getChildByName(const std::string& name)
|
|
||||||
{
|
|
||||||
|
|
||||||
for (auto& child : _children)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(child->_name == name)
|
|
||||||
{
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto found = child->getChildByName(name);
|
|
||||||
if(found != nullptr)
|
|
||||||
{
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* "add" logic MUST only be on this method
|
/* "add" logic MUST only be on this method
|
||||||
* If a class want's to extend the 'addChild' behavior it only needs
|
* If a class want's to extend the 'addChild' behavior it only needs
|
||||||
* to override this method
|
* to override this method
|
||||||
|
|
|
@ -645,15 +645,6 @@ public:
|
||||||
* @return a Node object whose tag equals to the input parameter
|
* @return a Node object whose tag equals to the input parameter
|
||||||
*/
|
*/
|
||||||
virtual Node * getChildByTag(int tag);
|
virtual Node * getChildByTag(int tag);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a child from the container with its name
|
|
||||||
*
|
|
||||||
* @param name A string identifier to find the child node.
|
|
||||||
*
|
|
||||||
* @return the first Node object whose name equals to the input parameter
|
|
||||||
*/
|
|
||||||
virtual Node* getChildByName(const std::string& name);
|
|
||||||
/**
|
/**
|
||||||
* Returns the array of the node's children
|
* Returns the array of the node's children
|
||||||
*
|
*
|
||||||
|
@ -768,38 +759,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void setTag(int tag);
|
virtual void setTag(int tag);
|
||||||
|
|
||||||
/// @{
|
|
||||||
/// @name name
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a name that is used to identify the node easily.
|
|
||||||
*
|
|
||||||
* You can set name to node then identify them easily.
|
|
||||||
@code
|
|
||||||
|
|
||||||
// set name
|
|
||||||
node1->setName("player");
|
|
||||||
node2->setName("monster");
|
|
||||||
node3->setName("boss");
|
|
||||||
parent->addChild(node1);
|
|
||||||
parent->addChild(node2);
|
|
||||||
parent->addChild(node3);
|
|
||||||
// identify by name
|
|
||||||
Node* player = nullptr;
|
|
||||||
player = parent->getChildByName("player")
|
|
||||||
@endcode
|
|
||||||
*
|
|
||||||
* @return A C string that identifies the node.
|
|
||||||
*/
|
|
||||||
virtual std::string& getName();
|
|
||||||
/**
|
|
||||||
* Changes the string TAG that is used to identify the node easily.
|
|
||||||
*
|
|
||||||
* Please refer to getLabel for the sample code.
|
|
||||||
*
|
|
||||||
* @param name A string that indentifies the node.
|
|
||||||
*/
|
|
||||||
virtual void setName(const std::string& name);
|
|
||||||
/**
|
/**
|
||||||
* Returns a custom user data pointer
|
* Returns a custom user data pointer
|
||||||
*
|
*
|
||||||
|
|
|
@ -386,7 +386,8 @@ void GLView::end()
|
||||||
glfwSetWindowShouldClose(_mainWindow,1);
|
glfwSetWindowShouldClose(_mainWindow,1);
|
||||||
_mainWindow = nullptr;
|
_mainWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
// Release self. Otherwise, GLView could not be freed.
|
||||||
|
release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::swapBuffers()
|
void GLView::swapBuffers()
|
||||||
|
|
|
@ -74,24 +74,6 @@ public:
|
||||||
{
|
{
|
||||||
DeleteDC(_DC);
|
DeleteDC(_DC);
|
||||||
}
|
}
|
||||||
/*HFONT hDefFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
|
|
||||||
if (hDefFont != _font)
|
|
||||||
{
|
|
||||||
DeleteObject(_font);
|
|
||||||
_font = hDefFont;
|
|
||||||
}
|
|
||||||
// release temp font resource
|
|
||||||
if (_curFontPath.size() > 0)
|
|
||||||
{
|
|
||||||
wchar_t * pwszBuffer = utf8ToUtf16(_curFontPath);
|
|
||||||
if (pwszBuffer)
|
|
||||||
{
|
|
||||||
RemoveFontResource(pwszBuffer);
|
|
||||||
SendMessage( _wnd, WM_FONTCHANGE, 0, 0);
|
|
||||||
delete [] pwszBuffer;
|
|
||||||
pwszBuffer = NULL;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
removeCustomFont();
|
removeCustomFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,10 +423,7 @@ Data Device::getTextureDataForText(const char * text,const FontDefinition& textD
|
||||||
for (int x = 0; x < width; ++x)
|
for (int x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
COLORREF& clr = *pPixel;
|
COLORREF& clr = *pPixel;
|
||||||
if (GetRValue(clr) || GetGValue(clr) || GetBValue(clr))
|
clr = (0xffffff | (GetRValue(clr) << 24));
|
||||||
{
|
|
||||||
clr |= 0xff000000;
|
|
||||||
}
|
|
||||||
++pPixel;
|
++pPixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1070,6 +1070,10 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va
|
||||||
{
|
{
|
||||||
readerName = "PageViewReader";
|
readerName = "PageViewReader";
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<Widget*>(widget))
|
||||||
|
{
|
||||||
|
readerName = "WidgetReader";
|
||||||
|
}
|
||||||
reader = ObjectFactory::getInstance()->createWidgetReaderProtocol(readerName);
|
reader = ObjectFactory::getInstance()->createWidgetReaderProtocol(readerName);
|
||||||
setPropsForAllWidgetFromJsonDictionary(reader, widget, uiOptions);
|
setPropsForAllWidgetFromJsonDictionary(reader, widget, uiOptions);
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,10 @@
|
||||||
-- @param #float float
|
-- @param #float float
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#Node] setScaleY
|
-- @function [parent=#Node] enumerateChildrenByName
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #float float
|
-- @param #string str
|
||||||
|
-- @param #function func
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#Node] setScaleX
|
-- @function [parent=#Node] setScaleX
|
||||||
|
@ -329,16 +330,11 @@
|
||||||
-- @return bool#bool ret (return value: bool)
|
-- @return bool#bool ret (return value: bool)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- overload function: visit()
|
-- @function [parent=#Node] runAction
|
||||||
--
|
|
||||||
-- overload function: visit(cc.Renderer, kmMat4, bool)
|
|
||||||
--
|
|
||||||
-- @function [parent=#Node] visit
|
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #cc.Renderer renderer
|
-- @param #cc.Action action
|
||||||
-- @param #kmMat4 kmmat4
|
-- @return Action#Action ret (return value: cc.Action)
|
||||||
-- @param #bool bool
|
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#Node] setShaderProgram
|
-- @function [parent=#Node] setShaderProgram
|
||||||
-- @param self
|
-- @param self
|
||||||
|
@ -355,11 +351,16 @@
|
||||||
-- @return point_table#point_table ret (return value: point_table)
|
-- @return point_table#point_table ret (return value: point_table)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#Node] runAction
|
-- overload function: visit()
|
||||||
|
--
|
||||||
|
-- overload function: visit(cc.Renderer, kmMat4, bool)
|
||||||
|
--
|
||||||
|
-- @function [parent=#Node] visit
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #cc.Action action
|
-- @param #cc.Renderer renderer
|
||||||
-- @return Action#Action ret (return value: cc.Action)
|
-- @param #kmMat4 kmmat4
|
||||||
|
-- @param #bool bool
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#Node] setScheduler
|
-- @function [parent=#Node] setScheduler
|
||||||
-- @param self
|
-- @param self
|
||||||
|
@ -503,6 +504,11 @@
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #float float
|
-- @param #float float
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Node] setScaleY
|
||||||
|
-- @param self
|
||||||
|
-- @param #float float
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- overload function: setScale(float, float)
|
-- overload function: setScale(float, float)
|
||||||
--
|
--
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
c0580e239bc0d30c6d09103a806ab3e6e76da123
|
fa5cf8075e2b31cc61b8c17783dbdc435feae281
|
|
@ -1547,6 +1547,7 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __cocos2dx_h__
|
#endif // __cocos2dx_h__
|
||||||
|
|
|
@ -407,12 +407,24 @@ void ListView::addEventListenerListView(Ref *target, SEL_ListViewEvent selector)
|
||||||
_listViewEventSelector = selector;
|
_listViewEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::selectedItemEvent()
|
void ListView::selectedItemEvent(int state)
|
||||||
{
|
{
|
||||||
if (_listViewEventListener && _listViewEventSelector)
|
switch (state)
|
||||||
{
|
{
|
||||||
(_listViewEventListener->*_listViewEventSelector)(this, LISTVIEW_ONSELECTEDITEM);
|
case 0:
|
||||||
|
if (_listViewEventListener && _listViewEventSelector)
|
||||||
|
{
|
||||||
|
(_listViewEventListener->*_listViewEventSelector)(this, LISTVIEW_ONSELECTEDITEM_START);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (_listViewEventListener && _listViewEventSelector)
|
||||||
|
{
|
||||||
|
(_listViewEventListener->*_listViewEventSelector)(this, LISTVIEW_ONSELECTEDITEM_END);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::interceptTouchEvent(int handleState, Widget *sender, const Point &touchPoint)
|
void ListView::interceptTouchEvent(int handleState, Widget *sender, const Point &touchPoint)
|
||||||
|
@ -430,7 +442,7 @@ void ListView::interceptTouchEvent(int handleState, Widget *sender, const Point
|
||||||
}
|
}
|
||||||
parent = dynamic_cast<Widget*>(parent->getParent());
|
parent = dynamic_cast<Widget*>(parent->getParent());
|
||||||
}
|
}
|
||||||
selectedItemEvent();
|
selectedItemEvent(handleState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
LISTVIEW_ONSELECTEDITEM
|
LISTVIEW_ONSELECTEDITEM_START,
|
||||||
|
LISTVIEW_ONSELECTEDITEM_END
|
||||||
}ListViewEventType;
|
}ListViewEventType;
|
||||||
|
|
||||||
typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType);
|
typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType);
|
||||||
|
@ -193,7 +194,7 @@ protected:
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
virtual void copyClonedWidgetChildren(Widget* model) override;
|
virtual void copyClonedWidgetChildren(Widget* model) override;
|
||||||
void selectedItemEvent();
|
void selectedItemEvent(int state);
|
||||||
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
|
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,41 @@ THE SOFTWARE.
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
ScrollInnerContainer::ScrollInnerContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollInnerContainer::~ScrollInnerContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollInnerContainer* ScrollInnerContainer::create()
|
||||||
|
{
|
||||||
|
ScrollInnerContainer* widget = new ScrollInnerContainer();
|
||||||
|
if (widget && widget->init())
|
||||||
|
{
|
||||||
|
widget->autorelease();
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(widget);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Size& ScrollInnerContainer::getLayoutSize()
|
||||||
|
{
|
||||||
|
Widget* parent = getWidgetParent();
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
return parent->getSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const float AUTOSCROLLMAXSPEED = 1000.0f;
|
static const float AUTOSCROLLMAXSPEED = 1000.0f;
|
||||||
|
|
||||||
|
@ -233,7 +268,7 @@ void ScrollView::addChild(Node * child, int zOrder)
|
||||||
|
|
||||||
void ScrollView::addChild(Node *child, int zOrder, int tag)
|
void ScrollView::addChild(Node *child, int zOrder, int tag)
|
||||||
{
|
{
|
||||||
return _innerContainer->addChild(child, zOrder, tag);
|
_innerContainer->addChild(child, zOrder, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollView::removeAllChildren()
|
void ScrollView::removeAllChildren()
|
||||||
|
|
|
@ -31,6 +31,15 @@ THE SOFTWARE.
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
class ScrollInnerContainer : public Layout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScrollInnerContainer();
|
||||||
|
virtual ~ScrollInnerContainer();
|
||||||
|
static ScrollInnerContainer* create();
|
||||||
|
virtual const Size& getLayoutSize() override;
|
||||||
|
};
|
||||||
|
|
||||||
enum SCROLLVIEW_DIR
|
enum SCROLLVIEW_DIR
|
||||||
{
|
{
|
||||||
|
|
|
@ -396,6 +396,21 @@ void Widget::setSizePercent(const Point &percent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateSizeAndPosition()
|
void Widget::updateSizeAndPosition()
|
||||||
|
{
|
||||||
|
Widget* widgetParent = getWidgetParent();
|
||||||
|
Size pSize;
|
||||||
|
if (widgetParent)
|
||||||
|
{
|
||||||
|
pSize = widgetParent->getLayoutSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pSize = _parent->getContentSize();
|
||||||
|
}
|
||||||
|
updateSizeAndPosition(pSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
|
||||||
{
|
{
|
||||||
switch (_sizeType)
|
switch (_sizeType)
|
||||||
{
|
{
|
||||||
|
@ -409,70 +424,33 @@ void Widget::updateSizeAndPosition()
|
||||||
{
|
{
|
||||||
_size = _customSize;
|
_size = _customSize;
|
||||||
}
|
}
|
||||||
Widget* widgetParent = getWidgetParent();
|
float spx = 0.0f;
|
||||||
if (widgetParent)
|
float spy = 0.0f;
|
||||||
|
if (parentSize.width > 0.0f)
|
||||||
{
|
{
|
||||||
Size pSize = widgetParent->getSize();
|
spx = _customSize.width / parentSize.width;
|
||||||
float spx = 0.0f;
|
|
||||||
float spy = 0.0f;
|
|
||||||
if (pSize.width > 0.0f)
|
|
||||||
{
|
|
||||||
spx = _customSize.width / pSize.width;
|
|
||||||
}
|
|
||||||
if (pSize.height > 0.0f)
|
|
||||||
{
|
|
||||||
spy = _customSize.height / pSize.height;
|
|
||||||
}
|
|
||||||
_sizePercent = Point(spx, spy);
|
|
||||||
}
|
}
|
||||||
else
|
if (parentSize.height > 0.0f)
|
||||||
{
|
{
|
||||||
Size pSize = _parent->getContentSize();
|
spy = _customSize.height / parentSize.height;
|
||||||
float spx = 0.0f;
|
|
||||||
float spy = 0.0f;
|
|
||||||
if (pSize.width > 0.0f)
|
|
||||||
{
|
|
||||||
spx = _customSize.width / pSize.width;
|
|
||||||
}
|
|
||||||
if (pSize.height > 0.0f)
|
|
||||||
{
|
|
||||||
spy = _customSize.height / pSize.height;
|
|
||||||
}
|
|
||||||
_sizePercent = Point(spx, spy);
|
|
||||||
}
|
}
|
||||||
|
_sizePercent = Point(spx, spy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIZE_PERCENT:
|
case SIZE_PERCENT:
|
||||||
{
|
{
|
||||||
Widget* widgetParent = getWidgetParent();
|
Size cSize = Size(parentSize.width * _sizePercent.x , parentSize.height * _sizePercent.y);
|
||||||
if (widgetParent)
|
if (_ignoreSize)
|
||||||
{
|
{
|
||||||
Size cSize = Size(widgetParent->getSize().width * _sizePercent.x , widgetParent->getSize().height * _sizePercent.y);
|
_size = getContentSize();
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_size = getContentSize();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_size = cSize;
|
|
||||||
}
|
|
||||||
_customSize = cSize;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Size cSize = Size(_parent->getContentSize().width * _sizePercent.x , _parent->getContentSize().height * _sizePercent.y);
|
_size = cSize;
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_size = getContentSize();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_size = cSize;
|
|
||||||
}
|
|
||||||
_customSize = cSize;
|
|
||||||
}
|
}
|
||||||
}
|
_customSize = cSize;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -482,46 +460,19 @@ void Widget::updateSizeAndPosition()
|
||||||
{
|
{
|
||||||
case POSITION_ABSOLUTE:
|
case POSITION_ABSOLUTE:
|
||||||
{
|
{
|
||||||
Widget* widgetParent = getWidgetParent();
|
if (parentSize.width <= 0.0f || parentSize.height <= 0.0f)
|
||||||
if (widgetParent)
|
|
||||||
{
|
{
|
||||||
Size pSize = widgetParent->getSize();
|
_positionPercent = Point::ZERO;
|
||||||
if (pSize.width <= 0.0f || pSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_positionPercent = Point::ZERO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_positionPercent = Point(absPos.x / pSize.width, absPos.y / pSize.height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Size pSize = _parent->getContentSize();
|
_positionPercent = Point(absPos.x / parentSize.width, absPos.y / parentSize.height);
|
||||||
if (pSize.width <= 0.0f || pSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_positionPercent = Point::ZERO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_positionPercent = Point(absPos.x / pSize.width, absPos.y / pSize.height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case POSITION_PERCENT:
|
case POSITION_PERCENT:
|
||||||
{
|
{
|
||||||
Widget* widgetParent = getWidgetParent();
|
absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y);
|
||||||
if (widgetParent)
|
|
||||||
{
|
|
||||||
Size parentSize = widgetParent->getSize();
|
|
||||||
absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size parentSize = _parent->getContentSize();
|
|
||||||
absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -549,6 +549,8 @@ public:
|
||||||
const Size& getSize() const;
|
const Size& getSize() const;
|
||||||
|
|
||||||
const Size& getCustomSize() const;
|
const Size& getCustomSize() const;
|
||||||
|
|
||||||
|
virtual const Size& getLayoutSize() {return _size;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns size percent of widget
|
* Returns size percent of widget
|
||||||
|
@ -642,6 +644,8 @@ public:
|
||||||
|
|
||||||
void updateSizeAndPosition();
|
void updateSizeAndPosition();
|
||||||
|
|
||||||
|
void updateSizeAndPosition(const Size& parentSize);
|
||||||
|
|
||||||
/*temp action*/
|
/*temp action*/
|
||||||
void setActionTag(int tag);
|
void setActionTag(int tag);
|
||||||
int getActionTag();
|
int getActionTag();
|
||||||
|
|
|
@ -1,158 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ButtonReader.h"
|
|
||||||
#include "ui/UIButton.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static ButtonReader* instanceButtonReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader)
|
|
||||||
|
|
||||||
ButtonReader::ButtonReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonReader::~ButtonReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonReader* ButtonReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceButtonReader)
|
|
||||||
{
|
|
||||||
instanceButtonReader = new ButtonReader();
|
|
||||||
}
|
|
||||||
return instanceButtonReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonReader::purge()
|
|
||||||
{
|
|
||||||
CC_SAFE_DELETE(instanceButtonReader);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
Button* button = static_cast<Button*>(widget);
|
|
||||||
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
||||||
button->setScale9Enabled(scale9Enable);
|
|
||||||
|
|
||||||
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "normalData");
|
|
||||||
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
|
||||||
switch (normalType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_n = jsonPath;
|
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
||||||
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
|
|
||||||
button->loadTextureNormal(normalFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
||||||
button->loadTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "pressedData");
|
|
||||||
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
|
||||||
switch (pressedType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_p = jsonPath;
|
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
||||||
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
|
|
||||||
button->loadTexturePressed(pressedFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
||||||
button->loadTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "disabledData");
|
|
||||||
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
|
||||||
switch (disabledType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_d = jsonPath;
|
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
||||||
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
|
|
||||||
button->loadTextureDisabled(disabledFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
||||||
button->loadTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (scale9Enable)
|
|
||||||
{
|
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
||||||
|
|
||||||
button->setCapInsets(Rect(cx, cy, cw, ch));
|
|
||||||
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
||||||
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
||||||
if (sw && sh)
|
|
||||||
{
|
|
||||||
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
||||||
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
|
||||||
button->setSize(Size(swf, shf));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool tt = DICTOOL->checkObjectExist_json(options, "text");
|
|
||||||
if (tt)
|
|
||||||
{
|
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
||||||
if (text)
|
|
||||||
{
|
|
||||||
button->setTitleText(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cr = DICTOOL->checkObjectExist_json(options, "textColorR");
|
|
||||||
bool cg = DICTOOL->checkObjectExist_json(options, "textColorG");
|
|
||||||
bool cb = DICTOOL->checkObjectExist_json(options, "textColorB");
|
|
||||||
int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255;
|
|
||||||
int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255;
|
|
||||||
int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255;
|
|
||||||
button->setTitleColor(Color3B(cri,cgi,cbi));
|
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
||||||
if (fs)
|
|
||||||
{
|
|
||||||
button->setTitleFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
||||||
}
|
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
||||||
if (fn)
|
|
||||||
{
|
|
||||||
button->setTitleFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__ButtonReader__
|
|
||||||
#define __TestCpp__ButtonReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class ButtonReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
ButtonReader();
|
|
||||||
virtual ~ButtonReader();
|
|
||||||
|
|
||||||
static ButtonReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__ButtonReader__) */
|
|
|
@ -1,153 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "CheckBoxReader.h"
|
|
||||||
#include "ui/UICheckBox.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static CheckBoxReader* instanceCheckBoxReader = NULL;
|
|
||||||
using cocos2d::ui::CheckBox;
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader)
|
|
||||||
|
|
||||||
CheckBoxReader::CheckBoxReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckBoxReader::~CheckBoxReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckBoxReader* CheckBoxReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceCheckBoxReader)
|
|
||||||
{
|
|
||||||
instanceCheckBoxReader = new CheckBoxReader();
|
|
||||||
}
|
|
||||||
return instanceCheckBoxReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBoxReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
CheckBox* checkBox = static_cast<CheckBox*>(widget);
|
|
||||||
|
|
||||||
const rapidjson::Value& backGroundDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxData");
|
|
||||||
int backGroundType = DICTOOL->getIntValue_json(backGroundDic, "resourceType");
|
|
||||||
switch (backGroundType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_b = jsonPath;
|
|
||||||
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
|
||||||
const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():nullptr;
|
|
||||||
checkBox->loadTextureBackGround(backGroundFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
|
||||||
checkBox->loadTextureBackGround(backGroundFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& backGroundSelectedDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxSelectedData");
|
|
||||||
int backGroundSelectedType = DICTOOL->getIntValue_json(backGroundSelectedDic, "resourceType");
|
|
||||||
switch (backGroundSelectedType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_bs = jsonPath;
|
|
||||||
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
|
||||||
const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():nullptr;
|
|
||||||
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
|
||||||
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& frontCrossDic = DICTOOL->getSubDictionary_json(options, "frontCrossData");
|
|
||||||
int frontCrossType = DICTOOL->getIntValue_json(frontCrossDic, "resourceType");
|
|
||||||
switch (frontCrossType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_c = jsonPath;
|
|
||||||
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
|
||||||
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():nullptr;
|
|
||||||
checkBox->loadTextureFrontCross(frontCrossFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
|
||||||
checkBox->loadTextureFrontCross(frontCrossFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& backGroundDisabledDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxDisabledData");
|
|
||||||
int backGroundDisabledType = DICTOOL->getIntValue_json(backGroundDisabledDic, "resourceType");
|
|
||||||
switch (backGroundDisabledType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_bd = jsonPath;
|
|
||||||
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
|
||||||
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():nullptr;
|
|
||||||
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
|
||||||
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& frontCrossDisabledDic = DICTOOL->getSubDictionary_json(options, "frontCrossDisabledData");
|
|
||||||
int frontCrossDisabledType = DICTOOL->getIntValue_json(frontCrossDisabledDic, "resourceType");
|
|
||||||
switch (frontCrossDisabledType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_cd = jsonPath;
|
|
||||||
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
|
||||||
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():nullptr;
|
|
||||||
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
|
||||||
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__CheckBoxReader__
|
|
||||||
#define __TestCpp__CheckBoxReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class CheckBoxReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
CheckBoxReader();
|
|
||||||
virtual ~CheckBoxReader();
|
|
||||||
|
|
||||||
static CheckBoxReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__CheckBoxReader__) */
|
|
|
@ -1,98 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ImageViewReader.h"
|
|
||||||
#include "ui/UIImageView.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static ImageViewReader* instanceImageViewReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader)
|
|
||||||
|
|
||||||
ImageViewReader::ImageViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageViewReader::~ImageViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageViewReader* ImageViewReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceImageViewReader)
|
|
||||||
{
|
|
||||||
instanceImageViewReader = new ImageViewReader();
|
|
||||||
}
|
|
||||||
return instanceImageViewReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
ImageView* imageView = static_cast<ImageView*>(widget);
|
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
||||||
switch (imageFileNameType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_i = jsonPath;
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
const char* imageFileName_tp = nullptr;
|
|
||||||
if (imageFileName && (strcmp(imageFileName, "") != 0))
|
|
||||||
{
|
|
||||||
imageFileName_tp = tp_i.append(imageFileName).c_str();
|
|
||||||
imageView->loadTexture(imageFileName_tp);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable");
|
|
||||||
bool scale9Enable = false;
|
|
||||||
if (scale9EnableExist)
|
|
||||||
{
|
|
||||||
scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
||||||
}
|
|
||||||
imageView->setScale9Enabled(scale9Enable);
|
|
||||||
|
|
||||||
|
|
||||||
if (scale9Enable)
|
|
||||||
{
|
|
||||||
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
|
||||||
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
|
||||||
if (sw && sh)
|
|
||||||
{
|
|
||||||
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
|
||||||
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
|
||||||
imageView->setSize(Size(swf, shf));
|
|
||||||
}
|
|
||||||
|
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
||||||
|
|
||||||
imageView->setCapInsets(Rect(cx, cy, cw, ch));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__ImageViewReader__
|
|
||||||
#define __TestCpp__ImageViewReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class ImageViewReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
ImageViewReader();
|
|
||||||
virtual ~ImageViewReader();
|
|
||||||
|
|
||||||
static ImageViewReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__ImageViewReader__) */
|
|
|
@ -1,119 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "LayoutReader.h"
|
|
||||||
#include "ui/UILayout.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static LayoutReader* instanceLayoutReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader)
|
|
||||||
|
|
||||||
LayoutReader::LayoutReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutReader::~LayoutReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutReader* LayoutReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceLayoutReader)
|
|
||||||
{
|
|
||||||
instanceLayoutReader = new LayoutReader();
|
|
||||||
}
|
|
||||||
return instanceLayoutReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayoutReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
Layout* panel = static_cast<Layout*>(widget);
|
|
||||||
|
|
||||||
/* adapt screen gui */
|
|
||||||
float w = 0, h = 0;
|
|
||||||
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen");
|
|
||||||
if (adaptScrenn)
|
|
||||||
{
|
|
||||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
||||||
w = screenSize.width;
|
|
||||||
h = screenSize.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
h = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
}
|
|
||||||
panel->setSize(Size(w, h));
|
|
||||||
/**/
|
|
||||||
|
|
||||||
bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable");
|
|
||||||
panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);
|
|
||||||
int cr = DICTOOL->getIntValue_json(options, "bgColorR");
|
|
||||||
int cg = DICTOOL->getIntValue_json(options, "bgColorG");
|
|
||||||
int cb = DICTOOL->getIntValue_json(options, "bgColorB");
|
|
||||||
|
|
||||||
int scr = DICTOOL->getIntValue_json(options, "bgStartColorR");
|
|
||||||
int scg = DICTOOL->getIntValue_json(options, "bgStartColorG");
|
|
||||||
int scb = DICTOOL->getIntValue_json(options, "bgStartColorB");
|
|
||||||
|
|
||||||
int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR");
|
|
||||||
int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG");
|
|
||||||
int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB");
|
|
||||||
|
|
||||||
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
|
|
||||||
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
|
|
||||||
panel->setBackGroundColorVector(Point(bgcv1, bgcv2));
|
|
||||||
|
|
||||||
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
|
|
||||||
|
|
||||||
int colorType = DICTOOL->getIntValue_json(options, "colorType");
|
|
||||||
panel->setBackGroundColorType(LayoutBackGroundColorType(colorType));
|
|
||||||
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
|
||||||
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
|
||||||
panel->setBackGroundColorOpacity(co);
|
|
||||||
|
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "backGroundImageData");
|
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
||||||
switch (imageFileNameType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_b = jsonPath;
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
|
||||||
panel->setBackGroundImage(imageFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backGroundScale9Enable)
|
|
||||||
{
|
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
||||||
panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
|
|
||||||
}
|
|
||||||
panel->setLayoutType((LayoutType)DICTOOL->getIntValue_json(options, "layoutType"));
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__LayoutReader__
|
|
||||||
#define __TestCpp__LayoutReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class LayoutReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
LayoutReader();
|
|
||||||
virtual ~LayoutReader();
|
|
||||||
|
|
||||||
static LayoutReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__LayoutReader__) */
|
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ListViewReader.h"
|
|
||||||
#include "ui/UIListView.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static ListViewReader* instanceListViewReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader)
|
|
||||||
|
|
||||||
ListViewReader::ListViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ListViewReader::~ListViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ListViewReader* ListViewReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceListViewReader)
|
|
||||||
{
|
|
||||||
instanceListViewReader = new ListViewReader();
|
|
||||||
}
|
|
||||||
return instanceListViewReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
ScrollViewReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
ListView* listView = static_cast<ListView*>(widget);
|
|
||||||
|
|
||||||
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
|
||||||
listView->setDirection((SCROLLVIEW_DIR)direction);
|
|
||||||
|
|
||||||
ListViewGravity gravity = (ListViewGravity)DICTOOL->getIntValue_json(options, "gravity");
|
|
||||||
listView->setGravity(gravity);
|
|
||||||
|
|
||||||
float itemMargin = DICTOOL->getFloatValue_json(options, "itemMargin");
|
|
||||||
listView->setItemsMargin(itemMargin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__ListViewReader__
|
|
||||||
#define __TestCpp__ListViewReader__
|
|
||||||
|
|
||||||
#include "../ScrollViewReader/ScrollViewReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class ListViewReader : public ScrollViewReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
ListViewReader();
|
|
||||||
virtual ~ListViewReader();
|
|
||||||
|
|
||||||
static ListViewReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__ListViewReader__) */
|
|
|
@ -1,91 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "LoadingBarReader.h"
|
|
||||||
#include "ui/UILoadingBar.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static LoadingBarReader* instanceLoadingBar = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader)
|
|
||||||
|
|
||||||
LoadingBarReader::LoadingBarReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadingBarReader::~LoadingBarReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadingBarReader* LoadingBarReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceLoadingBar)
|
|
||||||
{
|
|
||||||
instanceLoadingBar = new LoadingBarReader();
|
|
||||||
}
|
|
||||||
return instanceLoadingBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadingBarReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "textureData");
|
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
||||||
switch (imageFileNameType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_i = jsonPath;
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
const char* imageFileName_tp = nullptr;
|
|
||||||
if (imageFileName && (strcmp(imageFileName, "") != 0))
|
|
||||||
{
|
|
||||||
imageFileName_tp = tp_i.append(imageFileName).c_str();
|
|
||||||
loadingBar->loadTexture(imageFileName_tp);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* gui mark add load bar scale9 parse */
|
|
||||||
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
|
||||||
loadingBar->setScale9Enabled(scale9Enable);
|
|
||||||
|
|
||||||
if (scale9Enable)
|
|
||||||
{
|
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
|
||||||
|
|
||||||
loadingBar->setCapInsets(Rect(cx, cy, cw, ch));
|
|
||||||
|
|
||||||
float width = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
float height = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
loadingBar->setSize(Size(width, height));
|
|
||||||
}
|
|
||||||
/**/
|
|
||||||
|
|
||||||
loadingBar->setDirection(LoadingBarType(DICTOOL->getIntValue_json(options, "direction")));
|
|
||||||
loadingBar->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__LoadingBarReader__
|
|
||||||
#define __TestCpp__LoadingBarReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class LoadingBarReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
LoadingBarReader();
|
|
||||||
virtual ~LoadingBarReader();
|
|
||||||
|
|
||||||
static LoadingBarReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__LoadingBarReader__) */
|
|
|
@ -1,35 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "PageViewReader.h"
|
|
||||||
#include "ui/UIPageView.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static PageViewReader* instancePageViewReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader)
|
|
||||||
|
|
||||||
PageViewReader::PageViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PageViewReader::~PageViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PageViewReader* PageViewReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instancePageViewReader)
|
|
||||||
{
|
|
||||||
instancePageViewReader = new PageViewReader();
|
|
||||||
}
|
|
||||||
return instancePageViewReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PageViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__PageViewReader__
|
|
||||||
#define __TestCpp__PageViewReader__
|
|
||||||
|
|
||||||
#include "../LayoutReader/LayoutReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class PageViewReader : public LayoutReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
PageViewReader();
|
|
||||||
virtual ~PageViewReader();
|
|
||||||
|
|
||||||
static PageViewReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(ui::Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__PageViewReader__) */
|
|
|
@ -1,47 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ScrollViewReader.h"
|
|
||||||
#include "ui/UIScrollView.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static ScrollViewReader* instanceScrollViewReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
|
||||||
|
|
||||||
ScrollViewReader::ScrollViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollViewReader::~ScrollViewReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollViewReader* ScrollViewReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceScrollViewReader)
|
|
||||||
{
|
|
||||||
instanceScrollViewReader = new ScrollViewReader();
|
|
||||||
}
|
|
||||||
return instanceScrollViewReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrollViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
|
||||||
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
|
|
||||||
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
|
|
||||||
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
|
||||||
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
|
||||||
scrollView->setDirection((SCROLLVIEW_DIR)direction);
|
|
||||||
scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, "bounceEnable"));
|
|
||||||
|
|
||||||
|
|
||||||
LayoutReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__ScrollViewReader__
|
|
||||||
#define __TestCpp__ScrollViewReader__
|
|
||||||
|
|
||||||
#include "../LayoutReader/LayoutReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class ScrollViewReader : public LayoutReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
ScrollViewReader();
|
|
||||||
virtual ~ScrollViewReader();
|
|
||||||
|
|
||||||
static ScrollViewReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__ScrollViewReader__) */
|
|
|
@ -1,192 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "SliderReader.h"
|
|
||||||
#include "ui/UISlider.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static SliderReader* instanceSliderReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)
|
|
||||||
|
|
||||||
SliderReader::SliderReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SliderReader::~SliderReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SliderReader* SliderReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceSliderReader)
|
|
||||||
{
|
|
||||||
instanceSliderReader = new SliderReader();
|
|
||||||
}
|
|
||||||
return instanceSliderReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SliderReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
Slider* slider = static_cast<Slider*>(widget);
|
|
||||||
|
|
||||||
bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "barTextureScale9Enable");
|
|
||||||
slider->setScale9Enabled(barTextureScale9Enable);
|
|
||||||
bool bt = DICTOOL->checkObjectExist_json(options, "barFileName");
|
|
||||||
float barLength = DICTOOL->getFloatValue_json(options, "length");
|
|
||||||
if (bt)
|
|
||||||
{
|
|
||||||
if (barTextureScale9Enable)
|
|
||||||
{
|
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData");
|
|
||||||
int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
||||||
switch (imageFileType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_b = jsonPath;
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
|
||||||
slider->loadBarTexture(imageFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
slider->setSize(Size(barLength, slider->getContentSize().height));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData");
|
|
||||||
int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
|
||||||
switch (imageFileType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_b = jsonPath;
|
|
||||||
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
|
||||||
slider->loadBarTexture(imageFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
|
||||||
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "ballNormalData");
|
|
||||||
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
|
||||||
switch (normalType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_n = jsonPath;
|
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
||||||
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
|
|
||||||
slider->loadSlidBallTextureNormal(normalFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
|
||||||
slider->loadSlidBallTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "ballPressedData");
|
|
||||||
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
|
||||||
switch (pressedType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_p = jsonPath;
|
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
||||||
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
|
|
||||||
slider->loadSlidBallTexturePressed(pressedFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
|
||||||
slider->loadSlidBallTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "ballDisabledData");
|
|
||||||
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
|
||||||
switch (disabledType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_d = jsonPath;
|
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
||||||
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
|
|
||||||
slider->loadSlidBallTextureDisabled(disabledFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
|
||||||
slider->loadSlidBallTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
slider->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
|
||||||
|
|
||||||
const rapidjson::Value& progressBarDic = DICTOOL->getSubDictionary_json(options, "progressBarData");
|
|
||||||
int progressBarType = DICTOOL->getIntValue_json(progressBarDic, "resourceType");
|
|
||||||
switch (progressBarType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_b = jsonPath;
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
|
||||||
slider->loadProgressBarTexture(imageFileName_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
|
||||||
slider->loadProgressBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__SliderReader__
|
|
||||||
#define __TestCpp__SliderReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class SliderReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
SliderReader();
|
|
||||||
virtual ~SliderReader();
|
|
||||||
|
|
||||||
static SliderReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__SliderReader__) */
|
|
|
@ -1,69 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "TextAtlasReader.h"
|
|
||||||
#include "ui/UITextAtlas.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static TextAtlasReader* instanceTextAtalsReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader)
|
|
||||||
|
|
||||||
TextAtlasReader::TextAtlasReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextAtlasReader::~TextAtlasReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextAtlasReader* TextAtlasReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceTextAtalsReader)
|
|
||||||
{
|
|
||||||
instanceTextAtalsReader = new TextAtlasReader();
|
|
||||||
}
|
|
||||||
return instanceTextAtalsReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextAtlasReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
|
||||||
bool sv = DICTOOL->checkObjectExist_json(options, "stringValue");
|
|
||||||
bool cmf = DICTOOL->checkObjectExist_json(options, "charMapFile");
|
|
||||||
bool iw = DICTOOL->checkObjectExist_json(options, "itemWidth");
|
|
||||||
bool ih = DICTOOL->checkObjectExist_json(options, "itemHeight");
|
|
||||||
bool scm = DICTOOL->checkObjectExist_json(options, "startCharMap");
|
|
||||||
if (sv && cmf && iw && ih && scm)
|
|
||||||
{
|
|
||||||
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "charMapFileData");
|
|
||||||
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
|
||||||
switch (cmfType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_c = jsonPath;
|
|
||||||
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
|
||||||
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
|
||||||
labelAtlas->setProperty(DICTOOL->getStringValue_json(options, "stringValue"),cmf_tp,DICTOOL->getIntValue_json(options, "itemWidth"),DICTOOL->getIntValue_json(options,"itemHeight"), DICTOOL->getStringValue_json(options, "startCharMap"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
CCLOG("Wrong res type of LabelAtlas!");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__TextAtlasReader__
|
|
||||||
#define __TestCpp__TextAtlasReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class TextAtlasReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
TextAtlasReader();
|
|
||||||
virtual ~TextAtlasReader();
|
|
||||||
|
|
||||||
static TextAtlasReader* getInstance();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__TextAtlasReader__) */
|
|
|
@ -1,65 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "TextBMFontReader.h"
|
|
||||||
#include "ui/UITextBMFont.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static TextBMFontReader* instanceTextBMFontReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader)
|
|
||||||
|
|
||||||
TextBMFontReader::TextBMFontReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextBMFontReader::~TextBMFontReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextBMFontReader* TextBMFontReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceTextBMFontReader)
|
|
||||||
{
|
|
||||||
instanceTextBMFontReader = new TextBMFontReader();
|
|
||||||
}
|
|
||||||
return instanceTextBMFontReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextBMFontReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
|
||||||
|
|
||||||
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
|
||||||
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
|
||||||
switch (cmfType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
std::string tp_c = jsonPath;
|
|
||||||
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
|
||||||
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
|
||||||
labelBMFont->setFntFile(cmf_tp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
CCLOG("Wrong res type of LabelAtlas!");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
||||||
labelBMFont->setText(text);
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__TextBMFontReader__
|
|
||||||
#define __TestCpp__TextBMFontReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class TextBMFontReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
TextBMFontReader();
|
|
||||||
virtual ~TextBMFontReader();
|
|
||||||
|
|
||||||
static TextBMFontReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__TextBMFontReader__) */
|
|
|
@ -1,84 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "TextFieldReader.h"
|
|
||||||
#include "ui/UITextField.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static TextFieldReader* instanceTextFieldReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextFieldReader)
|
|
||||||
|
|
||||||
TextFieldReader::TextFieldReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextFieldReader::~TextFieldReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextFieldReader* TextFieldReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceTextFieldReader)
|
|
||||||
{
|
|
||||||
instanceTextFieldReader = new TextFieldReader();
|
|
||||||
}
|
|
||||||
return instanceTextFieldReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextFieldReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
TextField* textField = static_cast<TextField*>(widget);
|
|
||||||
bool ph = DICTOOL->checkObjectExist_json(options, "placeHolder");
|
|
||||||
if (ph)
|
|
||||||
{
|
|
||||||
textField->setPlaceHolder(DICTOOL->getStringValue_json(options, "placeHolder"));
|
|
||||||
}
|
|
||||||
textField->setText(DICTOOL->getStringValue_json(options, "text"));
|
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
||||||
if (fs)
|
|
||||||
{
|
|
||||||
textField->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
||||||
}
|
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
||||||
if (fn)
|
|
||||||
{
|
|
||||||
textField->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
||||||
}
|
|
||||||
bool tsw = DICTOOL->checkObjectExist_json(options, "touchSizeWidth");
|
|
||||||
bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight");
|
|
||||||
if (tsw && tsh)
|
|
||||||
{
|
|
||||||
textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight")));
|
|
||||||
}
|
|
||||||
|
|
||||||
float dw = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
float dh = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
if (dw > 0.0f || dh > 0.0f)
|
|
||||||
{
|
|
||||||
//textField->setSize(Size(dw, dh));
|
|
||||||
}
|
|
||||||
bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, "maxLengthEnable");
|
|
||||||
textField->setMaxLengthEnabled(maxLengthEnable);
|
|
||||||
|
|
||||||
if (maxLengthEnable)
|
|
||||||
{
|
|
||||||
int maxLength = DICTOOL->getIntValue_json(options, "maxLength");
|
|
||||||
textField->setMaxLength(maxLength);
|
|
||||||
}
|
|
||||||
bool passwordEnable = DICTOOL->getBooleanValue_json(options, "passwordEnable");
|
|
||||||
textField->setPasswordEnabled(passwordEnable);
|
|
||||||
if (passwordEnable)
|
|
||||||
{
|
|
||||||
textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, "passwordStyleText"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__TextFieldReader__
|
|
||||||
#define __TestCpp__TextFieldReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class TextFieldReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
TextFieldReader();
|
|
||||||
virtual ~TextFieldReader();
|
|
||||||
|
|
||||||
static TextFieldReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__TextFieldReader__) */
|
|
|
@ -1,74 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "TextReader.h"
|
|
||||||
#include "ui/UIText.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
static TextReader* instanceTextReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader)
|
|
||||||
|
|
||||||
TextReader::TextReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextReader::~TextReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextReader* TextReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceTextReader)
|
|
||||||
{
|
|
||||||
instanceTextReader = new TextReader();
|
|
||||||
}
|
|
||||||
return instanceTextReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
|
||||||
|
|
||||||
|
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
|
||||||
|
|
||||||
Text* label = static_cast<Text*>(widget);
|
|
||||||
bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, "touchScaleEnable");
|
|
||||||
label->setTouchScaleChangeEnabled(touchScaleChangeAble);
|
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
|
||||||
label->setText(text);
|
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
|
||||||
if (fs)
|
|
||||||
{
|
|
||||||
label->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
|
||||||
}
|
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
|
||||||
if (fn)
|
|
||||||
{
|
|
||||||
label->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
|
||||||
}
|
|
||||||
bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth");
|
|
||||||
bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight");
|
|
||||||
if (aw && ah)
|
|
||||||
{
|
|
||||||
Size size = Size(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight"));
|
|
||||||
label->setTextAreaSize(size);
|
|
||||||
}
|
|
||||||
bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment");
|
|
||||||
if (ha)
|
|
||||||
{
|
|
||||||
label->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, "hAlignment"));
|
|
||||||
}
|
|
||||||
bool va = DICTOOL->checkObjectExist_json(options, "vAlignment");
|
|
||||||
if (va)
|
|
||||||
{
|
|
||||||
label->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, "vAlignment"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__TextReader__
|
|
||||||
#define __TestCpp__TextReader__
|
|
||||||
|
|
||||||
#include "../WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class TextReader : public WidgetReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
TextReader();
|
|
||||||
virtual ~TextReader();
|
|
||||||
|
|
||||||
static TextReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__TextReader__) */
|
|
|
@ -1,173 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
#include "WidgetReader.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
using namespace cocos2d::ui;
|
|
||||||
static WidgetReader* instanceWidgetReader = NULL;
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader)
|
|
||||||
|
|
||||||
WidgetReader::WidgetReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetReader::~WidgetReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetReader* WidgetReader::getInstance()
|
|
||||||
{
|
|
||||||
if (!instanceWidgetReader)
|
|
||||||
{
|
|
||||||
instanceWidgetReader = new WidgetReader();
|
|
||||||
}
|
|
||||||
return instanceWidgetReader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetReader::purge()
|
|
||||||
{
|
|
||||||
CC_SAFE_DELETE(instanceWidgetReader);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetReader::setPropsFromJsonDictionary(cocos2d::ui::Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, "ignoreSize");
|
|
||||||
if (ignoreSizeExsit)
|
|
||||||
{
|
|
||||||
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, "ignoreSize"));
|
|
||||||
}
|
|
||||||
|
|
||||||
widget->setSizeType((SizeType)DICTOOL->getIntValue_json(options, "sizeType"));
|
|
||||||
widget->setPositionType((PositionType)DICTOOL->getIntValue_json(options, "positionType"));
|
|
||||||
|
|
||||||
widget->setSizePercent(Point(DICTOOL->getFloatValue_json(options, "sizePercentX"), DICTOOL->getFloatValue_json(options, "sizePercentY")));
|
|
||||||
widget->setPositionPercent(Point(DICTOOL->getFloatValue_json(options, "positionPercentX"), DICTOOL->getFloatValue_json(options, "positionPercentY")));
|
|
||||||
|
|
||||||
/* adapt screen */
|
|
||||||
float w = 0, h = 0;
|
|
||||||
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen");
|
|
||||||
if (adaptScrenn)
|
|
||||||
{
|
|
||||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
|
||||||
w = screenSize.width;
|
|
||||||
h = screenSize.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
h = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
}
|
|
||||||
widget->setSize(Size(w, h));
|
|
||||||
// before
|
|
||||||
/*
|
|
||||||
float w = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
float h = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
widget->setSize(CCSizeMake(w, h));
|
|
||||||
*/
|
|
||||||
/**/
|
|
||||||
|
|
||||||
widget->setTag(DICTOOL->getIntValue_json(options, "tag"));
|
|
||||||
widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag"));
|
|
||||||
widget->setTouchEnabled(DICTOOL->getBooleanValue_json(options, "touchAble"));
|
|
||||||
const char* name = DICTOOL->getStringValue_json(options, "name");
|
|
||||||
const char* widgetName = name?name:"default";
|
|
||||||
widget->setName(widgetName);
|
|
||||||
float x = DICTOOL->getFloatValue_json(options, "x");
|
|
||||||
float y = DICTOOL->getFloatValue_json(options, "y");
|
|
||||||
widget->setPosition(Point(x,y));
|
|
||||||
bool sx = DICTOOL->checkObjectExist_json(options, "scaleX");
|
|
||||||
if (sx)
|
|
||||||
{
|
|
||||||
widget->setScaleX(DICTOOL->getFloatValue_json(options, "scaleX"));
|
|
||||||
}
|
|
||||||
bool sy = DICTOOL->checkObjectExist_json(options, "scaleY");
|
|
||||||
if (sy)
|
|
||||||
{
|
|
||||||
widget->setScaleY(DICTOOL->getFloatValue_json(options, "scaleY"));
|
|
||||||
}
|
|
||||||
bool rt = DICTOOL->checkObjectExist_json(options, "rotation");
|
|
||||||
if (rt)
|
|
||||||
{
|
|
||||||
widget->setRotation(DICTOOL->getFloatValue_json(options, "rotation"));
|
|
||||||
}
|
|
||||||
bool vb = DICTOOL->checkObjectExist_json(options, "visible");
|
|
||||||
if (vb)
|
|
||||||
{
|
|
||||||
widget->setVisible(DICTOOL->getBooleanValue_json(options, "visible"));
|
|
||||||
}
|
|
||||||
int z = DICTOOL->getIntValue_json(options, "ZOrder");
|
|
||||||
widget->setLocalZOrder(z);
|
|
||||||
|
|
||||||
bool layout = DICTOOL->checkObjectExist_json(options, "layoutParameter");
|
|
||||||
if (layout)
|
|
||||||
{
|
|
||||||
const rapidjson::Value& layoutParameterDic = DICTOOL->getSubDictionary_json(options, "layoutParameter");
|
|
||||||
int paramType = DICTOOL->getIntValue_json(layoutParameterDic, "type");
|
|
||||||
LayoutParameter* parameter = nullptr;
|
|
||||||
switch (paramType)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
parameter = LinearLayoutParameter::create();
|
|
||||||
int gravity = DICTOOL->getIntValue_json(layoutParameterDic, "gravity");
|
|
||||||
((LinearLayoutParameter*)parameter)->setGravity((LinearGravity)gravity);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
parameter = RelativeLayoutParameter::create();
|
|
||||||
RelativeLayoutParameter* rParameter = (RelativeLayoutParameter*)parameter;
|
|
||||||
const char* relativeName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeName");
|
|
||||||
rParameter->setRelativeName(relativeName);
|
|
||||||
const char* relativeToName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeToName");
|
|
||||||
rParameter->setRelativeToWidgetName(relativeToName);
|
|
||||||
int align = DICTOOL->getIntValue_json(layoutParameterDic, "align");
|
|
||||||
rParameter->setAlign((RelativeAlign)align);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (parameter)
|
|
||||||
{
|
|
||||||
float mgl = DICTOOL->getFloatValue_json(layoutParameterDic, "marginLeft");
|
|
||||||
float mgt = DICTOOL->getFloatValue_json(layoutParameterDic, "marginTop");
|
|
||||||
float mgr = DICTOOL->getFloatValue_json(layoutParameterDic, "marginRight");
|
|
||||||
float mgb = DICTOOL->getFloatValue_json(layoutParameterDic, "marginDown");
|
|
||||||
parameter->setMargin(Margin(mgl, mgt, mgr, mgb));
|
|
||||||
widget->setLayoutParameter(parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetReader::setColorPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options)
|
|
||||||
{
|
|
||||||
bool op = DICTOOL->checkObjectExist_json(options, "opacity");
|
|
||||||
if (op)
|
|
||||||
{
|
|
||||||
widget->setOpacity(DICTOOL->getIntValue_json(options, "opacity"));
|
|
||||||
}
|
|
||||||
bool cr = DICTOOL->checkObjectExist_json(options, "colorR");
|
|
||||||
bool cg = DICTOOL->checkObjectExist_json(options, "colorG");
|
|
||||||
bool cb = DICTOOL->checkObjectExist_json(options, "colorB");
|
|
||||||
int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255;
|
|
||||||
int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255;
|
|
||||||
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
|
||||||
widget->setColor(Color3B(colorR, colorG, colorB));
|
|
||||||
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
|
||||||
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
|
||||||
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
|
||||||
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
|
||||||
widget->setAnchorPoint(Point(apxf, apyf));
|
|
||||||
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
|
||||||
widget->setFlipX(flipX);
|
|
||||||
widget->setFlipY(flipY);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__WidgetReader__
|
|
||||||
#define __TestCpp__WidgetReader__
|
|
||||||
|
|
||||||
#include "WidgetReaderProtocol.h"
|
|
||||||
#include "CCSGUIReader.h"
|
|
||||||
#include "ui/GUIDefine.h"
|
|
||||||
#include "ui/UIWidget.h"
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class WidgetReader : public Object, public WidgetReaderProtocol
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS_WIDGET_READER_INFO
|
|
||||||
|
|
||||||
WidgetReader();
|
|
||||||
virtual ~WidgetReader();
|
|
||||||
|
|
||||||
static WidgetReader* getInstance();
|
|
||||||
static void purge();
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
virtual void setColorPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__WidgetReader__) */
|
|
|
@ -1,53 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2014 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
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
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TestCpp__WidgetReaderProtocol__
|
|
||||||
#define __TestCpp__WidgetReaderProtocol__
|
|
||||||
|
|
||||||
#include "cocos2d.h"
|
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
namespace ui
|
|
||||||
{
|
|
||||||
class Widget;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
USING_NS_CC;
|
|
||||||
using namespace cocos2d::ui;
|
|
||||||
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class WidgetReaderProtocol
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~WidgetReaderProtocol() {};
|
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options) = 0;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__WidgetReaderProtocol__) */
|
|
|
@ -102,6 +102,7 @@ Control::~Control()
|
||||||
|
|
||||||
void Control::sendActionsForControlEvents(EventType controlEvents)
|
void Control::sendActionsForControlEvents(EventType controlEvents)
|
||||||
{
|
{
|
||||||
|
retain();
|
||||||
// For each control events
|
// For each control events
|
||||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||||
{
|
{
|
||||||
|
@ -126,6 +127,7 @@ void Control::sendActionsForControlEvents(EventType controlEvents)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
release();
|
||||||
}
|
}
|
||||||
void Control::addTargetWithActionForControlEvents(Ref* target, Handler action, EventType controlEvents)
|
void Control::addTargetWithActionForControlEvents(Ref* target, Handler action, EventType controlEvents)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
aaa15588eceeedb1870d9326a5e367b2a47d5694
|
9f3063090daa92453372f232d777b4b625e31f98
|
|
@ -3,6 +3,9 @@ package org.cocos2dx.cpp;
|
||||||
import android.app.NativeActivity;
|
import android.app.NativeActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
// The name of .so is specified in AndroidMenifest.xml. NativityActivity will load it automatically for you.
|
||||||
|
// You can use "System.loadLibrary()" to load other .so files.
|
||||||
|
|
||||||
public class Cocos2dxActivity extends NativeActivity{
|
public class Cocos2dxActivity extends NativeActivity{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,8 +10,7 @@ LOCAL_SRC_FILES := hellolua/main.cpp \
|
||||||
../../Classes/AppDelegate.cpp
|
../../Classes/AppDelegate.cpp
|
||||||
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||||
$(LOCAL_PATH)/../../cocos2d-x/external/lua/tolua
|
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
|
LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
|
||||||
|
|
||||||
|
@ -19,4 +18,4 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos_lua_static
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
$(call import-module,bindings)
|
$(call import-module,scripting/lua-bindings)
|
|
@ -1,20 +1,10 @@
|
||||||
package org.cocos2dx.lua;
|
package org.cocos2dx.lua;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
|
|
||||||
import android.app.NativeActivity;
|
import android.app.NativeActivity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
|
||||||
import android.provider.Settings;
|
// The name of .so is specified in AndroidMenifest.xml. NativityActivity will load it automatically for you.
|
||||||
import android.util.Log;
|
// You can use "System.loadLibrary()" to load other .so files.
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class Cocos2dxActivity extends NativeActivity{
|
public class Cocos2dxActivity extends NativeActivity{
|
||||||
|
|
||||||
|
|
|
@ -503,10 +503,10 @@ public:
|
||||||
for (int i=0;i< sizeof(commands)/sizeof(Console::Command);i++) {
|
for (int i=0;i< sizeof(commands)/sizeof(Console::Command);i++) {
|
||||||
_console->addCommand(commands[i]);
|
_console->addCommand(commands[i]);
|
||||||
}
|
}
|
||||||
_console->listenOnTCP(6001);
|
_console->listenOnTCP(6010);
|
||||||
|
|
||||||
_fileserver=new FileServer();
|
_fileserver=new FileServer();
|
||||||
_fileserver->listenOnTCP(6002);
|
_fileserver->listenOnTCP(6020);
|
||||||
}
|
}
|
||||||
~ConsoleCustomCommand()
|
~ConsoleCustomCommand()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,8 +12,7 @@ LOCAL_SRC_FILES := hellolua/main.cpp \
|
||||||
../../Classes/Runtime.cpp
|
../../Classes/Runtime.cpp
|
||||||
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||||
$(LOCAL_PATH)/../../cocos2d-x/external/lua/tolua
|
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
|
LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
|
||||||
|
|
||||||
|
@ -21,4 +20,4 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos_lua_static
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
$(call import-module,bindings)
|
$(call import-module,scripting/lua-bindings)
|
|
@ -16,6 +16,9 @@ import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
// The name of .so is specified in AndroidMenifest.xml. NativityActivity will load it automatically for you.
|
||||||
|
// You can use "System.loadLibrary()" to load other .so files.
|
||||||
|
|
||||||
public class Cocos2dxActivity extends NativeActivity{
|
public class Cocos2dxActivity extends NativeActivity{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
bool g_landscape=false;
|
bool g_landscape = false;
|
||||||
CCSize g_screenSize;
|
cocos2d::Size g_screenSize;
|
||||||
GLView* g_eglView=NULL;
|
GLView* g_eglView = nullptr;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
@ -54,7 +54,7 @@ using namespace cocos2d;
|
||||||
|
|
||||||
-(void) dealloc
|
-(void) dealloc
|
||||||
{
|
{
|
||||||
CCDirector::sharedDirector()->end();
|
Director::getInstance()->end();
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ using namespace cocos2d;
|
||||||
|
|
||||||
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
|
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
|
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
[self createSimulator:[NSString stringWithUTF8String:"HelloLua"] viewWidth:960 viewHeight:640 factor:1.0];
|
[self createSimulator:[NSString stringWithUTF8String:"HelloLua"] viewWidth:960 viewHeight:640 factor:1.0];
|
||||||
int ret = Application::getInstance()->run();
|
Application::getInstance()->run();
|
||||||
|
// After run, application needs to be terminated immediately.
|
||||||
|
[NSApp terminate: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}</ProjectGuid>
|
<ProjectGuid>{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}</ProjectGuid>
|
||||||
<RootNamespace>HelloCppwin32</RootNamespace>
|
<RootNamespace>cpp-empty-test-win32</RootNamespace>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
@ -36,12 +36,12 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="..\..\..\..\cocos\2d\cocos2dx.props" />
|
<Import Project="..\..\..\cocos\2d\cocos2dx.props" />
|
||||||
<Import Project="..\..\..\..\cocos\2d\cocos2d_headers.props" />
|
<Import Project="..\..\..\cocos\2d\cocos2d_headers.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="..\..\..\..\cocos\2d\cocos2dx.props" />
|
<Import Project="..\..\..\cocos\2d\cocos2dx.props" />
|
||||||
<Import Project="..\..\..\..\cocos\2d\cocos2d_headers.props" />
|
<Import Project="..\..\..\cocos\2d\cocos2d_headers.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -133,11 +133,11 @@
|
||||||
<ClInclude Include="main.h" />
|
<ClInclude Include="main.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\..\cocos\2d\cocos2d.vcxproj">
|
<ProjectReference Include="..\..\..\cocos\2d\cocos2d.vcxproj">
|
||||||
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
||||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\..\external\chipmunk\proj.win32\chipmunk.vcxproj">
|
<ProjectReference Include="..\..\..\external\chipmunk\proj.win32\chipmunk.vcxproj">
|
||||||
<Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
|
<Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
|
@ -1,6 +1,5 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "../Classes/AppDelegate.h"
|
#include "../Classes/AppDelegate.h"
|
||||||
#include "CCEGLView.h"
|
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
|
@ -14,7 +13,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView eglView;
|
|
||||||
eglView.init("HelloCpp",900,640);
|
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,27 @@ void CustomParticleWidget::setParticlePosition(const Point &pos)
|
||||||
_emitterPostion = pos;
|
_emitterPostion = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CCPoint& CustomParticleWidget::getParticlePosition() const
|
const Point& CustomParticleWidget::getParticlePosition() const
|
||||||
{
|
{
|
||||||
return _emitterPostion;
|
return _emitterPostion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomParticleWidget::playParticle()
|
||||||
|
{
|
||||||
|
if (_emitter)
|
||||||
|
{
|
||||||
|
_emitter->resetSystem();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomParticleWidget::stopParticle()
|
||||||
|
{
|
||||||
|
if (_emitter)
|
||||||
|
{
|
||||||
|
_emitter->stopSystem();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,10 @@ public:
|
||||||
void setParticlePosition(const cocos2d::Point& pos);
|
void setParticlePosition(const cocos2d::Point& pos);
|
||||||
const cocos2d::Point& getParticlePosition() const;
|
const cocos2d::Point& getParticlePosition() const;
|
||||||
|
|
||||||
|
void playParticle();
|
||||||
|
|
||||||
|
void stopParticle();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
virtual void initRenderer();
|
virtual void initRenderer();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "CustomParticleWidgetReader.h"
|
#include "CustomParticleWidgetReader.h"
|
||||||
#include "CustomParticleWidget.h"
|
#include "CustomParticleWidget.h"
|
||||||
|
#include "cocostudio/CCSGUIReader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
|
@ -39,13 +40,16 @@ void CustomParticleWidgetReader::setProperties(const std::string& classType,
|
||||||
Widget *widget,
|
Widget *widget,
|
||||||
const rapidjson::Value &customOptions)
|
const rapidjson::Value &customOptions)
|
||||||
{
|
{
|
||||||
|
GUIReader* guiReader = GUIReader::getInstance();
|
||||||
|
|
||||||
CustomParticleWidget* custom = static_cast<CustomParticleWidget*>(widget);
|
CustomParticleWidget* custom = static_cast<CustomParticleWidget*>(widget);
|
||||||
|
|
||||||
bool isExistParticlePlist = DICTOOL->checkObjectExist_json(customOptions, "ParticlePlist");
|
bool isExistPlistFile = DICTOOL->checkObjectExist_json(customOptions, "PlistFile");
|
||||||
if (isExistParticlePlist)
|
if (isExistPlistFile)
|
||||||
{
|
{
|
||||||
const char* ParticlePlist = DICTOOL->getStringValue_json(customOptions, "ParticlePlist");
|
const char* PlistFile = DICTOOL->getStringValue_json(customOptions, "PlistFile");
|
||||||
custom->setParticlePlist(ParticlePlist);
|
std::string PlistFilePath = guiReader->getFilePath();
|
||||||
|
PlistFilePath.append(PlistFile);
|
||||||
|
custom->setParticlePlist(PlistFilePath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,13 +176,18 @@ void UIListViewTest_Vertical::selectedItemEvent(Ref *pSender, ListViewEventType
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case LISTVIEW_ONSELECTEDITEM:
|
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_START:
|
||||||
{
|
{
|
||||||
ListView* listView = static_cast<ListView*>(pSender);
|
ListView* listView = static_cast<ListView*>(pSender);
|
||||||
CCLOG("select child index = %ld", listView->getCurSelectedIndex());
|
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_END:
|
||||||
|
{
|
||||||
|
ListView* listView = static_cast<ListView*>(pSender);
|
||||||
|
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,13 +359,18 @@ void UIListViewTest_Horizontal::selectedItemEvent(Ref *pSender, ListViewEventTyp
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case LISTVIEW_ONSELECTEDITEM:
|
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_START:
|
||||||
{
|
{
|
||||||
ListView* listView = static_cast<ListView*>(pSender);
|
ListView* listView = static_cast<ListView*>(pSender);
|
||||||
CCLOG("select child index = %ld", listView->getCurSelectedIndex());
|
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_END:
|
||||||
|
{
|
||||||
|
ListView* listView = static_cast<ListView*>(pSender);
|
||||||
|
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ TestCocosNodeDemo::~TestCocosNodeDemo(void)
|
||||||
|
|
||||||
std::string TestCocosNodeDemo::title() const
|
std::string TestCocosNodeDemo::title() const
|
||||||
{
|
{
|
||||||
return "No title";
|
return "Node Test";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TestCocosNodeDemo::subtitle() const
|
std::string TestCocosNodeDemo::subtitle() const
|
||||||
|
@ -352,6 +352,7 @@ std::string Test6::subtitle() const
|
||||||
return "remove/cleanup with children";
|
return "remove/cleanup with children";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// StressTest1
|
// StressTest1
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue