0externboolCC_DLLcc_assert_script_compatible(constchar*" />

亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

ccMacros

系統(tǒng) 2392 0


#ifndef __CCMACROS_H__

#define __CCMACROS_H__


#ifndef _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

#endif


#include "platform/CCCommon.h"

#include "CCStdC.h"


#ifndef CCAssert

#if COCOS2D_DEBUG > 0

extern bool CC_DLL cc_assert_script_compatible(const char *msg);

#define CCAssert(cond, msg) do {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? ? if (!(cond)) {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? ? ? if (!cc_assert_script_compatible(msg) && strlen(msg)) \

? ? ? ? ? cocos2d::CCLog("Assert failed: %s", msg); ? ? ? ? ? \

? ? ? ? CC_ASSERT(cond);? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? ? } \

? ? } while (0)

#else

#define CCAssert(cond, msg)

#endif

#endif? // CCAssert


#include "ccConfig.h"


/** @def CC_SWAP

simple macro that swaps 2 variables

*/

#define CC_SWAP(x, y, type)? ? \

{? ? type temp = (x);? ? ? ? \

? ? x = y; y = temp;? ? ? ? \

}



/** @def CCRANDOM_MINUS1_1

?returns a random float between -1 and 1

?*/

#define CCRANDOM_MINUS1_1() ((2.0f*((float)rand()/RAND_MAX))-1.0f)


/** @def CCRANDOM_0_1

?returns a random float between 0 and 1

?*/

#define CCRANDOM_0_1() ((float)rand()/RAND_MAX)


/** @def CC_DEGREES_TO_RADIANS

?converts degrees to radians

?*/

#define CC_DEGREES_TO_RADIANS(__ANGLE__) ((__ANGLE__) * 0.01745329252f) // PI / 180


/** @def CC_RADIANS_TO_DEGREES

?converts radians to degrees

?*/

#define CC_RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__) * 57.29577951f) // PI * 180


#define kCCRepeatForever (UINT_MAX -1)


/** @def CC_BLEND_SRC

default gl blend src function. Compatible with premultiplied alpha images.

*/

#define CC_BLEND_SRC GL_ONE

#define CC_BLEND_DST GL_ONE_MINUS_SRC_ALPHA



/** @def CC_NODE_DRAW_SETUP

?Helpful macro that setups the GL server state, the correct GL program and sets the Model View Projection matrix

?@since v2.0

?*/

#define CC_NODE_DRAW_SETUP() \

do { \

? ? ccGLEnable(m_eGLServerState); \

? ? CCAssert(getShaderProgram(), "No shader program set for this node"); \

? ? { \

? ? ? ? getShaderProgram()->use(); \

? ? ? ? getShaderProgram()->setUniformsForBuiltins(); \

? ? } \

} while(0)



?/** @def CC_DIRECTOR_END

? Stops and removes the director from memory.

? Removes the CCGLView from its parent


? @since v0.99.4

? */

#define CC_DIRECTOR_END()? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

do {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? CCDirector *__director = CCDirector::sharedDirector();? ? ? ? \

? ? __director->end();? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

} while(0)


/** @def CC_CONTENT_SCALE_FACTOR

On Mac it returns 1;

On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1

*/

#define CC_CONTENT_SCALE_FACTOR() CCDirector::sharedDirector()->getContentScaleFactor()


/****************************/

/** RETINA DISPLAY ENABLED **/

/****************************/


/** @def CC_RECT_PIXELS_TO_POINTS

?Converts a rect in pixels to points

?*/

#define CC_RECT_PIXELS_TO_POINTS(__rect_in_pixels__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? CCRectMake( (__rect_in_pixels__).origin.x / CC_CONTENT_SCALE_FACTOR(), (__rect_in_pixels__).origin.y / CC_CONTENT_SCALE_FACTOR(),? ? \

? ? ? ? ? ? (__rect_in_pixels__).size.width / CC_CONTENT_SCALE_FACTOR(), (__rect_in_pixels__).size.height / CC_CONTENT_SCALE_FACTOR() )


/** @def CC_RECT_POINTS_TO_PIXELS

?Converts a rect in points to pixels

?*/

#define CC_RECT_POINTS_TO_PIXELS(__rect_in_points_points__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

? ? CCRectMake( (__rect_in_points_points__).origin.x * CC_CONTENT_SCALE_FACTOR(), (__rect_in_points_points__).origin.y * CC_CONTENT_SCALE_FACTOR(),? ? \

? ? ? ? ? ? (__rect_in_points_points__).size.width * CC_CONTENT_SCALE_FACTOR(), (__rect_in_points_points__).size.height * CC_CONTENT_SCALE_FACTOR() )


/** @def CC_POINT_PIXELS_TO_POINTS

?Converts a rect in pixels to points

?*/

#define CC_POINT_PIXELS_TO_POINTS(__pixels__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

CCPointMake( (__pixels__).x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).y / CC_CONTENT_SCALE_FACTOR())


/** @def CC_POINT_POINTS_TO_PIXELS

?Converts a rect in points to pixels

?*/

#define CC_POINT_POINTS_TO_PIXELS(__points__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

CCPointMake( (__points__).x * CC_CONTENT_SCALE_FACTOR(), (__points__).y * CC_CONTENT_SCALE_FACTOR())


/** @def CC_POINT_PIXELS_TO_POINTS

?Converts a rect in pixels to points

?*/

#define CC_SIZE_PIXELS_TO_POINTS(__size_in_pixels__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

CCSizeMake( (__size_in_pixels__).width / CC_CONTENT_SCALE_FACTOR(), (__size_in_pixels__).height / CC_CONTENT_SCALE_FACTOR())


/** @def CC_POINT_POINTS_TO_PIXELS

?Converts a rect in points to pixels

?*/

#define CC_SIZE_POINTS_TO_PIXELS(__size_in_points__)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

CCSizeMake( (__size_in_points__).width * CC_CONTENT_SCALE_FACTOR(), (__size_in_points__).height * CC_CONTENT_SCALE_FACTOR())



#ifndef FLT_EPSILON

#define FLT_EPSILON ? ? 1.192092896e-07F

#endif // FLT_EPSILON


#define DISALLOW_COPY_AND_ASSIGN(TypeName) \

? ? ? ? ? ? TypeName(const TypeName&);\

? ? ? ? ? ? void operator=(const TypeName&)


/**

Helper macros which converts 4-byte little/big endian?

integral number to the machine native number representation

?

It should work same as apples CFSwapInt32LittleToHost(..)

*/


/// when define returns true it means that our architecture uses big endian

#define CC_HOST_IS_BIG_ENDIAN (bool)(*(unsigned short *)"\0\xff" < 0x100)?

#define CC_SWAP32(i)? ((i & 0x000000ff) << 24 | (i & 0x0000ff00) << 8 | (i & 0x00ff0000) >> 8 | (i & 0xff000000) >> 24)

#define CC_SWAP16(i)? ((i & 0x00ff) << 8 | (i &0xff00) >> 8)? ?

#define CC_SWAP_INT32_LITTLE_TO_HOST(i) ((CC_HOST_IS_BIG_ENDIAN == true)? CC_SWAP32(i) : (i) )

#define CC_SWAP_INT16_LITTLE_TO_HOST(i) ((CC_HOST_IS_BIG_ENDIAN == true)? CC_SWAP16(i) : (i) )

#define CC_SWAP_INT32_BIG_TO_HOST(i)? ? ((CC_HOST_IS_BIG_ENDIAN == true)? (i) : CC_SWAP32(i) )

#define CC_SWAP_INT16_BIG_TO_HOST(i)? ? ((CC_HOST_IS_BIG_ENDIAN == true)? (i):? CC_SWAP16(i) )


/**********************/

/** Profiling Macros **/

/**********************/

#if CC_ENABLE_PROFILERS


#define CC_PROFILER_DISPLAY_TIMERS() CCProfiler::sharedProfiler()->displayTimers()

#define CC_PROFILER_PURGE_ALL() CCProfiler::sharedProfiler()->releaseAllTimers()


#define CC_PROFILER_START(__name__) CCProfilingBeginTimingBlock(__name__)

#define CC_PROFILER_STOP(__name__) CCProfilingEndTimingBlock(__name__)

#define CC_PROFILER_RESET(__name__) CCProfilingResetTimingBlock(__name__)


#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) CCProfilingBeginTimingBlock(__name__); } while(0)

#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) CCProfilingEndTimingBlock(__name__); } while(0)

#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) CCProfilingResetTimingBlock(__name__); } while(0)


#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ CCProfilingBeginTimingBlock( CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)

#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ CCProfilingEndTimingBlock(? ? CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)

#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ CCProfilingResetTimingBlock( CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)



#else


#define CC_PROFILER_DISPLAY_TIMERS() do {} while (0)

#define CC_PROFILER_PURGE_ALL() do {} while (0)


#define CC_PROFILER_START(__name__)? do {} while (0)

#define CC_PROFILER_STOP(__name__) do {} while (0)

#define CC_PROFILER_RESET(__name__) do {} while (0)


#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do {} while(0)

#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do {} while(0)

#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do {} while(0)


#define CC_PROFILER_START_INSTANCE(__id__, __name__) do {} while(0)

#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do {} while(0)

#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do {} while(0)


#endif


#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0

#define CHECK_GL_ERROR_DEBUG()

#else

#define CHECK_GL_ERROR_DEBUG() \

? ? do { \

? ? ? ? GLenum __error = glGetError(); \

? ? ? ? if(__error) { \

? ? ? ? ? ? CCLog("OpenGL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \

? ? ? ? } \

? ? } while (false)

#endif


/** @def CC_INCREMENT_GL_DRAWS_BY_ONE

?Increments the GL Draws counts by one.

?The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled.

?*/

extern unsigned int CC_DLL g_uNumberOfDraws;

#define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__


/*******************/

/** Notifications **/

/*******************/

/** @def CCAnimationFrameDisplayedNotification

?Notification name when a CCSpriteFrame is displayed

?*/

#define CCAnimationFrameDisplayedNotification "CCAnimationFrameDisplayedNotification"


#endif // __CCMACROS_H__


ccMacros


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 精品久久九九 | 欧美区日韩区 | 曰批免费视频播放在线看片二 | 色老头老太做爰视频在线观看 | 天海翼精品久久中文字幕 | 免费视频99 | 2022久久国产精品免费热麻豆 | 国产区在线观看 | 日本高清中文字幕在线观穿线视频 | 国产精品毛片一区二区三区 | 成人短视频在线观看视频 | 欧美日韩在线观看免费 | 羞羞视频网站在线观看 | 国产一区二区三区不卡免费观看 | 亚洲一区二区三区国产精品 | 91在线网址| 毛片大全网站 | 久操视频网站 | 超碰最新上传 | 国产片欧美片亚洲片久久综合 | 日韩精品福利视频一区二区三区 | 亚洲伦理精品久久 | 成人欧美一区二区三区白人 | 伊人不卡久久大香线蕉综合影院 | 欧美日韩国产高清视频 | 91视频一区二区 | 26uuu欧美日本| 久久成人免费大片 | 亚洲伦理久久 | 97国产成人精品免费视频 | 在线观看99 | 香蕉青草久久成人网 | 在线亚洲欧美性天天影院 | 久久精品国产亚洲a不卡 | 日本一级毛片视频网站 | 日日噜噜夜夜狠狠久久aⅴ 日日噜噜夜夜狠狠久久丁香 | 亚洲视频区 | 国产亚洲精品第一区在线观看 | 久操国产 | 91亚洲精品一区二区自 | 午夜精品福利视频 |