mirror of https://github.com/axmolengine/axmol.git
Remove the old implementation of LabelBMFont.
This commit is contained in:
parent
2bf256db0a
commit
fd5a4acddb
|
@ -12,7 +12,7 @@ namespace cocosbuilder {
|
|||
|
||||
void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((LabelBMFont *)pNode)->setColor(pColor3B);
|
||||
((Label *)pNode)->setColor(pColor3B);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, con
|
|||
|
||||
void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((LabelBMFont *)pNode)->setOpacity(pByte);
|
||||
((Label *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const
|
|||
|
||||
void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
|
||||
((LabelBMFont *)pNode)->setBlendFunc(pBlendFunc);
|
||||
((Label *)pNode)->setBlendFunc(pBlendFunc);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent,
|
|||
|
||||
void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
|
||||
((LabelBMFont *)pNode)->setFntFile(pFntFile);
|
||||
((Label *)pNode)->setBMFontFilePath(pFntFile);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, ccbReader);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, co
|
|||
|
||||
void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
|
||||
((LabelBMFont *)pNode)->setString(pText);
|
||||
((Label *)pNode)->setString(pText);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _CCB_CCLABELBMFONTLOADER_H_
|
||||
|
||||
#include "CCRef.h"
|
||||
#include "CCLabelBMFont.h"
|
||||
#include "CCLabel.h"
|
||||
|
||||
#include "CCNodeLoader.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LabelBMFontLoader, loader);
|
||||
|
||||
protected:
|
||||
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::LabelBMFont);
|
||||
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Label);
|
||||
|
||||
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Color3B pColor3B, CCBReader * ccbReader);
|
||||
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
|
||||
|
|
|
@ -59,7 +59,7 @@ TextBMFont* TextBMFont::create()
|
|||
|
||||
void TextBMFont::initRenderer()
|
||||
{
|
||||
_labelBMFontRenderer = cocos2d::LabelBMFont::create();
|
||||
_labelBMFontRenderer = cocos2d::Label::create();
|
||||
addProtectedChild(_labelBMFontRenderer, LABELBMFONT_RENDERER_Z, -1);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ void TextBMFont::setFntFile(const char *fileName)
|
|||
return;
|
||||
}
|
||||
_fntFileName = fileName;
|
||||
_labelBMFontRenderer->initWithString("", fileName);
|
||||
_labelBMFontRenderer->setBMFontFilePath(fileName);
|
||||
updateAnchorPoint();
|
||||
labelBMFontScaleChangedWithSize();
|
||||
_fntFileHasInit = true;
|
||||
|
|
|
@ -81,7 +81,7 @@ protected:
|
|||
virtual Widget* createCloneInstance() override;
|
||||
virtual void copySpecialProperties(Widget* model) override;
|
||||
protected:
|
||||
cocos2d::LabelBMFont* _labelBMFontRenderer;
|
||||
cocos2d::Label* _labelBMFontRenderer;
|
||||
bool _fntFileHasInit;
|
||||
std::string _fntFileName;
|
||||
std::string _stringValue;
|
||||
|
|
|
@ -90,14 +90,14 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* b
|
|||
|
||||
// Set the default anchor point
|
||||
ignoreAnchorPointForPosition(false);
|
||||
setAnchorPoint(Point(0.5f, 0.5f));
|
||||
setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
|
||||
// Set the nodes
|
||||
setTitleLabel(node);
|
||||
setBackgroundSprite(backgroundSprite);
|
||||
|
||||
// Set the default color and opacity
|
||||
setColor(Color3B(255.0f, 255.0f, 255.0f));
|
||||
setColor(Color3B::WHITE);
|
||||
setOpacity(255.0f);
|
||||
setOpacityModifyRGB(true);
|
||||
|
||||
|
@ -108,7 +108,7 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* b
|
|||
setTitleLabelForState(node, Control::State::NORMAL);
|
||||
setBackgroundSpriteForState(backgroundSprite, Control::State::NORMAL);
|
||||
|
||||
setLabelAnchorPoint(Point(0.5f, 0.5f));
|
||||
setLabelAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
|
||||
// Layout update
|
||||
needsLayout();
|
||||
|
@ -409,16 +409,16 @@ float ControlButton::getTitleTTFSizeForState(State state)
|
|||
void ControlButton::setTitleBMFontForState(const std::string& fntFile, State state)
|
||||
{
|
||||
std::string title = this->getTitleForState(state);
|
||||
this->setTitleLabelForState(LabelBMFont::create(title, fntFile), state);
|
||||
this->setTitleLabelForState(Label::createWithBMFont(fntFile, title), state);
|
||||
}
|
||||
|
||||
const std::string& ControlButton::getTitleBMFontForState(State state)
|
||||
{
|
||||
LabelProtocol* label = dynamic_cast<LabelProtocol*>(this->getTitleLabelForState(state));
|
||||
LabelBMFont* labelBMFont = dynamic_cast<LabelBMFont*>(label);
|
||||
auto labelBMFont = dynamic_cast<Label*>(label);
|
||||
if(labelBMFont != 0)
|
||||
{
|
||||
return labelBMFont->getFntFile();
|
||||
return labelBMFont->getBMFontFilePath();
|
||||
}
|
||||
|
||||
static std::string ret("");
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
virtual float getTitleTTFSizeForState(State state);
|
||||
|
||||
/**
|
||||
* Sets the font of the label, changes the label to a LabelBMFont if neccessary.
|
||||
* Sets the font of the label, changes the label to a BMFont if neccessary.
|
||||
* @param fntFile The name of the font to change to
|
||||
* @param state The state that uses the specified fntFile. The values are described
|
||||
* in "CCControlState".
|
||||
|
|
|
@ -24,7 +24,7 @@ Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, c
|
|||
}
|
||||
|
||||
bool ButtonTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) {
|
||||
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", LabelBMFont *, this->mControlEventLabel);
|
||||
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", Label *, this->mControlEventLabel);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void onControlButtonClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
||||
|
||||
private:
|
||||
cocos2d::LabelBMFont * mControlEventLabel;
|
||||
cocos2d::Label * mControlEventLabel;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -5,7 +5,7 @@ USING_NS_CC_EXT;
|
|||
using namespace cocosbuilder;
|
||||
|
||||
MenuTestLayer::MenuTestLayer()
|
||||
: mMenuItemStatusLabelBMFont(NULL)
|
||||
: mMenuItemStatusLabelBMFont(nullptr)
|
||||
{}
|
||||
|
||||
MenuTestLayer::~MenuTestLayer()
|
||||
|
@ -18,15 +18,15 @@ SEL_MenuHandler MenuTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, con
|
|||
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onMenuItemBClicked", MenuTestLayer::onMenuItemBClicked);
|
||||
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onMenuItemCClicked", MenuTestLayer::onMenuItemCClicked);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Control::Handler MenuTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool MenuTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) {
|
||||
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mMenuItemStatusLabelBMFont", LabelBMFont *, this->mMenuItemStatusLabelBMFont);
|
||||
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mMenuItemStatusLabelBMFont", Label *, this->mMenuItemStatusLabelBMFont);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class MenuTestLayer
|
|||
void onMenuItemCClicked(cocos2d::Ref * sender);
|
||||
|
||||
private:
|
||||
cocos2d::LabelBMFont * mMenuItemStatusLabelBMFont;
|
||||
cocos2d::Label * mMenuItemStatusLabelBMFont;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -24,11 +24,11 @@ IntervalLayer::IntervalLayer()
|
|||
this->addChild(sun);
|
||||
|
||||
// timers
|
||||
_label0 = LabelBMFont::create("0", "fonts/bitmapFontTest4.fnt");
|
||||
_label1 = LabelBMFont::create("0", "fonts/bitmapFontTest4.fnt");
|
||||
_label2 = LabelBMFont::create("0", "fonts/bitmapFontTest4.fnt");
|
||||
_label3 = LabelBMFont::create("0", "fonts/bitmapFontTest4.fnt");
|
||||
_label4 = LabelBMFont::create("0", "fonts/bitmapFontTest4.fnt");
|
||||
_label0 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
|
||||
_label1 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
|
||||
_label2 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
|
||||
_label3 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
|
||||
_label4 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
|
||||
|
||||
scheduleUpdate();
|
||||
schedule(schedule_selector(IntervalLayer::step1));
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
class IntervalLayer : public Layer
|
||||
{
|
||||
protected:
|
||||
LabelBMFont* _label0;
|
||||
LabelBMFont* _label1;
|
||||
LabelBMFont* _label2;
|
||||
LabelBMFont* _label3;
|
||||
LabelBMFont* _label4;
|
||||
Label* _label0;
|
||||
Label* _label1;
|
||||
Label* _label2;
|
||||
Label* _label3;
|
||||
Label* _label4;
|
||||
|
||||
float _time0, _time1, _time2, _time3, _time4;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void LayerTestCascadingOpacityA::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
@ -186,7 +186,7 @@ void LayerTestCascadingOpacityB::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
@ -239,7 +239,7 @@ void LayerTestCascadingOpacityC::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
@ -287,7 +287,7 @@ void LayerTestCascadingColorA::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
@ -340,7 +340,7 @@ void LayerTestCascadingColorB::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
@ -392,7 +392,7 @@ void LayerTestCascadingColorC::onEnter()
|
|||
|
||||
auto sister1 = Sprite::create("Images/grossinis_sister1.png");
|
||||
auto sister2 = Sprite::create("Images/grossinis_sister2.png");
|
||||
auto label = LabelBMFont::create("Test", "fonts/bitmapFontTest.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Test");
|
||||
|
||||
layer1->addChild(sister1);
|
||||
layer1->addChild(sister2);
|
||||
|
|
|
@ -84,7 +84,7 @@ MenuLayerMainMenu::MenuLayerMainMenu()
|
|||
item4->setFontName("fonts/Marker Felt.ttf");
|
||||
|
||||
// Label Item (LabelBMFont)
|
||||
auto label = LabelBMFont::create("configuration", "fonts/bitmapFontTest3.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "configuration");
|
||||
auto item5 = MenuItemLabel::create(label, CC_CALLBACK_1(MenuLayerMainMenu::menuCallbackConfig, this));
|
||||
|
||||
// Testing issue #500
|
||||
|
@ -323,7 +323,7 @@ MenuLayer3::MenuLayer3()
|
|||
MenuItemFont::setFontName("fonts/Marker Felt.ttf");
|
||||
MenuItemFont::setFontSize(28);
|
||||
|
||||
auto label = LabelBMFont::create("Enable AtlasItem", "fonts/bitmapFontTest3.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "Enable AtlasItem");
|
||||
auto item1 = MenuItemLabel::create(label, [&](Ref *sender) {
|
||||
//CCLOG("Label clicked. Toogling AtlasSprite");
|
||||
_disabledItem->setEnabled( ! _disabledItem->isEnabled() );
|
||||
|
@ -435,7 +435,7 @@ MenuLayer4::MenuLayer4()
|
|||
MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
|
||||
MenuItemFont::setFontSize( 34 );
|
||||
|
||||
auto label = LabelBMFont::create( "go back", "fonts/bitmapFontTest3.fnt" );
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "go back");
|
||||
auto back = MenuItemLabel::create(label, CC_CALLBACK_1(MenuLayer4::backCallback, this) );
|
||||
|
||||
auto menu = Menu::create(
|
||||
|
|
|
@ -204,7 +204,7 @@ void LabelMainScene::onIncrease(Ref* sender)
|
|||
case kCaseLabelBMFontUpdate:
|
||||
for( int i=0;i< kNodesIncrease;i++)
|
||||
{
|
||||
auto label = LabelBMFont::create("LabelBMFont", "fonts/bitmapFontTest3.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt","LabelBMFont");
|
||||
label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50)));
|
||||
_labelContainer->addChild(label, 1, _quantityNodes);
|
||||
|
||||
|
@ -227,7 +227,7 @@ void LabelMainScene::onIncrease(Ref* sender)
|
|||
case kCaseLabelBMFontBigLabels:
|
||||
for( int i=0;i< kNodesIncrease;i++)
|
||||
{
|
||||
auto label = LabelBMFont::create(LongSentencesExample, "fonts/bitmapFontTest3.fnt");
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", LongSentencesExample);
|
||||
label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50)));
|
||||
_labelContainer->addChild(label, 1, _quantityNodes);
|
||||
|
||||
|
@ -329,7 +329,7 @@ void LabelMainScene::updateText(float dt)
|
|||
break;
|
||||
case kCaseLabelBMFontUpdate:
|
||||
for(const auto &child : children) {
|
||||
LabelBMFont* label = (LabelBMFont*)child;
|
||||
auto label = (Label*)child;
|
||||
label->setString(text);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -79,7 +79,7 @@ void TouchesMainScene::onEnter()
|
|||
|
||||
scheduleUpdate();
|
||||
|
||||
_plabel = LabelBMFont::create("00.0", "fonts/arial16.fnt");
|
||||
_plabel = Label::createWithBMFont("fonts/arial16.fnt","00.0");
|
||||
_plabel->setPosition(Point(s.width/2, s.height/2));
|
||||
addChild(_plabel);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual void update(float dt) override;
|
||||
|
||||
protected:
|
||||
LabelBMFont * _plabel;
|
||||
Label * _plabel;
|
||||
int numberOfTouchesB;
|
||||
int numberOfTouchesM;
|
||||
int numberOfTouchesE;
|
||||
|
|
Loading…
Reference in New Issue