mirror of https://github.com/axmolengine/axmol.git
Scale9Sprite test improvemets
This commit is contained in:
parent
98fe1d46cc
commit
714c01991e
|
@ -38,8 +38,6 @@ UIScale9SpriteTests::UIScale9SpriteTests()
|
|||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotated);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCropped);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotated);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedImage);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotatedImage);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedSimple);
|
||||
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotatedSimple);
|
||||
ADD_TEST_CASE(UIS9BatchNodeScaledNoInsets);
|
||||
|
@ -357,9 +355,14 @@ bool UIS9FrameNameSpriteSheetCropped::init()
|
|||
|
||||
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png");
|
||||
blocks->setPreferredSize(Size(400,80));
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
blocks->setPosition(Vec2(x, y + 45));
|
||||
this->addChild(blocks);
|
||||
|
||||
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9c.png");
|
||||
blocks2->setPreferredSize(Size(400,80));
|
||||
blocks2->setPosition(Vec2(x, y - 45));
|
||||
this->addChild(blocks2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -377,48 +380,13 @@ bool UIS9FrameNameSpriteSheetCroppedRotated::init()
|
|||
|
||||
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png");
|
||||
blocks->setPreferredSize(Size(400,80));
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
blocks->setPosition(Vec2(x, y + 45));
|
||||
this->addChild(blocks);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UIS9FrameNameSpriteSheetCroppedImage::init()
|
||||
{
|
||||
if (UIScene::init()) {
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
|
||||
|
||||
auto blocks = Sprite::createWithSpriteFrameName("blocks9c.png");
|
||||
blocks->setScale(400/blocks->getContentSize().width, 80/blocks->getContentSize().height);
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
this->addChild(blocks);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UIS9FrameNameSpriteSheetCroppedRotatedImage::init()
|
||||
{
|
||||
if (UIScene::init()) {
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
|
||||
|
||||
auto blocks = Sprite::createWithSpriteFrameName("blocks9cr.png");
|
||||
blocks->setScale(400/blocks->getContentSize().width, 80/blocks->getContentSize().height);
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
this->addChild(blocks);
|
||||
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9cr.png");
|
||||
blocks2->setPreferredSize(Size(400,80));
|
||||
blocks2->setPosition(Vec2(x, y - 45));
|
||||
this->addChild(blocks2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -438,9 +406,14 @@ bool UIS9FrameNameSpriteSheetCroppedSimple::init()
|
|||
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png");
|
||||
blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
|
||||
blocks->setPreferredSize(Size(400,80));
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
blocks->setPosition(Vec2(x, y + 45));
|
||||
this->addChild(blocks);
|
||||
|
||||
auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9c.png");
|
||||
blocksSprite->setScale(400/blocksSprite->getContentSize().width, 80/blocksSprite->getContentSize().height);
|
||||
blocksSprite->setPosition(Vec2(x, y - 45));
|
||||
this->addChild(blocksSprite);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -459,9 +432,14 @@ bool UIS9FrameNameSpriteSheetCroppedRotatedSimple::init()
|
|||
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png");
|
||||
blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
|
||||
blocks->setPreferredSize(Size(400,80));
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
blocks->setPosition(Vec2(x, y + 45));
|
||||
this->addChild(blocks);
|
||||
|
||||
auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9cr.png");
|
||||
blocksSprite->setScale(400/blocksSprite->getContentSize().width, 80/blocksSprite->getContentSize().height);
|
||||
blocksSprite->setPosition(Vec2(x, y - 45));
|
||||
this->addChild(blocksSprite);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,27 +91,7 @@ public:
|
|||
virtual bool init() override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetCropped
|
||||
|
||||
class UIS9FrameNameSpriteSheetCroppedImage : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIS9FrameNameSpriteSheetCroppedImage);
|
||||
|
||||
virtual bool init() override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetCroppedRotated
|
||||
|
||||
class UIS9FrameNameSpriteSheetCroppedRotatedImage : public UIScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(UIS9FrameNameSpriteSheetCroppedRotatedImage);
|
||||
|
||||
virtual bool init() override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetCropped
|
||||
// S9FrameNameSpriteSheetCroppedSimple
|
||||
|
||||
class UIS9FrameNameSpriteSheetCroppedSimple : public UIScene
|
||||
{
|
||||
|
@ -121,7 +101,7 @@ public:
|
|||
virtual bool init() override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetCroppedRotated
|
||||
// S9FrameNameSpriteSheetCroppedRotatedSimple
|
||||
|
||||
class UIS9FrameNameSpriteSheetCroppedRotatedSimple : public UIScene
|
||||
{
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 4.5 KiB |
Loading…
Reference in New Issue