axmol/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp

1196 lines
42 KiB
C++
Raw Normal View History

2014-07-29 14:33:22 +08:00
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
http://www.cocos2d-x.org
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
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:
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
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.
****************************************************************************/
#include "UIScale9SpriteTest.h"
#include "testResource.h"
2015-04-09 12:23:47 +08:00
USING_NS_CC;
using namespace cocos2d::ui;
UIScale9SpriteTests::UIScale9SpriteTests()
{
ADD_TEST_CASE(UIScale9SpriteTest);
ADD_TEST_CASE(UIScale9SpriteHierarchialTest);
ADD_TEST_CASE(UIScale9SpriteTouchTest);
ADD_TEST_CASE(UIS9BatchNodeBasic);
ADD_TEST_CASE(UIS9FrameNameSpriteSheet);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotated);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCropped);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotated);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedSimple);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotatedSimple);
ADD_TEST_CASE(UIS9BatchNodeScaledNoInsets);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetScaledNoInsets);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotatedScaledNoInsets);
ADD_TEST_CASE(UIS9BatchNodeScaleWithCapInsets);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetInsets);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetInsetsScaled);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotatedInsets);
ADD_TEST_CASE(UIS9_TexturePacker);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotatedInsetsScaled);
ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotatedSetCapInsetLater);
ADD_TEST_CASE(UIS9CascadeOpacityAndColor);
ADD_TEST_CASE(UIS9ZOrder);
ADD_TEST_CASE(UIS9Flip);
ADD_TEST_CASE(UIS9ChangeAnchorPoint);
ADD_TEST_CASE(UIS9NinePatchTest);
2015-10-30 09:58:02 +08:00
ADD_TEST_CASE(UIS9BatchTest);
2015-10-30 14:01:01 +08:00
ADD_TEST_CASE(UIS9ToggleRenderingTypeTest);
ADD_TEST_CASE(UIS9GlobalZOrderTest);
ADD_TEST_CASE(UIS9EnableScale9FalseTest);
ADD_TEST_CASE(UIS9GrayStateOpacityTest);
}
2014-07-29 14:33:22 +08:00
// UIScale9SpriteTest
2021-12-28 16:06:23 +08:00
UIScale9SpriteTest::UIScale9SpriteTest() {}
2014-07-29 14:33:22 +08:00
2021-12-28 16:06:23 +08:00
UIScale9SpriteTest::~UIScale9SpriteTest() {}
2014-07-29 14:33:22 +08:00
bool UIScale9SpriteTest::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
2021-12-28 16:06:23 +08:00
auto moveTo = MoveBy::create(1.0f, Vec2(30.0f, 0.0f));
2014-07-29 14:33:22 +08:00
auto moveBack = moveTo->reverse();
auto rotateBy = RotateBy::create(1.0f, 180.0f);
2021-12-28 16:06:23 +08:00
auto scaleBy = ScaleTo::create(1.0f, -2.0f);
auto action = Sequence::create(moveTo, moveBack, rotateBy, scaleBy, NULL);
2014-07-29 14:33:22 +08:00
2021-12-28 16:06:23 +08:00
Sprite* normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
2014-07-29 14:33:22 +08:00
normalSprite1->setPosition(100, 270);
2014-11-07 11:09:22 +08:00
normalSprite1->setFlippedY(true);
2014-07-29 14:33:22 +08:00
this->addChild(normalSprite1);
normalSprite1->runAction((FiniteTimeAction*)action->clone());
2021-12-28 16:06:23 +08:00
ui::Scale9Sprite* normalSprite2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
2014-07-29 14:33:22 +08:00
normalSprite2->setPosition(120, 270);
normalSprite2->setScale9Enabled(false);
normalSprite2->setOpacity(100);
normalSprite2->setContentSize(normalSprite2->getContentSize() * 2);
2014-07-29 14:33:22 +08:00
this->addChild(normalSprite2);
normalSprite2->setColor(Color3B::GREEN);
normalSprite2->runAction(action);
2021-12-28 16:06:23 +08:00
auto action2 = action->clone();
ui::Scale9Sprite* sp1 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
2014-07-29 14:33:22 +08:00
sp1->setPosition(100, 160);
2014-10-09 17:19:43 +08:00
sp1->setScale(1.2f);
2021-12-28 16:06:23 +08:00
sp1->setContentSize(Size(100.0f, 100.0f));
2014-07-29 14:33:22 +08:00
sp1->setColor(Color3B::GREEN);
this->addChild(sp1);
sp1->runAction((FiniteTimeAction*)action2);
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2021-12-28 16:06:23 +08:00
cocos2d::ui::Scale9Sprite* sp2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
sp2->setPosition(350.0f, 160.0f);
2014-10-09 17:19:43 +08:00
sp2->setPreferredSize(sp1->getContentSize() * 1.2f);
2014-07-29 14:33:22 +08:00
sp2->setColor(Color3B::GREEN);
2021-12-28 16:06:23 +08:00
sp2->setContentSize(Size(100.0f, 100.0f));
2014-07-29 14:33:22 +08:00
this->addChild(sp2);
auto action3 = action->clone();
sp2->runAction((FiniteTimeAction*)action3);
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
2021-12-28 16:06:23 +08:00
UIScale9SpriteHierarchialTest::UIScale9SpriteHierarchialTest() {}
2014-07-29 14:33:22 +08:00
2021-12-28 16:06:23 +08:00
UIScale9SpriteHierarchialTest::~UIScale9SpriteHierarchialTest() {}
2014-07-29 14:33:22 +08:00
bool UIScale9SpriteHierarchialTest::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
2021-12-28 16:06:23 +08:00
auto moveTo = MoveBy::create(1.0f, Vec2(30.0f, 0.0f));
2014-07-29 14:33:22 +08:00
auto moveBack = moveTo->reverse();
auto rotateBy = RotateBy::create(1.0f, 180.0f);
2021-12-28 16:06:23 +08:00
auto fadeOut = FadeOut::create(2.0f);
auto scaleTo = ScaleTo::create(1.0f, 2.0f);
auto action = Sequence::create(moveTo, moveBack, rotateBy, fadeOut, scaleTo, NULL);
Sprite* normalSprite1 = Sprite::create("cocosui/animationbuttonnormal.png");
2014-07-29 14:33:22 +08:00
normalSprite1->setPosition(100, 270);
normalSprite1->setCascadeColorEnabled(true);
normalSprite1->setCascadeOpacityEnabled(true);
normalSprite1->setColor(Color3B::GREEN);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(normalSprite1);
normalSprite1->runAction((FiniteTimeAction*)action->clone());
2021-12-28 16:06:23 +08:00
ui::Scale9Sprite* normalSprite2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
2014-07-29 14:33:22 +08:00
normalSprite2->setScale9Enabled(false);
normalSprite2->setOpacity(100);
normalSprite1->addChild(normalSprite2);
2021-12-28 16:06:23 +08:00
auto action2 = action->clone();
ui::Scale9Sprite* sp1 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
sp1->setPosition(200.0f, 160.0f);
2014-10-09 17:19:43 +08:00
sp1->setScale(1.2f);
2021-12-28 16:06:23 +08:00
sp1->setContentSize(Size(100.0f, 100.0f));
2014-07-29 14:33:22 +08:00
sp1->setColor(Color3B::GREEN);
this->addChild(sp1);
sp1->runAction((FiniteTimeAction*)action2);
2021-12-28 16:06:23 +08:00
cocos2d::ui::Scale9Sprite* sp2 = ui::Scale9Sprite::create("cocosui/animationbuttonnormal.png");
2014-10-09 17:19:43 +08:00
sp2->setPreferredSize(sp1->getContentSize() * 1.2f);
2014-07-29 14:33:22 +08:00
sp2->setColor(Color3B::GREEN);
2014-11-07 11:09:22 +08:00
sp2->setFlippedX(true);
2021-12-28 16:06:23 +08:00
sp2->setContentSize(Size(100.0f, 100.0f));
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2014-07-29 14:33:22 +08:00
sp1->addChild(sp2);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
2021-12-28 16:06:23 +08:00
UIScale9SpriteTouchTest::UIScale9SpriteTouchTest() {}
2014-07-29 14:33:22 +08:00
2021-12-28 16:06:23 +08:00
UIScale9SpriteTouchTest::~UIScale9SpriteTouchTest() {}
2014-07-29 14:33:22 +08:00
bool UIScale9SpriteTouchTest::init()
{
if (UIScene::init())
{
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
Vec2 origin = Director::getInstance()->getVisibleOrigin();
2021-12-28 16:06:23 +08:00
Size size = Director::getInstance()->getVisibleSize();
2014-07-29 14:33:22 +08:00
auto containerForSprite1 = Node::create();
2021-12-28 16:06:23 +08:00
auto sprite1 = cocos2d::ui::Scale9Sprite::create("Images/CyanSquare.png");
sprite1->setPosition(origin + Vec2(size.width / 2, size.height / 2) + Vec2(-80.0f, 80.0f));
2014-07-29 14:33:22 +08:00
containerForSprite1->addChild(sprite1);
addChild(containerForSprite1, 10);
2014-11-07 11:09:22 +08:00
2021-12-28 16:06:23 +08:00
auto sprite2 = ui::Scale9Sprite::create("Images/MagentaSquare.png");
sprite2->setPosition(origin + Vec2(size.width / 2, size.height / 2));
2014-07-29 14:33:22 +08:00
addChild(sprite2, 20);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto sprite3 = ui::Scale9Sprite::create("Images/YellowSquare.png");
sprite3->setPosition(Vec2(0.0f, 0.0f));
2014-07-29 14:33:22 +08:00
sprite3->setCascadeOpacityEnabled(false);
sprite2->addChild(sprite3, 1);
// Make sprite1 touchable
auto listener1 = EventListenerTouchOneByOne::create();
listener1->setSwallowTouches(true);
2021-12-28 16:06:23 +08:00
listener1->onTouchBegan = [](Touch* touch, Event* event) {
2014-07-29 14:33:22 +08:00
auto target = static_cast<Sprite*>(event->getCurrentTarget());
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
Vec2 locationInNode = target->convertToNodeSpace(touch->getLocation());
2021-12-28 16:06:23 +08:00
Size s = target->getContentSize();
Rect rect = Rect(0, 0, s.width, s.height);
2014-07-29 14:33:22 +08:00
if (rect.containsPoint(locationInNode))
{
log("sprite began... x = %f, y = %f", locationInNode.x, locationInNode.y);
target->setOpacity(180);
return true;
}
return false;
};
2021-12-28 16:06:23 +08:00
listener1->onTouchMoved = [](Touch* touch, Event* event) {
2014-07-29 14:33:22 +08:00
auto target = static_cast<Sprite*>(event->getCurrentTarget());
target->setPosition(target->getPosition() + touch->getDelta());
};
2021-12-28 16:06:23 +08:00
listener1->onTouchEnded = [=](Touch* touch, Event* event) {
2014-07-29 14:33:22 +08:00
auto target = static_cast<ui::Scale9Sprite*>(event->getCurrentTarget());
log("sprite onTouchesEnded.. ");
target->setOpacity(255);
if (target == sprite2)
{
containerForSprite1->setLocalZOrder(100);
}
2021-12-28 16:06:23 +08:00
else if (target == sprite1)
2014-07-29 14:33:22 +08:00
{
containerForSprite1->setLocalZOrder(0);
}
};
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, sprite1);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), sprite2);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), sprite3);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
bool UIS9BatchNodeBasic::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
auto sprite = Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto blocks = ui::Scale9Sprite::create();
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks->updateWithSprite(sprite, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheet::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9ss/blocks9.png");
blocks->setInsetLeft(0);
blocks->setInsetRight(0);
blocks->setInsetTop(0);
blocks->setInsetBottom(0);
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2014-07-29 14:33:22 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks);
return true;
}
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return false;
}
bool UIS9FrameNameSpriteSheetRotated::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2014-07-29 14:33:22 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
return true;
}
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
return false;
}
bool UIS9FrameNameSpriteSheetCropped::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-09-28 05:56:00 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-09-28 05:56:00 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png");
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks->setPosition(Vec2(x, y + 45));
2014-09-28 05:56:00 +08:00
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2015-12-18 06:38:53 +08:00
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9c.png");
2021-12-28 16:06:23 +08:00
blocks2->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks2->setPosition(Vec2(x, y - 45));
this->addChild(blocks2);
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
return true;
}
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
return false;
}
bool UIS9FrameNameSpriteSheetCroppedRotated::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-09-28 05:56:00 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-09-28 05:56:00 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png");
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks->setPosition(Vec2(x, y + 45));
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2015-12-18 06:38:53 +08:00
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9cr.png");
2021-12-28 16:06:23 +08:00
blocks2->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks2->setPosition(Vec2(x, y - 45));
this->addChild(blocks2);
2021-12-28 16:06:23 +08:00
return true;
}
2021-12-28 16:06:23 +08:00
return false;
}
bool UIS9FrameNameSpriteSheetCroppedSimple::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png");
blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks->setPosition(Vec2(x, y + 45));
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2015-12-18 06:38:53 +08:00
auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9c.png");
2021-12-28 16:06:23 +08:00
blocksSprite->setScale(400 / blocksSprite->getContentSize().width, 80 / blocksSprite->getContentSize().height);
2015-12-18 06:38:53 +08:00
blocksSprite->setPosition(Vec2(x, y - 45));
this->addChild(blocksSprite);
2021-12-28 16:06:23 +08:00
return true;
}
2021-12-28 16:06:23 +08:00
return false;
}
bool UIS9FrameNameSpriteSheetCroppedRotatedSimple::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
2014-09-28 05:56:00 +08:00
auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png");
2015-10-29 23:13:36 +08:00
blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(400.0f, 80.0f));
2015-12-18 06:38:53 +08:00
blocks->setPosition(Vec2(x, y + 45));
2014-07-29 14:33:22 +08:00
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
2015-12-18 06:38:53 +08:00
auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9cr.png");
2021-12-28 16:06:23 +08:00
blocksSprite->setScale(400 / blocksSprite->getContentSize().width, 80 / blocksSprite->getContentSize().height);
2015-12-18 06:38:53 +08:00
blocksSprite->setPosition(Vec2(x, y - 45));
this->addChild(blocksSprite);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return false;
}
bool UIS9BatchNodeScaledNoInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
// scaled without insets
auto sprite_scaled = Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto blocks_scaled = ui::Scale9Sprite::create();
blocks_scaled->updateWithSprite(sprite_scaled, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks_scaled->setContentSize(Size(96 * 4, 96 * 2));
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetScaledNoInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
auto blocks_scaled = ui::Scale9Sprite::createWithSpriteFrameName("blocks9ss/blocks9.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks_scaled->setContentSize(Size(96 * 4, 96 * 2));
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetRotatedScaledNoInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
auto blocks_scaled = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks_scaled->setContentSize(Size(96 * 4, 96 * 2));
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
bool UIS9BatchNodeScaleWithCapInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
auto sprite_scaled_with_insets = Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto blocks_scaled_with_insets = ui::Scale9Sprite::create();
2021-12-28 16:06:23 +08:00
blocks_scaled_with_insets->updateWithSprite(sprite_scaled_with_insets, Rect(0, 0, 96, 96), false,
Rect(32, 32, 32, 32));
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled_with_insets);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
auto blocks_with_insets =
ui::Scale9Sprite::createWithSpriteFrameName("blocks9ss/blocks9.png", Rect(32, 32, 32, 32));
2014-07-29 14:33:22 +08:00
blocks_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_with_insets);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetInsetsScaled::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
auto blocks_scaled_with_insets =
ui::Scale9Sprite::createWithSpriteFrameName("blocks9ss/blocks9.png", Rect(32, 32, 32, 32));
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled_with_insets);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetRotatedInsets::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
auto blocks_with_insets = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png", Rect(32, 32, 32, 32));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_with_insets);
return true;
}
return false;
}
bool UIS9_TexturePacker::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_ui_plist);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
float x = winSize.width / 4;
float y = 0 + (winSize.height / 2);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto s = ui::Scale9Sprite::createWithSpriteFrameName("button_normal.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
s->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
s->setContentSize(Size(14 * 16, 10 * 16));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(s);
2021-12-28 16:06:23 +08:00
x = winSize.width * 3 / 4;
2014-07-29 14:33:22 +08:00
auto s2 = ui::Scale9Sprite::createWithSpriteFrameName("button_actived.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
s2->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
s2->setContentSize(Size(14 * 16, 10 * 16));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(s2);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetRotatedInsetsScaled::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
auto blocks_scaled_with_insets =
ui::Scale9Sprite::createWithSpriteFrameName("blocks9ss/blocks9.png", Rect(32, 32, 32, 32));
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled_with_insets);
return true;
}
return false;
}
bool UIS9FrameNameSpriteSheetRotatedSetCapInsetLater::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2014-07-29 14:33:22 +08:00
auto blocks_scaled_with_insets = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setInsetLeft(32);
blocks_scaled_with_insets->setInsetRight(32);
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2021-12-28 16:06:23 +08:00
blocks_scaled_with_insets->setPreferredSize(Size(32 * 5.5f, 32 * 4));
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
2014-07-29 14:33:22 +08:00
this->addChild(blocks_scaled_with_insets);
return true;
}
return false;
}
bool UIS9CascadeOpacityAndColor::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
auto rgba = Layer::create();
2014-07-29 14:33:22 +08:00
rgba->setCascadeColorEnabled(true);
rgba->setCascadeOpacityEnabled(true);
this->addChild(rgba);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto blocks_scaled_with_insets = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
rgba->addChild(blocks_scaled_with_insets);
2021-12-28 16:06:23 +08:00
auto actions = Sequence::create(FadeIn::create(1), TintTo::create(1, 0, 255, 0), TintTo::create(1, 255, 0, 255),
CallFunc::create([=]() {
rgba->setCascadeColorEnabled(false);
rgba->setCascadeOpacityEnabled(false);
}),
2014-07-29 14:33:22 +08:00
nullptr);
2021-12-28 16:06:23 +08:00
auto repeat = RepeatForever::create(actions);
2014-07-29 14:33:22 +08:00
rgba->runAction(repeat);
return true;
}
return false;
}
bool UIS9ZOrder::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-07-29 14:33:22 +08:00
auto blocks_scaled_with_insets = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->setPosition(Vec2(x, y));
this->addChild(blocks_scaled_with_insets);
2021-12-28 16:06:23 +08:00
Sprite* normalSprite = Sprite::createWithSpriteFrameName("blocks9r.png");
2014-07-29 14:33:22 +08:00
normalSprite->setColor(Color3B::RED);
blocks_scaled_with_insets->addChild(normalSprite);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto topLabel = Label::createWithSystemFont("I Must be On the Top", "Arial", 15);
2021-12-28 16:06:23 +08:00
topLabel->setPosition(Vec2(20.0f, 20.0f));
2014-07-29 14:33:22 +08:00
blocks_scaled_with_insets->addChild(topLabel);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto bottomLabel = Label::createWithSystemFont("I Must be On the Bottom", "Arial", 15);
2021-12-28 16:06:23 +08:00
bottomLabel->setPosition(Vec2(80.0f, 80.0f));
2014-07-29 14:33:22 +08:00
bottomLabel->setColor(Color3B::BLUE);
2021-12-28 16:06:23 +08:00
blocks_scaled_with_insets->addChild(bottomLabel, -1);
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
bool UIS9Flip::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2014-07-29 14:33:22 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
2014-11-07 11:09:22 +08:00
auto statusLabel = Label::createWithSystemFont("Scale9Enabled", "Arial", 10);
statusLabel->setPosition(Vec2(x, winSize.height - statusLabel->getContentSize().height - 40));
this->addChild(statusLabel);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto normalSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
normalSprite->setPosition(Vec2(x, y));
2014-07-29 14:33:22 +08:00
this->addChild(normalSprite);
2021-12-28 16:06:23 +08:00
auto normalLabel = Label::createWithSystemFont("Normal Sprite", "Arial", 10);
normalLabel->setPosition(normalSprite->getPosition() +
Vec2(0.0f, normalSprite->getContentSize().height / 2 + 10));
2014-07-29 14:33:22 +08:00
this->addChild(normalLabel);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto flipXSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
flipXSprite->setPosition(Vec2(x - 120, y));
flipXSprite->setScale(1.2f);
2014-07-29 14:33:22 +08:00
this->addChild(flipXSprite);
2014-11-07 11:09:22 +08:00
flipXSprite->setFlippedX(false);
2021-12-28 16:06:23 +08:00
auto flipXLabel = Label::createWithSystemFont("sprite is not flipped!", "Arial", 10);
flipXLabel->setPosition(flipXSprite->getPosition() + Vec2(0.0f, flipXSprite->getContentSize().height / 2 + 10));
2014-07-29 14:33:22 +08:00
this->addChild(flipXLabel);
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
auto flipYSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
2014-07-29 14:33:22 +08:00
flipYSprite->setPosition(Vec2(x + 120, y));
this->addChild(flipYSprite);
2021-12-28 16:06:23 +08:00
flipYSprite->setScale(0.8f);
2014-07-29 14:33:22 +08:00
flipYSprite->setFlippedY(true);
2021-12-28 16:06:23 +08:00
auto flipYLabel = Label::createWithSystemFont("sprite is flipped!", "Arial", 10);
flipYLabel->setPosition(flipYSprite->getPosition() + Vec2(0.0f, flipYSprite->getContentSize().height / 2 + 10));
2014-07-29 14:33:22 +08:00
this->addChild(flipYLabel);
2021-12-28 16:06:23 +08:00
2014-11-07 11:09:22 +08:00
auto toggleFlipXButton = Button::create();
toggleFlipXButton->setTitleText("Toggle FlipX");
2021-12-28 16:06:23 +08:00
toggleFlipXButton->setPosition(flipXSprite->getPosition() +
Vec2(0.0f, -20 - flipXSprite->getContentSize().height / 2));
toggleFlipXButton->addClickEventListener([=](Ref*) {
flipXSprite->setFlippedX(!flipXSprite->isFlippedX());
if (flipXSprite->isFlippedX())
{
2014-11-07 11:09:22 +08:00
flipXLabel->setString("sprite is flipped!");
}
2021-12-28 16:06:23 +08:00
else
{
2014-11-07 11:09:22 +08:00
flipXLabel->setString("sprite is not flipped!");
}
});
this->addChild(toggleFlipXButton);
2021-12-28 16:06:23 +08:00
2014-11-07 11:09:22 +08:00
auto toggleFlipYButton = Button::create();
toggleFlipYButton->setTitleText("Toggle FlipY");
2021-12-28 16:06:23 +08:00
toggleFlipYButton->setPosition(flipYSprite->getPosition() +
Vec2(0.0f, -20 - flipYSprite->getContentSize().height / 2));
toggleFlipYButton->addClickEventListener([=](Ref*) {
2014-11-07 11:09:22 +08:00
flipYSprite->setFlippedY(!flipYSprite->isFlippedY());
2021-12-28 16:06:23 +08:00
if (flipYSprite->isFlippedY())
{
2014-11-07 11:09:22 +08:00
flipYLabel->setString("sprite is flipped!");
}
2021-12-28 16:06:23 +08:00
else
{
flipYLabel->setString("sprite is not flipped!");
2014-11-07 11:09:22 +08:00
}
});
this->addChild(toggleFlipYButton);
2021-12-28 16:06:23 +08:00
2014-11-07 11:09:22 +08:00
auto toggleScale9Button = Button::create();
toggleScale9Button->setTitleText("Toggle Scale9");
2021-12-28 16:06:23 +08:00
toggleScale9Button->setPosition(normalSprite->getPosition() +
Vec2(0.0f, -20 - normalSprite->getContentSize().height / 2));
toggleScale9Button->addClickEventListener([=](Ref*) {
2014-11-07 11:09:22 +08:00
flipXSprite->setScale9Enabled(!flipXSprite->isScale9Enabled());
flipYSprite->setScale9Enabled(!flipYSprite->isScale9Enabled());
2021-12-28 16:06:23 +08:00
if (flipXSprite->isScale9Enabled())
{
2014-11-07 11:09:22 +08:00
statusLabel->setString("Scale9Enabled");
2021-12-28 16:06:23 +08:00
}
else
{
2014-11-07 11:09:22 +08:00
statusLabel->setString("Scale9Disabled");
}
2021-12-28 16:06:23 +08:00
2014-11-07 11:09:22 +08:00
CCLOG("scaleX = %f", flipXSprite->getScaleX());
CCLOG("scaleY = %f", flipYSprite->getScale());
2021-12-28 16:06:23 +08:00
if (flipXSprite->isFlippedX())
{
2014-11-07 11:09:22 +08:00
CCLOG("xxxxxxx");
}
2021-12-28 16:06:23 +08:00
if (flipYSprite->isFlippedY())
{
2014-11-07 11:09:22 +08:00
CCLOG("YYYYYY");
}
2021-12-28 16:06:23 +08:00
if (flipXSprite->isFlippedX())
{
2014-11-07 11:09:22 +08:00
flipXLabel->setString("sprite is flipped!");
}
2021-12-28 16:06:23 +08:00
else
{
2014-11-07 11:09:22 +08:00
flipXLabel->setString("sprite is not flipped!");
}
2021-12-28 16:06:23 +08:00
if (flipYSprite->isFlippedY())
{
2014-11-07 11:09:22 +08:00
flipYLabel->setString("sprite is flipped!");
}
2021-12-28 16:06:23 +08:00
else
{
flipYLabel->setString("sprite is not flipped!");
2014-11-07 11:09:22 +08:00
}
});
this->addChild(toggleScale9Button);
2021-12-28 16:06:23 +08:00
return true;
}
return false;
}
bool UIS9ChangeAnchorPoint::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
2021-12-28 16:06:23 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2 + 50);
auto normalSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
2021-12-28 16:06:23 +08:00
normalSprite->setPosition(Vec2(x, y));
// normalSprite->setScale9Enabled(false);
// normalSprite->setAnchorPoint(Vec2::ANCHOR_TOP_RIGHT);
this->addChild(normalSprite);
2021-12-28 16:06:23 +08:00
Button* button1 = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
2021-12-28 16:06:23 +08:00
button1->setPosition(Vec2(winSize.width / 2 - 100, winSize.height / 2 - 50));
button1->setName("button2");
button1->setTitleText("Vec(0,0)");
2021-12-28 16:06:23 +08:00
button1->addTouchEventListener([=](Ref*, Widget::TouchEventType type) {
if (type == Widget::TouchEventType::ENDED)
{
normalSprite->setAnchorPoint(Vec2::ZERO);
normalSprite->setScale9Enabled(true);
CCLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x,
normalSprite->getPosition().y, normalSprite->getAnchorPoint().x,
normalSprite->getAnchorPoint().y);
CCLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width,
normalSprite->getContentSize().height);
}
});
this->addChild(button1);
2021-12-28 16:06:23 +08:00
Button* button2 = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
2021-12-28 16:06:23 +08:00
button2->setPosition(Vec2(winSize.width / 2 + 100, winSize.height / 2 - 50));
button2->setName("button2");
button2->setTitleText("Vec(1,1)");
2021-12-28 16:06:23 +08:00
button2->addTouchEventListener([=](Ref*, Widget::TouchEventType type) {
if (type == Widget::TouchEventType::ENDED)
{
normalSprite->setAnchorPoint(Vec2::ANCHOR_TOP_RIGHT);
normalSprite->setScale9Enabled(false);
CCLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x,
normalSprite->getPosition().y, normalSprite->getAnchorPoint().x,
normalSprite->getAnchorPoint().y);
CCLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width,
normalSprite->getContentSize().height);
}
});
this->addChild(button2);
return true;
}
return false;
}
bool UIS9NinePatchTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("cocosui/android9patch.plist");
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2 + 50);
2021-12-28 16:06:23 +08:00
auto preferedSize = Size(99, 99);
2021-12-28 16:06:23 +08:00
// 9-patch sprite with filename
auto playerSprite = ui::Scale9Sprite::create("cocosui/player.9.png");
playerSprite->setPosition(x, y);
playerSprite->setContentSize(preferedSize);
auto capInsets = playerSprite->getCapInsets();
2021-12-28 16:06:23 +08:00
CCLOG("player sprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width,
capInsets.size.height);
this->addChild(playerSprite);
auto animationBtnSprite = ui::Scale9Sprite::createWithSpriteFrameName("animationbuttonpressed.png");
2021-12-28 16:06:23 +08:00
animationBtnSprite->setPosition(x - 100, y - 100);
capInsets = animationBtnSprite->getCapInsets();
2021-12-28 16:06:23 +08:00
CCLOG("animationBtnSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y,
capInsets.size.width, capInsets.size.height);
this->addChild(animationBtnSprite);
2021-12-28 16:06:23 +08:00
auto monsterSprite = ui::Scale9Sprite::createWithSpriteFrameName("monster.9.png");
2021-12-28 16:06:23 +08:00
monsterSprite->setPosition(x + 100, y - 100);
capInsets = monsterSprite->getCapInsets();
monsterSprite->setContentSize(preferedSize);
2021-12-28 16:06:23 +08:00
CCLOG("monsterSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width,
capInsets.size.height);
this->addChild(monsterSprite);
2021-12-28 16:06:23 +08:00
auto spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("buttonnormal.9.png");
auto buttonScale9Sprite = Scale9Sprite::createWithSpriteFrame(spriteFrame);
2021-12-28 16:06:23 +08:00
buttonScale9Sprite->setContentSize(Size(150.0f, 80.0f));
buttonScale9Sprite->setPosition(Vec2(100.0f, 200.0f));
this->addChild(buttonScale9Sprite);
2014-07-29 14:33:22 +08:00
return true;
}
return false;
}
2015-10-30 09:58:02 +08:00
bool UIS9BatchTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2015-10-30 09:58:02 +08:00
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/blocks9ss.plist");
2021-12-28 16:06:23 +08:00
2015-10-30 09:58:02 +08:00
auto winSize = Director::getInstance()->getVisibleSize();
2021-12-28 16:06:23 +08:00
auto label = Label::createWithSystemFont(
"Click Button to Add Sprite and Slice Sprite\nThe draw call should always be 19 after adding sprites",
"Arial", 15);
label->setPosition(Vec2(winSize.width / 2, winSize.height - 60));
2015-10-30 09:58:02 +08:00
this->addChild(label);
2021-12-28 16:06:23 +08:00
auto preferedSize = Size(150.0f, 99.0f);
std::vector<std::string> spriteFrameNameArray = {"blocks9ss/blocks9.png", "blocks9ss/blocks9r.png"};
auto addSpriteButton =
ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
addSpriteButton->setPosition(Vec2(winSize.width / 2 - 50, winSize.height - 100));
2015-10-30 09:58:02 +08:00
addSpriteButton->setTitleText("Add Normal Sprite");
2016-07-11 11:17:28 +08:00
std::srand((unsigned)time(nullptr));
2021-12-28 16:06:23 +08:00
addSpriteButton->addClickEventListener([=](Ref*) {
auto spriteFrameName = spriteFrameNameArray[rand() % 2];
auto sprite = Sprite::createWithSpriteFrameName(spriteFrameName);
sprite->setPosition(Vec2(rand() % (int)winSize.width + 50.0f, winSize.height / 2));
2015-10-30 09:58:02 +08:00
this->addChild(sprite);
});
this->addChild(addSpriteButton);
2021-12-28 16:06:23 +08:00
auto addSliceSpriteButton =
ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
addSliceSpriteButton->setPosition(Vec2(winSize.width / 2 + 50, winSize.height - 100));
2015-10-30 09:58:02 +08:00
addSliceSpriteButton->setTitleText("Add Slice Sprite");
2021-12-28 16:06:23 +08:00
addSliceSpriteButton->addClickEventListener([=](Ref*) {
int random = rand() % 2;
2015-10-30 09:58:02 +08:00
auto spriteFrameName = spriteFrameNameArray[random];
2021-12-28 16:06:23 +08:00
auto sprite = ui::Scale9Sprite::createWithSpriteFrameName(spriteFrameName);
sprite->setPosition(Vec2(rand() % (int)winSize.width + 50.0f, winSize.height / 3));
if (random == 0)
{
2015-10-30 09:58:02 +08:00
sprite->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
2021-12-28 16:06:23 +08:00
}
else
{
2015-10-30 09:58:02 +08:00
sprite->setRenderingType(Scale9Sprite::RenderingType::SLICE);
}
sprite->setPreferredSize(preferedSize);
this->addChild(sprite);
});
this->addChild(addSliceSpriteButton);
2021-12-28 16:06:23 +08:00
2015-10-30 09:58:02 +08:00
return true;
}
return false;
}
2015-10-30 14:01:01 +08:00
bool UIS9ToggleRenderingTypeTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
2015-10-30 14:01:01 +08:00
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2 - 20);
2015-10-30 14:01:01 +08:00
auto label = Label::createWithSystemFont("Click Button to toggle rendering type", "Arial", 15);
2021-12-28 16:06:23 +08:00
label->setPosition(Vec2(winSize.width / 2, winSize.height - 60));
2015-10-30 14:01:01 +08:00
this->addChild(label);
2021-12-28 16:06:23 +08:00
2015-10-30 14:01:01 +08:00
auto blocks = ui::Scale9Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
2015-10-30 14:01:01 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(96 * 2, 96));
2015-10-30 14:01:01 +08:00
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
auto addSliceSpriteButton =
ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
addSliceSpriteButton->setPosition(Vec2(winSize.width / 2, winSize.height - 100));
2015-10-30 14:01:01 +08:00
addSliceSpriteButton->setTitleText("Slice Rendering");
2021-12-28 16:06:23 +08:00
addSliceSpriteButton->addClickEventListener([=](Ref*) {
if (blocks->getRenderingType() == Scale9Sprite::RenderingType::SLICE)
{
2015-10-30 14:01:01 +08:00
blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE);
addSliceSpriteButton->setTitleText("Simple Rendering");
2021-12-28 16:06:23 +08:00
}
else
{
2015-10-30 14:01:01 +08:00
blocks->setRenderingType(Scale9Sprite::RenderingType::SLICE);
addSliceSpriteButton->setTitleText("Slice Rendering");
2021-12-28 16:06:23 +08:00
blocks->setCapInsets(Rect(96 / 3, 96 / 3, 96 / 3, 96 / 3));
2015-10-30 14:01:01 +08:00
}
});
this->addChild(addSliceSpriteButton);
2021-12-28 16:06:23 +08:00
2015-10-30 14:01:01 +08:00
return true;
}
return false;
}
bool UIS9GlobalZOrderTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2 - 20);
auto label = Label::createWithSystemFont("The green scale9sprite is in the back.", "Arial", 15);
2021-12-28 16:06:23 +08:00
label->setPosition(Vec2(winSize.width / 2, winSize.height - 60));
this->addChild(label);
2021-12-28 16:06:23 +08:00
auto blocks = ui::Scale9Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(96 * 2, 96 * 1.5));
blocks->setColor(Color3B::RED);
blocks->setGlobalZOrder(1);
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9.png");
blocks2->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks2->setPreferredSize(Size(96 * 3, 96));
blocks2->setGlobalZOrder(0);
blocks2->setColor(Color3B::GREEN);
this->addChild(blocks2);
return true;
}
return false;
}
bool UIS9EnableScale9FalseTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2 + 50;
float y = 0 + (winSize.height / 2 + 10);
auto label = Label::createWithSystemFont("Only the yellow block intersect with the green one.", "Arial", 15);
2021-12-28 16:06:23 +08:00
label->setPosition(Vec2(winSize.width / 2, winSize.height - 60));
this->addChild(label);
2021-12-28 16:06:23 +08:00
auto blocks = ui::Scale9Sprite::create("Images/blocks9.png");
blocks->setScale9Enabled(false);
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(96 * 2.0f, 96.0f));
blocks->setColor(Color3B::RED);
blocks->setGlobalZOrder(1);
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
auto blocks2 = ui::Scale9Sprite::create("Images/blocks9.png");
blocks2->setScale9Enabled(false);
blocks2->setPosition(Vec2(0.0f, 0.0f));
2021-12-28 16:06:23 +08:00
blocks2->setPreferredSize(Size(96 * 1.5f, 96.0f));
blocks2->setGlobalZOrder(0);
blocks2->setColor(Color3B::GREEN);
blocks->addChild(blocks2);
2021-12-28 16:06:23 +08:00
auto blocks3 = ui::Scale9Sprite::create("Images/blocks9.png");
blocks3->setScale9Enabled(false);
blocks3->setPosition(Vec2(0.0f, 0.0f));
blocks3->setPreferredSize(Size(96.0f, 96.0f));
blocks3->setGlobalZOrder(2);
blocks3->setColor(Color3B::YELLOW);
blocks2->addChild(blocks3);
2021-12-28 16:06:23 +08:00
return true;
}
return false;
}
bool UIS9GrayStateOpacityTest::init()
{
2021-12-28 16:06:23 +08:00
if (UIScene::init())
{
auto winSize = Director::getInstance()->getWinSize();
2021-12-28 16:06:23 +08:00
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2 + 10);
auto label = Label::createWithSystemFont("Drap slider to change opacity of the scale9Sprite", "Arial", 15);
2021-12-28 16:06:23 +08:00
label->setPosition(Vec2(winSize.width / 2, winSize.height - 60));
this->addChild(label);
2021-12-28 16:06:23 +08:00
auto blocks = ui::Scale9Sprite::create("Images/blocks9.png");
2021-12-28 16:06:23 +08:00
blocks->setPosition(Vec2(x, y));
2021-12-28 16:06:23 +08:00
blocks->setPreferredSize(Size(96 * 2, 96 * 1.5));
blocks->setOpacity(100);
blocks->setState(Scale9Sprite::State::GRAY);
blocks->setGlobalZOrder(1);
blocks->setName("GrayScale9");
this->addChild(blocks);
2021-12-28 16:06:23 +08:00
Slider* slider = Slider::create();
slider->loadBarTexture("cocosui/sliderTrack.png");
slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
slider->loadProgressBarTexture("cocosui/sliderProgress.png");
slider->setContentSize(Size(300, slider->getContentSize().height * 1.5f));
slider->setMaxPercent(100);
slider->setPercent(100 * 100.0f / 255.0);
slider->setPosition(Vec2(winSize.width / 2.0f, winSize.height / 2.0f - 100));
slider->addEventListener(CC_CALLBACK_2(UIS9GrayStateOpacityTest::sliderEvent, this));
_uiLayer->addChild(slider);
return true;
}
return false;
}
2021-12-28 16:06:23 +08:00
void UIS9GrayStateOpacityTest::sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type)
{
if (type == Slider::EventType::ON_PERCENTAGE_CHANGED)
{
2021-12-28 16:06:23 +08:00
Slider* slider = dynamic_cast<Slider*>(sender);
int percent = slider->getPercent();
int maxPercent = slider->getMaxPercent();
auto scale9Sprite = (Scale9Sprite*)this->getChildByName("GrayScale9");
scale9Sprite->setOpacity(1.0 * percent / maxPercent * 255.0);
}
Scale9Sprite refactor (#16891) * Squashed commit of the following: commit 026eee59c9ece7fc59d71fead41104f375f72eb5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 21:45:12 2016 -0800 yay! everything works! commit a645c99d44f0d7674e6238afae7628d8d2a030b1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 22 14:55:31 2016 -0800 more fixes in Scale9Sprite commit 3a688f4ea70c0abe311232c65ed14a7e9acc7611 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 23:06:45 2016 -0800 rotated sprites commit 45e2085df3aa4b52236c817f7db7c1f6602c1e95 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 17:10:44 2016 -0800 android patch 9: fixes is not 100% backward compatible since the previous version had some artifacts. fixed the artifacts. now it renders ok commit 4655d894387fa40a7e63b074a36bfed20e41d5f9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 21 16:31:29 2016 -0800 sprite: correct size for "fake scale9" commit cb98aba27cc1c82a986268d5b74afb55b6cca2f3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 21:55:51 2016 -0800 sprite: adds setStrechEnabled for backward compatibility and other fixes commit c0fe67aac54cd62e3846810d56f87133f3a7343b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:49:42 2016 -0800 implemts missing functions in scale9sprite commit e471ef318725ccabc9eca2c062e285e9ca4f9a81 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Nov 18 18:42:30 2016 -0800 "batched" works commit 33124bfb14d1f275d4b0ffca8989975625a8a76d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:59:38 2016 -0800 more fixes commit 149f8206269843af63a1739885c00ed8d94c239c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 18:37:12 2016 -0800 scale 9 rotated not fixed yet. but making progress commit 27f98275d94ce00c8d5ff0b6f74b5c22723cc3c3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 15:32:57 2016 -0800 sprite: streching works ok with normal sprites commit 2519498cac8b77a32dee5bdf1805be56fbda5ed6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 16 12:12:28 2016 -0800 somes fixes... still not working commit 43580d0b4aa976b0200717611a286bf1035c472d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 23:15:22 2016 -0800 more bug fixes related to untrimmed setCenterRect... ...in SCale9Sprite commit 407247616e506afaa0415c58ad7fce38efed0cd9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 15 22:13:38 2016 -0800 spritecale9: untrimmed vs. trimmed capInsets WIP. there still a few bugs commit 3d845b2af3500be287fabb04bb6ba0ec04dbb401 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 23:11:17 2016 -0800 started progressbar commit 0a44b00daf723869b7105689890f29cd53a62608 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 14 17:43:23 2016 -0800 adds EditBox test commit 330304bd9b2e762de95c2f27f1ae3ceee83b2fbf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 16:57:08 2016 -0800 adds elastic to scroll view commit a06a35f8691ff56a143953c44acd947b519150b6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:58:29 2016 -0800 yay! scrollview works commit 37748a885c62eca8c00d2c9c11ee103f1d95e71c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 15:33:58 2016 -0800 yet more scrollview fixes commit a6e563b497adef7b141ac7c92c844d479b244c59 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 9 14:48:28 2016 -0800 initial scroll view commit 4243edd7548e5533ca03c26d5042f8dc5517445a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Nov 8 17:50:15 2016 -0800 sanity check in frames. missing files commit 159d88603ad22f3c01761b60bacec98d52b9041d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 19:21:00 2016 -0800 three buttons working commit 6764cfc7937a1a81d6993d5e32a21f17457b8e0d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:50:22 2016 -0800 missing files commit 11c1fa3812e706a7d34137fe2626f05ab73ee3e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:49:59 2016 -0800 button works! commit 26b6de4c28fc973e332dd51fcd763a6249c0b4c2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 18:19:47 2016 -0800 Scale9: more fixes. complies with odd Rect::ZERO behavior commit ce561268096afe322f25034eeab3508a60027afd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Nov 7 11:50:42 2016 -0800 label: setTitleLabel commit 51b5536cd2af36896002621f75c7310960c3f5e7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 17:41:08 2016 -0700 UIButton kind of working commit 7562a49a761ef70c383a99d2addefc63d77e279f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 11:11:42 2016 -0700 missing resoruces commit a9890dee5da0104bff6872cc04e8786a6c0a9018 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 10:54:55 2016 -0700 setCenterRect to .cpp file commit c9c4bb55ed3fc55709eca46c43d1bfe5301c317f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Nov 2 00:19:51 2016 -0700 removed unused paramter commit e47732934cca79c08e6fe96e46ebdf075508e568 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 18:19:31 2016 -0700 flipping works! commit c9769bacd321aeddf84e1772dd270f12194d2f04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 17:57:53 2016 -0700 spirte flip fixes... not finished yet commit 1cbdc8e12cc6d0d2728c06dfabaada001784a178 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:53:16 2016 -0700 centerRect changes commit aeb1b14c00331dabba640f52d79ab0e255fa3407 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 28 09:10:41 2016 -0700 changes from v3 commit e7a61c4a20d786c2bc1d6f57e33bf3ac95cb6f21 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 17:01:15 2016 -0700 sprite: rotated slice 9 works as expected commit 91049389426051deb49a9d951364bf60abaf4532 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 15:39:54 2016 -0700 more bug fixes in scale9sprite support commit 9feb12449078441c439df16dc7bcfb4506c7a226 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 13:22:52 2016 -0700 Android's Patch 9 works as expected commit 1cf46afe3e7f7f5f714d30779caefc25a9bb1b3b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 26 10:18:47 2016 -0700 Sprite: uses capInsets instead of centerRect just to share the same API as Scale9Sprite commit e944fa0248a7eb58012aacb229de1a9b814e0aef Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 18:59:42 2016 -0700 scale9sprite support fixes commit b08765740d480b6ae1491800161b40d88f458767 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:38:47 2016 -0700 more scale9sprite fixes commit 388a34d93de5e6007a2cecea959c929f26427cab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 25 17:20:01 2016 -0700 UI::Scale9Sprite refactoring subclass of Sprite... much cleaner! commit c84ec8ee654f74d4b38be2d0a3d7ffe6adbc6faf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 20:58:36 2016 -0700 supports tiled sprites commit d2b18eb47a647b29319488bd53edac9f304acb84 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 19:21:57 2016 -0700 testing tiled sprite commit b4832ab2facc01cbb624db587ede01fe7acf23e8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:53:19 2016 -0700 using correct top-left coordinates for setCenterRect commit 29d8de86a71cc597b2338f59f7951a28ee0c93b2 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Oct 24 16:46:13 2016 -0700 fixes from scale_sprite9 branch commit ccbe1063bea7db75397ecaf9046aac3dd977a621 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 19:01:50 2016 -0700 updated example commit 24f7f85d4eba80f8e543810dcbc1a02447900bdc Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:47:28 2016 -0700 more fixes in nine slice commit df3358fae68f2d81baf3a8cbe033a4c400ea50da Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 18:22:14 2016 -0700 anchor point fixes commit 4ac7409bc72425abb0dc747b956ec346fbd1b2fa Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 17:01:48 2016 -0700 support for slice-9 from creator commit a3221375d3a9defc2e03df0b1c2da1b36dfdd491 Merge: 73e5389 d7490d9 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 20 14:13:38 2016 -0700 Merge branch 'sprite_scale9' into creator_cpp_support commit d7490d94896ad0ce8705dc0695252cee34329b5e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 13 14:34:52 2016 -0700 Adds slice9 support for Sprite. how to use it: // points coords sprite->setCenterRect(Rect(x,y,w,h)); // normalized coords sprite->setCenterRectNormalized(Rect(x,y,w,h)); starts scale9sprite in sprite more slice 9 changes sprite 9 slice works? kind of works correct anchor point slice 9 works, at least with non-rotated atlases streched works ok better Y invert code. cleaner, compatible with the previous code yay, scaling workings... need a better api now sets scale correctly yay! works as expected! more fixes and tests better test for box setContentSize() changes size in non-9-slice mode sprites as well setCenterRect() -> setCenterRectNormalized() yet another test adds setPositionNormalized() adds setCenterRect() tests remove devel team from xcode tests: add one more tests fun test! improved test yet another test for slice 9 commit 73e5389ef719880096067d0f7d0bffd6e1f3cfd1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Sun Oct 9 18:54:22 2016 -0700 kind of ProgressBar support commit 4db5e9e7369e93ceba1d9512ab88c26b843c43d5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Oct 7 16:23:54 2016 -0700 new generatred ui files commit 75aa06f3d39df8c6aa898d5e6810b3cd8015c07b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Oct 6 10:44:59 2016 -0700 bette canvas support commit 89beacac478fc7f58ef930963b6393f3da4a743c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 21:47:11 2016 -0700 sprites tests commit 5fe930ad50c2c1b6d868982709c7b659176f9889 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:35:44 2016 -0700 more label tests commit d3f615a097d080d78f2ebd95f3e2388da45f92db Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Oct 5 18:08:24 2016 -0700 label tests commit 2a4018922ce8d36117f7092fc324e37cf75fdeab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 21:52:56 2016 -0700 label fixes commit 41fafbd023de63e376d014311605f2b156add307 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 19:14:58 2016 -0700 updated test commit 06919fc28fffbc5a20cd14bdcc2ad2ff997e0da1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Oct 4 18:50:45 2016 -0700 creator tests: works commit 6e362e7cc7f68dc216b569a7f7f90aaa110c0e4a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 27 23:15:56 2016 -0700 autogen: new data commit e78078b2ad84b4e364827a66f1c459de7384a91d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 26 18:18:57 2016 -0700 fix: initial test for CPP support for Creator * adds more documentation * adds more documentation
2016-11-24 09:59:00 +08:00
}