2019-11-23 20:27:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __BASE_CCMACROS_H__
|
|
|
|
#define __BASE_CCMACROS_H__
|
|
|
|
|
|
|
|
#ifndef _USE_MATH_DEFINES
|
2021-08-27 12:34:24 +08:00
|
|
|
# define _USE_MATH_DEFINES
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "base/CCConsole.h"
|
|
|
|
#include "platform/CCStdC.h"
|
|
|
|
|
|
|
|
#ifndef CCASSERT
|
2021-08-27 12:34:24 +08:00
|
|
|
# if COCOS2D_DEBUG > 0
|
|
|
|
# if CC_ENABLE_SCRIPT_BINDING
|
|
|
|
extern bool CC_DLL cc_assert_script_compatible(const char* msg);
|
|
|
|
# define CCASSERT(cond, msg) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (!(cond)) \
|
|
|
|
{ \
|
|
|
|
if (msg && *msg && !cc_assert_script_compatible(msg)) \
|
|
|
|
cocos2d::log("Assert failed: %s", msg); \
|
|
|
|
CC_ASSERT(cond); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# else
|
|
|
|
# define CCASSERT(cond, msg) CC_ASSERT(cond)
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define CCASSERT(cond, msg)
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# define GP_ASSERT(cond) CCASSERT(cond, "")
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
// FIXME:: Backward compatible
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CCAssert CCASSERT
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif // CCASSERT
|
|
|
|
|
|
|
|
#include "base/ccConfig.h"
|
|
|
|
|
|
|
|
#include "base/ccRandom.h"
|
|
|
|
|
2021-07-15 17:01:57 +08:00
|
|
|
#define CC_HALF_PI (M_PI * 0.5f)
|
|
|
|
|
|
|
|
#define CC_DOUBLE_PI (M_PI * 2)
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/** @def CCRANDOM_MINUS1_1
|
|
|
|
returns a random float between -1 and 1
|
|
|
|
*/
|
|
|
|
#define CCRANDOM_MINUS1_1() cocos2d::rand_minus1_1()
|
|
|
|
|
|
|
|
/** @def CCRANDOM_0_1
|
|
|
|
returns a random float between 0 and 1
|
|
|
|
*/
|
|
|
|
#define CCRANDOM_0_1() cocos2d::rand_0_1()
|
|
|
|
|
|
|
|
/** @def CC_DEGREES_TO_RADIANS
|
|
|
|
converts degrees to radians
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_DEGREES_TO_RADIANS(__ANGLE__) ((__ANGLE__)*0.01745329252f) // PI / 180
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_RADIANS_TO_DEGREES
|
|
|
|
converts radians to degrees
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__)*57.29577951f) // PI * 180
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_REPEAT_FOREVER (UINT_MAX - 1)
|
2019-11-23 20:27:39 +08:00
|
|
|
#define kRepeatForever CC_REPEAT_FOREVER
|
|
|
|
|
|
|
|
/** @def CC_BLEND_SRC
|
|
|
|
default gl blend src function. Compatible with premultiplied alpha images.
|
|
|
|
*/
|
|
|
|
#define CC_BLEND_SRC cocos2d::backend::BlendFactor::ONE
|
|
|
|
#define CC_BLEND_DST cocos2d::backend::BlendFactor::ONE_MINUS_SRC_ALPHA
|
|
|
|
|
2021-07-07 13:52:56 +08:00
|
|
|
/** @def CC_NODE_DRAW_SETUP [DEPRECATED]
|
2019-11-23 20:27:39 +08:00
|
|
|
Helpful macro that setups the GL server state, the correct GL program and sets the Model View Projection matrix
|
|
|
|
@since v2.0
|
|
|
|
*/
|
2021-07-07 13:52:56 +08:00
|
|
|
#define CC_NODE_DRAW_SETUP()
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
/** @def CC_DIRECTOR_END
|
|
|
|
Stops and removes the director from memory.
|
|
|
|
Removes the GLView from its parent
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
@since v0.99.4
|
|
|
|
*/
|
|
|
|
#define CC_DIRECTOR_END() \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
Director* __director = cocos2d::Director::getInstance(); \
|
|
|
|
__director->end(); \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @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() cocos2d::Director::getInstance()->getContentScaleFactor()
|
|
|
|
|
|
|
|
/****************************/
|
|
|
|
/** RETINA DISPLAY ENABLED **/
|
|
|
|
/****************************/
|
|
|
|
|
|
|
|
/** @def CC_RECT_PIXELS_TO_POINTS
|
|
|
|
Converts a rect in pixels to points
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_RECT_PIXELS_TO_POINTS(__rect_in_pixels__) \
|
|
|
|
cocos2d::Rect((__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())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_RECT_POINTS_TO_PIXELS
|
|
|
|
Converts a rect in points to pixels
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_RECT_POINTS_TO_PIXELS(__rect_in_points_points__) \
|
|
|
|
cocos2d::Rect((__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())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_POINT_PIXELS_TO_POINTS
|
|
|
|
Converts a rect in pixels to points
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_POINT_PIXELS_TO_POINTS(__pixels__) \
|
|
|
|
cocos2d::Vec2((__pixels__).x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).y / CC_CONTENT_SCALE_FACTOR())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_POINT_POINTS_TO_PIXELS
|
|
|
|
Converts a rect in points to pixels
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_POINT_POINTS_TO_PIXELS(__points__) \
|
|
|
|
cocos2d::Vec2((__points__).x* CC_CONTENT_SCALE_FACTOR(), (__points__).y* CC_CONTENT_SCALE_FACTOR())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_POINT_PIXELS_TO_POINTS
|
|
|
|
Converts a rect in pixels to points
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_SIZE_PIXELS_TO_POINTS(__size_in_pixels__) \
|
|
|
|
cocos2d::Size((__size_in_pixels__).width / CC_CONTENT_SCALE_FACTOR(), \
|
|
|
|
(__size_in_pixels__).height / CC_CONTENT_SCALE_FACTOR())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/** @def CC_POINT_POINTS_TO_PIXELS
|
|
|
|
Converts a rect in points to pixels
|
|
|
|
*/
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_SIZE_POINTS_TO_PIXELS(__size_in_points__) \
|
|
|
|
cocos2d::Size((__size_in_points__).width* CC_CONTENT_SCALE_FACTOR(), \
|
|
|
|
(__size_in_points__).height* CC_CONTENT_SCALE_FACTOR())
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#ifndef FLT_EPSILON
|
2021-08-27 12:34:24 +08:00
|
|
|
# define FLT_EPSILON 1.192092896e-07F
|
|
|
|
#endif // FLT_EPSILON
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
2021-08-27 12:34:24 +08:00
|
|
|
TypeName(const TypeName&); \
|
|
|
|
void operator=(const TypeName&)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
2021-08-27 12:34:24 +08:00
|
|
|
Helper macros which converts 4-byte little/big endian
|
2019-11-23 20:27:39 +08:00
|
|
|
integral number to the machine native number representation
|
2021-08-27 12:34:24 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
It should work same as apples CFSwapInt32LittleToHost(..)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/// when define returns true it means that our architecture uses big endian
|
2021-08-27 12:34:24 +08:00
|
|
|
#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))
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**********************/
|
|
|
|
/** Profiling Macros **/
|
|
|
|
/**********************/
|
|
|
|
#if CC_ENABLE_PROFILERS
|
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_DISPLAY_TIMERS() NS_CC::Profiler::getInstance()->displayTimers()
|
|
|
|
# define CC_PROFILER_PURGE_ALL() NS_CC::Profiler::getInstance()->releaseAllTimers()
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_START(__name__) NS_CC::ProfilingBeginTimingBlock(__name__)
|
|
|
|
# define CC_PROFILER_STOP(__name__) NS_CC::ProfilingEndTimingBlock(__name__)
|
|
|
|
# define CC_PROFILER_RESET(__name__) NS_CC::ProfilingResetTimingBlock(__name__)
|
2021-08-27 12:25:18 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_START_CATEGORY(__cat__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (__cat__) \
|
|
|
|
NS_CC::ProfilingBeginTimingBlock(__name__); \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (__cat__) \
|
|
|
|
NS_CC::ProfilingEndTimingBlock(__name__); \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (__cat__) \
|
|
|
|
NS_CC::ProfilingResetTimingBlock(__name__); \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_START_INSTANCE(__id__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
NS_CC::ProfilingBeginTimingBlock( \
|
|
|
|
NS_CC::String::createWithFormat("%08X - %s", __id__, __name__)->getCString()); \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_STOP_INSTANCE(__id__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
NS_CC::ProfilingEndTimingBlock( \
|
|
|
|
NS_CC::String::createWithFormat("%08X - %s", __id__, __name__)->getCString()); \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_RESET_INSTANCE(__id__, __name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
NS_CC::ProfilingResetTimingBlock( \
|
|
|
|
NS_CC::String::createWithFormat("%08X - %s", __id__, __name__)->getCString()); \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_DISPLAY_TIMERS() \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_PURGE_ALL() \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_PROFILER_START(__name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_STOP(__name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
|
|
|
# define CC_PROFILER_RESET(__name__) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# 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)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
# 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)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
/*********************************/
|
|
|
|
/** 64bits Program Sense Macros **/
|
|
|
|
/*********************************/
|
|
|
|
#if defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(__x86_64) || \
|
|
|
|
defined(__arm64__) || defined(__aarch64__)
|
|
|
|
# define CC_64BITS 1
|
2019-11-23 20:27:39 +08:00
|
|
|
#else
|
2021-08-27 12:34:24 +08:00
|
|
|
# define CC_64BITS 0
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2021-08-27 12:34:24 +08:00
|
|
|
/******************************************************************************************/
|
|
|
|
/** LittleEndian Sense Macro, from google protobuf see: **/
|
|
|
|
/** https://github.com/google/protobuf/blob/master/src/google/protobuf/io/coded_stream.h **/
|
|
|
|
/******************************************************************************************/
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Assuming windows is always little-endian.
|
|
|
|
# if !defined(ADXE_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
|
|
|
|
# define ADXE_LITTLE_ENDIAN 1
|
|
|
|
# endif
|
|
|
|
# if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
|
|
|
|
// If MSVC has "/RTCc" set, it will complain about truncating casts at
|
|
|
|
// runtime. This file contains some intentional truncating casts.
|
|
|
|
# pragma runtime_checks("c", off)
|
|
|
|
# endif
|
2019-11-23 20:27:39 +08:00
|
|
|
#else
|
2021-08-27 12:34:24 +08:00
|
|
|
# ifdef __APPLE__
|
|
|
|
# include <machine/endian.h> // __BYTE_ORDER
|
|
|
|
# elif defined(__FreeBSD__)
|
|
|
|
# include <sys/endian.h> // __BYTE_ORDER
|
|
|
|
# else
|
|
|
|
# if !defined(__QNX__)
|
|
|
|
# include <endian.h> // __BYTE_ORDER
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
|
|
|
|
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \
|
|
|
|
!defined(ADXE_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
|
|
|
|
# define ADXE_LITTLE_ENDIAN 1
|
|
|
|
# endif
|
2019-11-23 20:27:39 +08:00
|
|
|
#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 Director's stats are enabled.
|
|
|
|
*/
|
|
|
|
#define CC_INCREMENT_GL_DRAWS(__n__) cocos2d::Director::getInstance()->getRenderer()->addDrawnBatches(__n__)
|
|
|
|
#define CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(__drawcalls__, __vertices__) \
|
2021-08-27 12:34:24 +08:00
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
auto __renderer__ = cocos2d::Director::getInstance()->getRenderer(); \
|
|
|
|
__renderer__->addDrawnBatches(__drawcalls__); \
|
|
|
|
__renderer__->addDrawnVertices(__vertices__); \
|
|
|
|
} while (0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/*******************/
|
|
|
|
/** Notifications **/
|
|
|
|
/*******************/
|
|
|
|
/** @def AnimationFrameDisplayedNotification
|
|
|
|
Notification name when a SpriteFrame is displayed
|
|
|
|
*/
|
|
|
|
#define AnimationFrameDisplayedNotification "CCAnimationFrameDisplayedNotification"
|
|
|
|
|
|
|
|
/*******************/
|
|
|
|
/** Notifications **/
|
|
|
|
/*******************/
|
|
|
|
/** @def Animate3DDisplayedNotification
|
|
|
|
Notification name when a frame in Animate3D is played
|
|
|
|
*/
|
|
|
|
#define Animate3DDisplayedNotification "CCAnimate3DDisplayedNotification"
|
|
|
|
|
|
|
|
// new callbacks based on C++11
|
2021-08-27 12:34:24 +08:00
|
|
|
#define CC_CALLBACK_0(__selector__, __target__, ...) std::bind(&__selector__, __target__, ##__VA_ARGS__)
|
|
|
|
#define CC_CALLBACK_1(__selector__, __target__, ...) \
|
|
|
|
std::bind(&__selector__, __target__, std::placeholders::_1, ##__VA_ARGS__)
|
|
|
|
#define CC_CALLBACK_2(__selector__, __target__, ...) \
|
|
|
|
std::bind(&__selector__, __target__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__)
|
|
|
|
#define CC_CALLBACK_3(__selector__, __target__, ...) \
|
|
|
|
std::bind(&__selector__, __target__, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, \
|
|
|
|
##__VA_ARGS__)
|
|
|
|
|
|
|
|
#endif // __BASE_CCMACROS_H__
|