Merge branch 'LayerGradientCtor' into develop

This commit is contained in:
pandamicro 2014-03-27 10:37:46 +08:00
commit 6bdf4e9684
15 changed files with 50 additions and 26 deletions

View File

@ -793,6 +793,9 @@ Developers:
LoungeKatt LoungeKatt
Corrected a mistake of building android project in README.md Corrected a mistake of building android project in README.md
flashjay
Remove deprecated code in lua tests & template
Retired Core Developers: Retired Core Developers:
WenSheng Yang WenSheng Yang

View File

@ -627,12 +627,13 @@ std::string LayerColor::getDescription() const
{ {
return StringUtils::format("<LayerColor | Tag = %d>", _tag); return StringUtils::format("<LayerColor | Tag = %d>", _tag);
} }
// //
// LayerGradient // LayerGradient
// //
LayerGradient::LayerGradient() LayerGradient::LayerGradient()
: _startColor(Color4B(0, 0, 0, 255)) : _startColor(Color4B::BLACK)
, _endColor(Color4B(0, 0, 0, 255)) , _endColor(Color4B::BLACK)
, _startOpacity(255) , _startOpacity(255)
, _endOpacity(255) , _endOpacity(255)
, _alongVector(Point(0, -1)) , _alongVector(Point(0, -1))
@ -640,9 +641,11 @@ LayerGradient::LayerGradient()
{ {
} }
LayerGradient::~LayerGradient() {
LayerGradient::~LayerGradient()
{
} }
LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end) LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end)
{ {
LayerGradient * layer = new LayerGradient(); LayerGradient * layer = new LayerGradient();

View File

@ -273,7 +273,7 @@ To enable set it to a value different than 0. Disabled by default.
protected by default. protected by default.
*/ */
#ifndef CC_CONSTRUCTOR_ACCESS #ifndef CC_CONSTRUCTOR_ACCESS
#define CC_CONSTRUCTOR_ACCESS public #define CC_CONSTRUCTOR_ACCESS protected
#endif #endif
#endif // __CCCONFIG_H__ #endif // __CCCONFIG_H__

View File

@ -2,13 +2,6 @@
-------------------------------- --------------------------------
-- @module Helper -- @module Helper
--------------------------------
-- @function [parent=#Helper] seekActionWidgetByActionTag
-- @param self
-- @param #ccui.Widget widget
-- @param #int int
-- @return Widget#Widget ret (return value: ccui.Widget)
-------------------------------- --------------------------------
-- @function [parent=#Helper] seekWidgetByTag -- @function [parent=#Helper] seekWidgetByTag
-- @param self -- @param self
@ -17,10 +10,10 @@
-- @return Widget#Widget ret (return value: ccui.Widget) -- @return Widget#Widget ret (return value: ccui.Widget)
-------------------------------- --------------------------------
-- @function [parent=#Helper] seekWidgetByRelativeName -- @function [parent=#Helper] seekActionWidgetByActionTag
-- @param self -- @param self
-- @param #ccui.Widget widget -- @param #ccui.Widget widget
-- @param #char char -- @param #int int
-- @return Widget#Widget ret (return value: ccui.Widget) -- @return Widget#Widget ret (return value: ccui.Widget)
-------------------------------- --------------------------------

View File

@ -111,6 +111,12 @@
-- @param self -- @param self
-- @return string#string ret (return value: string) -- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#Slider] hitTest
-- @param self
-- @param #point_table point
-- @return bool#bool ret (return value: bool)
-------------------------------- --------------------------------
-- @function [parent=#Slider] getContentSize -- @function [parent=#Slider] getContentSize
-- @param self -- @param self

View File

@ -1 +1 @@
4fac42101ef2fb9622f22ccabc18c918622908ad d608beef525313b9c497786a1dd7b2460ff65d84

View File

@ -366,7 +366,6 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);
#endif // __cocos2dx_ui_h__ #endif // __cocos2dx_ui_h__

View File

@ -377,6 +377,16 @@ void Slider::setPercent(int percent)
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size); spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
} }
} }
bool Slider::hitTest(const cocos2d::Point &pt)
{
Point nsp = this->_slidBallNormalRenderer->convertToNodeSpace(pt);
Rect ballRect = this->_slidBallNormalRenderer->getTextureRect();
if (ballRect.containsPoint(nsp)) {
return true;
}
return false;
}
bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent) bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent)
{ {

View File

@ -189,6 +189,8 @@ public:
//override "ignoreContentAdaptWithSize" method of widget. //override "ignoreContentAdaptWithSize" method of widget.
virtual void ignoreContentAdaptWithSize(bool ignore) override; virtual void ignoreContentAdaptWithSize(bool ignore) override;
//override the widget's hitTest function to perfom its own
virtual bool hitTest(const Point &pt) override;
/** /**
* Returns the "class name" of widget. * Returns the "class name" of widget.
*/ */

View File

@ -21,7 +21,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <malloc.h>
#ifndef WIN32
#include <alloca.h>
#endif
#include "chipmunk_private.h" #include "chipmunk_private.h"

View File

@ -1 +1 @@
d53bc7d6e68a49984c5971344f59bba8414d142b 8cce920bd091a03ab1e10db03eb397451b0d70c5

View File

@ -1,4 +1,6 @@
require "Cocos2d" require "Cocos2d"
require "Cocos2dConstants"
-- cclog -- cclog
cclog = function(...) cclog = function(...)
print(string.format(...)) print(string.format(...))
@ -43,7 +45,7 @@ local function main()
local frameHeight = 95 local frameHeight = 95
-- create dog animate -- create dog animate
local textureDog = cc.TextureCache:getInstance():addImage("dog.png") local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png")
local rect = cc.rect(0, 0, frameWidth, frameHeight) local rect = cc.rect(0, 0, frameWidth, frameHeight)
local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect)
rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight)
@ -206,7 +208,7 @@ local function main()
-- uncomment below for the BlackBerry version -- uncomment below for the BlackBerry version
local bgMusicPath = nil local bgMusicPath = nil
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then
bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf")
else else
bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3")
end end

View File

@ -1,4 +1,6 @@
require "Cocos2d" require "Cocos2d"
require "Cocos2dConstants"
-- cclog -- cclog
cclog = function(...) cclog = function(...)
print(string.format(...)) print(string.format(...))
@ -43,7 +45,7 @@ local function main()
local frameHeight = 95 local frameHeight = 95
-- create dog animate -- create dog animate
local textureDog = cc.TextureCache:getInstance():addImage("dog.png") local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png")
local rect = cc.rect(0, 0, frameWidth, frameHeight) local rect = cc.rect(0, 0, frameWidth, frameHeight)
local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect)
rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight)
@ -206,7 +208,7 @@ local function main()
-- uncomment below for the BlackBerry version -- uncomment below for the BlackBerry version
local bgMusicPath = nil local bgMusicPath = nil
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then
bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf")
else else
bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3")
end end

View File

@ -637,9 +637,8 @@ std::string LayerGradientTest::subtitle() const
//------------------------------------------------------------------ //------------------------------------------------------------------
LayerGradientTest2::LayerGradientTest2() LayerGradientTest2::LayerGradientTest2()
{ {
auto layer = new LayerGradient; auto layer = LayerGradient::create();
layer->initWithColor(Color4B(255,0,0,255), Color4B(255,255,0,255)); layer->initWithColor(Color4B(255,0,0,255), Color4B(255,255,0,255));
layer->autorelease();
addChild(layer); addChild(layer);
} }

View File

@ -1,4 +1,6 @@
require "Cocos2d" require "Cocos2d"
require "Cocos2dConstants"
-- cclog -- cclog
cclog = function(...) cclog = function(...)
print(string.format(...)) print(string.format(...))
@ -39,7 +41,7 @@ local function main()
local frameHeight = 95 local frameHeight = 95
-- create dog animate -- create dog animate
local textureDog = cc.TextureCache:getInstance():addImage("res/dog.png") local textureDog = cc.Director:getInstance():getTextureCache():addImage("res/dog.png")
local rect = cc.rect(0, 0, frameWidth, frameHeight) local rect = cc.rect(0, 0, frameWidth, frameHeight)
local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect)
rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight)
@ -195,7 +197,7 @@ local function main()
-- uncomment below for the BlackBerry version -- uncomment below for the BlackBerry version
local bgMusicPath = nil local bgMusicPath = nil
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then
bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf")
else else
bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3")
end end