背景和头像缺失
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#include "UITextBMFontTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocos2d::ui;
|
||||
|
||||
UITextBMFontTests::UITextBMFontTests()
|
||||
{
|
||||
ADD_TEST_CASE(UITextBMFontTest);
|
||||
}
|
||||
// UITextBMFontTest
|
||||
|
||||
bool UITextBMFontTest::init()
|
||||
{
|
||||
if (UIScene::init())
|
||||
{
|
||||
Size widgetSize = _widget->getContentSize();
|
||||
|
||||
Text* alert = Text::create("TextBMFont","TextBMFont",30);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
|
||||
_uiLayer->addChild(alert);
|
||||
|
||||
// Create the TextBMFont
|
||||
TextBMFont* textBMFont = TextBMFont::create("BMFont", "cocosui/bitmapFontTest2.fnt");
|
||||
textBMFont->setPosition(Vec2(widgetSize.width / 2, widgetSize.height / 2.0f + textBMFont->getContentSize().height / 8.0f));
|
||||
_uiLayer->addChild(textBMFont);
|
||||
|
||||
_textBMFont = textBMFont;
|
||||
|
||||
TTFConfig ttfConfig("fonts/arial.ttf", 15);
|
||||
auto label1 = Label::createWithTTF(ttfConfig, "Print Resources");
|
||||
auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UITextBMFontTest::printWidgetResources, this));
|
||||
item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3));
|
||||
auto pMenu1 = Menu::create(item1, nullptr);
|
||||
pMenu1->setPosition(Vec2(0, 0));
|
||||
this->addChild(pMenu1, 10);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void UITextBMFontTest::printWidgetResources(cocos2d::Ref* sender)
|
||||
{
|
||||
cocos2d::ResourceData textureFile = _textBMFont->getRenderFile();
|
||||
CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2013 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__UITextBMFontTest__
|
||||
#define __TestCpp__UITextBMFontTest__
|
||||
|
||||
#include "../UIScene.h"
|
||||
|
||||
DEFINE_TEST_SUITE(UITextBMFontTests);
|
||||
|
||||
class UITextBMFontTest : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UITextBMFontTest)
|
||||
|
||||
virtual bool init() override;
|
||||
void printWidgetResources(cocos2d::Ref* sender);
|
||||
protected:
|
||||
cocos2d::ui::TextBMFont* _textBMFont;
|
||||
};
|
||||
|
||||
#endif /* defined(__TestCpp__UITextBMFontTest__) */
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "UITextBMFontTest_Editor.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocos2d::ui;
|
||||
|
||||
UITextBMFontEditorTest::UITextBMFontEditorTest()
|
||||
{
|
||||
ADD_TEST_CASE(UITextBMFontTest_Editor);
|
||||
}
|
||||
|
||||
// UITextBMFontTest_Editor
|
||||
|
||||
bool UITextBMFontTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
Node* node = CSLoader::createNode("cocosui/UIEditorTest/UILabelBMFont/res.csb");
|
||||
Node* child = node->getChildByTag(5);
|
||||
child->removeFromParent();
|
||||
_layout = static_cast<Layout*>(child);
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
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__UITextBMFontTest_Editor__
|
||||
#define __TestCpp__UITextBMFontTest_Editor__
|
||||
|
||||
#include "../UIScene_Editor.h"
|
||||
|
||||
DEFINE_TEST_SUITE(UITextBMFontEditorTest);
|
||||
class UITextBMFontTest_Editor : public UIScene_Editor
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UITextBMFontTest_Editor);
|
||||
|
||||
virtual bool init() override;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
#endif /* defined(__TestCpp__UITextBMFontTest_Editor__) */
|
||||
Reference in New Issue
Block a user