CCNS(函数库CCPointFromString CCRectFromString CCSizeFromString 参数是字符串"{x,y}"、{{x,y},{w, h}}、"{w, h}")

#ifndef __PLATFOMR_CCNS_H__

#define __PLATFOMR_CCNS_H__


#include "CCGeometry.h"


NS_CC_BEGIN


/**

 * @addtogroup data_structures

 * @{

 */


/**

@brief Returns a Core(核心) Graphics(图形) rectangle(矩形) structure结构 corresponding(相应的) to(对应于) the data in a given string.

@param pszContent   A string object whose contents are of the form "{{x,y},{w, h}}",

                    where x is the x coordinate, y is the y coordinate, w is the width, and h is the height.

                    These components(组件) can represent(代表) integer or float values.

                    An example of a valid(有效地) string is "{{3,2},{4,5}}".

                    The string is not localized(本地化), so items are always separated with a comma(逗号).

@return A Core Graphics structure that represents a rectangle.

        If the string is not well-formed, the function returns CCRectZero.

*/

CCRect CC_DLL CCRectFromString(const char* pszContent);  //根据字符串得到一个ccrect 类似{{x,y},{w, h}}


/**

@brief Returns a Core Graphics point structure corresponding to the data in a given string.

@param pszContent   A string object whose contents are of the form "{x,y}",

                    where x is the x coordinate and y is the y coordinate.

                    The x and y values can represent integer or float values.

                    An example of a valid string is "{3.0,2.5}".

                    The string is not localized, so items are always separated with a comma.

@return A Core Graphics structure that represents a point.

        If the string is not well-formed, the function returns CCPointZero.

*/

CCPoint CC_DLL CCPointFromString(const char* pszContent); //根据字符串得到一个ccpoint类似 "{x,y}"


/**

@brief Returns a Core Graphics size structure corresponding to the data in a given string.

@param pszContent   A string object whose contents are of the form "{w, h}",

                    where w is the width and h is the height.

                    The w and h values can be integer or float values.

                    An example of a valid string is "{3.0,2.5}".

                    The string is not localized, so items are always separated with a comma.

@return A Core Graphics structure that represents a size.

        If the string is not well-formed, the function returns CCSizeZero.

*/

CCSize CC_DLL CCSizeFromString(const char* pszContent);  //根据字符串得到一个ccsize 类似 "{w, h}"


// end of data_structure group

/// @}


NS_CC_END


#endif // __PLATFOMR_CCNS_H__



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值