Merge pull request #7434 from samuele3hu/v3_hot_fix

Fix the crash that CocoStudioGuiTest in the Linux platform and error display than Sprite3DTest
This commit is contained in:
minggo 2014-07-14 16:26:42 +08:00
commit 7f68bdf179
4 changed files with 148 additions and 77 deletions

View File

@ -6510,6 +6510,73 @@ static void extendFastTMXLayer(lua_State* tolua_S)
lua_pop(tolua_S, 1); lua_pop(tolua_S, 1);
} }
static int lua_cocos2dx_TextureCache_addImageAsync(lua_State* tolua_S)
{
if (nullptr == tolua_S)
return 0 ;
int argc = 0;
TextureCache* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"cc.TextureCache",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextureCache*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_TextureCache_addImageAsync'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
if (2 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_isstring(tolua_S, 2, 0, &tolua_err) ||
!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
const char* configFilePath = tolua_tostring(tolua_S, 2, "");
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S, 3, 0));
self->addImageAsync(configFilePath, [=](Texture2D* tex){
int ID = (tex) ? (int)tex->_ID : -1;
int* luaID = (tex) ? &tex->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)tex, "cc.Texture2D");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler,1);
LuaEngine::getInstance()->removeScriptHandler(handler);
});
return 0;
}
CCLOG("'addImageAsync' function of TextureCache has wrong number of arguments: %d, was expecting %d\n", argc, 1);
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'addImageAsync'.",&tolua_err);
return 0;
#endif
}
static void extendTextureCache(lua_State* tolua_S)
{
lua_pushstring(tolua_S, "cc.TextureCache");
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
tolua_function(tolua_S, "addImageAsync", lua_cocos2dx_TextureCache_addImageAsync);
}
lua_pop(tolua_S, 1);
}
int register_all_cocos2dx_manual(lua_State* tolua_S) int register_all_cocos2dx_manual(lua_State* tolua_S)
{ {
if (NULL == tolua_S) if (NULL == tolua_S)
@ -6564,6 +6631,7 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
extendEventListenerFocus(tolua_S); extendEventListenerFocus(tolua_S);
extendApplication(tolua_S); extendApplication(tolua_S);
extendFastTMXLayer(tolua_S); extendFastTMXLayer(tolua_S);
extendTextureCache(tolua_S);
return 0; return 0;
} }

View File

@ -1,5 +1,6 @@
local guiSceneManager = {} local guiSceneManager = {}
guiSceneManager.currentUISceneIdx = 1 guiSceneManager.currentUISceneIdx = 1
local font_TextName = "fonts/Marker Felt.ttf"
local UIScene = class("UIScene") local UIScene = class("UIScene")
UIScene.__index = UIScene UIScene.__index = UIScene
@ -106,7 +107,7 @@ function UIButtonTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -114,7 +115,7 @@ function UIButtonTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Button") alert:setString("Button")
alert:setFontName(font_UIButtonTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
@ -170,7 +171,7 @@ function UIButtonScale9Test:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -178,7 +179,7 @@ function UIButtonScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Button scale9 render") alert:setString("Button scale9 render")
alert:setFontName(font_UIButtonTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -236,7 +237,7 @@ function UIButtonPressedActionTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -244,7 +245,7 @@ function UIButtonPressedActionTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Button Pressed Action") alert:setString("Button Pressed Action")
alert:setFontName(font_UIButtonTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -301,7 +302,7 @@ function UITextButtonTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -309,7 +310,7 @@ function UITextButtonTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextButton") alert:setString("TextButton")
alert:setFontName(font_UIButtonTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -365,7 +366,7 @@ function UITextButtonScale9Test:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -373,7 +374,7 @@ function UITextButtonScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextButton scale9 render") alert:setString("TextButton scale9 render")
alert:setFontName(font_UIButtonTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -431,7 +432,7 @@ function UICheckBoxTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIButtonTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -439,7 +440,7 @@ function UICheckBoxTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("CheckBox") alert:setString("CheckBox")
alert:setFontName(font_UICheckBoxTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -496,7 +497,7 @@ function UISliderTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move the slider thumb") self._displayValueLabel:setString("Move the slider thumb")
self._displayValueLabel:setFontName(font_UISliderTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -504,7 +505,7 @@ function UISliderTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Slider") alert:setString("Slider")
alert:setFontName(font_UISliderTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -558,7 +559,7 @@ function UISliderScale9Test:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move the slider thumb") self._displayValueLabel:setString("Move the slider thumb")
self._displayValueLabel:setFontName(font_UISliderTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -566,7 +567,7 @@ function UISliderScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Slider scale9 render") alert:setString("Slider scale9 render")
alert:setFontName(font_UISliderTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -622,7 +623,7 @@ function UIImageViewTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ImageView") alert:setString("ImageView")
alert:setFontName(font_UIImageViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -663,7 +664,7 @@ function UIImageViewScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ImageView scale9 render") alert:setString("ImageView scale9 render")
alert:setFontName(font_UIImageViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -716,7 +717,7 @@ function UILoadingBarLeftTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LoadingBar") alert:setString("LoadingBar")
alert:setFontName(font_UILoadingBarTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -842,7 +843,7 @@ function UILoadingBarRightTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LoadingBar") alert:setString("LoadingBar")
alert:setFontName(font_UILoadingBarTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -969,7 +970,7 @@ function UILoadingBarLeftScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LoadingBar Scale9 Render") alert:setString("LoadingBar Scale9 Render")
alert:setFontName(font_UILoadingBarTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1098,7 +1099,7 @@ function UILoadingBarRightScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LoadingBar Scale9 Render") alert:setString("LoadingBar Scale9 Render")
alert:setFontName(font_UILoadingBarTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1216,7 +1217,7 @@ function UILabelAtlasTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LabelAtlas") alert:setString("LabelAtlas")
alert:setFontName(font_UILabelAtlasTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1257,7 +1258,7 @@ function UILabelBMFontTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("LabelBMFont") alert:setString("LabelBMFont")
alert:setFontName(font_UILabelBMFontTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1299,7 +1300,7 @@ function UILabelTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Label") alert:setString("Label")
alert:setFontName(font_UILabelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1340,7 +1341,7 @@ function UITextAreaTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextArea") alert:setString("TextArea")
alert:setFontName(font_UITextAreaTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1384,7 +1385,7 @@ function UITextFieldTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UITextFieldTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -1392,7 +1393,7 @@ function UITextFieldTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextField") alert:setString("TextField")
alert:setFontName(font_UITextFieldTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1418,7 +1419,7 @@ function UITextFieldTest:initExtend()
local textField = ccui.TextField:create() local textField = ccui.TextField:create()
textField:setTouchEnabled(true) textField:setTouchEnabled(true)
textField:setFontName(font_UITextFieldTest) textField:setFontName(font_TextName)
textField:setFontSize(30) textField:setFontSize(30)
textField:setPlaceHolder("input words here") textField:setPlaceHolder("input words here")
textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -1454,7 +1455,7 @@ function UITextFieldMaxLengthTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UITextFieldTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -1462,7 +1463,7 @@ function UITextFieldMaxLengthTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextField max length") alert:setString("TextField max length")
alert:setFontName(font_UITextFieldTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1496,7 +1497,7 @@ function UITextFieldMaxLengthTest:initExtend()
textField:setMaxLengthEnabled(true) textField:setMaxLengthEnabled(true)
textField:setMaxLength(3) textField:setMaxLength(3)
textField:setTouchEnabled(true) textField:setTouchEnabled(true)
textField:setFontName(font_UITextFieldTest) textField:setFontName(font_TextName)
textField:setFontSize(30) textField:setFontSize(30)
textField:setPlaceHolder("input words here") textField:setPlaceHolder("input words here")
textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -1532,7 +1533,7 @@ function UITextFieldPasswordTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UITextFieldTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -1540,7 +1541,7 @@ function UITextFieldPasswordTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("TextField password") alert:setString("TextField password")
alert:setFontName(font_UITextFieldTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1568,7 +1569,7 @@ function UITextFieldPasswordTest:initExtend()
textField:setPasswordEnabled(true) textField:setPasswordEnabled(true)
textField:setPasswordStyleText("*") textField:setPasswordStyleText("*")
textField:setTouchEnabled(true) textField:setTouchEnabled(true)
textField:setFontName(font_UITextFieldTest) textField:setFontName(font_TextName)
textField:setFontSize(30) textField:setFontSize(30)
textField:setPlaceHolder("input password here") textField:setPlaceHolder("input password here")
textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)) textField:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0))
@ -1604,7 +1605,7 @@ function UIPanelTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel") alert:setString("Panel")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -1672,7 +1673,7 @@ function UIPanelColorTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel color render") alert:setString("Panel color render")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -1742,7 +1743,7 @@ function UIPanelGradientTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel color Gradient") alert:setString("Panel color Gradient")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -1812,7 +1813,7 @@ function UIPanelBackGroundImageTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel background image") alert:setString("Panel background image")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -1882,7 +1883,7 @@ function UIPanelBackGroundImageScale9Test:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel background image scale9") alert:setString("Panel background image scale9")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -1952,7 +1953,7 @@ function UIPanelLayoutLinearVerticalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel Layout Linear Vertical") alert:setString("Panel Layout Linear Vertical")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2035,7 +2036,7 @@ function UIPanelLayoutLinearHorizontalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("Panel Layout Linear Horizontal") alert:setString("Panel Layout Linear Horizontal")
alert:setFontName(font_UIPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2120,7 +2121,7 @@ function UIScrollViewVerticalTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move by vertical direction") self._displayValueLabel:setString("Move by vertical direction")
self._displayValueLabel:setFontName(font_UIScrollViewTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2128,7 +2129,7 @@ function UIScrollViewVerticalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ScrollView") alert:setString("ScrollView")
alert:setFontName(font_UIScrollViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2209,7 +2210,7 @@ function UIScrollViewHorizontalTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move by horizontal direction") self._displayValueLabel:setString("Move by horizontal direction")
self._displayValueLabel:setFontName(font_UIScrollViewTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2217,7 +2218,7 @@ function UIScrollViewHorizontalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ScrollView") alert:setString("ScrollView")
alert:setFontName(font_UIScrollViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2305,7 +2306,7 @@ function UIPageViewTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move by horizontal direction") self._displayValueLabel:setString("Move by horizontal direction")
self._displayValueLabel:setFontName(font_UIPageViewTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2313,7 +2314,7 @@ function UIPageViewTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("PageView") alert:setString("PageView")
alert:setFontName(font_UIPageViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2346,7 +2347,7 @@ function UIPageViewTest:initExtend()
local label = ccui.Text:create() local label = ccui.Text:create()
local pageInfo = string.format("page %d", i) local pageInfo = string.format("page %d", i)
label:setString(pageInfo) label:setString(pageInfo)
label:setFontName(font_UIPageViewTest) label:setFontName(font_TextName)
label:setFontSize(30) label:setFontSize(30)
label:setColor(cc.c3b(192, 192, 192)) label:setColor(cc.c3b(192, 192, 192))
label:setPosition(cc.p(layout:getContentSize().width / 2, layout:getContentSize().height / 2)) label:setPosition(cc.p(layout:getContentSize().width / 2, layout:getContentSize().height / 2))
@ -2399,7 +2400,7 @@ function UIListViewVerticalTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move by vertical direction") self._displayValueLabel:setString("Move by vertical direction")
self._displayValueLabel:setFontName(font_UIListViewTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2407,7 +2408,7 @@ function UIListViewVerticalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ListView") alert:setString("ListView")
alert:setFontName(font_UIListViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2567,7 +2568,7 @@ function UIListViewHorizontalTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("Move by vertical direction") self._displayValueLabel:setString("Move by vertical direction")
self._displayValueLabel:setFontName(font_UIListViewTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2575,7 +2576,7 @@ function UIListViewHorizontalTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("ListView") alert:setString("ListView")
alert:setFontName(font_UIListViewTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2723,7 +2724,7 @@ function UIDragPanelTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIDragPanelTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2731,7 +2732,7 @@ function UIDragPanelTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("DragPanel") alert:setString("DragPanel")
alert:setFontName(font_UIDragPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2782,7 +2783,7 @@ function UIDragPanelBounceTest:initExtend()
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("No Event") self._displayValueLabel:setString("No Event")
self._displayValueLabel:setFontName(font_UIDragPanelTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2791,7 +2792,7 @@ function UIDragPanelBounceTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("DragPanel Bounce") alert:setString("DragPanel Bounce")
alert:setFontName(font_UIDragPanelTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 2.925))
@ -2839,10 +2840,10 @@ function UINodeContainerTest:initExtend()
self:init() self:init()
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
print("setFontName before")
self._displayValueLabel = ccui.Text:create() self._displayValueLabel = ccui.Text:create()
self._displayValueLabel:setString("NodeContainer Add CCNode") self._displayValueLabel:setString("NodeContainer Add CCNode")
self._displayValueLabel:setFontName(font_UINodeContainerTest) self._displayValueLabel:setFontName(font_TextName)
self._displayValueLabel:setFontSize(32) self._displayValueLabel:setFontSize(32)
self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1))
self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5)) self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.5))
@ -2850,7 +2851,7 @@ function UINodeContainerTest:initExtend()
local alert = ccui.Text:create() local alert = ccui.Text:create()
alert:setString("NodeContainer") alert:setString("NodeContainer")
alert:setFontName(font_UINodeContainerTest) alert:setFontName(font_TextName)
alert:setFontSize(30) alert:setFontSize(30)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 1.75))
@ -2892,7 +2893,7 @@ function UIRichTextTest:initExtend()
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create("RichText", "fonts/Marker Felt.ttf", 30) local alert = ccui.Text:create("RichText", "fonts/Marker Felt.ttf", 30)
alert:setFontName(font_UINodeContainerTest) alert:setFontName(font_TextName)
alert:setColor(cc.c3b(159, 168, 176)) alert:setColor(cc.c3b(159, 168, 176))
alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 3.125)) alert:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 - alert:getContentSize().height * 3.125))
self._widget:addChild(alert) self._widget:addChild(alert)

View File

@ -79,18 +79,27 @@ function Sprite3DWithSkinTest.addNewSpriteWithCoords(parent,x,y)
sprite:setPosition(cc.p(x, y)) sprite:setPosition(cc.p(x, y))
parent:addChild(sprite) parent:addChild(sprite)
local animation = cc.Animation3D:getOrCreate("Sprite3DTest/orc.c3b") local animation = cc.Animation3D:create("Sprite3DTest/orc.c3b")
if nil ~= animation then if nil ~= animation then
local animate = cc.Animate3D:create(animation) local animate = cc.Animate3D:create(animation)
if math.random() < (1/3) then local inverse = false
animate:setPlayBack(true) if math.random() == 0 then
inverse = true
end end
local rand2 = math.random() local rand2 = math.random()
local speed = 1.0
if rand2 < 1/3 then if rand2 < 1/3 then
animate:setSpeed(animate:getSpeed() + math.random()) speed = animate:getSpeed() + math.random()
elseif rand2 < 2/3 then elseif rand2 < 2/3 then
animate:setSpeed(animate:getSpeed() - 0.5 * math.random()) speed = animate:getSpeed() - 0.5 * math.random()
end
if inverse then
animate:setSpeed(-speed)
else
animate:setSpeed(speed)
end end
sprite:runAction(cc.RepeatForever:create(animate)) sprite:runAction(cc.RepeatForever:create(animate))
@ -226,7 +235,7 @@ function Animate3DTest:addSprite3D()
self._sprite = sprite self._sprite = sprite
local animation = cc.Animation3D:getOrCreate(fileName) local animation = cc.Animation3D:create(fileName)
if nil ~= animation then if nil ~= animation then
local animate = cc.Animate3D:create(animation, 0.0, 1.933) local animate = cc.Animate3D:create(animation, 0.0, 1.933)
sprite:runAction(cc.RepeatForever:create(animate)) sprite:runAction(cc.RepeatForever:create(animate))

View File

@ -969,23 +969,16 @@ local function TextureAsync()
local seq = cc.Sequence:create(scale, scale_back) local seq = cc.Sequence:create(scale, scale_back)
label:runAction(cc.RepeatForever:create(seq)) label:runAction(cc.RepeatForever:create(seq))
local function imageLoaded(pObj) local function imageLoaded(texture)
local tex = pObj
local director = cc.Director:getInstance() local director = cc.Director:getInstance()
--cc.ASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread") local sprite = cc.Sprite:createWithTexture(texture)
-- IMPORTANT: The order on the callback is not guaranteed. Don't depend on the callback
-- This test just creates a sprite based on the Texture
local sprite = cc.Sprite:createWithTexture(tex)
sprite:setAnchorPoint(cc.p(0,0)) sprite:setAnchorPoint(cc.p(0,0))
ret:addChild(sprite, -1) ret:addChild(sprite, -1)
local size = director:getWinSize() local size = director:getWinSize()
local i = m_nImageOffset * 32 local i = m_nImageOffset * 32
sprite:setPosition(cc.p( i % size.width, (i / size.width) * 32 )) sprite:setPosition(cc.p( i % size.width, math.floor((i / size.width)) * 32 ))
m_nImageOffset = m_nImageOffset + 1 m_nImageOffset = m_nImageOffset + 1
cclog("Image loaded:...")-- %p", tex) cclog("Image loaded:...")-- %p", tex)