From 7333a636c13302c52815fc970b80126f4248f5d0 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 25 Dec 2013 15:13:11 +0800 Subject: [PATCH] fix Label->LabelBMFontBounds --- samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp | 8 ++++++++ samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp index 57d5618a78..09280e9b63 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp @@ -1612,6 +1612,14 @@ std::string LabelBMFontBounds::subtitle() const } void LabelBMFontBounds::draw() +{ + CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + cmd->init(0, _vertexZ); + cmd->func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this); + Director::getInstance()->getRenderer()->addCommand(cmd); +} + +void LabelBMFontBounds::onDraw() { auto labelSize = label1->getContentSize(); auto origin = Director::getInstance()->getWinSize(); diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.h b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.h index c532bef477..11c9934f93 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.h +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.h @@ -376,6 +376,8 @@ public: virtual void draw(); virtual std::string title() const override; virtual std::string subtitle() const override; +protected: + void onDraw(); private: LabelBMFont *label1; };