Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2371-add-lua-ios-mac

Conflicts:
	scripting/lua/cocos2dx_support/LuaCocos2d.cpp
This commit is contained in:
James Chen 2013-07-04 17:15:09 +08:00
commit a67ac821f7
61 changed files with 354 additions and 343 deletions

View File

@ -504,6 +504,9 @@ Developers:
smilingpoplar (YangLe) smilingpoplar (YangLe)
Fixing a bug that CCScale9Sprite doesn't support rotated spriteframe in atlas. Fixing a bug that CCScale9Sprite doesn't support rotated spriteframe in atlas.
xxuejie
Add namespace prefix to selector macros
Retired Core Developers: Retired Core Developers:
WenSheng Yang WenSheng Yang

View File

@ -208,12 +208,12 @@ void AtlasNode::setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor)
// AtlasNode - CocosNodeTexture protocol // AtlasNode - CocosNodeTexture protocol
ccBlendFunc AtlasNode::getBlendFunc() const ccBlendFunc& AtlasNode::getBlendFunc() const
{ {
return _blendFunc; return _blendFunc;
} }
void AtlasNode::setBlendFunc(ccBlendFunc blendFunc) void AtlasNode::setBlendFunc(const ccBlendFunc &blendFunc)
{ {
_blendFunc = blendFunc; _blendFunc = blendFunc;
} }

View File

@ -69,7 +69,7 @@ protected:
// protocol variables // protocol variables
bool _isOpacityModifyRGB; bool _isOpacityModifyRGB;
CC_PROPERTY(ccBlendFunc, _blendFunc, BlendFunc); CC_PROPERTY_PASS_BY_REF(ccBlendFunc, _blendFunc, BlendFunc);
// quads to draw // quads to draw
CC_PROPERTY(unsigned int, _quadsToDraw, QuadsToDraw); CC_PROPERTY(unsigned int, _quadsToDraw, QuadsToDraw);

View File

@ -149,7 +149,7 @@ bool Node::init()
return true; return true;
} }
float Node::getSkewX() float Node::getSkewX() const
{ {
return _skewX; return _skewX;
} }
@ -160,7 +160,7 @@ void Node::setSkewX(float newSkewX)
_transformDirty = _inverseDirty = true; _transformDirty = _inverseDirty = true;
} }
float Node::getSkewY() float Node::getSkewY() const
{ {
return _skewY; return _skewY;
} }
@ -173,7 +173,7 @@ void Node::setSkewY(float newSkewY)
} }
/// zOrder getter /// zOrder getter
int Node::getZOrder() int Node::getZOrder() const
{ {
return _ZOrder; return _ZOrder;
} }
@ -195,7 +195,7 @@ void Node::setZOrder(int z)
} }
/// vertexZ getter /// vertexZ getter
float Node::getVertexZ() float Node::getVertexZ() const
{ {
return _vertexZ; return _vertexZ;
} }
@ -209,7 +209,7 @@ void Node::setVertexZ(float var)
/// rotation getter /// rotation getter
float Node::getRotation() float Node::getRotation() const
{ {
CCAssert(_rotationX == _rotationY, "CCNode#rotation. RotationX != RotationY. Don't know which one to return"); CCAssert(_rotationX == _rotationY, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
return _rotationX; return _rotationX;
@ -222,7 +222,7 @@ void Node::setRotation(float newRotation)
_transformDirty = _inverseDirty = true; _transformDirty = _inverseDirty = true;
} }
float Node::getRotationX() float Node::getRotationX() const
{ {
return _rotationX; return _rotationX;
} }
@ -233,7 +233,7 @@ void Node::setRotationX(float fRotationX)
_transformDirty = _inverseDirty = true; _transformDirty = _inverseDirty = true;
} }
float Node::getRotationY() float Node::getRotationY() const
{ {
return _rotationY; return _rotationY;
} }
@ -245,7 +245,7 @@ void Node::setRotationY(float fRotationY)
} }
/// scale getter /// scale getter
float Node::getScale(void) float Node::getScale(void) const
{ {
CCAssert( _scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return"); CCAssert( _scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
return _scaleX; return _scaleX;
@ -259,7 +259,7 @@ void Node::setScale(float scale)
} }
/// scaleX getter /// scaleX getter
float Node::getScaleX() float Node::getScaleX() const
{ {
return _scaleX; return _scaleX;
} }
@ -272,7 +272,7 @@ void Node::setScaleX(float newScaleX)
} }
/// scaleY getter /// scaleY getter
float Node::getScaleY() float Node::getScaleY() const
{ {
return _scaleY; return _scaleY;
} }
@ -285,7 +285,7 @@ void Node::setScaleY(float newScaleY)
} }
/// position getter /// position getter
const Point& Node::getPosition() const Point& Node::getPosition() const
{ {
return _position; return _position;
} }
@ -297,7 +297,7 @@ void Node::setPosition(const Point& newPosition)
_transformDirty = _inverseDirty = true; _transformDirty = _inverseDirty = true;
} }
void Node::getPosition(float* x, float* y) void Node::getPosition(float* x, float* y) const
{ {
*x = _position.x; *x = _position.x;
*y = _position.y; *y = _position.y;
@ -308,12 +308,12 @@ void Node::setPosition(float x, float y)
setPosition(ccp(x, y)); setPosition(ccp(x, y));
} }
float Node::getPositionX(void) float Node::getPositionX(void) const
{ {
return _position.x; return _position.x;
} }
float Node::getPositionY(void) float Node::getPositionY(void) const
{ {
return _position.y; return _position.y;
} }
@ -367,7 +367,7 @@ void Node::setGrid(GridBase* pGrid)
/// isVisible getter /// isVisible getter
bool Node::isVisible() bool Node::isVisible() const
{ {
return _visible; return _visible;
} }
@ -378,13 +378,13 @@ void Node::setVisible(bool var)
_visible = var; _visible = var;
} }
const Point& Node::getAnchorPointInPoints() const Point& Node::getAnchorPointInPoints() const
{ {
return _anchorPointInPoints; return _anchorPointInPoints;
} }
/// anchorPoint getter /// anchorPoint getter
const Point& Node::getAnchorPoint() const Point& Node::getAnchorPoint() const
{ {
return _anchorPoint; return _anchorPoint;
} }
@ -417,7 +417,7 @@ void Node::setContentSize(const Size & size)
} }
// isRunning getter // isRunning getter
bool Node::isRunning() bool Node::isRunning() const
{ {
return _running; return _running;
} }
@ -434,7 +434,7 @@ void Node::setParent(Node * var)
} }
/// isRelativeAnchorPoint getter /// isRelativeAnchorPoint getter
bool Node::isIgnoreAnchorPointForPosition() bool Node::isIgnoreAnchorPointForPosition() const
{ {
return _ignoreAnchorPointForPosition; return _ignoreAnchorPointForPosition;
} }
@ -472,7 +472,7 @@ void Node::setUserData(void *var)
_userData = var; _userData = var;
} }
unsigned int Node::getOrderOfArrival() unsigned int Node::getOrderOfArrival() const
{ {
return _orderOfArrival; return _orderOfArrival;
} }
@ -492,7 +492,7 @@ Object* Node::getUserObject()
return _userObject; return _userObject;
} }
ccGLServerState Node::getGLServerState() ccGLServerState Node::getGLServerState() const
{ {
return _GLServerState; return _GLServerState;
} }
@ -552,7 +552,7 @@ void Node::cleanup()
} }
const char* Node::description() const char* Node::description() const
{ {
return String::createWithFormat("<Node | Tag = %d>", _tag)->getCString(); return String::createWithFormat("<Node | Tag = %d>", _tag)->getCString();
} }
@ -1334,12 +1334,12 @@ bool NodeRGBA::init()
return false; return false;
} }
GLubyte NodeRGBA::getOpacity(void) GLubyte NodeRGBA::getOpacity(void) const
{ {
return _realOpacity; return _realOpacity;
} }
GLubyte NodeRGBA::getDisplayedOpacity(void) GLubyte NodeRGBA::getDisplayedOpacity(void) const
{ {
return _displayedOpacity; return _displayedOpacity;
} }
@ -1378,7 +1378,7 @@ void NodeRGBA::updateDisplayedOpacity(GLubyte parentOpacity)
} }
} }
bool NodeRGBA::isCascadeOpacityEnabled(void) bool NodeRGBA::isCascadeOpacityEnabled(void) const
{ {
return _cascadeOpacityEnabled; return _cascadeOpacityEnabled;
} }
@ -1388,12 +1388,12 @@ void NodeRGBA::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
_cascadeOpacityEnabled = cascadeOpacityEnabled; _cascadeOpacityEnabled = cascadeOpacityEnabled;
} }
const ccColor3B& NodeRGBA::getColor(void) const ccColor3B& NodeRGBA::getColor(void) const
{ {
return _realColor; return _realColor;
} }
const ccColor3B& NodeRGBA::getDisplayedColor() const ccColor3B& NodeRGBA::getDisplayedColor() const
{ {
return _displayedColor; return _displayedColor;
} }
@ -1435,7 +1435,7 @@ void NodeRGBA::updateDisplayedColor(const ccColor3B& parentColor)
} }
} }
bool NodeRGBA::isCascadeColorEnabled(void) bool NodeRGBA::isCascadeColorEnabled(void) const
{ {
return _cascadeColorEnabled; return _cascadeColorEnabled;
} }

View File

@ -156,7 +156,7 @@ public:
* Gets the description string. It makes debugging easier. * Gets the description string. It makes debugging easier.
* @return A string terminated with '\0' * @return A string terminated with '\0'
*/ */
const char* description(void); const char* description(void) const;
/// @} end of initializers /// @} end of initializers
@ -192,7 +192,7 @@ public:
* *
* @return The Z order. * @return The Z order.
*/ */
virtual int getZOrder(); virtual int getZOrder() const;
/** /**
@ -215,7 +215,7 @@ public:
* *
* @return OpenGL Z vertex of this node * @return OpenGL Z vertex of this node
*/ */
virtual float getVertexZ(); virtual float getVertexZ() const;
/** /**
@ -233,7 +233,7 @@ public:
* *
* @return The scale factor on X axis. * @return The scale factor on X axis.
*/ */
virtual float getScaleX(); virtual float getScaleX() const;
/** /**
@ -251,7 +251,7 @@ public:
* *
* @return The scale factor on Y axis. * @return The scale factor on Y axis.
*/ */
virtual float getScaleY(); virtual float getScaleY() const;
/** /**
@ -270,7 +270,7 @@ public:
* *
* @return The scale factor of the node. * @return The scale factor of the node.
*/ */
virtual float getScale(); virtual float getScale() const;
/** /**
@ -294,7 +294,7 @@ public:
* *
* @return The position (x,y) of the node in OpenGL coordinates * @return The position (x,y) of the node in OpenGL coordinates
*/ */
virtual const Point& getPosition(); virtual const Point& getPosition() const;
/** /**
* Sets position in a more efficient way. * Sets position in a more efficient way.
* *
@ -317,15 +317,15 @@ public:
* *
* @see setPosition(float, float) * @see setPosition(float, float)
*/ */
virtual void getPosition(float* x, float* y); virtual void getPosition(float* x, float* y) const;
/** /**
* Gets/Sets x or y coordinate individually for position. * Gets/Sets x or y coordinate individually for position.
* These methods are used in Lua and Javascript Bindings * These methods are used in Lua and Javascript Bindings
*/ */
virtual void setPositionX(float x); virtual void setPositionX(float x);
virtual float getPositionX(void); virtual float getPositionX(void) const;
virtual void setPositionY(float y); virtual void setPositionY(float y);
virtual float getPositionY(void); virtual float getPositionY(void) const;
/** /**
@ -345,7 +345,7 @@ public:
* *
* @return The X skew angle of the node in degrees. * @return The X skew angle of the node in degrees.
*/ */
virtual float getSkewX(); virtual float getSkewX() const;
/** /**
@ -365,7 +365,7 @@ public:
* *
* @return The Y skew angle of the node in degrees. * @return The Y skew angle of the node in degrees.
*/ */
virtual float getSkewY(); virtual float getSkewY() const;
/** /**
@ -387,7 +387,7 @@ public:
* *
* @return The anchor point of node. * @return The anchor point of node.
*/ */
virtual const Point& getAnchorPoint(); virtual const Point& getAnchorPoint() const;
/** /**
* Returns the anchorPoint in absolute pixels. * Returns the anchorPoint in absolute pixels.
* *
@ -396,7 +396,7 @@ public:
* *
* @return The anchor point in absolute pixels. * @return The anchor point in absolute pixels.
*/ */
virtual const Point& getAnchorPointInPoints(); virtual const Point& getAnchorPointInPoints() const;
/** /**
@ -433,7 +433,7 @@ public:
* *
* @return true if the node is visible, false if the node is hidden. * @return true if the node is visible, false if the node is hidden.
*/ */
virtual bool isVisible(); virtual bool isVisible() const;
/** /**
@ -452,7 +452,7 @@ public:
* *
* @return The rotation of the node in degrees. * @return The rotation of the node in degrees.
*/ */
virtual float getRotation(); virtual float getRotation() const;
/** /**
@ -471,7 +471,7 @@ public:
* *
* @return The X rotation in degrees. * @return The X rotation in degrees.
*/ */
virtual float getRotationX(); virtual float getRotationX() const;
/** /**
@ -490,7 +490,7 @@ public:
* *
* @return The Y rotation in degrees. * @return The Y rotation in degrees.
*/ */
virtual float getRotationY(); virtual float getRotationY() const;
/** /**
@ -511,7 +511,7 @@ public:
* *
* @return The arrival order. * @return The arrival order.
*/ */
virtual unsigned int getOrderOfArrival(); virtual unsigned int getOrderOfArrival() const;
/** /**
@ -525,7 +525,7 @@ public:
* *
* @return The state of OpenGL server side. * @return The state of OpenGL server side.
*/ */
virtual ccGLServerState getGLServerState(); virtual ccGLServerState getGLServerState() const;
/** /**
@ -545,7 +545,7 @@ public:
* *
* @return true if the anchor point will be (0,0) when you position this node. * @return true if the anchor point will be (0,0) when you position this node.
*/ */
virtual bool isIgnoreAnchorPointForPosition(); virtual bool isIgnoreAnchorPointForPosition() const;
/// @} end of Setters & Getters for Graphic Peroperties /// @} end of Setters & Getters for Graphic Peroperties
@ -855,7 +855,7 @@ public:
* *
* @return Whether or not the node is running. * @return Whether or not the node is running.
*/ */
virtual bool isRunning(); virtual bool isRunning() const;
/// @{ /// @{
@ -896,7 +896,7 @@ public:
* *
* @return A number that indicates a lua function. * @return A number that indicates a lua function.
*/ */
inline int getScriptHandler() { return _scriptHandler; }; inline int getScriptHandler() const { return _scriptHandler; };
/** /**
* Schedules for lua script. * Schedules for lua script.
@ -1428,22 +1428,22 @@ public:
virtual bool init(); virtual bool init();
virtual GLubyte getOpacity(); virtual GLubyte getOpacity() const;
virtual GLubyte getDisplayedOpacity(); virtual GLubyte getDisplayedOpacity() const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled(); virtual bool isCascadeOpacityEnabled() const;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled); virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
virtual const ccColor3B& getColor(void); virtual const ccColor3B& getColor(void) const;
virtual const ccColor3B& getDisplayedColor(); virtual const ccColor3B& getDisplayedColor() const;
virtual void setColor(const ccColor3B& color); virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled(); virtual bool isCascadeColorEnabled() const;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled); virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
virtual void setOpacityModifyRGB(bool bValue) {}; virtual void setOpacityModifyRGB(bool bValue) {};
virtual bool isOpacityModifyRGB() { return false; }; virtual bool isOpacityModifyRGB() const { return false; };
protected: protected:
GLubyte _displayedOpacity; GLubyte _displayedOpacity;

View File

@ -100,14 +100,14 @@ typedef void (Object::*SEL_MenuHandler)(Object*);
typedef void (Object::*SEL_EventHandler)(Event*); typedef void (Object::*SEL_EventHandler)(Event*);
typedef int (Object::*SEL_Compare)(Object*); typedef int (Object::*SEL_Compare)(Object*);
#define schedule_selector(_SELECTOR) static_cast<SEL_SCHEDULE>(&_SELECTOR) #define schedule_selector(_SELECTOR) static_cast<cocos2d::SEL_SCHEDULE>(&_SELECTOR)
#define callfunc_selector(_SELECTOR) static_cast<SEL_CallFunc>(&_SELECTOR) #define callfunc_selector(_SELECTOR) static_cast<cocos2d::SEL_CallFunc>(&_SELECTOR)
#define callfuncN_selector(_SELECTOR) static_cast<SEL_CallFuncN>(&_SELECTOR) #define callfuncN_selector(_SELECTOR) static_cast<cocos2d::SEL_CallFuncN>(&_SELECTOR)
#define callfuncND_selector(_SELECTOR) static_cast<SEL_CallFuncND>(&_SELECTOR) #define callfuncND_selector(_SELECTOR) static_cast<cocos2d::SEL_CallFuncND>(&_SELECTOR)
#define callfuncO_selector(_SELECTOR) static_cast<SEL_CallFuncO>(&_SELECTOR) #define callfuncO_selector(_SELECTOR) static_cast<cocos2d::SEL_CallFuncO>(&_SELECTOR)
#define menu_selector(_SELECTOR) static_cast<SEL_MenuHandler>(&_SELECTOR) #define menu_selector(_SELECTOR) static_cast<cocos2d::SEL_MenuHandler>(&_SELECTOR)
#define event_selector(_SELECTOR) static_cast<SEL_EventHandler>(&_SELECTOR) #define event_selector(_SELECTOR) static_cast<cocos2d::SEL_EventHandler>(&_SELECTOR)
#define compare_selector(_SELECTOR) static_cast<SEL_Compare>(&_SELECTOR) #define compare_selector(_SELECTOR) static_cast<cocos2d::SEL_Compare>(&_SELECTOR)
// new callbacks based on C++11 // new callbacks based on C++11
#define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__) #define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__)

View File

@ -430,7 +430,7 @@ void DrawNode::clear()
_dirty = true; _dirty = true;
} }
ccBlendFunc DrawNode::getBlendFunc() const const ccBlendFunc& DrawNode::getBlendFunc() const
{ {
return _blendFunc; return _blendFunc;
} }

View File

@ -74,7 +74,7 @@ public:
/** Clear the geometry in the node's buffer. */ /** Clear the geometry in the node's buffer. */
void clear(); void clear();
ccBlendFunc getBlendFunc() const; const ccBlendFunc& getBlendFunc() const;
void setBlendFunc(const ccBlendFunc &blendFunc); void setBlendFunc(const ccBlendFunc &blendFunc);
DrawNode(); DrawNode();

View File

@ -50,21 +50,21 @@ public:
* *
* @return The ccColor3B contains R,G,B bytes. * @return The ccColor3B contains R,G,B bytes.
*/ */
virtual const ccColor3B& getColor(void) = 0; virtual const ccColor3B& getColor(void) const = 0;
/** /**
* Returns the displayed color. * Returns the displayed color.
* *
* @return The ccColor3B contains R,G,B bytes. * @return The ccColor3B contains R,G,B bytes.
*/ */
virtual const ccColor3B& getDisplayedColor(void) = 0; virtual const ccColor3B& getDisplayedColor(void) const = 0;
/** /**
* Returns the displayed opacity. * Returns the displayed opacity.
* *
* @return The opacity of sprite, from 0 ~ 255 * @return The opacity of sprite, from 0 ~ 255
*/ */
virtual GLubyte getDisplayedOpacity(void) = 0; virtual GLubyte getDisplayedOpacity(void) const = 0;
/** /**
* Returns the opacity. * Returns the opacity.
* *
@ -73,7 +73,7 @@ public:
* *
* @return The opacity of sprite, from 0 ~ 255 * @return The opacity of sprite, from 0 ~ 255
*/ */
virtual GLubyte getOpacity(void) = 0; virtual GLubyte getOpacity(void) const = 0;
/** /**
* Changes the opacity. * Changes the opacity.
@ -100,12 +100,12 @@ public:
* *
* @return Returns opacity modify flag. * @return Returns opacity modify flag.
*/ */
virtual bool isOpacityModifyRGB(void) = 0; virtual bool isOpacityModifyRGB(void) const = 0;
/** /**
* whether or not color should be propagated to its children. * whether or not color should be propagated to its children.
*/ */
virtual bool isCascadeColorEnabled(void) = 0; virtual bool isCascadeColorEnabled(void) const = 0;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled) = 0; virtual void setCascadeColorEnabled(bool cascadeColorEnabled) = 0;
/** /**
@ -116,7 +116,7 @@ public:
/** /**
* whether or not opacity should be propagated to its children. * whether or not opacity should be propagated to its children.
*/ */
virtual bool isCascadeOpacityEnabled(void) = 0; virtual bool isCascadeOpacityEnabled(void) const = 0;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) = 0; virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) = 0;
/** /**
@ -140,14 +140,14 @@ public:
* e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}. * e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
* *
*/ */
virtual void setBlendFunc(ccBlendFunc blendFunc) = 0; virtual void setBlendFunc(const ccBlendFunc &blendFunc) = 0;
/** /**
* Returns the blending function that is currently being used. * Returns the blending function that is currently being used.
* *
* @return A ccBlendFunc structure with source and destination factor which specified pixel arithmetic. * @return A ccBlendFunc structure with source and destination factor which specified pixel arithmetic.
*/ */
virtual ccBlendFunc getBlendFunc(void) = 0; virtual const ccBlendFunc &getBlendFunc(void) const = 0;
}; };
/** /**
@ -195,7 +195,7 @@ public:
* *
* @return The string that is currently being used in this label * @return The string that is currently being used in this label
*/ */
virtual const char* getString(void) = 0; virtual const char* getString(void) const = 0;
}; };
/** /**

View File

@ -54,11 +54,11 @@ void KeyboardDispatcher::setKeyReleaseDelegate(KeyboardDelegate delegate)
bool KeyboardDispatcher::dispatchKeyboardEvent(int keyCode, bool pressed) bool KeyboardDispatcher::dispatchKeyboardEvent(int keyCode, bool pressed)
{ {
if (_keyPressDelegate != NULL && pressed) if (_keyPressDelegate != nullptr && pressed)
{ {
_keyPressDelegate(keyCode); _keyPressDelegate(keyCode);
} }
else if (_keyReleaseDelegate != NULL) else if (_keyReleaseDelegate != nullptr )
{ {
_keyReleaseDelegate(keyCode); _keyReleaseDelegate(keyCode);
} }

View File

@ -205,7 +205,7 @@ void LabelAtlas::setString(const char *label)
_quadsToDraw = len; _quadsToDraw = len;
} }
const char* LabelAtlas::getString(void) const char* LabelAtlas::getString(void) const
{ {
return _string.c_str(); return _string.c_str();
} }

View File

@ -81,7 +81,7 @@ public:
// super methods // super methods
virtual void updateAtlasValues(); virtual void updateAtlasValues();
virtual void setString(const char *label); virtual void setString(const char *label);
virtual const char* getString(void); virtual const char* getString(void) const;
#if CC_LABELATLAS_DEBUG_DRAW #if CC_LABELATLAS_DEBUG_DRAW
virtual void draw(); virtual void draw();

View File

@ -777,7 +777,7 @@ void LabelBMFont::setString(unsigned short *newString, bool needUpdateLabel)
} }
} }
const char* LabelBMFont::getString(void) const char* LabelBMFont::getString(void) const
{ {
return _initialStringUTF8.c_str(); return _initialStringUTF8.c_str();
} }
@ -788,12 +788,12 @@ void LabelBMFont::setCString(const char *label)
} }
//LabelBMFont - RGBAProtocol protocol //LabelBMFont - RGBAProtocol protocol
const ccColor3B& LabelBMFont::getColor() const ccColor3B& LabelBMFont::getColor() const
{ {
return _realColor; return _realColor;
} }
const ccColor3B& LabelBMFont::getDisplayedColor() const ccColor3B& LabelBMFont::getDisplayedColor() const
{ {
return _displayedColor; return _displayedColor;
} }
@ -813,12 +813,12 @@ void LabelBMFont::setColor(const ccColor3B& color)
} }
} }
GLubyte LabelBMFont::getOpacity(void) GLubyte LabelBMFont::getOpacity(void) const
{ {
return _realOpacity; return _realOpacity;
} }
GLubyte LabelBMFont::getDisplayedOpacity(void) GLubyte LabelBMFont::getDisplayedOpacity(void) const
{ {
return _displayedOpacity; return _displayedOpacity;
} }
@ -859,7 +859,7 @@ void LabelBMFont::setOpacityModifyRGB(bool var)
} }
} }
} }
bool LabelBMFont::isOpacityModifyRGB() bool LabelBMFont::isOpacityModifyRGB() const
{ {
return _isOpacityModifyRGB; return _isOpacityModifyRGB;
} }
@ -890,7 +890,7 @@ void LabelBMFont::updateDisplayedColor(const ccColor3B& parentColor)
} }
} }
bool LabelBMFont::isCascadeColorEnabled() bool LabelBMFont::isCascadeColorEnabled() const
{ {
return false; return false;
} }
@ -900,7 +900,7 @@ void LabelBMFont::setCascadeColorEnabled(bool cascadeColorEnabled)
_cascadeColorEnabled = cascadeColorEnabled; _cascadeColorEnabled = cascadeColorEnabled;
} }
bool LabelBMFont::isCascadeOpacityEnabled() bool LabelBMFont::isCascadeOpacityEnabled() const
{ {
return false; return false;
} }

View File

@ -214,7 +214,7 @@ public:
virtual void setString(const char *newString); virtual void setString(const char *newString);
virtual void setString(const char *newString, bool needUpdateLabel); virtual void setString(const char *newString, bool needUpdateLabel);
virtual const char* getString(void); virtual const char* getString(void) const;
virtual void setCString(const char *label); virtual void setCString(const char *label);
virtual void setAnchorPoint(const Point& var); virtual void setAnchorPoint(const Point& var);
virtual void updateLabel(); virtual void updateLabel();
@ -226,18 +226,19 @@ public:
virtual void setScaleY(float scaleY); virtual void setScaleY(float scaleY);
// RGBAProtocol // RGBAProtocol
virtual bool isOpacityModifyRGB(); virtual bool isOpacityModifyRGB() const;
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB); virtual GLubyte getOpacity(); virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
virtual GLubyte getDisplayedOpacity(); virtual GLubyte getOpacity() const;
virtual GLubyte getDisplayedOpacity() const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled(); virtual bool isCascadeOpacityEnabled() const;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled); virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
virtual const ccColor3B& getColor(void); virtual const ccColor3B& getColor(void) const;
virtual const ccColor3B& getDisplayedColor(); virtual const ccColor3B& getDisplayedColor() const;
virtual void setColor(const ccColor3B& color); virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled(); virtual bool isCascadeColorEnabled() const;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled); virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
void setFntFile(const char* fntFile); void setFntFile(const char* fntFile);

View File

@ -183,7 +183,7 @@ void LabelTTF::setString(const char *string)
} }
} }
const char* LabelTTF::getString(void) const char* LabelTTF::getString(void) const
{ {
return _string.c_str(); return _string.c_str();
} }
@ -193,7 +193,7 @@ const char* LabelTTF::description()
return String::createWithFormat("<LabelTTF | FontName = %s, FontSize = %.1f>", _fontName->c_str(), _fontSize)->getCString(); return String::createWithFormat("<LabelTTF | FontName = %s, FontSize = %.1f>", _fontName->c_str(), _fontSize)->getCString();
} }
TextAlignment LabelTTF::getHorizontalAlignment() TextAlignment LabelTTF::getHorizontalAlignment() const
{ {
return _alignment; return _alignment;
} }
@ -212,7 +212,7 @@ void LabelTTF::setHorizontalAlignment(TextAlignment alignment)
} }
} }
VerticalTextAlignment LabelTTF::getVerticalAlignment() VerticalTextAlignment LabelTTF::getVerticalAlignment() const
{ {
return _vAlignment; return _vAlignment;
} }
@ -231,7 +231,7 @@ void LabelTTF::setVerticalAlignment(VerticalTextAlignment verticalAlignment)
} }
} }
Size LabelTTF::getDimensions() const Size& LabelTTF::getDimensions() const
{ {
return _dimensions; return _dimensions;
} }
@ -250,7 +250,7 @@ void LabelTTF::setDimensions(const Size &dim)
} }
} }
float LabelTTF::getFontSize() float LabelTTF::getFontSize() const
{ {
return _fontSize; return _fontSize;
} }
@ -269,7 +269,7 @@ void LabelTTF::setFontSize(float fontSize)
} }
} }
const char* LabelTTF::getFontName() const char* LabelTTF::getFontName() const
{ {
return _fontName->c_str(); return _fontName->c_str();
} }

View File

@ -134,21 +134,21 @@ public:
* @warning Changing the string is as expensive as creating a new LabelTTF. To obtain better performance use LabelAtlas * @warning Changing the string is as expensive as creating a new LabelTTF. To obtain better performance use LabelAtlas
*/ */
virtual void setString(const char *label); virtual void setString(const char *label);
virtual const char* getString(void); virtual const char* getString(void) const;
TextAlignment getHorizontalAlignment(); TextAlignment getHorizontalAlignment() const;
void setHorizontalAlignment(TextAlignment alignment); void setHorizontalAlignment(TextAlignment alignment);
VerticalTextAlignment getVerticalAlignment(); VerticalTextAlignment getVerticalAlignment() const;
void setVerticalAlignment(VerticalTextAlignment verticalAlignment); void setVerticalAlignment(VerticalTextAlignment verticalAlignment);
Size getDimensions(); const Size& getDimensions() const;
void setDimensions(const Size &dim); void setDimensions(const Size &dim);
float getFontSize(); float getFontSize() const;
void setFontSize(float fontSize); void setFontSize(float fontSize);
const char* getFontName(); const char* getFontName() const;
void setFontName(const char *fontName); void setFontName(const char *fontName);
private: private:

View File

@ -151,7 +151,7 @@ int Layer::excuteScriptTouchHandler(int nEventType, Set *pTouches)
} }
/// isTouchEnabled getter /// isTouchEnabled getter
bool Layer::isTouchEnabled() bool Layer::isTouchEnabled() const
{ {
return _touchEnabled; return _touchEnabled;
} }
@ -204,18 +204,18 @@ void Layer::setTouchPriority(int priority)
} }
} }
int Layer::getTouchPriority() int Layer::getTouchPriority() const
{ {
return _touchPriority; return _touchPriority;
} }
int Layer::getTouchMode() int Layer::getTouchMode() const
{ {
return _touchMode; return _touchMode;
} }
/// isAccelerometerEnabled getter /// isAccelerometerEnabled getter
bool Layer::isAccelerometerEnabled() bool Layer::isAccelerometerEnabled() const
{ {
return _accelerometerEnabled; return _accelerometerEnabled;
} }
@ -276,7 +276,7 @@ void Layer::unregisterScriptAccelerateHandler(void)
} }
/// isKeyboardEnabled getter /// isKeyboardEnabled getter
bool Layer::isKeyboardEnabled() bool Layer::isKeyboardEnabled() const
{ {
return _keyboardEnabled; return _keyboardEnabled;
} }
@ -302,7 +302,7 @@ void Layer::setKeyboardEnabled(bool enabled)
} }
/// isKeypadEnabled getter /// isKeypadEnabled getter
bool Layer::isKeypadEnabled() bool Layer::isKeypadEnabled() const
{ {
return _keypadEnabled; return _keypadEnabled;
} }
@ -545,12 +545,12 @@ bool LayerRGBA::init()
} }
} }
GLubyte LayerRGBA::getOpacity() GLubyte LayerRGBA::getOpacity() const
{ {
return _realOpacity; return _realOpacity;
} }
GLubyte LayerRGBA::getDisplayedOpacity() GLubyte LayerRGBA::getDisplayedOpacity() const
{ {
return _displayedOpacity; return _displayedOpacity;
} }
@ -572,12 +572,12 @@ void LayerRGBA::setOpacity(GLubyte opacity)
} }
} }
const ccColor3B& LayerRGBA::getColor() const ccColor3B& LayerRGBA::getColor() const
{ {
return _realColor; return _realColor;
} }
const ccColor3B& LayerRGBA::getDisplayedColor() const ccColor3B& LayerRGBA::getDisplayedColor() const
{ {
return _displayedColor; return _displayedColor;
} }
@ -637,7 +637,7 @@ void LayerRGBA::updateDisplayedColor(const ccColor3B& parentColor)
} }
} }
bool LayerRGBA::isCascadeOpacityEnabled() bool LayerRGBA::isCascadeOpacityEnabled() const
{ {
return _cascadeOpacityEnabled; return _cascadeOpacityEnabled;
} }
@ -647,7 +647,7 @@ void LayerRGBA::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
_cascadeOpacityEnabled = cascadeOpacityEnabled; _cascadeOpacityEnabled = cascadeOpacityEnabled;
} }
bool LayerRGBA::isCascadeColorEnabled() bool LayerRGBA::isCascadeColorEnabled() const
{ {
return _cascadeColorEnabled; return _cascadeColorEnabled;
} }
@ -671,12 +671,12 @@ LayerColor::~LayerColor()
} }
/// blendFunc getter /// blendFunc getter
ccBlendFunc LayerColor::getBlendFunc() const ccBlendFunc &LayerColor::getBlendFunc() const
{ {
return _blendFunc; return _blendFunc;
} }
/// blendFunc setter /// blendFunc setter
void LayerColor::setBlendFunc(ccBlendFunc var) void LayerColor::setBlendFunc(const ccBlendFunc &var)
{ {
_blendFunc = var; _blendFunc = var;
} }
@ -959,7 +959,7 @@ void LayerGradient::updateColor()
_squareColors[3].a = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)); _squareColors[3].a = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c));
} }
const ccColor3B& LayerGradient::getStartColor() const ccColor3B& LayerGradient::getStartColor() const
{ {
return _realColor; return _realColor;
} }
@ -975,7 +975,7 @@ void LayerGradient::setEndColor(const ccColor3B& color)
updateColor(); updateColor();
} }
const ccColor3B& LayerGradient::getEndColor() const ccColor3B& LayerGradient::getEndColor() const
{ {
return _endColor; return _endColor;
} }
@ -1008,12 +1008,12 @@ void LayerGradient::setVector(const Point& var)
updateColor(); updateColor();
} }
const Point& LayerGradient::getVector() const Point& LayerGradient::getVector() const
{ {
return _alongVector; return _alongVector;
} }
bool LayerGradient::isCompressedInterpolation() bool LayerGradient::isCompressedInterpolation() const
{ {
return _compressedInterpolation; return _compressedInterpolation;
} }

View File

@ -112,21 +112,21 @@ public:
Only the touches of this node will be affected. This "method" is not propagated to it's children. Only the touches of this node will be affected. This "method" is not propagated to it's children.
@since v0.8.1 @since v0.8.1
*/ */
virtual bool isTouchEnabled(); virtual bool isTouchEnabled() const;
virtual void setTouchEnabled(bool value); virtual void setTouchEnabled(bool value);
virtual void setTouchMode(ccTouchesMode mode); virtual void setTouchMode(ccTouchesMode mode);
virtual int getTouchMode(); virtual int getTouchMode() const;
/** priority of the touch events. Default is 0 */ /** priority of the touch events. Default is 0 */
virtual void setTouchPriority(int priority); virtual void setTouchPriority(int priority);
virtual int getTouchPriority(); virtual int getTouchPriority() const;
/** whether or not it will receive Accelerometer events /** whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property. You can enable / disable accelerometer events with this property.
@since v0.8.1 @since v0.8.1
*/ */
virtual bool isAccelerometerEnabled(); virtual bool isAccelerometerEnabled() const;
virtual void setAccelerometerEnabled(bool value); virtual void setAccelerometerEnabled(bool value);
virtual void setAccelerometerInterval(double interval); virtual void setAccelerometerInterval(double interval);
@ -135,12 +135,12 @@ public:
it's new in cocos2d-x it's new in cocos2d-x
*/ */
virtual bool isKeyboardEnabled(); virtual bool isKeyboardEnabled() const;
virtual void setKeyboardEnabled(bool value); virtual void setKeyboardEnabled(bool value);
virtual void keyPressed(int keyCode) {}; virtual void keyPressed(int keyCode) {};
virtual void keyReleased(int keyCode) {}; virtual void keyReleased(int keyCode) {};
virtual bool isKeypadEnabled(); virtual bool isKeypadEnabled() const;
virtual void setKeypadEnabled(bool value); virtual void setKeypadEnabled(bool value);
/** Register keypad events handler */ /** Register keypad events handler */
@ -151,9 +151,9 @@ public:
virtual void keyBackClicked(void); virtual void keyBackClicked(void);
virtual void keyMenuClicked(void); virtual void keyMenuClicked(void);
inline TouchScriptHandlerEntry* getScriptTouchHandlerEntry() { return _scriptTouchHandlerEntry; }; inline TouchScriptHandlerEntry* getScriptTouchHandlerEntry() const { return _scriptTouchHandlerEntry; };
inline ScriptHandlerEntry* getScriptKeypadHandlerEntry() { return _scriptKeypadHandlerEntry; }; inline ScriptHandlerEntry* getScriptKeypadHandlerEntry() const { return _scriptKeypadHandlerEntry; };
inline ScriptHandlerEntry* getScriptAccelerateHandlerEntry() { return _scriptAccelerateHandlerEntry; }; inline ScriptHandlerEntry* getScriptAccelerateHandlerEntry() const { return _scriptAccelerateHandlerEntry; };
protected: protected:
bool _touchEnabled; bool _touchEnabled;
bool _accelerometerEnabled; bool _accelerometerEnabled;
@ -195,22 +195,22 @@ public:
virtual bool init(); virtual bool init();
virtual GLubyte getOpacity(); virtual GLubyte getOpacity() const;
virtual GLubyte getDisplayedOpacity(); virtual GLubyte getDisplayedOpacity() const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled(); virtual bool isCascadeOpacityEnabled() const;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled); virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
virtual const ccColor3B& getColor(); virtual const ccColor3B& getColor() const;
virtual const ccColor3B& getDisplayedColor(); virtual const ccColor3B& getDisplayedColor() const;
virtual void setColor(const ccColor3B& color); virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled(); virtual bool isCascadeColorEnabled() const;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled); virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
virtual void setOpacityModifyRGB(bool bValue) {} virtual void setOpacityModifyRGB(bool bValue) {}
virtual bool isOpacityModifyRGB() { return false; } virtual bool isOpacityModifyRGB() const { return false; }
protected: protected:
GLubyte _displayedOpacity, _realOpacity; GLubyte _displayedOpacity, _realOpacity;
ccColor3B _displayedColor, _realColor; ccColor3B _displayedColor, _realColor;
@ -266,10 +266,10 @@ public:
void changeWidthAndHeight(GLfloat w ,GLfloat h); void changeWidthAndHeight(GLfloat w ,GLfloat h);
/** BlendFunction. Conforms to BlendProtocol protocol */ /** BlendFunction. Conforms to BlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, _blendFunc, BlendFunc) CC_PROPERTY_PASS_BY_REF(ccBlendFunc, _blendFunc, BlendFunc)
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) const { return false;}
virtual void setColor(const ccColor3B &color); virtual void setColor(const ccColor3B &color);
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
@ -318,6 +318,12 @@ public:
/** Initializes the Layer with a gradient between start and end in the direction of v. */ /** Initializes the Layer with a gradient between start and end in the direction of v. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end, const Point& v); virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end, const Point& v);
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: YES
*/
virtual void setCompressedInterpolation(bool bCompressedInterpolation);
virtual bool isCompressedInterpolation() const;
CC_PROPERTY_PASS_BY_REF(ccColor3B, _startColor, StartColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, _startColor, StartColor)
CC_PROPERTY_PASS_BY_REF(ccColor3B, _endColor, EndColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, _endColor, EndColor)
@ -325,17 +331,11 @@ public:
CC_PROPERTY(GLubyte, _endOpacity, EndOpacity) CC_PROPERTY(GLubyte, _endOpacity, EndOpacity)
CC_PROPERTY_PASS_BY_REF(Point, _alongVector, Vector) CC_PROPERTY_PASS_BY_REF(Point, _alongVector, Vector)
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: YES
*/
protected:
bool _compressedInterpolation;
public:
virtual void setCompressedInterpolation(bool bCompressedInterpolation);
virtual bool isCompressedInterpolation();
protected: protected:
virtual void updateColor(); virtual void updateColor();
protected:
bool _compressedInterpolation;
}; };

View File

@ -144,7 +144,7 @@ void MenuItem::setEnabled(bool enabled)
_enabled = enabled; _enabled = enabled;
} }
bool MenuItem::isEnabled() bool MenuItem::isEnabled() const
{ {
return _enabled; return _enabled;
} }
@ -156,7 +156,7 @@ Rect MenuItem::rect()
_contentSize.width, _contentSize.height); _contentSize.width, _contentSize.height);
} }
bool MenuItem::isSelected() bool MenuItem::isSelected() const
{ {
return _selected; return _selected;
} }
@ -179,7 +179,7 @@ void MenuItem::setCallback(const ccMenuCallback& callback)
//CCMenuItemLabel //CCMenuItemLabel
// //
const ccColor3B& MenuItemLabel::getDisabledColor() const ccColor3B& MenuItemLabel::getDisabledColor() const
{ {
return _disabledColor; return _disabledColor;
} }

View File

@ -90,15 +90,15 @@ public:
/** Register menu handler script function */ /** Register menu handler script function */
virtual void registerScriptTapHandler(int nHandler); virtual void registerScriptTapHandler(int nHandler);
virtual void unregisterScriptTapHandler(void); virtual void unregisterScriptTapHandler(void);
int getScriptTapHandler() { return _scriptTapHandler; }; int getScriptTapHandler() const { return _scriptTapHandler; };
virtual bool isEnabled(); virtual bool isEnabled() const;
//@note: It's 'setIsEnable' in cocos2d-iphone. //@note: It's 'setIsEnable' in cocos2d-iphone.
virtual void setEnabled(bool value); virtual void setEnabled(bool value);
virtual bool isSelected(); virtual bool isSelected() const;
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) const { return false;}
/** set the target/selector of the menu item*/ /** set the target/selector of the menu item*/
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector); CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
@ -292,7 +292,7 @@ public:
virtual void setEnabled(bool bEnabled); virtual void setEnabled(bool bEnabled);
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) const { return false;}
protected: protected:
virtual void updateImagesVisibility(); virtual void updateImagesVisibility();
}; };
@ -399,7 +399,7 @@ public:
virtual void setEnabled(bool var); virtual void setEnabled(bool var);
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) const { return false;}
}; };

View File

@ -169,12 +169,12 @@ void MotionStreak::setTexture(Texture2D *texture)
} }
} }
void MotionStreak::setBlendFunc(ccBlendFunc blendFunc) void MotionStreak::setBlendFunc(const ccBlendFunc &blendFunc)
{ {
_blendFunc = blendFunc; _blendFunc = blendFunc;
} }
ccBlendFunc MotionStreak::getBlendFunc(void) const ccBlendFunc& MotionStreak::getBlendFunc(void) const
{ {
return _blendFunc; return _blendFunc;
} }
@ -184,7 +184,7 @@ void MotionStreak::setOpacity(GLubyte opacity)
CCAssert(false, "Set opacity no supported"); CCAssert(false, "Set opacity no supported");
} }
GLubyte MotionStreak::getOpacity(void) GLubyte MotionStreak::getOpacity(void) const
{ {
CCAssert(false, "Opacity no supported"); CCAssert(false, "Opacity no supported");
return 0; return 0;
@ -195,7 +195,7 @@ void MotionStreak::setOpacityModifyRGB(bool bValue)
CC_UNUSED_PARAM(bValue); CC_UNUSED_PARAM(bValue);
} }
bool MotionStreak::isOpacityModifyRGB(void) bool MotionStreak::isOpacityModifyRGB(void) const
{ {
return false; return false;
} }

View File

@ -76,18 +76,18 @@ public:
/* Implement interfaces */ /* Implement interfaces */
virtual Texture2D* getTexture(void); virtual Texture2D* getTexture(void);
virtual void setTexture(Texture2D *texture); virtual void setTexture(Texture2D *texture);
virtual void setBlendFunc(ccBlendFunc blendFunc); virtual void setBlendFunc(const ccBlendFunc &blendFunc);
virtual ccBlendFunc getBlendFunc(void); virtual const ccBlendFunc& getBlendFunc(void) const;
virtual GLubyte getOpacity(void); virtual GLubyte getOpacity(void) const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void setOpacityModifyRGB(bool bValue); virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void); virtual bool isOpacityModifyRGB(void) const;
/** When fast mode is enabled, new points are added faster but with lower precision */ /** When fast mode is enabled, new points are added faster but with lower precision */
inline bool isFastMode() { return _fastMode; } inline bool isFastMode() const { return _fastMode; }
inline void setFastMode(bool bFastMode) { _fastMode = bFastMode; } inline void setFastMode(bool bFastMode) { _fastMode = bFastMode; }
inline bool isStartingPositionInitialized() { return _startingPositionInitialized; } inline bool isStartingPositionInitialized() const { return _startingPositionInitialized; }
inline void setStartingPositionInitialized(bool bStartingPositionInitialized) inline void setStartingPositionInitialized(bool bStartingPositionInitialized)
{ {
_startingPositionInitialized = bStartingPositionInitialized; _startingPositionInitialized = bStartingPositionInitialized;

View File

@ -509,12 +509,12 @@ Texture2D* ParticleBatchNode::getTexture(void)
return _textureAtlas->getTexture(); return _textureAtlas->getTexture();
} }
void ParticleBatchNode::setBlendFunc(ccBlendFunc blendFunc) void ParticleBatchNode::setBlendFunc(const ccBlendFunc &blendFunc)
{ {
_blendFunc = blendFunc; _blendFunc = blendFunc;
} }
// returns the blending function used for the texture // returns the blending function used for the texture
ccBlendFunc ParticleBatchNode::getBlendFunc(void) const ccBlendFunc& ParticleBatchNode::getBlendFunc(void) const
{ {
return _blendFunc; return _blendFunc;
} }

View File

@ -102,9 +102,9 @@ public:
virtual Texture2D* getTexture(void); virtual Texture2D* getTexture(void);
// sets a new texture. it will be retained // sets a new texture. it will be retained
virtual void setTexture(Texture2D *texture); virtual void setTexture(Texture2D *texture);
virtual void setBlendFunc(ccBlendFunc blendFunc); virtual void setBlendFunc(const ccBlendFunc &blendFunc);
// returns the blending function used for the texture // returns the blending function used for the texture
virtual ccBlendFunc getBlendFunc(void); virtual const ccBlendFunc& getBlendFunc(void) const;
void visit(); void visit();

View File

@ -1046,7 +1046,7 @@ void ParticleSystem::setDuration(float var)
_duration = var; _duration = var;
} }
const Point& ParticleSystem::getSourcePosition() const Point& ParticleSystem::getSourcePosition() const
{ {
return _sourcePosition; return _sourcePosition;
} }
@ -1056,7 +1056,7 @@ void ParticleSystem::setSourcePosition(const Point& var)
_sourcePosition = var; _sourcePosition = var;
} }
const Point& ParticleSystem::getPosVar() const Point& ParticleSystem::getPosVar() const
{ {
return _posVar; return _posVar;
} }
@ -1146,7 +1146,7 @@ void ParticleSystem::setEndSizeVar(float var)
_endSizeVar = var; _endSizeVar = var;
} }
const ccColor4F& ParticleSystem::getStartColor() const ccColor4F& ParticleSystem::getStartColor() const
{ {
return _startColor; return _startColor;
} }
@ -1156,7 +1156,7 @@ void ParticleSystem::setStartColor(const ccColor4F& var)
_startColor = var; _startColor = var;
} }
const ccColor4F& ParticleSystem::getStartColorVar() const ccColor4F& ParticleSystem::getStartColorVar() const
{ {
return _startColorVar; return _startColorVar;
} }
@ -1166,7 +1166,7 @@ void ParticleSystem::setStartColorVar(const ccColor4F& var)
_startColorVar = var; _startColorVar = var;
} }
const ccColor4F& ParticleSystem::getEndColor() const ccColor4F& ParticleSystem::getEndColor() const
{ {
return _endColor; return _endColor;
} }
@ -1176,7 +1176,7 @@ void ParticleSystem::setEndColor(const ccColor4F& var)
_endColor = var; _endColor = var;
} }
const ccColor4F& ParticleSystem::getEndColorVar() const ccColor4F& ParticleSystem::getEndColorVar() const
{ {
return _endColorVar; return _endColorVar;
} }
@ -1246,12 +1246,12 @@ void ParticleSystem::setTotalParticles(unsigned int var)
_totalParticles = var; _totalParticles = var;
} }
ccBlendFunc ParticleSystem::getBlendFunc() const ccBlendFunc& ParticleSystem::getBlendFunc() const
{ {
return _blendFunc; return _blendFunc;
} }
void ParticleSystem::setBlendFunc(ccBlendFunc blendFunc) void ParticleSystem::setBlendFunc(const ccBlendFunc &blendFunc)
{ {
if( _blendFunc.src != blendFunc.src || _blendFunc.dst != blendFunc.dst ) { if( _blendFunc.src != blendFunc.src || _blendFunc.dst != blendFunc.dst ) {
_blendFunc = blendFunc; _blendFunc = blendFunc;

View File

@ -327,7 +327,7 @@ public:
/** conforms to CocosNodeTexture protocol */ /** conforms to CocosNodeTexture protocol */
CC_PROPERTY(Texture2D*, _texture, Texture) CC_PROPERTY(Texture2D*, _texture, Texture)
/** conforms to CocosNodeTexture protocol */ /** conforms to CocosNodeTexture protocol */
CC_PROPERTY(ccBlendFunc, _blendFunc, BlendFunc) CC_PROPERTY_PASS_BY_REF(ccBlendFunc, _blendFunc, BlendFunc)
/** does the alpha value modify color */ /** does the alpha value modify color */
CC_PROPERTY(bool, _opacityModifyRGB, OpacityModifyRGB) CC_PROPERTY(bool, _opacityModifyRGB, OpacityModifyRGB)

View File

@ -143,7 +143,7 @@ public: virtual void set##funName(varType var);
#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\ #define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\ protected: varType varName;\
public: virtual const varType& get##funName(void);\ public: virtual const varType& get##funName(void) const;\
public: virtual void set##funName(const varType& var); public: virtual void set##funName(const varType& var);
/** CC_SYNTHESIZE_READONLY is used to declare a protected variable. /** CC_SYNTHESIZE_READONLY is used to declare a protected variable.

View File

@ -505,9 +505,8 @@ static int eventQueueCount;
{ {
if( dispatchEvents_ ) { if( dispatchEvents_ ) {
tListEntry *entry, *tmp; tListEntry *entry, *tmp;
cocos2d::Director::sharedDirector()->getKeyboardDispatcher()->dispatchKeyboardEvent(event.keyCode, true);
cocos2d::KeyboardDispatcher *kbDisp = cocos2d::Director::sharedDirector()->getKeyboardDispatcher();
kbDisp->dispatchKeyboardEvent(event.keyCode, true);
DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) { DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) {
if ( entry->flags & kImplementsKeyDown ) { if ( entry->flags & kImplementsKeyDown ) {
void *swallows = [entry->delegate performSelector:@selector(ccKeyDown:) withObject:event]; void *swallows = [entry->delegate performSelector:@selector(ccKeyDown:) withObject:event];
@ -522,9 +521,8 @@ static int eventQueueCount;
{ {
if( dispatchEvents_ ) { if( dispatchEvents_ ) {
tListEntry *entry, *tmp; tListEntry *entry, *tmp;
cocos2d::Director::sharedDirector()->getKeyboardDispatcher()->dispatchKeyboardEvent(event.keyCode, false);
cocos2d::KeyboardDispatcher *kbDisp = cocos2d::Director::sharedDirector()->getKeyboardDispatcher();
kbDisp->dispatchKeyboardEvent(event.keyCode, true);
DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) { DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) {
if ( entry->flags & kImplementsKeyUp ) { if ( entry->flags & kImplementsKeyUp ) {
void *swallows = [entry->delegate performSelector:@selector(ccKeyUp:) withObject:event]; void *swallows = [entry->delegate performSelector:@selector(ccKeyUp:) withObject:event];

View File

@ -32,6 +32,9 @@ THE SOFTWARE.
#include "keypad_dispatcher/CCKeypadDispatcher.h" #include "keypad_dispatcher/CCKeypadDispatcher.h"
#include "support/CCPointExtension.h" #include "support/CCPointExtension.h"
#include "CCApplication.h" #include "CCApplication.h"
#ifdef CC_KEYBOARD_SUPPORT
#include "keyboard_dispatcher/CCKeyboardDispatcher.h"
#endif
NS_CC_BEGIN NS_CC_BEGIN
@ -449,6 +452,9 @@ LRESULT EGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
#ifdef CC_KEYBOARD_SUPPORT
Director::sharedDirector()->getKeyboardDispatcher()->dispatchKeyboardEvent(wParam, true);
#endif
if (wParam == VK_F1 || wParam == VK_F2) if (wParam == VK_F1 || wParam == VK_F2)
{ {
Director* pDirector = Director::sharedDirector(); Director* pDirector = Director::sharedDirector();
@ -466,6 +472,9 @@ LRESULT EGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_KEYUP: case WM_KEYUP:
#ifdef CC_KEYBOARD_SUPPORT
Director::sharedDirector()->getKeyboardDispatcher()->dispatchKeyboardEvent(wParam, false);
#endif
if ( _lpfnAccelerometerKeyHook!=NULL ) if ( _lpfnAccelerometerKeyHook!=NULL )
{ {
(*_lpfnAccelerometerKeyHook)( message,wParam,lParam ); (*_lpfnAccelerometerKeyHook)( message,wParam,lParam );

View File

@ -877,7 +877,7 @@ void Sprite::setFlipX(bool bFlipX)
} }
} }
bool Sprite::isFlipX(void) bool Sprite::isFlipX(void) const
{ {
return _flipX; return _flipX;
} }
@ -891,7 +891,7 @@ void Sprite::setFlipY(bool bFlipY)
} }
} }
bool Sprite::isFlipY(void) bool Sprite::isFlipY(void) const
{ {
return _flipY; return _flipY;
} }
@ -959,7 +959,7 @@ void Sprite::setOpacityModifyRGB(bool modify)
} }
} }
bool Sprite::isOpacityModifyRGB(void) bool Sprite::isOpacityModifyRGB(void) const
{ {
return _opacityModifyRGB; return _opacityModifyRGB;
} }
@ -1011,7 +1011,7 @@ void Sprite::setDisplayFrameWithAnimationName(const char *animationName, int fra
setDisplayFrame(frame->getSpriteFrame()); setDisplayFrame(frame->getSpriteFrame());
} }
bool Sprite::isFrameDisplayed(SpriteFrame *pFrame) bool Sprite::isFrameDisplayed(SpriteFrame *pFrame) const
{ {
Rect r = pFrame->getRect(); Rect r = pFrame->getRect();

View File

@ -263,8 +263,8 @@ public:
/// @name Functions inherited from TextureProtocol /// @name Functions inherited from TextureProtocol
virtual void setTexture(Texture2D *texture); virtual void setTexture(Texture2D *texture);
virtual Texture2D* getTexture(void); virtual Texture2D* getTexture(void);
inline void setBlendFunc(ccBlendFunc blendFunc) { _blendFunc = blendFunc; } inline void setBlendFunc(const ccBlendFunc &blendFunc) { _blendFunc = blendFunc; }
inline ccBlendFunc getBlendFunc(void) { return _blendFunc; } inline const ccBlendFunc& getBlendFunc(void) const { return _blendFunc; }
/// @} /// @}
/// @{ /// @{
@ -298,7 +298,7 @@ public:
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void setOpacityModifyRGB(bool modify); virtual void setOpacityModifyRGB(bool modify);
virtual bool isOpacityModifyRGB(void); virtual bool isOpacityModifyRGB(void) const;
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
/// @} /// @}
@ -372,7 +372,7 @@ public:
/** /**
* Returns whether or not a SpriteFrame is being displayed * Returns whether or not a SpriteFrame is being displayed
*/ */
virtual bool isFrameDisplayed(SpriteFrame *pFrame); virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
/** /**
* Returns the current displayed frame. * Returns the current displayed frame.
@ -400,7 +400,7 @@ public:
* *
* @return true if the sprite needs to be updated in the Atlas, false otherwise. * @return true if the sprite needs to be updated in the Atlas, false otherwise.
*/ */
inline virtual bool isDirty(void) { return _dirty; } inline virtual bool isDirty(void) const { return _dirty; }
/** /**
* Makes the Sprite to be updated in the Atlas. * Makes the Sprite to be updated in the Atlas.
@ -415,12 +415,12 @@ public:
/** /**
* Returns whether or not the texture rectangle is rotated. * Returns whether or not the texture rectangle is rotated.
*/ */
inline bool isTextureRectRotated(void) { return _rectRotated; } inline bool isTextureRectRotated(void) const { return _rectRotated; }
/** /**
* Returns the index used on the TextureAtlas. * Returns the index used on the TextureAtlas.
*/ */
inline unsigned int getAtlasIndex(void) { return _atlasIndex; } inline unsigned int getAtlasIndex(void) const { return _atlasIndex; }
/** /**
* Sets the index used on the TextureAtlas. * Sets the index used on the TextureAtlas.
@ -446,7 +446,7 @@ public:
/** /**
* Gets the offset position of the sprite. Calculated automatically by editors like Zwoptex. * Gets the offset position of the sprite. Calculated automatically by editors like Zwoptex.
*/ */
inline const Point& getOffsetPosition(void) { return _offsetPosition; } inline const Point& getOffsetPosition(void) const { return _offsetPosition; }
/** /**
@ -459,7 +459,7 @@ public:
* *
* @return true if the sprite is flipped horizaontally, false otherwise. * @return true if the sprite is flipped horizaontally, false otherwise.
*/ */
bool isFlipX(void); bool isFlipX(void) const;
/** /**
* Sets whether the sprite should be flipped horizontally or not. * Sets whether the sprite should be flipped horizontally or not.
* *
@ -477,7 +477,7 @@ public:
* *
* @return true if the sprite is flipped vertically, flase otherwise. * @return true if the sprite is flipped vertically, flase otherwise.
*/ */
bool isFlipY(void); bool isFlipY(void) const;
/** /**
* Sets whether the sprite should be flipped vertically or not. * Sets whether the sprite should be flipped vertically or not.
* *

View File

@ -673,12 +673,12 @@ void SpriteBatchNode::updateBlendFunc(void)
} }
// CocosNodeTexture protocol // CocosNodeTexture protocol
void SpriteBatchNode::setBlendFunc(ccBlendFunc blendFunc) void SpriteBatchNode::setBlendFunc(const ccBlendFunc &blendFunc)
{ {
_blendFunc = blendFunc; _blendFunc = blendFunc;
} }
ccBlendFunc SpriteBatchNode::getBlendFunc(void) const ccBlendFunc& SpriteBatchNode::getBlendFunc(void) const
{ {
return _blendFunc; return _blendFunc;
} }

View File

@ -131,8 +131,8 @@ public:
// TextureProtocol // TextureProtocol
virtual Texture2D* getTexture(void); virtual Texture2D* getTexture(void);
virtual void setTexture(Texture2D *texture); virtual void setTexture(Texture2D *texture);
virtual void setBlendFunc(ccBlendFunc blendFunc); virtual void setBlendFunc(const ccBlendFunc &blendFunc);
virtual ccBlendFunc getBlendFunc(void); virtual const ccBlendFunc& getBlendFunc(void) const;
virtual void visit(void); virtual void visit(void);
virtual void addChild(Node * child); virtual void addChild(Node * child);

View File

@ -64,7 +64,7 @@ public:
inline void setRotated(bool bRotated) { _rotated = bRotated; } inline void setRotated(bool bRotated) { _rotated = bRotated; }
/** get rect of the frame */ /** get rect of the frame */
inline const Rect& getRect(void) { return _rect; } inline const Rect& getRect(void) const { return _rect; }
/** set rect of the frame */ /** set rect of the frame */
void setRect(const Rect& rect); void setRect(const Rect& rect);

View File

@ -326,7 +326,7 @@ void TextFieldTTF::setString(const char *text)
_charCount = _calcCharCount(_inputText->c_str()); _charCount = _calcCharCount(_inputText->c_str());
} }
const char* TextFieldTTF::getString(void) const char* TextFieldTTF::getString(void) const
{ {
return _inputText->c_str(); return _inputText->c_str();
} }

View File

@ -133,7 +133,7 @@ public:
// input text property // input text property
public: public:
virtual void setString(const char *text); virtual void setString(const char *text);
virtual const char* getString(void); virtual const char* getString(void) const;
protected: protected:
std::string * _inputText; std::string * _inputText;

View File

@ -169,7 +169,7 @@ void* Texture2D::keepData(void *data, unsigned int length)
return data; return data;
} }
bool Texture2D::hasPremultipliedAlpha() bool Texture2D::hasPremultipliedAlpha() const
{ {
return _hasPremultipliedAlpha; return _hasPremultipliedAlpha;
} }
@ -264,7 +264,7 @@ bool Texture2D::initWithData(const void *data, Texture2DPixelFormat pixelFormat,
} }
const char* Texture2D::description(void) const char* Texture2D::description(void) const
{ {
return String::createWithFormat("<Texture2D | Name = %u | Dimensions = %u x %u | Coordinates = (%.2f, %.2f)>", _name, _pixelsWide, _pixelsHigh, _maxS, _maxT)->getCString(); return String::createWithFormat("<Texture2D | Name = %u | Dimensions = %u x %u | Coordinates = (%.2f, %.2f)>", _name, _pixelsWide, _pixelsHigh, _maxS, _maxT)->getCString();
} }
@ -771,22 +771,22 @@ void Texture2D::generateMipmap()
_hasMipmaps = true; _hasMipmaps = true;
} }
bool Texture2D::hasMipmaps() bool Texture2D::hasMipmaps() const
{ {
return _hasMipmaps; return _hasMipmaps;
} }
void Texture2D::setTexParameters(ccTexParams *texParams) void Texture2D::setTexParameters(const ccTexParams &texParams)
{ {
CCAssert( (_pixelsWide == ccNextPOT(_pixelsWide) || texParams->wrapS == GL_CLAMP_TO_EDGE) && CCAssert( (_pixelsWide == ccNextPOT(_pixelsWide) || texParams.wrapS == GL_CLAMP_TO_EDGE) &&
(_pixelsHigh == ccNextPOT(_pixelsHigh) || texParams->wrapT == GL_CLAMP_TO_EDGE), (_pixelsHigh == ccNextPOT(_pixelsHigh) || texParams.wrapT == GL_CLAMP_TO_EDGE),
"GL_CLAMP_TO_EDGE should be used in NPOT dimensions"); "GL_CLAMP_TO_EDGE should be used in NPOT dimensions");
ccGLBindTexture2D( _name ); ccGLBindTexture2D( _name );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texParams->minFilter ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texParams.minFilter );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texParams->magFilter ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texParams.magFilter );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texParams->wrapS ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texParams.wrapS );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texParams->wrapT ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texParams.wrapT );
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
VolatileTexture::setTexParameters(this, texParams); VolatileTexture::setTexParameters(this, texParams);
@ -809,7 +809,7 @@ void Texture2D::setAliasTexParameters()
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
ccTexParams texParams = {(GLuint)(_hasMipmaps?GL_NEAREST_MIPMAP_NEAREST:GL_NEAREST),GL_NEAREST,GL_NONE,GL_NONE}; ccTexParams texParams = {(GLuint)(_hasMipmaps?GL_NEAREST_MIPMAP_NEAREST:GL_NEAREST),GL_NEAREST,GL_NONE,GL_NONE};
VolatileTexture::setTexParameters(this, &texParams); VolatileTexture::setTexParameters(this, texParams);
#endif #endif
} }
@ -829,11 +829,11 @@ void Texture2D::setAntiAliasTexParameters()
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
ccTexParams texParams = {(GLuint)(_hasMipmaps?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR),GL_LINEAR,GL_NONE,GL_NONE}; ccTexParams texParams = {(GLuint)(_hasMipmaps?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR),GL_LINEAR,GL_NONE,GL_NONE};
VolatileTexture::setTexParameters(this, &texParams); VolatileTexture::setTexParameters(this, texParams);
#endif #endif
} }
const char* Texture2D::stringForFormat() const char* Texture2D::stringForFormat() const
{ {
switch (_pixelFormat) switch (_pixelFormat)
{ {
@ -891,7 +891,7 @@ Texture2DPixelFormat Texture2D::defaultAlphaPixelFormat()
return g_defaultAlphaPixelFormat; return g_defaultAlphaPixelFormat;
} }
unsigned int Texture2D::bitsPerPixelForFormat(Texture2DPixelFormat format) unsigned int Texture2D::bitsPerPixelForFormat(Texture2DPixelFormat format) const
{ {
unsigned int ret=0; unsigned int ret=0;
@ -936,7 +936,7 @@ unsigned int Texture2D::bitsPerPixelForFormat(Texture2DPixelFormat format)
return ret; return ret;
} }
unsigned int Texture2D::bitsPerPixelForFormat() unsigned int Texture2D::bitsPerPixelForFormat() const
{ {
return this->bitsPerPixelForFormat(_pixelFormat); return this->bitsPerPixelForFormat(_pixelFormat);
} }

View File

@ -105,7 +105,7 @@ public:
Texture2D(); Texture2D();
virtual ~Texture2D(); virtual ~Texture2D();
const char* description(void); const char* description(void) const;
/** These functions are needed to create mutable textures */ /** These functions are needed to create mutable textures */
void releaseData(void *data); void releaseData(void *data);
@ -151,7 +151,7 @@ public:
@since v0.8 @since v0.8
*/ */
void setTexParameters(ccTexParams* texParams); void setTexParameters(const ccTexParams& texParams);
/** sets antialias texture parameters: /** sets antialias texture parameters:
- GL_TEXTURE_MIN_FILTER = GL_LINEAR - GL_TEXTURE_MIN_FILTER = GL_LINEAR
@ -183,17 +183,17 @@ public:
/** returns the pixel format. /** returns the pixel format.
@since v2.0 @since v2.0
*/ */
const char* stringForFormat(); const char* stringForFormat() const;
/** returns the bits-per-pixel of the in-memory OpenGL texture /** returns the bits-per-pixel of the in-memory OpenGL texture
@since v1.0 @since v1.0
*/ */
unsigned int bitsPerPixelForFormat(); unsigned int bitsPerPixelForFormat() const;
/** Helper functions that returns bits per pixels for a given format. /** Helper functions that returns bits per pixels for a given format.
@since v2.0 @since v2.0
*/ */
unsigned int bitsPerPixelForFormat(Texture2DPixelFormat format); unsigned int bitsPerPixelForFormat(Texture2DPixelFormat format) const;
/** sets the default pixel format for UIImagescontains alpha channel. /** sets the default pixel format for UIImagescontains alpha channel.
If the UIImage contains alpha channel, then the options are: If the UIImage contains alpha channel, then the options are:
@ -231,9 +231,9 @@ public:
/** content size */ /** content size */
const Size& getContentSizeInPixels(); const Size& getContentSizeInPixels();
bool hasPremultipliedAlpha(); bool hasPremultipliedAlpha() const;
bool hasMipmaps(); bool hasMipmaps() const;
private: private:
bool initPremultipliedATextureWithImage(Image * image, unsigned int pixelsWide, unsigned int pixelsHigh); bool initPremultipliedATextureWithImage(Image * image, unsigned int pixelsWide, unsigned int pixelsHigh);

View File

@ -746,18 +746,18 @@ void VolatileTexture::addStringTexture(Texture2D *tt, const char* text, const Si
vt->_text = text; vt->_text = text;
} }
void VolatileTexture::setTexParameters(Texture2D *t, ccTexParams *texParams) void VolatileTexture::setTexParameters(Texture2D *t, const ccTexParams &texParams)
{ {
VolatileTexture *vt = findVolotileTexture(t); VolatileTexture *vt = findVolotileTexture(t);
if (texParams->minFilter != GL_NONE) if (texParams.minFilter != GL_NONE)
vt->_texParams.minFilter = texParams->minFilter; vt->_texParams.minFilter = texParams.minFilter;
if (texParams->magFilter != GL_NONE) if (texParams.magFilter != GL_NONE)
vt->_texParams.magFilter = texParams->magFilter; vt->_texParams.magFilter = texParams.magFilter;
if (texParams->wrapS != GL_NONE) if (texParams.wrapS != GL_NONE)
vt->_texParams.wrapS = texParams->wrapS; vt->_texParams.wrapS = texParams.wrapS;
if (texParams->wrapT != GL_NONE) if (texParams.wrapT != GL_NONE)
vt->_texParams.wrapT = texParams->wrapT; vt->_texParams.wrapT = texParams.wrapT;
} }
void VolatileTexture::removeTexture(Texture2D *t) void VolatileTexture::removeTexture(Texture2D *t)
@ -851,7 +851,7 @@ void VolatileTexture::reloadAllTextures()
default: default:
break; break;
} }
vt->texture->setTexParameters(&vt->_texParams); vt->texture->setTexParameters(vt->_texParams);
} }
isReloading = false; isReloading = false;

View File

@ -218,7 +218,7 @@ public:
static void addDataTexture(Texture2D *tt, void* data, Texture2DPixelFormat pixelFormat, const Size& contentSize); static void addDataTexture(Texture2D *tt, void* data, Texture2DPixelFormat pixelFormat, const Size& contentSize);
static void addImage(Texture2D *tt, Image *image); static void addImage(Texture2D *tt, Image *image);
static void setTexParameters(Texture2D *t, ccTexParams *texParams); static void setTexParameters(Texture2D *t, const ccTexParams &texParams);
static void removeTexture(Texture2D *t); static void removeTexture(Texture2D *t);
static void reloadAllTextures(); static void reloadAllTextures();

View File

@ -120,8 +120,8 @@ public:
*/ */
virtual void updateOffsetPoint(); virtual void updateOffsetPoint();
inline void setBlendFunc(ccBlendFunc blendFunc) { _blendFunc = blendFunc; } inline void setBlendFunc(const ccBlendFunc& blendFunc) { _blendFunc = blendFunc; }
inline ccBlendFunc getBlendFunc(void) { return _blendFunc; } inline const ccBlendFunc& getBlendFunc(void) const { return _blendFunc; }
protected: protected:

View File

@ -74,7 +74,7 @@ void Skin::setSkinData(const BaseData &var)
_skinTransform = nodeToParentTransform(); _skinTransform = nodeToParentTransform();
} }
const BaseData &Skin::getSkinData() const BaseData &Skin::getSkinData() const
{ {
return _skinData; return _skinData;
} }

View File

@ -271,11 +271,12 @@ bool CCSkeleton::setAttachment (const char* slotName, const char* attachmentName
// --- BlendProtocol // --- BlendProtocol
ccBlendFunc CCSkeleton::getBlendFunc () { const ccBlendFunc& CCSkeleton::getBlendFunc() const
{
return blendFunc; return blendFunc;
} }
void CCSkeleton::setBlendFunc (ccBlendFunc blendFunc) { void CCSkeleton::setBlendFunc( const ccBlendFunc &blendFunc) {
this->blendFunc = blendFunc; this->blendFunc = blendFunc;
} }

View File

@ -80,7 +80,7 @@ public:
bool setAttachment (const char* slotName, const char* attachmentName); bool setAttachment (const char* slotName, const char* attachmentName);
// --- BlendProtocol // --- BlendProtocol
CC_PROPERTY(cocos2d::ccBlendFunc, blendFunc, BlendFunc); CC_PROPERTY_PASS_BY_REF(cocos2d::ccBlendFunc, blendFunc, BlendFunc);
virtual void setOpacityModifyRGB (bool value); virtual void setOpacityModifyRGB (bool value);
virtual bool isOpacityModifyRGB (); virtual bool isOpacityModifyRGB ();

View File

@ -261,7 +261,7 @@ void TextureMipMap::onEnter()
Texture2D *texture0 = TextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas.png"); Texture2D *texture0 = TextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas.png");
texture0->generateMipmap(); texture0->generateMipmap();
ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE }; ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
texture0->setTexParameters(&texParams); texture0->setTexParameters(texParams);
Texture2D *texture1 = TextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png"); Texture2D *texture1 = TextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png");
@ -317,7 +317,7 @@ void TexturePVRMipMap::onEnter()
// support mipmap filtering // support mipmap filtering
ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE }; ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
imgMipMap->getTexture()->setTexParameters(&texParams); imgMipMap->getTexture()->setTexParameters(texParams);
} }
Sprite *img = Sprite::create("Images/logo-nomipmap.pvr"); Sprite *img = Sprite::create("Images/logo-nomipmap.pvr");
@ -363,7 +363,7 @@ void TexturePVRMipMap2::onEnter()
// support mipmap filtering // support mipmap filtering
ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE }; ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
imgMipMap->getTexture()->setTexParameters(&texParams); imgMipMap->getTexture()->setTexParameters(texParams);
Sprite *img = Sprite::create("Images/test_image.png"); Sprite *img = Sprite::create("Images/test_image.png");
img->setPosition(ccp( s.width/2.0f+100, s.height/2.0f)); img->setPosition(ccp( s.width/2.0f+100, s.height/2.0f));
@ -1545,7 +1545,7 @@ void TextureGlClamp::onEnter()
addChild(sprite, -1, kTagSprite1); addChild(sprite, -1, kTagSprite1);
sprite->setPosition(ccp(size.width/2,size.height/2)); sprite->setPosition(ccp(size.width/2,size.height/2));
ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE}; ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE};
sprite->getTexture()->setTexParameters(&params); sprite->getTexture()->setTexParameters(params);
auto rotate = RotateBy::create(4, 360); auto rotate = RotateBy::create(4, 360);
sprite->runAction(rotate); sprite->runAction(rotate);
@ -1582,7 +1582,7 @@ void TextureGlRepeat::onEnter()
addChild(sprite, -1, kTagSprite1); addChild(sprite, -1, kTagSprite1);
sprite->setPosition(ccp(size.width/2,size.height/2)); sprite->setPosition(ccp(size.width/2,size.height/2));
ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_REPEAT,GL_REPEAT}; ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_REPEAT,GL_REPEAT};
sprite->getTexture()->setTexParameters(&params); sprite->getTexture()->setTexParameters(params);
auto rotate = RotateBy::create(4, 360); auto rotate = RotateBy::create(4, 360);
sprite->runAction(rotate); sprite->runAction(rotate);

View File

@ -1 +1 @@
2fe7237c56cf52c3ca577e33fc39aa5c9e2469ba d97bee7049e0d811ef10d72b7558ca857c1721c3

View File

@ -1 +1 @@
eefb19f875e38a052ee562d826b34859d9169c89 af4e4c2177d9eee70c5a0bcc19a80176089d7eec

View File

@ -1 +1 @@
95de623da2cfd8eb0607e1eea576306341064846 4823a023cf264d8b8c7c2ac7934f21c30b776052

View File

@ -4,7 +4,7 @@ class CCLabelAtlas : public CCAtlasNode
void updateAtlasValues(); void updateAtlasValues();
void setString(const char *label); void setString(const char *label);
const char* getString(void); const char* getString(void) const;
CCTexture2D* getTexture(void); CCTexture2D* getTexture(void);
void setTexture(CCTexture2D *texture); void setTexture(CCTexture2D *texture);

View File

@ -11,7 +11,7 @@ class CCLabelBMFont : public CCSpriteBatchNode
void setString(const char *label); void setString(const char *label);
void setString(const char *label, bool fromUpdate); void setString(const char *label, bool fromUpdate);
void setCString(const char *label); void setCString(const char *label);
const char* getString(void); const char* getString(void) const;
void setAnchorPoint(const CCPoint & var); void setAnchorPoint(const CCPoint & var);
void setAlignment(CCTextAlignment alignment); void setAlignment(CCTextAlignment alignment);
@ -25,12 +25,12 @@ class CCLabelBMFont : public CCSpriteBatchNode
const char* getFntFile(); const char* getFntFile();
void setColor(const ccColor3B& color); void setColor(const ccColor3B& color);
const ccColor3B& getColor(void); const ccColor3B& getColor(void) const;
GLubyte getOpacity(void); GLubyte getOpacity(void) const;
void setOpacity(GLubyte opacity); void setOpacity(GLubyte opacity);
bool isOpacityModifyRGB(); bool isOpacityModifyRGB() const;
void setOpacityModifyRGB(bool isOpacityModifyRGB); void setOpacityModifyRGB(bool isOpacityModifyRGB);
static void purgeCachedData(); static void purgeCachedData();

View File

@ -5,21 +5,21 @@ class CCLabelTTF : public CCSprite
~CCLabelTTF(); ~CCLabelTTF();
bool init(); bool init();
void setString(const char *label); void setString(const char *label);
const char* getString(void); const char* getString(void) const;
CCTextAlignment getHorizontalAlignment(); CCTextAlignment getHorizontalAlignment() const;
void setHorizontalAlignment(CCTextAlignment alignment); void setHorizontalAlignment(CCTextAlignment alignment);
CCVerticalTextAlignment getVerticalAlignment(); CCVerticalTextAlignment getVerticalAlignment() const;
void setVerticalAlignment(CCVerticalTextAlignment verticalAlignment); void setVerticalAlignment(CCVerticalTextAlignment verticalAlignment);
CCSize getDimensions(); CCSize getDimensions() const;
void setDimensions(CCSize &dim); void setDimensions(CCSize &dim);
float getFontSize(); float getFontSize() const;
void setFontSize(float fontSize); void setFontSize(float fontSize);
const char* getFontName(); const char* getFontName() const;
void setFontName(const char *fontName); void setFontName(const char *fontName);
static CCLabelTTF * create(const char *str, const char *fontName, float fontSize, const CCSize& dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment); static CCLabelTTF * create(const char *str, const char *fontName, float fontSize, const CCSize& dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment);

View File

@ -6,18 +6,18 @@ typedef enum {
class CCLayer : public CCNode class CCLayer : public CCNode
{ {
void setTouchEnabled(bool bValue); void setTouchEnabled(bool bValue);
bool isTouchEnabled(); bool isTouchEnabled() const;
void setAccelerometerEnabled(bool bValue); void setAccelerometerEnabled(bool bValue);
bool isAccelerometerEnabled(); bool isAccelerometerEnabled() const;
void setKeypadEnabled(bool bValue); void setKeypadEnabled(bool bValue);
bool isKeypadEnabled(); bool isKeypadEnabled() const;
virtual void setTouchMode(ccTouchesMode mode); virtual void setTouchMode(ccTouchesMode mode);
virtual int getTouchMode(); virtual int getTouchMode() const;
virtual void setTouchPriority(int priority); virtual void setTouchPriority(int priority);
virtual int getTouchPriority(); virtual int getTouchPriority() const;
void registerScriptTouchHandler(LUA_FUNCTION nHandler, void registerScriptTouchHandler(LUA_FUNCTION nHandler,
bool bIsMultiTouches = false, bool bIsMultiTouches = false,
@ -43,22 +43,22 @@ class CCLayerRGBA : public CCLayer, public CCRGBAProtocol
virtual bool init(); virtual bool init();
virtual GLubyte getOpacity(); virtual GLubyte getOpacity() const;
virtual GLubyte getDisplayedOpacity(); virtual GLubyte getDisplayedOpacity() const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled(); virtual bool isCascadeOpacityEnabled() const;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled); virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
virtual const ccColor3B& getColor(); virtual const ccColor3B& getColor() const;
virtual const ccColor3B& getDisplayedColor(); virtual const ccColor3B& getDisplayedColor() const;
virtual void setColor(const ccColor3B& color); virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled(); virtual bool isCascadeColorEnabled() const;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled); virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
virtual void setOpacityModifyRGB(bool bValue); virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(); virtual bool isOpacityModifyRGB() const;
}; };
class CCLayerColor : public CCLayerRGBA class CCLayerColor : public CCLayerRGBA
@ -70,14 +70,12 @@ class CCLayerColor : public CCLayerRGBA
void setContentSize(const CCSize & var); void setContentSize(const CCSize & var);
void setOpacity(GLubyte var); void setOpacity(GLubyte var);
GLubyte getOpacity(void);
void setColor(ccColor3B Value); void setColor(ccColor3B Value);
ccColor3B getColor(void);
void setBlendFunc(ccBlendFunc Value); void setBlendFunc(ccBlendFunc Value);
ccBlendFunc getBlendFunc(void); ccBlendFunc getBlendFunc(void) const;
void setOpacityModifyRGB(bool bValue); void setOpacityModifyRGB(bool bValue);
bool isOpacityModifyRGB(void); bool isOpacityModifyRGB(void) const;
static CCLayerColor * create(ccColor4B color, GLfloat width, GLfloat height); static CCLayerColor * create(ccColor4B color, GLfloat width, GLfloat height);
static CCLayerColor * create(ccColor4B color); static CCLayerColor * create(ccColor4B color);
@ -86,9 +84,9 @@ class CCLayerColor : public CCLayerRGBA
class CCLayerGradient : public CCLayerColor class CCLayerGradient : public CCLayerColor
{ {
void setStartColor(ccColor3B colors); void setStartColor(ccColor3B colors);
ccColor3B getStartColor(); ccColor3B getStartColor() const;
void setEndColor(ccColor3B Value); void setEndColor(ccColor3B Value);
ccColor3B getEndColor(void); ccColor3B getEndColor(void) const;
void setStartOpacity(GLubyte Value); void setStartOpacity(GLubyte Value);
GLubyte getStartOpacity(void); GLubyte getStartOpacity(void);
void setEndOpacity(GLubyte Value); void setEndOpacity(GLubyte Value);
@ -97,7 +95,7 @@ class CCLayerGradient : public CCLayerColor
CCPoint getVector(void); CCPoint getVector(void);
void setCompressedInterpolation(bool Value); void setCompressedInterpolation(bool Value);
bool isCompressedInterpolation(void); bool isCompressedInterpolation(void) const;
static CCLayerGradient* create(ccColor4B start, ccColor4B end, CCPoint v); static CCLayerGradient* create(ccColor4B start, ccColor4B end, CCPoint v);
static CCLayerGradient* create(ccColor4B start, ccColor4B end); static CCLayerGradient* create(ccColor4B start, ccColor4B end);

View File

@ -6,8 +6,8 @@ class CCMenuItem : public CCNodeRGBA
void selected(); void selected();
void unselected(); void unselected();
void setEnabled(bool enabled); void setEnabled(bool enabled);
bool isEnabled(); bool isEnabled() const;
bool isSelected(); bool isSelected() const;
void registerScriptTapHandler(LUA_FUNCTION funcID); void registerScriptTapHandler(LUA_FUNCTION funcID);
void unregisterScriptTapHandler(void); void unregisterScriptTapHandler(void);

View File

@ -14,31 +14,33 @@ typedef enum {
class CCNode : public CCObject class CCNode : public CCObject
{ {
int getZOrder(); int getZOrder() const;
float getVertexZ(); float getVertexZ() const;
void setVertexZ(float var); void setVertexZ(float var);
float getRotation(); float getRotation() const;
float getRotationX() const;
float getRotationY() const;
void setRotation(float newRotation); void setRotation(float newRotation);
float getScale(); float getScale() const;
void setScale(float scale); void setScale(float scale);
float getScaleX(); float getScaleX() const;
void setScaleX(float newScaleX); void setScaleX(float newScaleX);
float getScaleY(); float getScaleY() const;
void setScaleY(float newScaleY); void setScaleY(float newScaleY);
void getPosition(float* x = 0, float* y = 0); void getPosition(float* x = 0, float* y = 0) const;
float getPositionX(); float getPositionX() const;
float getPositionY(); float getPositionY() const;
void setPosition(float x, float y); void setPosition(float x, float y);
void setPosition(CCPoint pos); void setPosition(CCPoint pos);
void setPositionX(float x); void setPositionX(float x);
void setPositionY(float y); void setPositionY(float y);
float getSkewX(); float getSkewX() const;
void setSkewX(float skewX); void setSkewX(float skewX);
float getSkewY(); float getSkewY() const;
void setSkewY(float skewY); void setSkewY(float skewY);
bool isVisible(); bool isVisible() const;
void setVisible(bool var); void setVisible(bool var);
CCPoint getAnchorPoint(); CCPoint getAnchorPoint() const;
void setAnchorPoint(CCPoint point); void setAnchorPoint(CCPoint point);
CCSize getContentSize(); CCSize getContentSize();
void setContentSize(const CCSize & size); void setContentSize(const CCSize & size);
@ -52,7 +54,7 @@ class CCNode : public CCObject
CCGridBase* getGrid(); CCGridBase* getGrid();
void setGrid(CCGridBase* pGrid); void setGrid(CCGridBase* pGrid);
CCPoint getAnchorPointInPoints(); CCPoint getAnchorPointInPoints();
bool isRunning(); bool isRunning() const;
CCNode* getParent(); CCNode* getParent();
void setParent(CCNode * var); void setParent(CCNode * var);
bool isIgnoreAnchorPointForPosition(); bool isIgnoreAnchorPointForPosition();
@ -63,9 +65,9 @@ class CCNode : public CCObject
void setUserObject(CCObject* pObject); void setUserObject(CCObject* pObject);
CCGLProgram* getShaderProgram(); CCGLProgram* getShaderProgram();
void setShaderProgram(CCGLProgram* pShaderProgram); void setShaderProgram(CCGLProgram* pShaderProgram);
int getOrderOfArrival(); int getOrderOfArrival() const;
void setOrderOfArrival(int order); void setOrderOfArrival(int order);
ccGLServerState getGLServerState(); ccGLServerState getGLServerState() const;
void setGLServerState(ccGLServerState state); void setGLServerState(ccGLServerState state);
CCActionManager* getActionManager(); CCActionManager* getActionManager();
void setActionManager(CCActionManager* pActionMgr); void setActionManager(CCActionManager* pActionMgr);
@ -92,7 +94,7 @@ class CCNode : public CCObject
void stopActionByTag(int tag); void stopActionByTag(int tag);
CCAction* getActionByTag(int tag); CCAction* getActionByTag(int tag);
char * description(void); const char * description(void) const;
CCNode* getChildByTag(int tag); CCNode* getChildByTag(int tag);
unsigned int numberOfRunningActions(void); unsigned int numberOfRunningActions(void);
@ -128,20 +130,20 @@ class CCNodeRGBA : public CCNode, public CCRGBAProtocol
virtual bool init(); virtual bool init();
virtual GLubyte getOpacity(); virtual GLubyte getOpacity() const;
virtual GLubyte getDisplayedOpacity(); virtual GLubyte getDisplayedOpacity() const;
virtual void setOpacity(GLubyte opacity); virtual void setOpacity(GLubyte opacity);
virtual void updateDisplayedOpacity(GLubyte parentOpacity); virtual void updateDisplayedOpacity(GLubyte parentOpacity);
virtual bool isCascadeOpacityEnabled(); virtual bool isCascadeOpacityEnabled() const;
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled); virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
virtual const ccColor3B& getColor(void); virtual const ccColor3B& getColor(void) const;
virtual const ccColor3B& getDisplayedColor(); virtual const ccColor3B& getDisplayedColor() const;
virtual void setColor(const ccColor3B& color); virtual void setColor(const ccColor3B& color);
virtual void updateDisplayedColor(const ccColor3B& parentColor); virtual void updateDisplayedColor(const ccColor3B& parentColor);
virtual bool isCascadeColorEnabled(); virtual bool isCascadeColorEnabled() const;
virtual void setCascadeColorEnabled(bool cascadeColorEnabled); virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
virtual void setOpacityModifyRGB(bool bValue); virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(); virtual bool isOpacityModifyRGB() const;
}; };

View File

@ -15,8 +15,8 @@ public:
CCTexture2D* getTexture(void); CCTexture2D* getTexture(void);
void setTexture(CCTexture2D *texture); void setTexture(CCTexture2D *texture);
void setBlendFunc(ccBlendFunc blendFunc); void setBlendFunc(const ccBlendFunc &blendFunc);
ccBlendFunc getBlendFunc(void); const ccBlendFunc& getBlendFunc(void);
static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity); static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity); static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);

View File

@ -17,7 +17,7 @@ typedef enum {
class CCSprite : public CCNodeRGBA class CCSprite : public CCNodeRGBA
{ {
void setDirty(bool bDirty); void setDirty(bool bDirty);
bool isDirty(void); bool isDirty(void) const;
ccV3F_C4B_T2F_Quad getQuad(void); ccV3F_C4B_T2F_Quad getQuad(void);
@ -26,7 +26,7 @@ class CCSprite : public CCNodeRGBA
bool isTextureRectRotated(void); bool isTextureRectRotated(void);
void setAtlasIndex(unsigned int uAtlasIndex); void setAtlasIndex(unsigned int uAtlasIndex);
unsigned int getAtlasIndex(void); unsigned int getAtlasIndex(void) const;
//void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode); //void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode);
void setTextureAtlas(CCTextureAtlas *pobTextureAtlas); void setTextureAtlas(CCTextureAtlas *pobTextureAtlas);
CCTextureAtlas* getTextureAtlas(void); CCTextureAtlas* getTextureAtlas(void);
@ -34,16 +34,16 @@ class CCSprite : public CCNodeRGBA
//CCSpriteBatchNode* getSpriteBatchNode(void); //CCSpriteBatchNode* getSpriteBatchNode(void);
//void setHonorParentTransform(ccHonorParentTransform eHonorParentTransform); //void setHonorParentTransform(ccHonorParentTransform eHonorParentTransform);
//ccHonorParentTransform getHonorParentTransform(void); //ccHonorParentTransform getHonorParentTransform(void);
void setBlendFunc(ccBlendFunc blendFunc); void setBlendFunc(const ccBlendFunc &blendFunc);
ccBlendFunc getBlendFunc(void); const ccBlendFunc& getBlendFunc(void);
CCPoint getOffsetPosition(void); const CCPoint& getOffsetPosition(void) const;
void ignoreAnchorPointForPosition(bool newValue); void ignoreAnchorPointForPosition(bool newValue);
void setFlipX(bool bFlipX); void setFlipX(bool bFlipX);
void setFlipY(bool bFlipY); void setFlipY(bool bFlipY);
bool isFlipX(void); bool isFlipX(void) const;
bool isFlipY(void); bool isFlipY(void) const;
void removeChild(CCNode* pChild, bool bCleanUp); void removeChild(CCNode* pChild, bool bCleanUp);
void removeAllChildrenWithCleanup(bool bCleanup); void removeAllChildrenWithCleanup(bool bCleanup);
@ -64,12 +64,11 @@ class CCSprite : public CCNodeRGBA
void setVisible(bool bVisible); void setVisible(bool bVisible);
void setOpacity(GLubyte opacity); void setOpacity(GLubyte opacity);
GLubyte getOpacity(void);
void setColor(ccColor3B color3); void setColor(ccColor3B color3);
ccColor3B getColor(void); ccColor3B getColor(void);
void setOpacityModifyRGB(bool bValue); void setOpacityModifyRGB(bool bValue);
bool isOpacityModifyRGB(void); bool isOpacityModifyRGB(void) const;
void setTexture(CCTexture2D *texture); void setTexture(CCTexture2D *texture);
CCTexture2D* getTexture(void); CCTexture2D* getTexture(void);
@ -81,7 +80,7 @@ class CCSprite : public CCNodeRGBA
void setVertexRect(CCRect rect); void setVertexRect(CCRect rect);
//void useBatchNode(CCSpriteBatchNode *batchNode); //void useBatchNode(CCSpriteBatchNode *batchNode);
void setDisplayFrame(CCSpriteFrame *pNewFrame); void setDisplayFrame(CCSpriteFrame *pNewFrame);
bool isFrameDisplayed(CCSpriteFrame *pFrame); bool isFrameDisplayed(CCSpriteFrame *pFrame) const;
CCSpriteFrame* displayFrame(void); CCSpriteFrame* displayFrame(void);
void setBatchNode(CCSpriteBatchNode* pBatchNode); void setBatchNode(CCSpriteBatchNode* pBatchNode);
CCSpriteBatchNode* getBatchNode(); CCSpriteBatchNode* getBatchNode();

View File

@ -19,8 +19,8 @@ class CCSpriteBatchNode : public CCNode
void reorderBatch(bool reorder); void reorderBatch(bool reorder);
void setTexture(CCTexture2D *texture); void setTexture(CCTexture2D *texture);
CCTexture2D* getTexture(void); CCTexture2D* getTexture(void);
void setBlendFunc(ccBlendFunc blendFunc); void setBlendFunc(const ccBlendFunc &blendFunc);
ccBlendFunc getBlendFunc(void); const ccBlendFunc& getBlendFunc(void);
void addChild(CCNode * child); void addChild(CCNode * child);
void addChild(CCNode * child, int zOrder); void addChild(CCNode * child, int zOrder);

View File

@ -7,7 +7,7 @@ class CCSpriteFrame : public CCObject
bool isRotated(void); bool isRotated(void);
void setRotated(bool bRotated); void setRotated(bool bRotated);
CCRect getRect(void); CCRect getRect(void) const;
void setRect(CCRect rect); void setRect(CCRect rect);
CCPoint getOffsetInPixels(void); CCPoint getOffsetInPixels(void);

View File

@ -8,7 +8,7 @@ class CCTextFieldTTF : public CCLabelTTF
void setColorSpaceHolder(ccColor3B val); void setColorSpaceHolder(ccColor3B val);
ccColor3B getColorSpaceHolder(); ccColor3B getColorSpaceHolder();
void setString(const char *text); void setString(const char *text);
const char* getString(void); const char* getString(void) const;
void setPlaceHolder(const char * text); void setPlaceHolder(const char * text);
const char * getPlaceHolder(void); const char * getPlaceHolder(void);

View File

@ -491,22 +491,22 @@ class CCTexture2D : public CCObject
GLfloat getMaxT(); GLfloat getMaxT();
void setMaxT(GLfloat val); void setMaxT(GLfloat val);
bool hasPremultipliedAlpha(); bool hasPremultipliedAlpha() const;
bool hasMipmaps(); bool hasMipmaps() const;
void drawAtPoint(CCPoint point); void drawAtPoint(CCPoint point);
void drawInRect(CCRect rect); void drawInRect(CCRect rect);
CCSize getContentSize(void); CCSize getContentSize(void);
void setTexParameters(ccTexParams* texParams); void setTexParameters(const ccTexParams& texParams);
void setAntiAliasTexParameters(); void setAntiAliasTexParameters();
void setAliasTexParameters(); void setAliasTexParameters();
void generateMipmap(); void generateMipmap();
const char* stringForFormat(); const char* stringForFormat() const;
unsigned int bitsPerPixelForFormat(); unsigned int bitsPerPixelForFormat() const;
unsigned int bitsPerPixelForFormat(CCTexture2DPixelFormat format); unsigned int bitsPerPixelForFormat(CCTexture2DPixelFormat format) const;
static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format); static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format);
static CCTexture2DPixelFormat defaultAlphaPixelFormat(); static CCTexture2DPixelFormat defaultAlphaPixelFormat();

0
tools/xcode4_template_generator/run_generator.sh Normal file → Executable file
View File