issue #2430:use const member variable instead of macro

This commit is contained in:
minggo 2013-07-25 21:04:32 +08:00
parent 051caf5e54
commit 8b748e2992
6 changed files with 23 additions and 14 deletions

View File

@ -153,4 +153,7 @@ const int kCCTransitionOrientationRightOver = TransitionScene::ORIENTATION_RIGHT
const int kCCTransitionOrientationUpOver = TransitionScene::ORIENTATION_UP_OVER;
const int kCCTransitionOrientationDownOver = TransitionScene::ORIENTATION_DOWN_OVER;
const int kCCPrioritySystem = Scheduler::PRIORITY_SYSTEM;
const int kCCPriorityNonSystemMin = Scheduler::PRIORITY_NON_SYSTEM_MIN;
NS_CC_END

View File

@ -146,7 +146,7 @@ bool Director::init(void)
_scheduler = new Scheduler();
// action manager
_actionManager = new ActionManager();
_scheduler->scheduleUpdateForTarget(_actionManager, kPrioritySystem, false);
_scheduler->scheduleUpdateForTarget(_actionManager, Scheduler::PRIORITY_SYSTEM, false);
// touchDispatcher
_touchDispatcher = new TouchDispatcher();
_touchDispatcher->init();

View File

@ -240,6 +240,12 @@ SEL_SCHEDULE Timer::getSelector() const
// implementation of Scheduler
// Priority level reserved for system services.
const int Scheduler::PRIORITY_SYSTEM = INT_MIN;
// Minimum priority level for user scheduling.
const int Scheduler::PRIORITY_NON_SYSTEM_MIN = PRIORITY_SYSTEM + 1;
Scheduler::Scheduler(void)
: _timeScale(1.0f)
, _updatesNegList(NULL)
@ -577,7 +583,7 @@ void Scheduler::unscheduleUpdateForTarget(const Object *target)
void Scheduler::unscheduleAll(void)
{
unscheduleAllWithMinPriority(kPrioritySystem);
unscheduleAllWithMinPriority(PRIORITY_SYSTEM);
}
void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
@ -759,7 +765,7 @@ bool Scheduler::isTargetPaused(Object *target)
Set* Scheduler::pauseAllTargets()
{
return pauseAllTargetsWithMinPriority(kPrioritySystem);
return pauseAllTargetsWithMinPriority(PRIORITY_SYSTEM);
}
Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)

View File

@ -37,12 +37,6 @@ NS_CC_BEGIN
* @{
*/
// Priority level reserved for system services.
#define kPrioritySystem INT_MIN
// Minimum priority level for user scheduling.
#define kPriorityNonSystemMin (kPrioritySystem+1)
class Set;
//
// Timer
@ -121,6 +115,12 @@ The 'custom selectors' should be avoided when possible. It is faster, and consum
class CC_DLL Scheduler : public Object
{
public:
// Priority level reserved for system services.
static const int PRIORITY_SYSTEM;
// Minimum priority level for user scheduling.
static const int PRIORITY_NON_SYSTEM_MIN;
Scheduler();
~Scheduler(void);

View File

@ -912,8 +912,8 @@ CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationUpOver;
CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationDownOver;
CC_DEPRECATED_ATTRIBUTE typedef enum TransitionScene::Orientation tOrientation;
#define kCCPrioritySystem kPrioritySystem
#define kCCPriorityNonSystemMin kPriorityNonSystemMin
CC_DEPRECATED_ATTRIBUTE extern const int kCCPrioritySystem;
CC_DEPRECATED_ATTRIBUTE extern const int kCCPriorityNonSystemMin;
#define kCCTMXTileHorizontalFlag kTMXTileHorizontalFlag
#define kCCTMXTileVerticalFlag kTMXTileVerticalFlag

View File

@ -359,7 +359,7 @@ void SchedulerPauseResumeAllUser::pause(float dt)
{
log("Pausing");
Director* director = Director::getInstance();
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(kPriorityNonSystemMin);
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(Scheduler::PRIORITY_NON_SYSTEM_MIN);
CC_SAFE_RETAIN(_pausedTargets);
}
@ -463,7 +463,7 @@ void SchedulerUnscheduleAllHard::onExit()
if(!_actionManagerActive) {
// Restore the director's action manager.
Director* director = Director::getInstance();
director->getScheduler()->scheduleUpdateForTarget(director->getActionManager(), kPrioritySystem, false);
director->getScheduler()->scheduleUpdateForTarget(director->getActionManager(), Scheduler::PRIORITY_SYSTEM, false);
}
}
@ -548,7 +548,7 @@ void SchedulerUnscheduleAllUserLevel::tick4(float dt)
void SchedulerUnscheduleAllUserLevel::unscheduleAll(float dt)
{
Director::getInstance()->getScheduler()->unscheduleAllWithMinPriority(kPriorityNonSystemMin);
Director::getInstance()->getScheduler()->unscheduleAllWithMinPriority(Scheduler::PRIORITY_NON_SYSTEM_MIN);
}
std::string SchedulerUnscheduleAllUserLevel::title()