closed #2393: fixed conflicts

This commit is contained in:
minggo 2013-07-12 15:07:44 +08:00
commit 58fe3c7563
23 changed files with 925 additions and 116 deletions

View File

@ -514,6 +514,9 @@ Developers:
hannon235 (Chris)
Fixing a bug that the submenu of ExtensionTest in TestCpp can't scroll.
pktangyue
Fixing a bug that CCScale9Sprite::setInsetLeft/XXX can't work for rotated sprite frame.
Retired Core Developers:
WenSheng Yang

View File

@ -1380,21 +1380,20 @@ BezierTo* BezierTo::create(float t, const ccBezierConfig& c)
bool BezierTo::initWithDuration(float t, const ccBezierConfig &c)
{
bool bRet = false;
if (ActionInterval::initWithDuration(t))
{
_toConfig = c;
return true;
}
return bRet;
return false;
}
BezierTo* BezierTo::clone(void) const
{
// no copy constructor
auto a = new BezierTo();
a->initWithDuration(_duration, _config);
a->initWithDuration(_duration, _toConfig);
a->autorelease();
return a;
}

View File

@ -53,7 +53,7 @@ public:
/** returns a copy of the object.
@deprecated Use clone() instead
*/
CC_DEPRECATED_ATTRIBUTE void copy() const
CC_DEPRECATED_ATTRIBUTE Object* copy() const
{
// use "clone" instead
CC_ASSERT(false);

View File

@ -96,8 +96,9 @@ bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bool
if(batchnode)
{
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
this->setAnchorPoint(Point(0.5f, 0.5f));
}
this->setAnchorPoint(Point(0.5f, 0.5f));
this->_positionsAreDirty = true;
return true;
@ -180,18 +181,15 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
float y = 0.0;
// top left
Rect lefttopbounds = Rect(x, y,
left_w, top_h);
Rect lefttopbounds = Rect(x, y, left_w, top_h);
// top center
TRANSLATE_X(x, y, left_w);
Rect centertopbounds = Rect(x, y,
center_w, top_h);
Rect centertopbounds = Rect(x, y, center_w, top_h);
// top right
TRANSLATE_X(x, y, center_w);
Rect righttopbounds = Rect(x, y,
right_w, top_h);
Rect righttopbounds = Rect(x, y, right_w, top_h);
// ... center row
x = 0.0;
@ -199,18 +197,15 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
TRANSLATE_Y(x, y, top_h);
// center left
Rect leftcenterbounds = Rect(x, y,
left_w, center_h);
Rect leftcenterbounds = Rect(x, y, left_w, center_h);
// center center
TRANSLATE_X(x, y, left_w);
Rect centerbounds = Rect(x, y,
center_w, center_h);
Rect centerbounds = Rect(x, y, center_w, center_h);
// center right
TRANSLATE_X(x, y, center_w);
Rect rightcenterbounds = Rect(x, y,
right_w, center_h);
Rect rightcenterbounds = Rect(x, y, right_w, center_h);
// ... bottom row
x = 0.0;
@ -219,18 +214,15 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
TRANSLATE_Y(x, y, center_h);
// bottom left
Rect leftbottombounds = Rect(x, y,
left_w, bottom_h);
Rect leftbottombounds = Rect(x, y, left_w, bottom_h);
// bottom center
TRANSLATE_X(x, y, left_w);
Rect centerbottombounds = Rect(x, y,
center_w, bottom_h);
Rect centerbottombounds = Rect(x, y, center_w, bottom_h);
// bottom right
TRANSLATE_X(x, y, center_w);
Rect rightbottombounds = Rect(x, y,
right_w, bottom_h);
Rect rightbottombounds = Rect(x, y, right_w, bottom_h);
if (!rotated) {
// CCLog("!rotated");
@ -383,11 +375,11 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
this->addChild(_scale9Image);
if (_spritesGenerated)
{
// Restore color and opacity
this->setOpacity(opacity);
this->setColor(color);
}
{
// Restore color and opacity
this->setOpacity(opacity);
this->setColor(color);
}
_spritesGenerated = true;
return true;
@ -687,20 +679,10 @@ void Scale9Sprite::updateCapInset()
}
else
{
if (_spriteFrameRotated)
{
insets = Rect(_insetBottom,
_insetLeft,
_spriteRect.size.width-_insetRight-_insetLeft,
_spriteRect.size.height-_insetTop-_insetBottom);
}
else
{
insets = Rect(_insetLeft,
_insetTop,
_spriteRect.size.width-_insetLeft-_insetRight,
_spriteRect.size.height-_insetTop-_insetBottom);
}
insets = Rect(_insetLeft,
_insetTop,
_spriteRect.size.width-_insetLeft-_insetRight,
_spriteRect.size.height-_insetTop-_insetBottom);
}
this->setCapInsets(insets);
}

View File

@ -66,7 +66,7 @@ public class QH360Wrapper {
if (orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ||
orientation != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
{
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
return (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

View File

@ -112,7 +112,7 @@ public class UCWrapper {
if (orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ||
orientation != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
{
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
return (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

View File

@ -10,11 +10,11 @@ export TARGET_DIR_NAME="publish"
if [ ! ${PLUGIN_ROOT} ]; then
pushd ../
export PLUGIN_ROOT=`pwd`
export TARGET_ROOT=${PLUGIN_ROOT}/${TARGET_DIR_NAME}
echo PLUGIN_ROOT = ${PLUGIN_ROOT}
echo TARGET_ROOT = ${TARGET_ROOT}
popd
fi
export TARGET_ROOT=${PLUGIN_ROOT}/${TARGET_DIR_NAME}
echo PLUGIN_ROOT = ${PLUGIN_ROOT}
echo TARGET_ROOT = ${TARGET_ROOT}
# get a string include all plugins name(separate with ':')
export PLUGINS_CAN_SELECT=""

View File

@ -1,4 +1,7 @@
SHELL_DIR=$(cd "$(dirname "$0")"; pwd)
type gawk >/dev/null 2>&1 || { echo >&2 "gawk is required, PLZ install it first."; exit 1; }
pushd ${SHELL_DIR}
# include the config

View File

@ -39,7 +39,8 @@ for pluginName in plugins:
if os.path.splitext(fileName)[1] == '.jar':
needAdd = True
for linkedJar in linkedLibs:
if -1 != linkedJar.find(fileName):
jarName = os.path.basename(linkedJar)
if fileName == jarName:
needAdd = False
break

View File

@ -29,6 +29,8 @@ if nodeLinkRes != None:
if linkNodes != None and len(linkNodes) > 0:
for node in linkNodes:
locNode = node.find('locationURI')
if locNode == None:
continue
tempText = locNode.text
tempText = tempText.strip(' \n\r\t')
if tempText == targetPath:

View File

@ -18,7 +18,7 @@ class step1(step):
step_tip = Label(self.stepFrame, text="Input the android project path of your game:")
step_tip.pack(anchor='nw', padx=30)
step_tip2 = Label(self.stepFrame, text="(Please keep your game project path away from spaces)")
step_tip2 = Label(self.stepFrame, text="(Pleasd avoid using spaces in your project path)")
step_tip2.pack(anchor='nw', padx=30)
self.step_entry = Entry(self.stepFrame)
self.step_entry.pack(anchor='nw', fill=X, padx=30)

View File

@ -66,6 +66,7 @@ Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
Classes/FontTest/FontTest.cpp \
Classes/IntervalTest/IntervalTest.cpp \
Classes/KeypadTest/KeypadTest.cpp \
@ -110,6 +111,8 @@ Classes/AppDelegate.cpp \
Classes/BaseTest.cpp \
Classes/VisibleRect.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static

View File

@ -8,53 +8,6 @@
USING_NS_CC;
enum
{
ACTION_MANUAL_LAYER = 0,
ACTION_MOVE_LAYER,
ACTION_SCALE_LAYER,
ACTION_ROTATE_LAYER,
ACTION_SKEW_LAYER,
ACTION_ROTATIONAL_SKEW_LAYER,
ACTION_ROTATIONAL_SKEW_VS_STANDARD_SKEW_LAYER,
ACTION_SKEWROTATE_LAYER,
ACTION_JUMP_LAYER,
ACTION_CARDINALSPLINE_LAYER,
ACTION_CATMULLROM_LAYER,
ACTION_BEZIER_LAYER,
ACTION_BLINK_LAYER,
ACTION_FADE_LAYER,
ACTION_TINT_LAYER,
ACTION_ANIMATE_LAYER,
ACTION_SEQUENCE_LAYER,
ACTION_SEQUENCE2_LAYER,
ACTION_SPAWN_LAYER,
ACTION_REVERSE,
ACTION_DELAYTIME_LAYER,
ACTION_REPEAT_LAYER,
ACTION_REPEATEFOREVER_LAYER,
ACTION_ROTATETOREPEATE_LAYER,
ACTION_ROTATEJERK_LAYER,
ACTION_CALLFUNC_LAYER,
ACTION_CALLFUNCND_LAYER,
ACTION_CALLFUNCTION_LAYER,
ACTION_REVERSESEQUENCE_LAYER,
ACTION_REVERSESEQUENCE2_LAYER,
ACTION_ORBIT_LAYER,
ACTION_FLLOW_LAYER,
ACTION_TARGETED_LAYER,
PAUSERESUMEACTIONS_LAYER,
ACTION_ISSUE1305_LAYER,
ACTION_ISSUE1305_2_LAYER,
ACTION_ISSUE1288_LAYER,
ACTION_ISSUE1288_2_LAYER,
ACTION_ISSUE1327_LAYER,
ACTION_ISSUE1398_LAYER,
ACTION_LAYER_COUNT,
ACTION_REMOVE_SELF,
};
// the class inherit from TestScene
// every Scene each test used must inherit from TestScene,
// make sure the test have the menu item for back to main menu

View File

@ -18,6 +18,8 @@
#include "EditBoxTest/EditBoxTest.h"
#endif
#include "Scale9SpriteTest/Scale9SpriteTest.h"
enum
{
LINE_SPACE = 40,
@ -30,6 +32,15 @@ static struct {
} g_extensionsTests[] = {
{ "NotificationCenterTest", [](Object* sender) { runNotificationCenterTest(); }
},
{ "Scale9SpriteTest", [](Object* sender) {
S9SpriteTestScene* pScene = new S9SpriteTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
},
{ "CCControlButtonTest", [](Object *sender){
ControlSceneManager* pManager = ControlSceneManager::sharedControlSceneManager();
Scene* pScene = pManager->currentControlScene();

View File

@ -0,0 +1,643 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013 Surith Thekkiam
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "Scale9SpriteTest.h"
#include "testResource.h"
#include "cocos2d.h"
#include "cocos-ext.h"
USING_NS_CC_EXT;
static std::function<Layer*()> createFunctions[] = {
CL(S9BatchNodeBasic),
CL(S9FrameNameSpriteSheet),
CL(S9FrameNameSpriteSheetRotated),
CL(S9BatchNodeScaledNoInsets),
CL(S9FrameNameSpriteSheetScaledNoInsets),
CL(S9FrameNameSpriteSheetRotatedScaledNoInsets),
CL(S9BatchNodeScaleWithCapInsets),
CL(S9FrameNameSpriteSheetInsets),
CL(S9FrameNameSpriteSheetInsetsScaled),
CL(S9FrameNameSpriteSheetRotatedInsets),
CL(S9_TexturePacker),
CL(S9FrameNameSpriteSheetRotatedInsetsScaled),
CL(S9FrameNameSpriteSheetRotatedSetCapInsetLater)
};
static int sceneIdx=-1;
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
static Layer* nextAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
static Layer* backAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
void S9SpriteTestScene::runThisTest()
{
sceneIdx = -1;
addChild(nextAction());
Director::sharedDirector()->replaceScene(this);
}
//------------------------------------------------------------------
//
// S9SpriteTestDemo
//
//------------------------------------------------------------------
void S9SpriteTestDemo::onEnter()
{
BaseTest::onEnter();
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
CCLOG("sprite frames added to sprite frame cache...");
}
void S9SpriteTestDemo::restartCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( restartAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
void S9SpriteTestDemo::nextCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( nextAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
void S9SpriteTestDemo::backCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( backAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
// S9BatchNodeBasic
void S9BatchNodeBasic::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeBasic ...");
auto batchNode = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode created with : Images/blocks9.png");
auto blocks = Scale9Sprite::create();
CCLog("... created");
blocks->updateWithBatchNode(batchNode, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9BatchNodeBasic done.");
}
std::string S9BatchNodeBasic::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeBasic::subtitle()
{
return "updateWithBatchNode(); capInsets=full size";
}
// S9FrameNameSpriteSheet
void S9FrameNameSpriteSheet::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheet ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheet done.");
}
std::string S9FrameNameSpriteSheet::title()
{
return "Scale9Sprite from sprite sheet";
}
std::string S9FrameNameSpriteSheet::subtitle()
{
return "createWithSpriteFrameName(); default cap insets";
}
//
//// S9FrameNameSpriteSheetRotated
//
void S9FrameNameSpriteSheetRotated::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotated ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotated done.");
}
std::string S9FrameNameSpriteSheetRotated::title()
{
return "Scale9Sprite from sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotated::subtitle()
{
return "createWithSpriteFrameName(); default cap insets";
}
//
//// S9BatchNodeScaledNoInsets
//
void S9BatchNodeScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaledNoInsets ...");
// scaled without insets
auto batchNode_scaled = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled created with : Images/blocks9.png");
auto blocks_scaled = Scale9Sprite::create();
CCLog("... created");
blocks_scaled->updateWithBatchNode(batchNode_scaled, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9BtchNodeScaledNoInsets done.");
}
std::string S9BatchNodeScaledNoInsets::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeScaledNoInsets::subtitle()
{
return "updateWithBatchNode(); capInsets=full size; rendered 4 X width, 2 X height";
}
//
//// S9FrameNameSpriteSheetScaledNoInsets
//
void S9FrameNameSpriteSheetScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetScaledNoInsets::title()
{
return "Scale9Sprite from sprite sheet";
}
std::string S9FrameNameSpriteSheetScaledNoInsets::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
}
//
//// S9FrameNameSpriteSheetRotatedScaledNoInsets
//
void S9FrameNameSpriteSheetRotatedScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::title()
{
return "Scale9Sprite from sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
}
//
//
//// S9BatchNodeScaleWithCapInsets
//
void S9BatchNodeScaleWithCapInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaleWithCapInsets ...");
auto batchNode_scaled_with_insets = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled_with_insets created with : Images/blocks9.png");
auto blocks_scaled_with_insets = Scale9Sprite::create();
CCLog("... created");
blocks_scaled_with_insets->updateWithBatchNode(batchNode_scaled_with_insets, Rect(0, 0, 96, 96), false, Rect(32, 32, 32, 32));
CCLog("... updateWithBatchNode");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9BatchNodeScaleWithCapInsets done.");
}
std::string S9BatchNodeScaleWithCapInsets::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeScaleWithCapInsets::subtitle()
{
return "updateWithBatchNode(); capInsets=(32, 32, 32, 32)";
}
//
//// S9FrameNameSpriteSheetInsets
//
void S9FrameNameSpriteSheetInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsets done.");
}
std::string S9FrameNameSpriteSheetInsets::title()
{
return "Scale9Sprite scaled with insets sprite sheet";
}
std::string S9FrameNameSpriteSheetInsets::subtitle()
{
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
}
//
//// S9FrameNameSpriteSheetInsetsScaled
//
void S9FrameNameSpriteSheetInsetsScaled::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetInsetsScaled::title()
{
return "Scale9Sprite scaled with insets sprite sheet";
}
std::string S9FrameNameSpriteSheetInsetsScaled::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
}
//// S9FrameNameSpriteSheetRotatedInsets
//
void S9FrameNameSpriteSheetRotatedInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedInsets::title()
{
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedInsets::subtitle()
{
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
}
//
//// S9_TexturePacker
//
void S9_TexturePacker::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(s_s9s_ui_plist);
float x = winSize.width / 4;
float y = 0 + (winSize.height / 2);
CCLog("S9_TexturePacker ...");
auto s = Scale9Sprite::createWithSpriteFrameName("button_normal.png");
CCLog("... created");
s->setPosition(Point(x, y));
CCLog("... setPosition");
s->setContentSize(Size(14 * 16, 10 * 16));
CCLog("... setContentSize");
this->addChild(s);
CCLog("this->addChild");
x = winSize.width * 3/4;
auto s2 = Scale9Sprite::createWithSpriteFrameName("button_actived.png");
CCLog("... created");
s2->setPosition(Point(x, y));
CCLog("... setPosition");
s2->setContentSize(Size(14 * 16, 10 * 16));
CCLog("... setContentSize");
this->addChild(s2);
CCLog("this->addChild");
CCLog("... S9_TexturePacker done.");
}
std::string S9_TexturePacker::title()
{
return "Scale9Sprite from a spritesheet created with TexturePacker";
}
std::string S9_TexturePacker::subtitle()
{
return "createWithSpriteFrameName('button_normal.png');createWithSpriteFrameName('button_actived.png');";
}
//
//// S9FrameNameSpriteSheetRotatedInsetsScaled
//
void S9FrameNameSpriteSheetRotatedInsetsScaled::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::title()
{
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
}
//
//// Scale9FrameNameSpriteSheetRotatedSetCapInsetLater
//
void S9FrameNameSpriteSheetRotatedSetCapInsetLater::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
blocks_scaled_with_insets->setInsetLeft(32);
blocks_scaled_with_insets->setInsetRight(32);
blocks_scaled_with_insets->setPreferredSize(Size(32*5.5f, 32*4));
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
}
std::string S9FrameNameSpriteSheetRotatedSetCapInsetLater::title()
{
return "Scale9Sprite from sprite sheet (stored rotated), with setting CapInset later";
}
std::string S9FrameNameSpriteSheetRotatedSetCapInsetLater::subtitle()
{
return "createWithSpriteFrameName(); setInsetLeft(32); setInsetRight(32);";
}

View File

@ -0,0 +1,190 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013 Surith Thekkiam
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "testBasic.h"
#include "BaseTest.h"
class S9SpriteTestScene : public TestScene
{
public:
virtual void runThisTest();
};
class S9SpriteTestDemo : public BaseTest
{
public:
virtual void onEnter();
virtual void restartCallback(Object* sender);
virtual void nextCallback(Object* sender);
virtual void backCallback(Object* sender);
};
// S9BatchNodeBasic
class S9BatchNodeBasic : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheet
class S9FrameNameSpriteSheet : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotated
class S9FrameNameSpriteSheetRotated : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9BatchNodeScaledNoInsets
class S9BatchNodeScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetScaledNoInsets
class S9FrameNameSpriteSheetScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedScaledNoInsets
class S9FrameNameSpriteSheetRotatedScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9BatchNodeScaleWithCapInsets
class S9BatchNodeScaleWithCapInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetInsets
class S9FrameNameSpriteSheetInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetInsetsScaled
class S9FrameNameSpriteSheetInsetsScaled : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedInsets
class S9FrameNameSpriteSheetRotatedInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9_TexturePacker
class S9_TexturePacker : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedInsetsScaled
class S9FrameNameSpriteSheetRotatedInsetsScaled : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedInsetsScaled
class S9FrameNameSpriteSheetRotatedSetCapInsetLater : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};

View File

@ -39,5 +39,10 @@ static const char s_AtlasTest[] = "Images/atlastest.png";
static const char s_TilesPng[] = "TileMaps/tiles.png";
static const char s_LevelMapTga[] = "TileMaps/levelmap.tga";
// Scale9Sprite resource
static const char s_s9s_blocks9[] = "Images/blocks9ss.png";
static const char s_s9s_blocks9_plist[] = "Images/blocks9ss.plist";
static const char s_s9s_ui[] = "Images/ui.png";
static const char s_s9s_ui_plist[] = "Images/ui.plist";
#endif

View File

@ -49,13 +49,14 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/ExtensionsTest.cpp \
../Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
../Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \
../Classes/KeypadTest/KeypadTest.cpp \

View File

@ -52,13 +52,14 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/ExtensionsTest.cpp \
../Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
../Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \
../Classes/KeyboardTest/KeyboardTest.cpp \

View File

@ -55,13 +55,14 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
../Classes/ExtensionsTest/ExtensionsTest.cpp \
../Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
../Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
../Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FileUtilsTest/FileUtilsTest.cpp \
../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \

View File

@ -151,6 +151,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
<ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.cpp" />
<ClCompile Include="..\Classes\FileUtilsTest\FileUtilsTest.cpp" />
@ -258,6 +259,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
<ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.h" />
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.h" />
<ClInclude Include="..\Classes\FileUtilsTest\FileUtilsTest.h" />

View File

@ -232,6 +232,9 @@
<Filter Include="Classes\ExtensionsTest\ComponentsTest">
<UniqueIdentifier>{285cdfb8-5749-4969-ae31-99ec25f15e6e}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\Scale9SpriteTest">
<UniqueIdentifier>{3d73aa04-d66e-43d3-921f-b867a753c113}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -543,6 +546,9 @@
<ClCompile Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.cpp">
<Filter>Classes\ExtensionsTest\ComponentsTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp">
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -1034,5 +1040,8 @@
<ClInclude Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.h">
<Filter>Classes\ExtensionsTest\ComponentsTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h">
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1 +1 @@
678e714c9c548501d076d34e2af0b13619e0a5aa
14e0d7211e9d0c638e41502416e3d944890dd856