mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3187 from dumganhar/ricardoquesada-more_best_practices_fixes
Merge https://github.com/cocos2d/cocos2d-x/pull/3183
This commit is contained in:
commit
7de69edad8
|
@ -99,12 +99,6 @@ Director* Director::getInstance()
|
|||
return s_SharedDirector;
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
Director* Director::sharedDirector()
|
||||
{
|
||||
return Director::getInstance();
|
||||
}
|
||||
|
||||
Director::Director(void)
|
||||
{
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
static Director* getInstance();
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static Director* sharedDirector(void);
|
||||
CC_DEPRECATED_ATTRIBUTE static Director* sharedDirector() { return Director::getInstance(); }
|
||||
|
||||
Director(void);
|
||||
virtual ~Director(void);
|
||||
|
|
|
@ -84,60 +84,60 @@ Timer::Timer()
|
|||
{
|
||||
}
|
||||
|
||||
Timer* Timer::timerWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector)
|
||||
Timer* Timer::createWithTarget(Object *target, SEL_SCHEDULE selector)
|
||||
{
|
||||
Timer *pTimer = new Timer();
|
||||
|
||||
pTimer->initWithTarget(pTarget, pfnSelector, 0.0f, kRepeatForever, 0.0f);
|
||||
pTimer->initWithTarget(target, selector, 0.0f, kRepeatForever, 0.0f);
|
||||
pTimer->autorelease();
|
||||
|
||||
return pTimer;
|
||||
}
|
||||
|
||||
Timer* Timer::timerWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds)
|
||||
Timer* Timer::createWithTarget(Object *target, SEL_SCHEDULE selector, float seconds)
|
||||
{
|
||||
Timer *pTimer = new Timer();
|
||||
|
||||
pTimer->initWithTarget(pTarget, pfnSelector, fSeconds, kRepeatForever, 0.0f);
|
||||
pTimer->initWithTarget(target, selector, seconds, kRepeatForever, 0.0f);
|
||||
pTimer->autorelease();
|
||||
|
||||
return pTimer;
|
||||
}
|
||||
|
||||
Timer* Timer::timerWithScriptHandler(int nHandler, float fSeconds)
|
||||
Timer* Timer::createWithScriptHandler(int handler, float seconds)
|
||||
{
|
||||
Timer *pTimer = new Timer();
|
||||
|
||||
pTimer->initWithScriptHandler(nHandler, fSeconds);
|
||||
pTimer->initWithScriptHandler(handler, seconds);
|
||||
pTimer->autorelease();
|
||||
|
||||
return pTimer;
|
||||
}
|
||||
|
||||
bool Timer::initWithScriptHandler(int nHandler, float fSeconds)
|
||||
bool Timer::initWithScriptHandler(int handler, float seconds)
|
||||
{
|
||||
_scriptHandler = nHandler;
|
||||
_scriptHandler = handler;
|
||||
_elapsed = -1;
|
||||
_interval = fSeconds;
|
||||
_interval = seconds;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Timer::initWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector)
|
||||
bool Timer::initWithTarget(Object *target, SEL_SCHEDULE selector)
|
||||
{
|
||||
return initWithTarget(pTarget, pfnSelector, 0, kRepeatForever, 0.0f);
|
||||
return initWithTarget(target, selector, 0, kRepeatForever, 0.0f);
|
||||
}
|
||||
|
||||
bool Timer::initWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds, unsigned int nRepeat, float fDelay)
|
||||
bool Timer::initWithTarget(Object *target, SEL_SCHEDULE selector, float seconds, unsigned int repeat, float delay)
|
||||
{
|
||||
_target = pTarget;
|
||||
_selector = pfnSelector;
|
||||
_target = target;
|
||||
_selector = selector;
|
||||
_elapsed = -1;
|
||||
_interval = fSeconds;
|
||||
_delay = fDelay;
|
||||
_useDelay = (fDelay > 0.0f) ? true : false;
|
||||
_repeat = nRepeat;
|
||||
_runForever = (nRepeat == kRepeatForever) ? true : false;
|
||||
_interval = seconds;
|
||||
_delay = delay;
|
||||
_useDelay = (delay > 0.0f) ? true : false;
|
||||
_repeat = repeat;
|
||||
_runForever = (repeat == kRepeatForever) ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -228,9 +228,9 @@ float Timer::getInterval() const
|
|||
return _interval;
|
||||
}
|
||||
|
||||
void Timer::setInterval(float fInterval)
|
||||
void Timer::setInterval(float interval)
|
||||
{
|
||||
_interval = fInterval;
|
||||
_interval = interval;
|
||||
}
|
||||
|
||||
SEL_SCHEDULE Timer::getSelector() const
|
||||
|
@ -261,14 +261,14 @@ Scheduler::~Scheduler(void)
|
|||
CC_SAFE_RELEASE(_scriptHandlerEntries);
|
||||
}
|
||||
|
||||
void Scheduler::removeHashElement(_hashSelectorEntry *pElement)
|
||||
void Scheduler::removeHashElement(_hashSelectorEntry *element)
|
||||
{
|
||||
|
||||
cocos2d::Object *target = pElement->target;
|
||||
cocos2d::Object *target = element->target;
|
||||
|
||||
ccArrayFree(pElement->timers);
|
||||
HASH_DEL(_hashForTimers, pElement);
|
||||
free(pElement);
|
||||
ccArrayFree(element->timers);
|
||||
HASH_DEL(_hashForTimers, element);
|
||||
free(element);
|
||||
|
||||
// make sure the target is released after we have removed the hash element
|
||||
// otherwise we access invalid memory when the release call deletes the target
|
||||
|
@ -277,108 +277,108 @@ void Scheduler::removeHashElement(_hashSelectorEntry *pElement)
|
|||
|
||||
}
|
||||
|
||||
void Scheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget, float fInterval, bool bPaused)
|
||||
void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float interval, bool paused)
|
||||
{
|
||||
this->scheduleSelector(pfnSelector, pTarget, fInterval, kRepeatForever, 0.0f, bPaused);
|
||||
this->scheduleSelector(selector, target, interval, kRepeatForever, 0.0f, paused);
|
||||
}
|
||||
|
||||
void Scheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget, float fInterval, unsigned int repeat, float delay, bool bPaused)
|
||||
void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float interval, unsigned int repeat, float delay, bool paused)
|
||||
{
|
||||
CCAssert(pfnSelector, "Argument selector must be non-NULL");
|
||||
CCAssert(pTarget, "Argument target must be non-NULL");
|
||||
CCAssert(selector, "Argument selector must be non-NULL");
|
||||
CCAssert(target, "Argument target must be non-NULL");
|
||||
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
|
||||
if (! pElement)
|
||||
if (! element)
|
||||
{
|
||||
pElement = (tHashTimerEntry *)calloc(sizeof(*pElement), 1);
|
||||
pElement->target = pTarget;
|
||||
if (pTarget)
|
||||
element = (tHashTimerEntry *)calloc(sizeof(*element), 1);
|
||||
element->target = target;
|
||||
if (target)
|
||||
{
|
||||
pTarget->retain();
|
||||
target->retain();
|
||||
}
|
||||
HASH_ADD_INT(_hashForTimers, target, pElement);
|
||||
HASH_ADD_INT(_hashForTimers, target, element);
|
||||
|
||||
// Is this the 1st element ? Then set the pause level to all the selectors of this target
|
||||
pElement->paused = bPaused;
|
||||
element->paused = paused;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCAssert(pElement->paused == bPaused, "");
|
||||
CCAssert(element->paused == paused, "");
|
||||
}
|
||||
|
||||
if (pElement->timers == NULL)
|
||||
if (element->timers == NULL)
|
||||
{
|
||||
pElement->timers = ccArrayNew(10);
|
||||
element->timers = ccArrayNew(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < pElement->timers->num; ++i)
|
||||
for (unsigned int i = 0; i < element->timers->num; ++i)
|
||||
{
|
||||
Timer *timer = (Timer*)pElement->timers->arr[i];
|
||||
Timer *timer = (Timer*)element->timers->arr[i];
|
||||
|
||||
if (pfnSelector == timer->getSelector())
|
||||
if (selector == timer->getSelector())
|
||||
{
|
||||
CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), fInterval);
|
||||
timer->setInterval(fInterval);
|
||||
CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval);
|
||||
timer->setInterval(interval);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ccArrayEnsureExtraCapacity(pElement->timers, 1);
|
||||
ccArrayEnsureExtraCapacity(element->timers, 1);
|
||||
}
|
||||
|
||||
Timer *pTimer = new Timer();
|
||||
pTimer->initWithTarget(pTarget, pfnSelector, fInterval, repeat, delay);
|
||||
ccArrayAppendObject(pElement->timers, pTimer);
|
||||
pTimer->initWithTarget(target, selector, interval, repeat, delay);
|
||||
ccArrayAppendObject(element->timers, pTimer);
|
||||
pTimer->release();
|
||||
}
|
||||
|
||||
void Scheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget)
|
||||
void Scheduler::unscheduleSelector(SEL_SCHEDULE selector, Object *target)
|
||||
{
|
||||
// explicity handle nil arguments when removing an object
|
||||
if (pTarget == 0 || pfnSelector == 0)
|
||||
if (target == 0 || selector == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//CCAssert(pTarget);
|
||||
//CCAssert(pfnSelector);
|
||||
//CCAssert(target);
|
||||
//CCAssert(selector);
|
||||
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
|
||||
if (pElement)
|
||||
if (element)
|
||||
{
|
||||
for (unsigned int i = 0; i < pElement->timers->num; ++i)
|
||||
for (unsigned int i = 0; i < element->timers->num; ++i)
|
||||
{
|
||||
Timer *pTimer = (Timer*)(pElement->timers->arr[i]);
|
||||
Timer *pTimer = (Timer*)(element->timers->arr[i]);
|
||||
|
||||
if (pfnSelector == pTimer->getSelector())
|
||||
if (selector == pTimer->getSelector())
|
||||
{
|
||||
if (pTimer == pElement->currentTimer && (! pElement->currentTimerSalvaged))
|
||||
if (pTimer == element->currentTimer && (! element->currentTimerSalvaged))
|
||||
{
|
||||
pElement->currentTimer->retain();
|
||||
pElement->currentTimerSalvaged = true;
|
||||
element->currentTimer->retain();
|
||||
element->currentTimerSalvaged = true;
|
||||
}
|
||||
|
||||
ccArrayRemoveObjectAtIndex(pElement->timers, i, true);
|
||||
ccArrayRemoveObjectAtIndex(element->timers, i, true);
|
||||
|
||||
// update timerIndex in case we are in tick:, looping over the actions
|
||||
if (pElement->timerIndex >= i)
|
||||
if (element->timerIndex >= i)
|
||||
{
|
||||
pElement->timerIndex--;
|
||||
element->timerIndex--;
|
||||
}
|
||||
|
||||
if (pElement->timers->num == 0)
|
||||
if (element->timers->num == 0)
|
||||
{
|
||||
if (_currentTarget == pElement)
|
||||
if (_currentTarget == element)
|
||||
{
|
||||
_currentTargetSalvaged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeHashElement(pElement);
|
||||
removeHashElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,40 +388,40 @@ void Scheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget)
|
|||
}
|
||||
}
|
||||
|
||||
void Scheduler::priorityIn(tListEntry **ppList, Object *pTarget, int nPriority, bool bPaused)
|
||||
void Scheduler::priorityIn(tListEntry **list, Object *target, int priority, bool paused)
|
||||
{
|
||||
tListEntry *pListElement = (tListEntry *)malloc(sizeof(*pListElement));
|
||||
tListEntry *listElement = (tListEntry *)malloc(sizeof(*listElement));
|
||||
|
||||
pListElement->target = pTarget;
|
||||
pListElement->priority = nPriority;
|
||||
pListElement->paused = bPaused;
|
||||
pListElement->next = pListElement->prev = NULL;
|
||||
pListElement->markedForDeletion = false;
|
||||
listElement->target = target;
|
||||
listElement->priority = priority;
|
||||
listElement->paused = paused;
|
||||
listElement->next = listElement->prev = NULL;
|
||||
listElement->markedForDeletion = false;
|
||||
|
||||
// empty list ?
|
||||
if (! *ppList)
|
||||
if (! *list)
|
||||
{
|
||||
DL_APPEND(*ppList, pListElement);
|
||||
DL_APPEND(*list, listElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bAdded = false;
|
||||
|
||||
for (tListEntry *pElement = *ppList; pElement; pElement = pElement->next)
|
||||
for (tListEntry *element = *list; element; element = element->next)
|
||||
{
|
||||
if (nPriority < pElement->priority)
|
||||
if (priority < element->priority)
|
||||
{
|
||||
if (pElement == *ppList)
|
||||
if (element == *list)
|
||||
{
|
||||
DL_PREPEND(*ppList, pListElement);
|
||||
DL_PREPEND(*list, listElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
pListElement->next = pElement;
|
||||
pListElement->prev = pElement->prev;
|
||||
listElement->next = element;
|
||||
listElement->prev = element->prev;
|
||||
|
||||
pElement->prev->next = pListElement;
|
||||
pElement->prev = pListElement;
|
||||
element->prev->next = listElement;
|
||||
element->prev = listElement;
|
||||
}
|
||||
|
||||
bAdded = true;
|
||||
|
@ -432,43 +432,43 @@ void Scheduler::priorityIn(tListEntry **ppList, Object *pTarget, int nPriority,
|
|||
// Not added? priority has the higher value. Append it.
|
||||
if (! bAdded)
|
||||
{
|
||||
DL_APPEND(*ppList, pListElement);
|
||||
DL_APPEND(*list, listElement);
|
||||
}
|
||||
}
|
||||
|
||||
// update hash entry for quick access
|
||||
tHashUpdateEntry *pHashElement = (tHashUpdateEntry *)calloc(sizeof(*pHashElement), 1);
|
||||
pHashElement->target = pTarget;
|
||||
pTarget->retain();
|
||||
pHashElement->list = ppList;
|
||||
pHashElement->entry = pListElement;
|
||||
pHashElement->target = target;
|
||||
target->retain();
|
||||
pHashElement->list = list;
|
||||
pHashElement->entry = listElement;
|
||||
HASH_ADD_INT(_hashForUpdates, target, pHashElement);
|
||||
}
|
||||
|
||||
void Scheduler::appendIn(_listEntry **ppList, Object *pTarget, bool bPaused)
|
||||
void Scheduler::appendIn(_listEntry **list, Object *target, bool paused)
|
||||
{
|
||||
tListEntry *pListElement = (tListEntry *)malloc(sizeof(*pListElement));
|
||||
tListEntry *listElement = (tListEntry *)malloc(sizeof(*listElement));
|
||||
|
||||
pListElement->target = pTarget;
|
||||
pListElement->paused = bPaused;
|
||||
pListElement->markedForDeletion = false;
|
||||
listElement->target = target;
|
||||
listElement->paused = paused;
|
||||
listElement->markedForDeletion = false;
|
||||
|
||||
DL_APPEND(*ppList, pListElement);
|
||||
DL_APPEND(*list, listElement);
|
||||
|
||||
// update hash entry for quicker access
|
||||
tHashUpdateEntry *pHashElement = (tHashUpdateEntry *)calloc(sizeof(*pHashElement), 1);
|
||||
pHashElement->target = pTarget;
|
||||
pTarget->retain();
|
||||
pHashElement->list = ppList;
|
||||
pHashElement->entry = pListElement;
|
||||
pHashElement->target = target;
|
||||
target->retain();
|
||||
pHashElement->list = list;
|
||||
pHashElement->entry = listElement;
|
||||
HASH_ADD_INT(_hashForUpdates, target, pHashElement);
|
||||
}
|
||||
|
||||
void Scheduler::scheduleUpdateForTarget(Object *pTarget, int nPriority, bool bPaused)
|
||||
void Scheduler::scheduleUpdateForTarget(Object *target, int priority, bool paused)
|
||||
{
|
||||
|
||||
tHashUpdateEntry *pHashElement = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &pTarget, pHashElement);
|
||||
HASH_FIND_INT(_hashForUpdates, &target, pHashElement);
|
||||
if (pHashElement)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
|
@ -482,44 +482,44 @@ void Scheduler::scheduleUpdateForTarget(Object *pTarget, int nPriority, bool bPa
|
|||
|
||||
// most of the updates are going to be 0, that's way there
|
||||
// is an special list for updates with priority 0
|
||||
if (nPriority == 0)
|
||||
if (priority == 0)
|
||||
{
|
||||
appendIn(&_updates0List, pTarget, bPaused);
|
||||
appendIn(&_updates0List, target, paused);
|
||||
}
|
||||
else if (nPriority < 0)
|
||||
else if (priority < 0)
|
||||
{
|
||||
priorityIn(&_updatesNegList, pTarget, nPriority, bPaused);
|
||||
priorityIn(&_updatesNegList, target, priority, paused);
|
||||
}
|
||||
else
|
||||
{
|
||||
// priority > 0
|
||||
priorityIn(&_updatesPosList, pTarget, nPriority, bPaused);
|
||||
priorityIn(&_updatesPosList, target, priority, paused);
|
||||
}
|
||||
}
|
||||
|
||||
bool Scheduler::isScheduledForTarget(SEL_SCHEDULE pfnSelector, Object *pTarget)
|
||||
bool Scheduler::isScheduledForTarget(SEL_SCHEDULE selector, Object *target)
|
||||
{
|
||||
CCAssert(pfnSelector, "Argument selector must be non-NULL");
|
||||
CCAssert(pTarget, "Argument target must be non-NULL");
|
||||
CCAssert(selector, "Argument selector must be non-NULL");
|
||||
CCAssert(target, "Argument target must be non-NULL");
|
||||
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
|
||||
if (!pElement)
|
||||
if (!element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pElement->timers == NULL)
|
||||
if (element->timers == NULL)
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
for (unsigned int i = 0; i < pElement->timers->num; ++i)
|
||||
for (unsigned int i = 0; i < element->timers->num; ++i)
|
||||
{
|
||||
Timer *timer = (Timer*)pElement->timers->arr[i];
|
||||
Timer *timer = (Timer*)element->timers->arr[i];
|
||||
|
||||
if (pfnSelector == timer->getSelector())
|
||||
if (selector == timer->getSelector())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -543,34 +543,34 @@ void Scheduler::removeUpdateFromHash(struct _listEntry *entry)
|
|||
free(element->entry);
|
||||
|
||||
// hash entry
|
||||
Object* pTarget = element->target;
|
||||
Object* target = element->target;
|
||||
HASH_DEL(_hashForUpdates, element);
|
||||
free(element);
|
||||
|
||||
// target#release should be the last one to prevent
|
||||
// a possible double-free. eg: If the [target dealloc] might want to remove it itself from there
|
||||
pTarget->release();
|
||||
target->release();
|
||||
}
|
||||
}
|
||||
|
||||
void Scheduler::unscheduleUpdateForTarget(const Object *pTarget)
|
||||
void Scheduler::unscheduleUpdateForTarget(const Object *target)
|
||||
{
|
||||
if (pTarget == NULL)
|
||||
if (target == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tHashUpdateEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &pTarget, pElement);
|
||||
if (pElement)
|
||||
tHashUpdateEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &target, element);
|
||||
if (element)
|
||||
{
|
||||
if (_updateHashLocked)
|
||||
{
|
||||
pElement->entry->markedForDeletion = true;
|
||||
element->entry->markedForDeletion = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->removeUpdateFromHash(pElement->entry);
|
||||
this->removeUpdateFromHash(element->entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -583,15 +583,15 @@ void Scheduler::unscheduleAll(void)
|
|||
void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
|
||||
{
|
||||
// Custom Selectors
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
tHashTimerEntry *element = NULL;
|
||||
tHashTimerEntry *pNextElement = NULL;
|
||||
for (pElement = _hashForTimers; pElement != NULL;)
|
||||
for (element = _hashForTimers; element != NULL;)
|
||||
{
|
||||
// pElement may be removed in unscheduleAllSelectorsForTarget
|
||||
pNextElement = (tHashTimerEntry *)pElement->hh.next;
|
||||
unscheduleAllForTarget(pElement->target);
|
||||
// element may be removed in unscheduleAllSelectorsForTarget
|
||||
pNextElement = (tHashTimerEntry *)element->hh.next;
|
||||
unscheduleAllForTarget(element->target);
|
||||
|
||||
pElement = pNextElement;
|
||||
element = pNextElement;
|
||||
}
|
||||
|
||||
// Updates selectors
|
||||
|
@ -629,45 +629,45 @@ void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
|
|||
}
|
||||
}
|
||||
|
||||
void Scheduler::unscheduleAllForTarget(Object *pTarget)
|
||||
void Scheduler::unscheduleAllForTarget(Object *target)
|
||||
{
|
||||
// explicit NULL handling
|
||||
if (pTarget == NULL)
|
||||
if (target == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Custom Selectors
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
|
||||
if (pElement)
|
||||
if (element)
|
||||
{
|
||||
if (ccArrayContainsObject(pElement->timers, pElement->currentTimer)
|
||||
&& (! pElement->currentTimerSalvaged))
|
||||
if (ccArrayContainsObject(element->timers, element->currentTimer)
|
||||
&& (! element->currentTimerSalvaged))
|
||||
{
|
||||
pElement->currentTimer->retain();
|
||||
pElement->currentTimerSalvaged = true;
|
||||
element->currentTimer->retain();
|
||||
element->currentTimerSalvaged = true;
|
||||
}
|
||||
ccArrayRemoveAllObjects(pElement->timers);
|
||||
ccArrayRemoveAllObjects(element->timers);
|
||||
|
||||
if (_currentTarget == pElement)
|
||||
if (_currentTarget == element)
|
||||
{
|
||||
_currentTargetSalvaged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeHashElement(pElement);
|
||||
removeHashElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
// update selector
|
||||
unscheduleUpdateForTarget(pTarget);
|
||||
unscheduleUpdateForTarget(target);
|
||||
}
|
||||
|
||||
unsigned int Scheduler::scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused)
|
||||
unsigned int Scheduler::scheduleScriptFunc(unsigned int handler, float interval, bool paused)
|
||||
{
|
||||
SchedulerScriptHandlerEntry* pEntry = SchedulerScriptHandlerEntry::create(nHandler, fInterval, bPaused);
|
||||
SchedulerScriptHandlerEntry* pEntry = SchedulerScriptHandlerEntry::create(handler, interval, paused);
|
||||
if (!_scriptHandlerEntries)
|
||||
{
|
||||
_scriptHandlerEntries = Array::createWithCapacity(20);
|
||||
|
@ -690,65 +690,65 @@ void Scheduler::unscheduleScriptEntry(unsigned int uScheduleScriptEntryID)
|
|||
}
|
||||
}
|
||||
|
||||
void Scheduler::resumeTarget(Object *pTarget)
|
||||
void Scheduler::resumeTarget(Object *target)
|
||||
{
|
||||
CCAssert(pTarget != NULL, "");
|
||||
CCAssert(target != NULL, "");
|
||||
|
||||
// custom selectors
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
if (pElement)
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
if (element)
|
||||
{
|
||||
pElement->paused = false;
|
||||
element->paused = false;
|
||||
}
|
||||
|
||||
// update selector
|
||||
tHashUpdateEntry *pElementUpdate = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &pTarget, pElementUpdate);
|
||||
if (pElementUpdate)
|
||||
tHashUpdateEntry *elementUpdate = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
|
||||
if (elementUpdate)
|
||||
{
|
||||
CCAssert(pElementUpdate->entry != NULL, "");
|
||||
pElementUpdate->entry->paused = false;
|
||||
CCAssert(elementUpdate->entry != NULL, "");
|
||||
elementUpdate->entry->paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Scheduler::pauseTarget(Object *pTarget)
|
||||
void Scheduler::pauseTarget(Object *target)
|
||||
{
|
||||
CCAssert(pTarget != NULL, "");
|
||||
CCAssert(target != NULL, "");
|
||||
|
||||
// custom selectors
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
if (pElement)
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
if (element)
|
||||
{
|
||||
pElement->paused = true;
|
||||
element->paused = true;
|
||||
}
|
||||
|
||||
// update selector
|
||||
tHashUpdateEntry *pElementUpdate = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &pTarget, pElementUpdate);
|
||||
if (pElementUpdate)
|
||||
tHashUpdateEntry *elementUpdate = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
|
||||
if (elementUpdate)
|
||||
{
|
||||
CCAssert(pElementUpdate->entry != NULL, "");
|
||||
pElementUpdate->entry->paused = true;
|
||||
CCAssert(elementUpdate->entry != NULL, "");
|
||||
elementUpdate->entry->paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Scheduler::isTargetPaused(Object *pTarget)
|
||||
bool Scheduler::isTargetPaused(Object *target)
|
||||
{
|
||||
CCAssert( pTarget != NULL, "target must be non nil" );
|
||||
CCAssert( target != NULL, "target must be non nil" );
|
||||
|
||||
// Custom selectors
|
||||
tHashTimerEntry *pElement = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &pTarget, pElement);
|
||||
if( pElement )
|
||||
tHashTimerEntry *element = NULL;
|
||||
HASH_FIND_INT(_hashForTimers, &target, element);
|
||||
if( element )
|
||||
{
|
||||
return pElement->paused;
|
||||
return element->paused;
|
||||
}
|
||||
|
||||
// We should check update selectors if target does not have custom selectors
|
||||
tHashUpdateEntry *elementUpdate = NULL;
|
||||
HASH_FIND_INT(_hashForUpdates, &pTarget, elementUpdate);
|
||||
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
|
||||
if ( elementUpdate )
|
||||
{
|
||||
return elementUpdate->entry->paused;
|
||||
|
@ -810,10 +810,10 @@ Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)
|
|||
return idsWithSelectors;
|
||||
}
|
||||
|
||||
void Scheduler::resumeTargets(Set* pTargetsToResume)
|
||||
void Scheduler::resumeTargets(Set* targetsToResume)
|
||||
{
|
||||
SetIterator iter;
|
||||
for (iter = pTargetsToResume->begin(); iter != pTargetsToResume->end(); ++iter)
|
||||
for (iter = targetsToResume->begin(); iter != targetsToResume->end(); ++iter)
|
||||
{
|
||||
resumeTarget(*iter);
|
||||
}
|
||||
|
|
|
@ -52,37 +52,36 @@ class Set;
|
|||
class CC_DLL Timer : public Object
|
||||
{
|
||||
public:
|
||||
/** Allocates a timer with a target and a selector. */
|
||||
static Timer* createWithTarget(Object *target, SEL_SCHEDULE selector);
|
||||
/** Allocates a timer with a target, a selector and an interval in seconds. */
|
||||
static Timer* createWithTarget(Object *target, SEL_SCHEDULE selector, float seconds);
|
||||
/** Allocates a timer with a script callback function and an interval in seconds. */
|
||||
static Timer* createWithScriptHandler(int nHandler, float seconds);
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithTarget(Object *target, SEL_SCHEDULE selector) { return Timer::createWithTarget(target, selector); }
|
||||
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithTarget(Object *target, SEL_SCHEDULE selector, float seconds) { return Timer::createWithTarget(target, selector, seconds); }
|
||||
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithScriptHandler(int nHandler, float seconds) { return Timer::createWithScriptHandler(nHandler, seconds); }
|
||||
|
||||
Timer(void);
|
||||
|
||||
|
||||
/** Initializes a timer with a target and a selector. */
|
||||
bool initWithTarget(Object *target, SEL_SCHEDULE selector);
|
||||
/** Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. */
|
||||
bool initWithTarget(Object *target, SEL_SCHEDULE selector, float seconds, unsigned int nRepeat, float fDelay);
|
||||
/** Initializes a timer with a script callback function and an interval in seconds. */
|
||||
bool initWithScriptHandler(int nHandler, float seconds);
|
||||
|
||||
/** get interval in seconds */
|
||||
float getInterval(void) const;
|
||||
float getInterval() const;
|
||||
/** set interval in seconds */
|
||||
void setInterval(float fInterval);
|
||||
void setInterval(float interval);
|
||||
|
||||
SEL_SCHEDULE getSelector() const;
|
||||
|
||||
/** Initializes a timer with a target and a selector. */
|
||||
bool initWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector);
|
||||
|
||||
/** Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. */
|
||||
bool initWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds, unsigned int nRepeat, float fDelay);
|
||||
|
||||
/** Initializes a timer with a script callback function and an interval in seconds. */
|
||||
bool initWithScriptHandler(int nHandler, float fSeconds);
|
||||
|
||||
|
||||
/** triggers the timer */
|
||||
void update(float dt);
|
||||
|
||||
public:
|
||||
/** Allocates a timer with a target and a selector. */
|
||||
static Timer* timerWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector);
|
||||
|
||||
/** Allocates a timer with a target, a selector and an interval in seconds. */
|
||||
static Timer* timerWithTarget(Object *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds);
|
||||
|
||||
/** Allocates a timer with a script callback function and an interval in seconds. */
|
||||
static Timer* timerWithScriptHandler(int nHandler, float fSeconds);
|
||||
|
||||
inline int getScriptHandler() const { return _scriptHandler; };
|
||||
|
||||
protected:
|
||||
|
@ -149,38 +148,38 @@ public:
|
|||
|
||||
@since v0.99.3, repeat and delay added in v1.1
|
||||
*/
|
||||
void scheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget, float fInterval, unsigned int repeat, float delay, bool bPaused);
|
||||
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float fInterval, unsigned int repeat, float delay, bool bPaused);
|
||||
|
||||
/** calls scheduleSelector with kRepeatForever and a 0 delay */
|
||||
void scheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget, float fInterval, bool bPaused);
|
||||
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float fInterval, bool bPaused);
|
||||
/** Schedules the 'update' selector for a given target with a given priority.
|
||||
The 'update' selector will be called every frame.
|
||||
The lower the priority, the earlier it is called.
|
||||
@since v0.99.3
|
||||
*/
|
||||
void scheduleUpdateForTarget(Object *pTarget, int nPriority, bool bPaused);
|
||||
void scheduleUpdateForTarget(Object *target, int nPriority, bool bPaused);
|
||||
|
||||
/** Checks whether a selector for a given taget is scheduled.
|
||||
@since v3.0.0
|
||||
*/
|
||||
bool isScheduledForTarget(SEL_SCHEDULE pfnSelector, Object *pTarget);
|
||||
bool isScheduledForTarget(SEL_SCHEDULE selector, Object *target);
|
||||
|
||||
/** Unschedule a selector for a given target.
|
||||
If you want to unschedule the "update", use unscheudleUpdateForTarget.
|
||||
@since v0.99.3
|
||||
*/
|
||||
void unscheduleSelector(SEL_SCHEDULE pfnSelector, Object *pTarget);
|
||||
void unscheduleSelector(SEL_SCHEDULE selector, Object *target);
|
||||
|
||||
/** Unschedules the update selector for a given target
|
||||
@since v0.99.3
|
||||
*/
|
||||
void unscheduleUpdateForTarget(const Object *pTarget);
|
||||
void unscheduleUpdateForTarget(const Object *target);
|
||||
|
||||
/** Unschedules all selectors for a given target.
|
||||
This also includes the "update" selector.
|
||||
@since v0.99.3
|
||||
*/
|
||||
void unscheduleAllForTarget(Object *pTarget);
|
||||
void unscheduleAllForTarget(Object *target);
|
||||
|
||||
/** Unschedules all selectors from all targets.
|
||||
You should NEVER call this method, unless you know what you are doing.
|
||||
|
@ -210,19 +209,19 @@ public:
|
|||
If the target is not present, nothing happens.
|
||||
@since v0.99.3
|
||||
*/
|
||||
void pauseTarget(Object *pTarget);
|
||||
void pauseTarget(Object *target);
|
||||
|
||||
/** Resumes the target.
|
||||
The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.
|
||||
If the target is not present, nothing happens.
|
||||
@since v0.99.3
|
||||
*/
|
||||
void resumeTarget(Object *pTarget);
|
||||
void resumeTarget(Object *target);
|
||||
|
||||
/** Returns whether or not the target is paused
|
||||
@since v1.0.0
|
||||
*/
|
||||
bool isTargetPaused(Object *pTarget);
|
||||
bool isTargetPaused(Object *target);
|
||||
|
||||
/** Pause all selectors from all targets.
|
||||
You should NEVER call this method, unless you know what you are doing.
|
||||
|
@ -248,8 +247,8 @@ private:
|
|||
|
||||
// update specific
|
||||
|
||||
void priorityIn(struct _listEntry **ppList, Object *pTarget, int nPriority, bool bPaused);
|
||||
void appendIn(struct _listEntry **ppList, Object *pTarget, bool bPaused);
|
||||
void priorityIn(struct _listEntry **ppList, Object *target, int nPriority, bool bPaused);
|
||||
void appendIn(struct _listEntry **ppList, Object *target, bool bPaused);
|
||||
|
||||
protected:
|
||||
float _timeScale;
|
||||
|
|
|
@ -122,10 +122,10 @@ Speed *Speed::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void Speed::startWithTarget(Node* pTarget)
|
||||
void Speed::startWithTarget(Node* target)
|
||||
{
|
||||
Action::startWithTarget(pTarget);
|
||||
_innerAction->startWithTarget(pTarget);
|
||||
Action::startWithTarget(target);
|
||||
_innerAction->startWithTarget(target);
|
||||
}
|
||||
|
||||
void Speed::stop()
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
virtual bool isDone(void) const;
|
||||
|
||||
//! called before the action start. It will also set the target.
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void startWithTarget(Node *target);
|
||||
|
||||
/**
|
||||
called after the action has finished. It will set the 'target' to nil.
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
inline Node* getTarget(void) const { return _target; }
|
||||
/** The action will modify the target properties. */
|
||||
inline void setTarget(Node *pTarget) { _target = pTarget; }
|
||||
inline void setTarget(Node *target) { _target = target; }
|
||||
|
||||
inline Node* getOriginalTarget(void) const { return _originalTarget; }
|
||||
/** Set the original target, since target can be nil.
|
||||
|
@ -157,7 +157,6 @@ class RepeatForever;
|
|||
class CC_DLL Speed : public Action
|
||||
{
|
||||
public:
|
||||
|
||||
/** create the action */
|
||||
static Speed* create(ActionInterval* pAction, float fSpeed);
|
||||
|
||||
|
@ -173,7 +172,7 @@ public:
|
|||
|
||||
void setInnerAction(ActionInterval *pAction);
|
||||
|
||||
inline ActionInterval* getInnerAction()
|
||||
inline ActionInterval* getInnerAction() const
|
||||
{
|
||||
return _innerAction;
|
||||
}
|
||||
|
@ -183,7 +182,7 @@ public:
|
|||
//
|
||||
virtual Speed* clone() const override;
|
||||
virtual Speed* reverse() const override;
|
||||
virtual void startWithTarget(Node* pTarget) override;
|
||||
virtual void startWithTarget(Node* target) override;
|
||||
virtual void stop() override;
|
||||
virtual void step(float dt) override;
|
||||
virtual bool isDone(void) const override;
|
||||
|
|
|
@ -33,11 +33,11 @@ NS_CC_BEGIN
|
|||
//
|
||||
// CameraAction
|
||||
//
|
||||
void ActionCamera::startWithTarget(Node *pTarget)
|
||||
void ActionCamera::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
Camera *camera = pTarget->getCamera();
|
||||
Camera *camera = target->getCamera();
|
||||
camera->getCenterXYZ(&_centerXOrig, &_centerYOrig, &_centerZOrig);
|
||||
camera->getEyeXYZ(&_eyeXOrig, &_eyeYOrig, &_eyeZOrig);
|
||||
camera->getUpXYZ(&_upXOrig, &_upYOrig, &_upZOrig);
|
||||
|
@ -99,9 +99,9 @@ bool OrbitCamera::initWithDuration(float t, float radius, float deltaRadius, flo
|
|||
return false;
|
||||
}
|
||||
|
||||
void OrbitCamera::startWithTarget(Node *pTarget)
|
||||
void OrbitCamera::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
float r, zenith, azimuth;
|
||||
this->sphericalRadius(&r, &zenith, &azimuth);
|
||||
if( isnan(_radius) )
|
||||
|
|
|
@ -56,12 +56,12 @@ public:
|
|||
,_upZOrig(0)
|
||||
{}
|
||||
virtual ~ActionCamera(){}
|
||||
// super methods
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
/** returns a new reversed action */
|
||||
virtual ActionCamera * reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual ActionCamera *clone() const;
|
||||
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ActionCamera * reverse() const override;
|
||||
virtual ActionCamera *clone() const override;
|
||||
|
||||
protected:
|
||||
float _centerXOrig;
|
||||
float _centerYOrig;
|
||||
|
@ -84,6 +84,9 @@ Orbits the camera around the center of the screen using spherical coordinates
|
|||
class CC_DLL OrbitCamera : public ActionCamera //<NSCopying>
|
||||
{
|
||||
public:
|
||||
/** creates a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
|
||||
static OrbitCamera* create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||
|
||||
OrbitCamera()
|
||||
: _radius(0.0)
|
||||
, _deltaRadius(0.0)
|
||||
|
@ -98,19 +101,15 @@ public:
|
|||
{}
|
||||
~OrbitCamera(){}
|
||||
|
||||
/** creates a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
|
||||
static OrbitCamera* create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||
|
||||
/** initializes a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
|
||||
bool initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||
/** positions the camera according to spherical coordinates */
|
||||
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
||||
// super methods
|
||||
/** returns a new clone of the action */
|
||||
OrbitCamera *clone() const;
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
// Overrides
|
||||
OrbitCamera *clone() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
float _radius;
|
||||
|
|
|
@ -265,16 +265,16 @@ CardinalSplineTo::CardinalSplineTo()
|
|||
{
|
||||
}
|
||||
|
||||
void CardinalSplineTo::startWithTarget(cocos2d::Node *pTarget)
|
||||
void CardinalSplineTo::startWithTarget(cocos2d::Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
// _deltaT = (float) 1 / _points->count();
|
||||
|
||||
// Issue #1441
|
||||
_deltaT = (float) 1 / (_points->count() - 1);
|
||||
|
||||
_previousPosition = pTarget->getPosition();
|
||||
_previousPosition = target->getPosition();
|
||||
_accumulatedDiff = Point::ZERO;
|
||||
}
|
||||
|
||||
|
@ -416,10 +416,10 @@ CardinalSplineBy* CardinalSplineBy::reverse() const
|
|||
return CardinalSplineBy::create(_duration, pReverse, _tension);
|
||||
}
|
||||
|
||||
void CardinalSplineBy::startWithTarget(cocos2d::Node *pTarget)
|
||||
void CardinalSplineBy::startWithTarget(cocos2d::Node *target)
|
||||
{
|
||||
CardinalSplineTo::startWithTarget(pTarget);
|
||||
_startPosition = pTarget->getPosition();
|
||||
CardinalSplineTo::startWithTarget(target);
|
||||
_startPosition = target->getPosition();
|
||||
}
|
||||
|
||||
CardinalSplineBy* CardinalSplineBy::clone() const
|
||||
|
|
|
@ -117,27 +117,23 @@ public:
|
|||
|
||||
/** initializes the action with a duration and an array of points */
|
||||
bool initWithDuration(float duration, PointArray* points, float tension);
|
||||
|
||||
// super virtual functions
|
||||
/** returns a new clone of the action */
|
||||
virtual CardinalSplineTo *clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CardinalSplineTo* reverse() const;
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
virtual void updatePosition(Point &newPos);
|
||||
|
||||
|
||||
inline PointArray* getPoints() { return _points; }
|
||||
inline void setPoints(PointArray* points)
|
||||
inline void setPoints(PointArray* points)
|
||||
{
|
||||
CC_SAFE_RETAIN(points);
|
||||
CC_SAFE_RELEASE(_points);
|
||||
_points = points;
|
||||
}
|
||||
|
||||
|
||||
// Overrides
|
||||
virtual CardinalSplineTo *clone() const override;
|
||||
virtual CardinalSplineTo* reverse() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
/** Array of control points */
|
||||
PointArray *_points;
|
||||
|
@ -160,15 +156,11 @@ public:
|
|||
|
||||
CardinalSplineBy();
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
|
||||
virtual void updatePosition(Point &newPos);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CardinalSplineBy *clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CardinalSplineBy* reverse() const;
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void updatePosition(Point &newPos) override;
|
||||
virtual CardinalSplineBy *clone() const override;
|
||||
virtual CardinalSplineBy* reverse() const override;
|
||||
|
||||
protected:
|
||||
Point _startPosition;
|
||||
|
@ -189,11 +181,9 @@ public:
|
|||
/** initializes the action with a duration and an array of points */
|
||||
bool initWithDuration(float dt, PointArray* points);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CatmullRomTo *clone() const;
|
||||
|
||||
/** returns a reversed copy of the action */
|
||||
virtual CatmullRomTo *reverse() const;
|
||||
// Override
|
||||
virtual CatmullRomTo *clone() const override;
|
||||
virtual CatmullRomTo *reverse() const override;
|
||||
};
|
||||
|
||||
/** An action that moves the target with a CatmullRom curve by a certain distance.
|
||||
|
@ -204,18 +194,15 @@ public:
|
|||
class CC_DLL CatmullRomBy : public CardinalSplineBy
|
||||
{
|
||||
public:
|
||||
|
||||
/** creates an action with a Cardinal Spline array of points and tension */
|
||||
static CatmullRomBy* create(float dt, PointArray* points);
|
||||
|
||||
/** initializes the action with a duration and an array of points */
|
||||
bool initWithDuration(float dt, PointArray* points);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CatmullRomBy *clone() const;
|
||||
|
||||
/** returns a reversed copy of the action */
|
||||
virtual CatmullRomBy *reverse() const;
|
||||
// Override
|
||||
virtual CatmullRomBy *clone() const override;
|
||||
virtual CatmullRomBy *reverse() const override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -62,9 +62,9 @@ ActionEase::~ActionEase(void)
|
|||
CC_SAFE_RELEASE(_inner);
|
||||
}
|
||||
|
||||
void ActionEase::startWithTarget(Node *pTarget)
|
||||
void ActionEase::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_inner->startWithTarget(_target);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
//
|
||||
virtual ActionEase* clone() const override = 0;
|
||||
virtual ActionEase* reverse() const override = 0;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ bool GridAction::initWithDuration(float duration, const Size& gridSize)
|
|||
return false;
|
||||
}
|
||||
|
||||
void GridAction::startWithTarget(Node *pTarget)
|
||||
void GridAction::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
GridBase *newgrid = this->getGrid();
|
||||
|
||||
|
@ -95,23 +95,13 @@ GridBase* Grid3DAction::getGrid(void)
|
|||
return Grid3D::create(_gridSize);
|
||||
}
|
||||
|
||||
Vertex3F Grid3DAction::vertex(const Point& position)
|
||||
{
|
||||
return getVertex(position);
|
||||
}
|
||||
|
||||
Vertex3F Grid3DAction::originalVertex(const Point& position)
|
||||
{
|
||||
return getOriginalVertex(position);
|
||||
}
|
||||
|
||||
Vertex3F Grid3DAction::getVertex(const Point& position)
|
||||
Vertex3F Grid3DAction::getVertex(const Point& position) const
|
||||
{
|
||||
Grid3D *g = (Grid3D*)_target->getGrid();
|
||||
return g->getVertex(position);
|
||||
}
|
||||
|
||||
Vertex3F Grid3DAction::getOriginalVertex(const Point& position)
|
||||
Vertex3F Grid3DAction::getOriginalVertex(const Point& position) const
|
||||
{
|
||||
Grid3D *g = (Grid3D*)_target->getGrid();
|
||||
return g->getOriginalVertex(position);
|
||||
|
@ -130,28 +120,18 @@ GridBase* TiledGrid3DAction::getGrid(void)
|
|||
return TiledGrid3D::create(_gridSize);
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3DAction::getTile(const Point& pos)
|
||||
Quad3 TiledGrid3DAction::getTile(const Point& pos) const
|
||||
{
|
||||
TiledGrid3D *g = (TiledGrid3D*)_target->getGrid();
|
||||
return g->getTile(pos);
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3DAction::getOriginalTile(const Point& pos)
|
||||
Quad3 TiledGrid3DAction::getOriginalTile(const Point& pos) const
|
||||
{
|
||||
TiledGrid3D *g = (TiledGrid3D*)_target->getGrid();
|
||||
return g->getOriginalTile(pos);
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3DAction::tile(const Point& pos)
|
||||
{
|
||||
return getTile(pos);
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3DAction::originalTile(const Point& pos)
|
||||
{
|
||||
return getOriginalTile(pos);
|
||||
}
|
||||
|
||||
void TiledGrid3DAction::setTile(const Point& pos, const Quad3& coords)
|
||||
{
|
||||
TiledGrid3D *g = (TiledGrid3D*)_target->getGrid();
|
||||
|
@ -206,10 +186,10 @@ AccelDeccelAmplitude::~AccelDeccelAmplitude(void)
|
|||
CC_SAFE_RELEASE(_other);
|
||||
}
|
||||
|
||||
void AccelDeccelAmplitude::startWithTarget(Node *pTarget)
|
||||
void AccelDeccelAmplitude::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_other->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_other->startWithTarget(target);
|
||||
}
|
||||
|
||||
void AccelDeccelAmplitude::update(float time)
|
||||
|
@ -278,10 +258,10 @@ AccelAmplitude::~AccelAmplitude(void)
|
|||
CC_SAFE_DELETE(_other);
|
||||
}
|
||||
|
||||
void AccelAmplitude::startWithTarget(Node *pTarget)
|
||||
void AccelAmplitude::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_other->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_other->startWithTarget(target);
|
||||
}
|
||||
|
||||
void AccelAmplitude::update(float time)
|
||||
|
@ -334,10 +314,10 @@ DeccelAmplitude::~DeccelAmplitude(void)
|
|||
CC_SAFE_RELEASE(_other);
|
||||
}
|
||||
|
||||
void DeccelAmplitude::startWithTarget(Node *pTarget)
|
||||
void DeccelAmplitude::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_other->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_other->startWithTarget(target);
|
||||
}
|
||||
|
||||
void DeccelAmplitude::update(float time)
|
||||
|
@ -362,9 +342,9 @@ DeccelAmplitude* DeccelAmplitude::reverse() const
|
|||
|
||||
// implementation of StopGrid
|
||||
|
||||
void StopGrid::startWithTarget(Node *pTarget)
|
||||
void StopGrid::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInstant::startWithTarget(pTarget);
|
||||
ActionInstant::startWithTarget(target);
|
||||
|
||||
GridBase *pGrid = _target->getGrid();
|
||||
if (pGrid && pGrid->isActive())
|
||||
|
@ -419,9 +399,9 @@ bool ReuseGrid::initWithTimes(int times)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ReuseGrid::startWithTarget(Node *pTarget)
|
||||
void ReuseGrid::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInstant::startWithTarget(pTarget);
|
||||
ActionInstant::startWithTarget(target);
|
||||
|
||||
if (_target->getGrid() && _target->getGrid()->isActive())
|
||||
{
|
||||
|
|
|
@ -41,21 +41,16 @@ class GridBase;
|
|||
class CC_DLL GridAction : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual GridAction * clone() const = 0;
|
||||
|
||||
/** returns a new reversed action.
|
||||
The reversed action is created with the ReverseTime action.
|
||||
*/
|
||||
virtual GridAction* reverse() const;
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
|
||||
/** initializes the action with size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize);
|
||||
|
||||
/** returns the grid */
|
||||
virtual GridBase* getGrid(void);
|
||||
virtual GridBase* getGrid();
|
||||
|
||||
// overrides
|
||||
virtual GridAction * clone() const override = 0;
|
||||
virtual GridAction* reverse() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
Size _gridSize;
|
||||
|
@ -68,57 +63,64 @@ protected:
|
|||
class CC_DLL Grid3DAction : public GridAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual Grid3DAction * clone() const = 0;
|
||||
|
||||
/** returns the grid */
|
||||
virtual GridBase* getGrid(void);
|
||||
/** returns the vertex than belongs to certain position in the grid */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F vertex(const Point& position);
|
||||
Vertex3F getVertex(const Point& position) const;
|
||||
|
||||
/** @deprecated Use getVertex() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE inline Vertex3F vertex(const Point& position) { return getVertex(position); }
|
||||
|
||||
/** returns the non-transformed vertex than belongs to certain position in the grid */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F originalVertex(const Point& position);
|
||||
|
||||
/** returns the vertex than belongs to certain position in the grid */
|
||||
Vertex3F getVertex(const Point& position);
|
||||
/** returns the non-transformed vertex than belongs to certain position in the grid */
|
||||
Vertex3F getOriginalVertex(const Point& position);
|
||||
|
||||
Vertex3F getOriginalVertex(const Point& position) const;
|
||||
|
||||
/** @deprecated Use getOriginalVertex() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE inline Vertex3F originalVertex(const Point& position) { return getOriginalVertex(position); }
|
||||
|
||||
/** sets a new vertex to a certain position of the grid */
|
||||
void setVertex(const Point& position, const Vertex3F& vertex);
|
||||
|
||||
// Overrides
|
||||
virtual Grid3DAction * clone() const override = 0;
|
||||
};
|
||||
|
||||
/** @brief Base class for TiledGrid3D actions */
|
||||
class CC_DLL TiledGrid3DAction : public GridAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual TiledGrid3DAction * clone() const = 0;
|
||||
/** creates the action with size and duration */
|
||||
static TiledGrid3DAction* create(float duration, const Size& gridSize);
|
||||
|
||||
/** returns the tile that belongs to a certain position of the grid */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& position);
|
||||
Quad3 getTile(const Point& position) const;
|
||||
|
||||
/** @deprecatd Use getTile() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& position) { return getTile(position); }
|
||||
|
||||
/** returns the non-transformed tile that belongs to a certain position of the grid */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& position);
|
||||
|
||||
/** returns the tile that belongs to a certain position of the grid */
|
||||
Quad3 getTile(const Point& position);
|
||||
/** returns the non-transformed tile that belongs to a certain position of the grid */
|
||||
Quad3 getOriginalTile(const Point& position);
|
||||
|
||||
Quad3 getOriginalTile(const Point& position) const;
|
||||
|
||||
/** @deprecatd Use getOriginalTile() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& position) { return getOriginalTile(position); }
|
||||
|
||||
/** sets a new tile to a certain position of the grid */
|
||||
void setTile(const Point& position, const Quad3& coords);
|
||||
|
||||
/** returns the grid */
|
||||
virtual GridBase* getGrid(void);
|
||||
|
||||
public:
|
||||
/** creates the action with size and duration */
|
||||
static TiledGrid3DAction* create(float duration, const Size& gridSize);
|
||||
// Override
|
||||
virtual TiledGrid3DAction * clone() const override = 0;
|
||||
};
|
||||
|
||||
/** @brief AccelDeccelAmplitude action */
|
||||
class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelDeccelAmplitude* create(Action *pAction, float duration);
|
||||
|
||||
virtual ~AccelDeccelAmplitude(void);
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *pAction, float duration);
|
||||
|
@ -128,17 +130,14 @@ public:
|
|||
/** returns a new reversed action */
|
||||
virtual AccelDeccelAmplitude* reverse() const;
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
/** set amplitude rate */
|
||||
inline void setRate(float fRate) { _rate = fRate; }
|
||||
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelDeccelAmplitude* create(Action *pAction, float duration);
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
float _rate;
|
||||
|
@ -149,27 +148,25 @@ protected:
|
|||
class CC_DLL AccelAmplitude : public ActionInterval
|
||||
{
|
||||
public:
|
||||
~AccelAmplitude(void);
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelAmplitude* create(Action *pAction, float duration);
|
||||
|
||||
virtual ~AccelAmplitude(void);
|
||||
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual AccelAmplitude* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual AccelAmplitude* reverse() const;
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
/** set amplitude rate */
|
||||
inline void setRate(float fRate) { _rate = fRate; }
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual AccelAmplitude* clone() const override;
|
||||
virtual AccelAmplitude* reverse() const override;
|
||||
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelAmplitude* create(Action *pAction, float duration);
|
||||
protected:
|
||||
float _rate;
|
||||
ActionInterval *_other;
|
||||
|
@ -179,27 +176,23 @@ protected:
|
|||
class CC_DLL DeccelAmplitude : public ActionInterval
|
||||
{
|
||||
public:
|
||||
~DeccelAmplitude(void);
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static DeccelAmplitude* create(Action *pAction, float duration);
|
||||
|
||||
virtual ~DeccelAmplitude();
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual DeccelAmplitude* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual DeccelAmplitude* reverse() const;
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
/** set amplitude rate */
|
||||
inline void setRate(float fRate) { _rate = fRate; }
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static DeccelAmplitude* create(Action *pAction, float duration);
|
||||
// overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual DeccelAmplitude* clone() const;
|
||||
virtual DeccelAmplitude* reverse() const;
|
||||
|
||||
protected:
|
||||
float _rate;
|
||||
|
@ -213,38 +206,31 @@ protected:
|
|||
*/
|
||||
class CC_DLL StopGrid : public ActionInstant
|
||||
{
|
||||
public:
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual StopGrid* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual StopGrid* reverse() const;
|
||||
|
||||
public:
|
||||
/** Allocates and initializes the action */
|
||||
static StopGrid* create(void);
|
||||
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual StopGrid* clone() const override;
|
||||
virtual StopGrid* reverse() const override;
|
||||
};
|
||||
|
||||
/** @brief ReuseGrid action */
|
||||
class CC_DLL ReuseGrid : public ActionInstant
|
||||
{
|
||||
public:
|
||||
/** creates an action with the number of times that the current grid will be reused */
|
||||
static ReuseGrid* create(int times);
|
||||
|
||||
/** initializes an action with the number of times that the current grid will be reused */
|
||||
bool initWithTimes(int times);
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
// Override
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ReuseGrid* clone() const override;
|
||||
virtual ReuseGrid* reverse() const override;
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual ReuseGrid* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual ReuseGrid* reverse() const;
|
||||
|
||||
public:
|
||||
/** creates an action with the number of times that the current grid will be reused */
|
||||
static ReuseGrid* create(int times);
|
||||
protected:
|
||||
int _times;
|
||||
};
|
||||
|
|
|
@ -40,23 +40,26 @@ NS_CC_BEGIN
|
|||
class CC_DLL Waves3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates an action with duration, grid size, waves and amplitude */
|
||||
static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns the amplitude of the effect */
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
/** sets the amplitude to the effect */
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
||||
/** returns the amplitude rate */
|
||||
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
||||
/** sets the ampliture rate */
|
||||
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
||||
|
||||
/** initializes an action with duration, grid size, waves and amplitude */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Waves3D* clone() const;
|
||||
// Overrides
|
||||
virtual Waves3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates an action with duration, grid size, waves and amplitude */
|
||||
static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
protected:
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
|
@ -67,37 +70,37 @@ protected:
|
|||
class CC_DLL FlipX3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with duration */
|
||||
static FlipX3D* create(float duration);
|
||||
|
||||
/** initializes the action with duration */
|
||||
bool initWithDuration(float duration);
|
||||
virtual bool initWithSize(const Size& gridSize, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual FlipX3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with duration */
|
||||
static FlipX3D* create(float duration);
|
||||
// Override
|
||||
virtual FlipX3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
};
|
||||
|
||||
/** @brief FlipY3D action */
|
||||
class CC_DLL FlipY3D : public FlipX3D
|
||||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual FlipY3D* clone() const;
|
||||
public:
|
||||
/** creates the action with duration */
|
||||
static FlipY3D* create(float duration);
|
||||
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FlipY3D* clone() const override;
|
||||
};
|
||||
|
||||
/** @brief Lens3D action */
|
||||
class CC_DLL Lens3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with center position, radius, a grid size and duration */
|
||||
static Lens3D* create(float duration, const Size& gridSize, const Point& position, float radius);
|
||||
|
||||
/** Get lens center position */
|
||||
inline float getLensEffect(void) const { return _lensEffect; }
|
||||
/** Set lens center position */
|
||||
|
@ -111,14 +114,10 @@ public:
|
|||
/** initializes the action with center position, radius, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Lens3D* clone() const;
|
||||
// Overrides
|
||||
virtual Lens3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with center position, radius, a grid size and duration */
|
||||
static Lens3D* create(float duration, const Size& gridSize, const Point& position, float radius);
|
||||
protected:
|
||||
/* lens center position */
|
||||
Point _position;
|
||||
|
@ -135,6 +134,9 @@ protected:
|
|||
class CC_DLL Ripple3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
static Ripple3D* create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||
|
||||
/** get center position */
|
||||
inline const Point& getPosition(void) const { return _position; }
|
||||
/** set center position */
|
||||
|
@ -149,14 +151,10 @@ public:
|
|||
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Ripple3D* clone() const;
|
||||
// Override
|
||||
virtual Ripple3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
static Ripple3D* create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||
protected:
|
||||
/* center position */
|
||||
Point _position;
|
||||
|
@ -170,17 +168,16 @@ protected:
|
|||
class CC_DLL Shaky3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with a range, shake Z vertices, a grid and duration */
|
||||
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||
|
||||
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Shaky3D* clone() const;
|
||||
// Overrides
|
||||
virtual Shaky3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with a range, shake Z vertices, a grid and duration */
|
||||
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||
protected:
|
||||
int _randrange;
|
||||
bool _shakeZ;
|
||||
|
@ -190,6 +187,9 @@ protected:
|
|||
class CC_DLL Liquid : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with amplitude, a grid and duration */
|
||||
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
||||
|
@ -199,14 +199,10 @@ public:
|
|||
/** initializes the action with amplitude, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Liquid* clone() const;
|
||||
// Overrides
|
||||
virtual Liquid* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with amplitude, a grid and duration */
|
||||
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
protected:
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
|
@ -217,6 +213,9 @@ protected:
|
|||
class CC_DLL Waves : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
||||
|
@ -226,15 +225,10 @@ public:
|
|||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Waves* clone() const;
|
||||
// Overrides
|
||||
virtual Waves* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
protected:
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
|
@ -247,6 +241,9 @@ protected:
|
|||
class CC_DLL Twirl : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
|
||||
/** get twirl center */
|
||||
inline const Point& getPosition(void) const { return _position; }
|
||||
/** set twirl center */
|
||||
|
@ -261,14 +258,10 @@ public:
|
|||
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual Twirl* clone() const;
|
||||
// Overrides
|
||||
virtual Twirl* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
protected:
|
||||
/* twirl center */
|
||||
Point _position;
|
||||
|
|
|
@ -138,9 +138,9 @@ float ActionInterval::getAmplitudeRate(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ActionInterval::startWithTarget(Node *pTarget)
|
||||
void ActionInterval::startWithTarget(Node *target)
|
||||
{
|
||||
FiniteTimeAction::startWithTarget(pTarget);
|
||||
FiniteTimeAction::startWithTarget(target);
|
||||
_elapsed = 0.0f;
|
||||
_firstTick = true;
|
||||
}
|
||||
|
@ -257,9 +257,9 @@ Sequence::~Sequence(void)
|
|||
CC_SAFE_RELEASE(_actions[1]);
|
||||
}
|
||||
|
||||
void Sequence::startWithTarget(Node *pTarget)
|
||||
void Sequence::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_split = _actions[0]->getDuration() / _duration;
|
||||
_last = -1;
|
||||
}
|
||||
|
@ -393,12 +393,12 @@ Repeat::~Repeat(void)
|
|||
CC_SAFE_RELEASE(_innerAction);
|
||||
}
|
||||
|
||||
void Repeat::startWithTarget(Node *pTarget)
|
||||
void Repeat::startWithTarget(Node *target)
|
||||
{
|
||||
_total = 0;
|
||||
_nextDt = _innerAction->getDuration()/_duration;
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_innerAction->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_innerAction->startWithTarget(target);
|
||||
}
|
||||
|
||||
void Repeat::stop(void)
|
||||
|
@ -498,10 +498,10 @@ RepeatForever *RepeatForever::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void RepeatForever::startWithTarget(Node* pTarget)
|
||||
void RepeatForever::startWithTarget(Node* target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_innerAction->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_innerAction->startWithTarget(target);
|
||||
}
|
||||
|
||||
void RepeatForever::step(float dt)
|
||||
|
@ -656,11 +656,11 @@ Spawn::~Spawn(void)
|
|||
CC_SAFE_RELEASE(_two);
|
||||
}
|
||||
|
||||
void Spawn::startWithTarget(Node *pTarget)
|
||||
void Spawn::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_one->startWithTarget(pTarget);
|
||||
_two->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_one->startWithTarget(target);
|
||||
_two->startWithTarget(target);
|
||||
}
|
||||
|
||||
void Spawn::stop(void)
|
||||
|
@ -742,12 +742,12 @@ RotateTo* RotateTo::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void RotateTo::startWithTarget(Node *pTarget)
|
||||
void RotateTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
// Calculate X
|
||||
_startAngleX = pTarget->getRotationX();
|
||||
_startAngleX = target->getRotationX();
|
||||
if (_startAngleX > 0)
|
||||
{
|
||||
_startAngleX = fmodf(_startAngleX, 360.0f);
|
||||
|
@ -860,11 +860,11 @@ RotateBy* RotateBy::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void RotateBy::startWithTarget(Node *pTarget)
|
||||
void RotateBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_startAngleX = pTarget->getRotationX();
|
||||
_startAngleY = pTarget->getRotationY();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_startAngleX = target->getRotationX();
|
||||
_startAngleY = target->getRotationY();
|
||||
}
|
||||
|
||||
void RotateBy::update(float time)
|
||||
|
@ -915,10 +915,10 @@ MoveBy* MoveBy::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void MoveBy::startWithTarget(Node *pTarget)
|
||||
void MoveBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_previousPosition = _startPosition = pTarget->getPosition();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_previousPosition = _startPosition = target->getPosition();
|
||||
}
|
||||
|
||||
MoveBy* MoveBy::reverse() const
|
||||
|
@ -977,10 +977,10 @@ MoveTo* MoveTo::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void MoveTo::startWithTarget(Node *pTarget)
|
||||
void MoveTo::startWithTarget(Node *target)
|
||||
{
|
||||
MoveBy::startWithTarget(pTarget);
|
||||
_positionDelta = _endPosition - pTarget->getPosition();
|
||||
MoveBy::startWithTarget(target);
|
||||
_positionDelta = _endPosition - target->getPosition();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1035,11 +1035,11 @@ SkewTo* SkewTo::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void SkewTo::startWithTarget(Node *pTarget)
|
||||
void SkewTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
_startSkewX = pTarget->getSkewX();
|
||||
_startSkewX = target->getSkewX();
|
||||
|
||||
if (_startSkewX > 0)
|
||||
{
|
||||
|
@ -1061,7 +1061,7 @@ void SkewTo::startWithTarget(Node *pTarget)
|
|||
_deltaX += 360;
|
||||
}
|
||||
|
||||
_startSkewY = pTarget->getSkewY();
|
||||
_startSkewY = target->getSkewY();
|
||||
|
||||
if (_startSkewY > 0)
|
||||
{
|
||||
|
@ -1147,9 +1147,9 @@ bool SkewBy::initWithDuration(float t, float deltaSkewX, float deltaSkewY)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
void SkewBy::startWithTarget(Node *pTarget)
|
||||
void SkewBy::startWithTarget(Node *target)
|
||||
{
|
||||
SkewTo::startWithTarget(pTarget);
|
||||
SkewTo::startWithTarget(target);
|
||||
_deltaX = _skewX;
|
||||
_deltaY = _skewY;
|
||||
_endSkewX = _startSkewX + _deltaX;
|
||||
|
@ -1197,10 +1197,10 @@ JumpBy* JumpBy::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void JumpBy::startWithTarget(Node *pTarget)
|
||||
void JumpBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_previousPos = _startPosition = pTarget->getPosition();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_previousPos = _startPosition = target->getPosition();
|
||||
}
|
||||
|
||||
void JumpBy::update(float t)
|
||||
|
@ -1263,9 +1263,9 @@ JumpTo* JumpTo::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void JumpTo::startWithTarget(Node *pTarget)
|
||||
void JumpTo::startWithTarget(Node *target)
|
||||
{
|
||||
JumpBy::startWithTarget(pTarget);
|
||||
JumpBy::startWithTarget(target);
|
||||
_delta = Point(_delta.x - _startPosition.x, _delta.y - _startPosition.y);
|
||||
}
|
||||
|
||||
|
@ -1305,10 +1305,10 @@ bool BezierBy::initWithDuration(float t, const ccBezierConfig& c)
|
|||
return false;
|
||||
}
|
||||
|
||||
void BezierBy::startWithTarget(Node *pTarget)
|
||||
void BezierBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_previousPosition = _startPosition = pTarget->getPosition();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_previousPosition = _startPosition = target->getPosition();
|
||||
}
|
||||
|
||||
BezierBy* BezierBy::clone(void) const
|
||||
|
@ -1397,9 +1397,9 @@ BezierTo* BezierTo::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void BezierTo::startWithTarget(Node *pTarget)
|
||||
void BezierTo::startWithTarget(Node *target)
|
||||
{
|
||||
BezierBy::startWithTarget(pTarget);
|
||||
BezierBy::startWithTarget(target);
|
||||
_config.controlPoint_1 = _toConfig.controlPoint_1 - _startPosition;
|
||||
_config.controlPoint_2 = _toConfig.controlPoint_2 - _startPosition;
|
||||
_config.endPosition = _toConfig.endPosition - _startPosition;
|
||||
|
@ -1475,11 +1475,11 @@ ScaleTo* ScaleTo::reverse() const
|
|||
}
|
||||
|
||||
|
||||
void ScaleTo::startWithTarget(Node *pTarget)
|
||||
void ScaleTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_startScaleX = pTarget->getScaleX();
|
||||
_startScaleY = pTarget->getScaleY();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_startScaleX = target->getScaleX();
|
||||
_startScaleY = target->getScaleY();
|
||||
_deltaX = _endScaleX - _startScaleX;
|
||||
_deltaY = _endScaleY - _startScaleY;
|
||||
}
|
||||
|
@ -1524,9 +1524,9 @@ ScaleBy* ScaleBy::clone(void) const
|
|||
return a;
|
||||
}
|
||||
|
||||
void ScaleBy::startWithTarget(Node *pTarget)
|
||||
void ScaleBy::startWithTarget(Node *target)
|
||||
{
|
||||
ScaleTo::startWithTarget(pTarget);
|
||||
ScaleTo::startWithTarget(target);
|
||||
_deltaX = _startScaleX * _endScaleX - _startScaleX;
|
||||
_deltaY = _startScaleY * _endScaleY - _startScaleY;
|
||||
}
|
||||
|
@ -1566,10 +1566,10 @@ void Blink::stop()
|
|||
ActionInterval::stop();
|
||||
}
|
||||
|
||||
void Blink::startWithTarget(Node *pTarget)
|
||||
void Blink::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_originalState = pTarget->isVisible();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_originalState = target->isVisible();
|
||||
}
|
||||
|
||||
Blink* Blink::clone(void) const
|
||||
|
@ -1711,16 +1711,16 @@ FadeTo* FadeTo::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void FadeTo::startWithTarget(Node *pTarget)
|
||||
void FadeTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(pTarget);
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(target);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
_fromOpacity = pRGBAProtocol->getOpacity();
|
||||
}
|
||||
/*_fromOpacity = pTarget->getOpacity();*/
|
||||
/*_fromOpacity = target->getOpacity();*/
|
||||
}
|
||||
|
||||
void FadeTo::update(float time)
|
||||
|
@ -1771,15 +1771,15 @@ TintTo* TintTo::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void TintTo::startWithTarget(Node *pTarget)
|
||||
void TintTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(_target);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
_from = pRGBAProtocol->getColor();
|
||||
}
|
||||
/*_from = pTarget->getColor();*/
|
||||
/*_from = target->getColor();*/
|
||||
}
|
||||
|
||||
void TintTo::update(float time)
|
||||
|
@ -1829,11 +1829,11 @@ TintBy* TintBy::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void TintBy::startWithTarget(Node *pTarget)
|
||||
void TintBy::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(pTarget);
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(target);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
Color3B color = pRGBAProtocol->getColor();
|
||||
|
@ -1944,10 +1944,10 @@ ReverseTime::~ReverseTime(void)
|
|||
CC_SAFE_RELEASE(_other);
|
||||
}
|
||||
|
||||
void ReverseTime::startWithTarget(Node *pTarget)
|
||||
void ReverseTime::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_other->startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_other->startWithTarget(target);
|
||||
}
|
||||
|
||||
void ReverseTime::stop(void)
|
||||
|
@ -2042,10 +2042,10 @@ Animate::~Animate()
|
|||
CC_SAFE_DELETE(_splitTimes);
|
||||
}
|
||||
|
||||
void Animate::startWithTarget(Node *pTarget)
|
||||
void Animate::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
Sprite *pSprite = (Sprite*)(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
Sprite *pSprite = static_cast<Sprite*>(target);
|
||||
|
||||
CC_SAFE_RELEASE(_origFrame);
|
||||
|
||||
|
@ -2153,21 +2153,21 @@ TargetedAction::~TargetedAction()
|
|||
CC_SAFE_RELEASE(_action);
|
||||
}
|
||||
|
||||
TargetedAction* TargetedAction::create(Node* pTarget, FiniteTimeAction* pAction)
|
||||
TargetedAction* TargetedAction::create(Node* target, FiniteTimeAction* pAction)
|
||||
{
|
||||
TargetedAction* p = new TargetedAction();
|
||||
p->initWithTarget(pTarget, pAction);
|
||||
p->initWithTarget(target, pAction);
|
||||
p->autorelease();
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
bool TargetedAction::initWithTarget(Node* pTarget, FiniteTimeAction* pAction)
|
||||
bool TargetedAction::initWithTarget(Node* target, FiniteTimeAction* pAction)
|
||||
{
|
||||
if(ActionInterval::initWithDuration(pAction->getDuration()))
|
||||
{
|
||||
CC_SAFE_RETAIN(pTarget);
|
||||
_forcedTarget = pTarget;
|
||||
CC_SAFE_RETAIN(target);
|
||||
_forcedTarget = target;
|
||||
CC_SAFE_RETAIN(pAction);
|
||||
_action = pAction;
|
||||
return true;
|
||||
|
@ -2191,9 +2191,9 @@ TargetedAction* TargetedAction::reverse(void) const
|
|||
return this->clone();
|
||||
}
|
||||
|
||||
void TargetedAction::startWithTarget(Node *pTarget)
|
||||
void TargetedAction::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
_action->startWithTarget(_forcedTarget);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
//
|
||||
virtual bool isDone(void) const override;
|
||||
virtual void step(float dt) override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ActionInterval* reverse() const override = 0;
|
||||
virtual ActionInterval *clone() const override = 0;
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
//
|
||||
virtual Sequence* clone() const override;
|
||||
virtual Sequence* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float t) override;
|
||||
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
//
|
||||
virtual Repeat* clone() const override;
|
||||
virtual Repeat* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float dt) override;
|
||||
virtual bool isDone(void) const override;
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
//
|
||||
virtual RepeatForever* clone() const override;
|
||||
virtual RepeatForever* reverse(void) const override;
|
||||
virtual void startWithTarget(Node* pTarget) override;
|
||||
virtual void startWithTarget(Node* target) override;
|
||||
virtual void step(float dt) override;
|
||||
virtual bool isDone(void) const override;
|
||||
|
||||
|
@ -242,7 +242,7 @@ public:
|
|||
//
|
||||
virtual Spawn* clone() const override;
|
||||
virtual Spawn* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
@ -273,7 +273,7 @@ public:
|
|||
//
|
||||
virtual RotateTo* clone() const override;
|
||||
virtual RotateTo* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -305,7 +305,7 @@ public:
|
|||
//
|
||||
virtual RotateBy* clone() const override;
|
||||
virtual RotateBy* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -335,7 +335,7 @@ public:
|
|||
//
|
||||
virtual MoveBy* clone() const override;
|
||||
virtual MoveBy* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -362,7 +362,7 @@ public:
|
|||
// Overrides
|
||||
//
|
||||
virtual MoveTo* clone() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
Point _endPosition;
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
//
|
||||
virtual SkewTo* clone() const override;
|
||||
virtual SkewTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -413,7 +413,7 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual SkewBy* clone() const override;
|
||||
virtual SkewBy* reverse(void) const override;
|
||||
};
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
//
|
||||
virtual JumpBy* clone() const override;
|
||||
virtual JumpBy* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -456,7 +456,7 @@ public:
|
|||
//
|
||||
// Override
|
||||
//
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual JumpTo* clone() const override;
|
||||
virtual JumpTo* reverse(void) const override;
|
||||
};
|
||||
|
@ -488,7 +488,7 @@ public:
|
|||
//
|
||||
virtual BezierBy* clone() const override;
|
||||
virtual BezierBy* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -510,9 +510,9 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual BezierTo* clone() const;
|
||||
virtual BezierTo* reverse(void) const;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual BezierTo* clone() const override;
|
||||
virtual BezierTo* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
ccBezierConfig _toConfig;
|
||||
|
@ -541,7 +541,7 @@ public:
|
|||
//
|
||||
virtual ScaleTo* clone() const override;
|
||||
virtual ScaleTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -569,7 +569,7 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ScaleBy* clone() const override;
|
||||
virtual ScaleBy* reverse(void) const override;
|
||||
};
|
||||
|
@ -591,7 +591,7 @@ public:
|
|||
virtual Blink* clone() const override;
|
||||
virtual Blink* reverse(void) const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop() override;
|
||||
|
||||
protected:
|
||||
|
@ -650,7 +650,7 @@ public:
|
|||
//
|
||||
virtual FadeTo* clone() const override;
|
||||
virtual FadeTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -676,7 +676,7 @@ public:
|
|||
//
|
||||
virtual TintTo* clone() const override;
|
||||
virtual TintTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -701,7 +701,7 @@ public:
|
|||
//
|
||||
virtual TintBy* clone() const override;
|
||||
virtual TintBy* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -754,7 +754,7 @@ public:
|
|||
//
|
||||
virtual ReverseTime* reverse() const override;
|
||||
virtual ReverseTime* clone() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
@ -781,7 +781,7 @@ public:
|
|||
//
|
||||
virtual Animate* clone() const override;
|
||||
virtual Animate* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float t) override;
|
||||
|
||||
|
@ -805,17 +805,17 @@ public:
|
|||
virtual ~TargetedAction();
|
||||
|
||||
/** Create an action with the specified action and forced target */
|
||||
static TargetedAction* create(Node* pTarget, FiniteTimeAction* pAction);
|
||||
static TargetedAction* create(Node* target, FiniteTimeAction* pAction);
|
||||
|
||||
/** Init an action with the specified action and forced target */
|
||||
bool initWithTarget(Node* pTarget, FiniteTimeAction* pAction);
|
||||
bool initWithTarget(Node* target, FiniteTimeAction* pAction);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual TargetedAction* clone() const override;
|
||||
virtual TargetedAction* reverse() const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
|
|
|
@ -120,20 +120,20 @@ void ActionManager::removeActionAtIndex(unsigned int uIndex, tHashElement *pElem
|
|||
|
||||
// pause / resume
|
||||
|
||||
void ActionManager::pauseTarget(Object *pTarget)
|
||||
void ActionManager::pauseTarget(Object *target)
|
||||
{
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
if (pElement)
|
||||
{
|
||||
pElement->paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ActionManager::resumeTarget(Object *pTarget)
|
||||
void ActionManager::resumeTarget(Object *target)
|
||||
{
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
if (pElement)
|
||||
{
|
||||
pElement->paused = false;
|
||||
|
@ -168,21 +168,21 @@ void ActionManager::resumeTargets(cocos2d::Set *targetsToResume)
|
|||
|
||||
// run
|
||||
|
||||
void ActionManager::addAction(Action *pAction, Node *pTarget, bool paused)
|
||||
void ActionManager::addAction(Action *pAction, Node *target, bool paused)
|
||||
{
|
||||
CCAssert(pAction != NULL, "");
|
||||
CCAssert(pTarget != NULL, "");
|
||||
CCAssert(target != NULL, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
// we should convert it to Object*, because we save it as Object*
|
||||
Object *tmp = pTarget;
|
||||
Object *tmp = target;
|
||||
HASH_FIND_INT(_targets, &tmp, pElement);
|
||||
if (! pElement)
|
||||
{
|
||||
pElement = (tHashElement*)calloc(sizeof(*pElement), 1);
|
||||
pElement->paused = paused;
|
||||
pTarget->retain();
|
||||
pElement->target = pTarget;
|
||||
target->retain();
|
||||
pElement->target = target;
|
||||
HASH_ADD_INT(_targets, target, pElement);
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void ActionManager::addAction(Action *pAction, Node *pTarget, bool paused)
|
|||
CCAssert(! ccArrayContainsObject(pElement->actions, pAction), "");
|
||||
ccArrayAppendObject(pElement->actions, pAction);
|
||||
|
||||
pAction->startWithTarget(pTarget);
|
||||
pAction->startWithTarget(target);
|
||||
}
|
||||
|
||||
// remove
|
||||
|
@ -200,22 +200,22 @@ void ActionManager::removeAllActions(void)
|
|||
{
|
||||
for (tHashElement *pElement = _targets; pElement != NULL; )
|
||||
{
|
||||
Object *pTarget = pElement->target;
|
||||
Object *target = pElement->target;
|
||||
pElement = (tHashElement*)pElement->hh.next;
|
||||
removeAllActionsFromTarget(pTarget);
|
||||
removeAllActionsFromTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
void ActionManager::removeAllActionsFromTarget(Object *pTarget)
|
||||
void ActionManager::removeAllActionsFromTarget(Object *target)
|
||||
{
|
||||
// explicit null handling
|
||||
if (pTarget == NULL)
|
||||
if (target == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
if (pElement)
|
||||
{
|
||||
if (ccArrayContainsObject(pElement->actions, pElement->currentAction) && (! pElement->currentActionSalvaged))
|
||||
|
@ -249,8 +249,8 @@ void ActionManager::removeAction(Action *pAction)
|
|||
}
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
Object *pTarget = pAction->getOriginalTarget();
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
Object *target = pAction->getOriginalTarget();
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
if (pElement)
|
||||
{
|
||||
unsigned int i = ccArrayGetIndexOfObject(pElement->actions, pAction);
|
||||
|
@ -265,13 +265,13 @@ void ActionManager::removeAction(Action *pAction)
|
|||
}
|
||||
}
|
||||
|
||||
void ActionManager::removeActionByTag(unsigned int tag, Object *pTarget)
|
||||
void ActionManager::removeActionByTag(unsigned int tag, Object *target)
|
||||
{
|
||||
CCAssert((int)tag != kActionTagInvalid, "");
|
||||
CCAssert(pTarget != NULL, "");
|
||||
CCAssert(target != NULL, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
|
||||
if (pElement)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ void ActionManager::removeActionByTag(unsigned int tag, Object *pTarget)
|
|||
{
|
||||
Action *pAction = (Action*)pElement->actions->arr[i];
|
||||
|
||||
if (pAction->getTag() == (int)tag && pAction->getOriginalTarget() == pTarget)
|
||||
if (pAction->getTag() == (int)tag && pAction->getOriginalTarget() == target)
|
||||
{
|
||||
removeActionAtIndex(i, pElement);
|
||||
break;
|
||||
|
@ -291,12 +291,14 @@ void ActionManager::removeActionByTag(unsigned int tag, Object *pTarget)
|
|||
|
||||
// get
|
||||
|
||||
Action* ActionManager::getActionByTag(unsigned int tag, Object *pTarget)
|
||||
// XXX: Passing "const O *" instead of "const O&" because HASH_FIND_IT requries the address of a pointer
|
||||
// and, it is not possible to get the address of a reference
|
||||
Action* ActionManager::getActionByTag(unsigned int tag, const Object *target) const
|
||||
{
|
||||
CCAssert((int)tag != kActionTagInvalid, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
|
||||
if (pElement)
|
||||
{
|
||||
|
@ -323,10 +325,12 @@ Action* ActionManager::getActionByTag(unsigned int tag, Object *pTarget)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int ActionManager::numberOfRunningActionsInTarget(Object *pTarget)
|
||||
// XXX: Passing "const O *" instead of "const O&" because HASH_FIND_IT requries the address of a pointer
|
||||
// and, it is not possible to get the address of a reference
|
||||
unsigned int ActionManager::getNumberOfRunningActionsInTarget(const Object *target) const
|
||||
{
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(_targets, &pTarget, pElement);
|
||||
HASH_FIND_INT(_targets, &target, pElement);
|
||||
if (pElement)
|
||||
{
|
||||
return pElement->actions ? pElement->actions->num : 0;
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
|
||||
When the target is paused, the queued actions won't be 'ticked'.
|
||||
*/
|
||||
void addAction(Action *pAction, Node *pTarget, bool paused);
|
||||
void addAction(Action *pAction, Node *target, bool paused);
|
||||
|
||||
/** Removes all actions from all the targets.
|
||||
*/
|
||||
|
@ -76,34 +76,37 @@ public:
|
|||
/** Removes all actions from a certain target.
|
||||
All the actions that belongs to the target will be removed.
|
||||
*/
|
||||
void removeAllActionsFromTarget(Object *pTarget);
|
||||
void removeAllActionsFromTarget(Object *target);
|
||||
|
||||
/** Removes an action given an action reference.
|
||||
*/
|
||||
void removeAction(Action *pAction);
|
||||
|
||||
/** Removes an action given its tag and the target */
|
||||
void removeActionByTag(unsigned int tag, Object *pTarget);
|
||||
void removeActionByTag(unsigned int tag, Object *target);
|
||||
|
||||
/** Gets an action given its tag an a target
|
||||
@return the Action the with the given tag
|
||||
*/
|
||||
Action* getActionByTag(unsigned int tag, Object *pTarget);
|
||||
Action* getActionByTag(unsigned int tag, const Object *target) const;
|
||||
|
||||
/** Returns the numbers of actions that are running in a certain target.
|
||||
* Composable actions are counted as 1 action. Example:
|
||||
* - If you are running 1 Sequence of 7 actions, it will return 1.
|
||||
* - If you are running 7 Sequences of 2 actions, it will return 7.
|
||||
*/
|
||||
unsigned int numberOfRunningActionsInTarget(Object *pTarget);
|
||||
unsigned int getNumberOfRunningActionsInTarget(const Object *target) const;
|
||||
|
||||
/** @deprecated use getNumberOfRunningActionsInTarget() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE inline unsigned int numberOfRunningActionsInTarget(Object *target) const { return getNumberOfRunningActionsInTarget(target); }
|
||||
|
||||
/** Pauses the target: all running actions and newly added actions will be paused.
|
||||
*/
|
||||
void pauseTarget(Object *pTarget);
|
||||
void pauseTarget(Object *target);
|
||||
|
||||
/** Resumes the target. All queued actions will be resumed.
|
||||
*/
|
||||
void resumeTarget(Object *pTarget);
|
||||
void resumeTarget(Object *target);
|
||||
|
||||
/** Pauses all running actions, returning a list of targets whose actions were paused.
|
||||
*/
|
||||
|
|
|
@ -46,15 +46,12 @@ NS_CC_BEGIN
|
|||
class CC_DLL PageTurn3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual PageTurn3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** create the action */
|
||||
static PageTurn3D* create(float duration, const Size& gridSize);
|
||||
|
||||
// Overrides
|
||||
virtual PageTurn3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -67,10 +67,10 @@ ProgressTo* ProgressTo::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ProgressTo::startWithTarget(Node *pTarget)
|
||||
void ProgressTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
_from = ((kProgressTimerCast)(pTarget))->getPercentage();
|
||||
ActionInterval::startWithTarget(target);
|
||||
_from = ((kProgressTimerCast)(target))->getPercentage();
|
||||
|
||||
// XXX: Is this correct ?
|
||||
// Adding it to support Repeat
|
||||
|
@ -124,9 +124,9 @@ ProgressFromTo* ProgressFromTo::reverse(void) const
|
|||
return ProgressFromTo::create(_duration, _to, _from);
|
||||
}
|
||||
|
||||
void ProgressFromTo::startWithTarget(Node *pTarget)
|
||||
void ProgressFromTo::startWithTarget(Node *target)
|
||||
{
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
ActionInterval::startWithTarget(target);
|
||||
}
|
||||
|
||||
void ProgressFromTo::update(float time)
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
//
|
||||
virtual ProgressTo* clone() const override;
|
||||
virtual ProgressTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
//
|
||||
virtual ProgressFromTo* clone() const override;
|
||||
virtual ProgressFromTo* reverse(void) const override;
|
||||
virtual void startWithTarget(Node *pTarget) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -295,9 +295,9 @@ void ShuffleTiles::placeTile(const Point& pos, Tile *t)
|
|||
setTile(pos, coords);
|
||||
}
|
||||
|
||||
void ShuffleTiles::startWithTarget(Node *pTarget)
|
||||
void ShuffleTiles::startWithTarget(Node *target)
|
||||
{
|
||||
TiledGrid3DAction::startWithTarget(pTarget);
|
||||
TiledGrid3DAction::startWithTarget(target);
|
||||
|
||||
if (_seed != (unsigned int)-1)
|
||||
{
|
||||
|
@ -673,11 +673,11 @@ void TurnOffTiles::turnOffTile(const Point& pos)
|
|||
setTile(pos, coords);
|
||||
}
|
||||
|
||||
void TurnOffTiles::startWithTarget(Node *pTarget)
|
||||
void TurnOffTiles::startWithTarget(Node *target)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
TiledGrid3DAction::startWithTarget(pTarget);
|
||||
TiledGrid3DAction::startWithTarget(target);
|
||||
|
||||
if (_seed != (unsigned int)-1)
|
||||
{
|
||||
|
@ -896,9 +896,9 @@ SplitRows* SplitRows::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void SplitRows::startWithTarget(Node *pTarget)
|
||||
void SplitRows::startWithTarget(Node *target)
|
||||
{
|
||||
TiledGrid3DAction::startWithTarget(pTarget);
|
||||
TiledGrid3DAction::startWithTarget(target);
|
||||
_winSize = Director::getInstance()->getWinSizeInPixels();
|
||||
}
|
||||
|
||||
|
@ -961,9 +961,9 @@ SplitCols* SplitCols::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void SplitCols::startWithTarget(Node *pTarget)
|
||||
void SplitCols::startWithTarget(Node *target)
|
||||
{
|
||||
TiledGrid3DAction::startWithTarget(pTarget);
|
||||
TiledGrid3DAction::startWithTarget(target);
|
||||
_winSize = Director::getInstance()->getWinSizeInPixels();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,18 +38,15 @@ NS_CC_BEGIN
|
|||
class CC_DLL ShakyTiles3D : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
static ShakyTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual ShakyTiles3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
static ShakyTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
// Override
|
||||
virtual ShakyTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
int _randrange;
|
||||
|
@ -60,18 +57,16 @@ protected:
|
|||
class CC_DLL ShatteredTiles3D : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
||||
static ShatteredTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual ShatteredTiles3D* clone() const;
|
||||
// Override
|
||||
virtual ShatteredTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
||||
static ShatteredTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
protected:
|
||||
int _randrange;
|
||||
bool _once;
|
||||
|
@ -85,22 +80,22 @@ struct Tile;
|
|||
class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
~ShuffleTiles(void);
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
static ShuffleTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
virtual ~ShuffleTiles(void);
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
void shuffle(unsigned int *pArray, unsigned int nLen);
|
||||
|
||||
void shuffle(unsigned int *array, unsigned int nLen);
|
||||
Size getDelta(const Size& pos) const;
|
||||
void placeTile(const Point& pos, Tile *t);
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual ShuffleTiles* clone() const override;
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual ShuffleTiles* clone() const;
|
||||
|
||||
public:
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
static ShuffleTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||
protected:
|
||||
unsigned int _seed;
|
||||
unsigned int _tilesCount;
|
||||
|
@ -114,19 +109,17 @@ protected:
|
|||
class CC_DLL FadeOutTRTiles : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with the grid size and the duration */
|
||||
static FadeOutTRTiles* create(float duration, const Size& gridSize);
|
||||
|
||||
virtual float testFunc(const Size& pos, float time);
|
||||
void turnOnTile(const Point& pos);
|
||||
void turnOffTile(const Point& pos);
|
||||
virtual void transformTile(const Point& pos, float distance);
|
||||
virtual void update(float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual FadeOutTRTiles* clone() const;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
static FadeOutTRTiles* create(float duration, const Size& gridSize);
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FadeOutTRTiles* clone() const override;
|
||||
};
|
||||
|
||||
/** @brief FadeOutBLTiles action.
|
||||
|
@ -135,15 +128,12 @@ public:
|
|||
class CC_DLL FadeOutBLTiles : public FadeOutTRTiles
|
||||
{
|
||||
public:
|
||||
virtual float testFunc(const Size& pos, float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual FadeOutBLTiles* clone() const;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
static FadeOutBLTiles* create(float duration, const Size& gridSize);
|
||||
|
||||
// Overrides
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
virtual FadeOutBLTiles* clone() const override;
|
||||
};
|
||||
|
||||
/** @brief FadeOutUpTiles action.
|
||||
|
@ -151,17 +141,15 @@ public:
|
|||
*/
|
||||
class CC_DLL FadeOutUpTiles : public FadeOutTRTiles
|
||||
{
|
||||
public:
|
||||
virtual float testFunc(const Size& pos, float time);
|
||||
virtual void transformTile(const Point& pos, float distance);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual FadeOutUpTiles* clone() const;
|
||||
|
||||
public:
|
||||
/** creates the action with the grid size and the duration */
|
||||
static FadeOutUpTiles* create(float duration, const Size& gridSize);
|
||||
|
||||
virtual void transformTile(const Point& pos, float distance);
|
||||
|
||||
// Overrides
|
||||
virtual FadeOutUpTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
};
|
||||
|
||||
/** @brief FadeOutDownTiles action.
|
||||
|
@ -170,15 +158,12 @@ public:
|
|||
class CC_DLL FadeOutDownTiles : public FadeOutUpTiles
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual FadeOutDownTiles* clone() const;
|
||||
|
||||
virtual float testFunc(const Size& pos, float time);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
static FadeOutDownTiles* create(float duration, const Size& gridSize);
|
||||
|
||||
// Overrides
|
||||
virtual FadeOutDownTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
};
|
||||
|
||||
/** @brief TurnOffTiles action.
|
||||
|
@ -187,26 +172,24 @@ public:
|
|||
class CC_DLL TurnOffTiles : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
~TurnOffTiles(void);
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
void shuffle(unsigned int *pArray, unsigned int nLen);
|
||||
void turnOnTile(const Point& pos);
|
||||
void turnOffTile(const Point& pos);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual TurnOffTiles* clone() const;
|
||||
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
static TurnOffTiles* create(float duration, const Size& gridSize);
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
static TurnOffTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
~TurnOffTiles(void);
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
void shuffle(unsigned int *pArray, unsigned int nLen);
|
||||
void turnOnTile(const Point& pos);
|
||||
void turnOffTile(const Point& pos);
|
||||
|
||||
// Overrides
|
||||
virtual TurnOffTiles* clone() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
unsigned int _seed;
|
||||
unsigned int _tilesCount;
|
||||
|
@ -217,6 +200,12 @@ protected:
|
|||
class CC_DLL WavesTiles3D : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
static WavesTiles3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** waves amplitude */
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -225,17 +214,10 @@ public:
|
|||
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
||||
|
||||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
// Override
|
||||
virtual WavesTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual WavesTiles3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
static WavesTiles3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
protected:
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
|
@ -248,6 +230,12 @@ protected:
|
|||
class CC_DLL JumpTiles3D : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
static JumpTiles3D* create(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
/** amplitude of the sin*/
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -256,18 +244,10 @@ public:
|
|||
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
||||
|
||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
// Override
|
||||
virtual JumpTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual JumpTiles3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
static JumpTiles3D* create(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
protected:
|
||||
unsigned int _jumps;
|
||||
float _amplitude;
|
||||
|
@ -278,19 +258,17 @@ protected:
|
|||
class CC_DLL SplitRows : public TiledGrid3DAction
|
||||
{
|
||||
public :
|
||||
/** creates the action with the number of rows to split and the duration */
|
||||
static SplitRows* create(float duration, unsigned int nRows);
|
||||
|
||||
/** initializes the action with the number of rows to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nRows);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual SplitRows* clone() const;
|
||||
// Overrides
|
||||
virtual SplitRows* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
virtual void update(float time);
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the number of rows to split and the duration */
|
||||
static SplitRows* create(float duration, unsigned int nRows);
|
||||
protected:
|
||||
unsigned int _rows;
|
||||
Size _winSize;
|
||||
|
@ -300,18 +278,17 @@ protected:
|
|||
class CC_DLL SplitCols : public TiledGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** creates the action with the number of columns to split and the duration */
|
||||
static SplitCols* create(float duration, unsigned int nCols);
|
||||
|
||||
/** initializes the action with the number of columns to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nCols);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual SplitCols* clone() const;
|
||||
// Overrides
|
||||
virtual SplitCols* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
virtual void update(float time);
|
||||
virtual void startWithTarget(Node *pTarget);
|
||||
|
||||
public:
|
||||
/** creates the action with the number of columns to split and the duration */
|
||||
static SplitCols* create(float duration, unsigned int nCols);
|
||||
protected:
|
||||
unsigned int _cols;
|
||||
Size _winSize;
|
||||
|
|
|
@ -63,10 +63,10 @@ ActionTween *ActionTween::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void ActionTween::startWithTarget(Node *pTarget)
|
||||
void ActionTween::startWithTarget(Node *target)
|
||||
{
|
||||
CCAssert(dynamic_cast<ActionTweenDelegate*>(pTarget), "target must implement ActionTweenDelegate");
|
||||
ActionInterval::startWithTarget(pTarget);
|
||||
CCAssert(dynamic_cast<ActionTweenDelegate*>(target), "target must implement ActionTweenDelegate");
|
||||
ActionInterval::startWithTarget(target);
|
||||
_delta = _to - _from;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,17 +63,17 @@ class CC_DLL ActionTween : public ActionInterval
|
|||
{
|
||||
public:
|
||||
/** creates an initializes the action with the property name (key), and the from and to parameters. */
|
||||
static ActionTween* create(float aDuration, const char* key, float from, float to);
|
||||
static ActionTween* create(float duration, const char* key, float from, float to);
|
||||
/** initializes the action with the property name (key), and the from and to parameters. */
|
||||
bool initWithDuration(float aDuration, const char* key, float from, float to);
|
||||
bool initWithDuration(float duration, const char* key, float from, float to);
|
||||
|
||||
void startWithTarget(Node *pTarget);
|
||||
void update(float dt);
|
||||
/** returns a new reversed action */
|
||||
ActionTween* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
ActionTween *clone() const;
|
||||
// Overrides
|
||||
void startWithTarget(Node *target) override;
|
||||
void update(float dt) override;
|
||||
ActionTween* reverse() const override;
|
||||
ActionTween *clone() const override;
|
||||
|
||||
protected:
|
||||
std::string _key;
|
||||
float _from, _to;
|
||||
float _delta;
|
||||
|
|
|
@ -49,9 +49,44 @@ All features from Node are valid, plus the following features:
|
|||
- opacity and RGB colors
|
||||
*/
|
||||
class CC_DLL AtlasNode : public NodeRGBA, public TextureProtocol
|
||||
{
|
||||
protected:
|
||||
{
|
||||
public:
|
||||
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
static AtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight,
|
||||
unsigned int itemsToRender);
|
||||
AtlasNode();
|
||||
virtual ~AtlasNode();
|
||||
|
||||
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||
|
||||
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
||||
bool initWithTexture(Texture2D* texture, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||
|
||||
/** updates the Atlas (indexed vertex array).
|
||||
* Shall be overridden in subclasses
|
||||
*/
|
||||
virtual void updateAtlasValues();
|
||||
|
||||
// Overrides
|
||||
virtual void draw() override;
|
||||
virtual Texture2D* getTexture() override;
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual bool isOpacityModifyRGB() const override;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override;
|
||||
virtual const Color3B& getColor(void) const override;
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
virtual void setOpacity(GLubyte opacity) override;
|
||||
|
||||
private :
|
||||
void calculateMaxItems();
|
||||
void updateBlendFunc();
|
||||
void updateOpacityModifyRGB();
|
||||
|
||||
friend class Director;
|
||||
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
||||
|
||||
protected:
|
||||
//! chars per row
|
||||
unsigned int _itemsPerRow;
|
||||
//! chars per column
|
||||
|
@ -68,7 +103,7 @@ protected:
|
|||
|
||||
// protocol variables
|
||||
bool _isOpacityModifyRGB;
|
||||
|
||||
|
||||
CC_PROPERTY_PASS_BY_REF(BlendFunc, _blendFunc, BlendFunc);
|
||||
|
||||
// quads to draw
|
||||
|
@ -77,49 +112,6 @@ protected:
|
|||
GLint _uniformColor;
|
||||
// This varible is only used for LabelAtlas FPS display. So plz don't modify its value.
|
||||
bool _ignoreContentScaleFactor;
|
||||
|
||||
public:
|
||||
AtlasNode();
|
||||
virtual ~AtlasNode();
|
||||
|
||||
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
static AtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight,
|
||||
unsigned int itemsToRender);
|
||||
|
||||
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||
|
||||
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
||||
bool initWithTexture(Texture2D* texture, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||
|
||||
/** updates the Atlas (indexed vertex array).
|
||||
* Shall be overridden in subclasses
|
||||
*/
|
||||
virtual void updateAtlasValues();
|
||||
|
||||
virtual void draw(void);
|
||||
|
||||
// CC Texture protocol
|
||||
|
||||
/** returns the used texture*/
|
||||
virtual Texture2D* getTexture(void);
|
||||
|
||||
/** sets a new texture. it will be retained*/
|
||||
virtual void setTexture(Texture2D *texture);
|
||||
|
||||
virtual bool isOpacityModifyRGB() const;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||
virtual const Color3B& getColor(void) const;
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
|
||||
private :
|
||||
void calculateMaxItems();
|
||||
void updateBlendFunc();
|
||||
void updateOpacityModifyRGB();
|
||||
|
||||
friend class Director;
|
||||
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
||||
};
|
||||
|
||||
// end of base_node group
|
||||
|
|
|
@ -519,12 +519,6 @@ Rect Node::getBoundingBox() const
|
|||
return RectApplyAffineTransform(rect, getNodeToParentTransform());
|
||||
}
|
||||
|
||||
Rect Node::boundingBox() const
|
||||
{
|
||||
return getBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
Node * Node::create(void)
|
||||
{
|
||||
Node * pRet = new Node();
|
||||
|
@ -1029,15 +1023,15 @@ void Node::stopActionByTag(int tag)
|
|||
_actionManager->removeActionByTag(tag, this);
|
||||
}
|
||||
|
||||
Action * Node::getActionByTag(int tag)
|
||||
Action * Node::getActionByTag(int tag) const
|
||||
{
|
||||
CCAssert( tag != kActionTagInvalid, "Invalid tag");
|
||||
return _actionManager->getActionByTag(tag, this);
|
||||
}
|
||||
|
||||
unsigned int Node::numberOfRunningActions()
|
||||
unsigned int Node::getNumberOfRunningActions() const
|
||||
{
|
||||
return _actionManager->numberOfRunningActionsInTarget(this);
|
||||
return _actionManager->getNumberOfRunningActionsInTarget(this);
|
||||
}
|
||||
|
||||
// Node - Callbacks
|
||||
|
@ -1231,12 +1225,6 @@ AffineTransform Node::getNodeToParentTransform() const
|
|||
return _transform;
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
AffineTransform Node::nodeToParentTransform() const
|
||||
{
|
||||
return getNodeToParentTransform();
|
||||
}
|
||||
|
||||
void Node::setAdditionalTransform(const AffineTransform& additionalTransform)
|
||||
{
|
||||
_additionalTransform = additionalTransform;
|
||||
|
@ -1254,12 +1242,6 @@ AffineTransform Node::getParentToNodeTransform() const
|
|||
return _inverse;
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
AffineTransform Node::parentToNodeTransform() const
|
||||
{
|
||||
return getParentToNodeTransform();
|
||||
}
|
||||
|
||||
AffineTransform Node::getNodeToWorldTransform() const
|
||||
{
|
||||
AffineTransform t = this->getNodeToParentTransform();
|
||||
|
@ -1270,23 +1252,11 @@ AffineTransform Node::getNodeToWorldTransform() const
|
|||
return t;
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
AffineTransform Node::nodeToWorldTransform() const
|
||||
{
|
||||
return getNodeToWorldTransform();
|
||||
}
|
||||
|
||||
AffineTransform Node::getWorldToNodeTransform() const
|
||||
{
|
||||
return AffineTransformInvert(this->getNodeToWorldTransform());
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
AffineTransform Node::worldToNodeTransform() const
|
||||
{
|
||||
return getWorldToNodeTransform();
|
||||
}
|
||||
|
||||
Point Node::convertToNodeSpace(const Point& worldPoint) const
|
||||
{
|
||||
Point ret = PointApplyAffineTransform(worldPoint, getWorldToNodeTransform());
|
||||
|
|
|
@ -935,7 +935,7 @@ public:
|
|||
virtual Rect getBoundingBox() const;
|
||||
|
||||
/** @deprecated Use getBoundingBox instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Rect boundingBox() const;
|
||||
CC_DEPRECATED_ATTRIBUTE inline virtual Rect boundingBox() const { return getBoundingBox(); }
|
||||
|
||||
/// @{
|
||||
/// @name Actions
|
||||
|
@ -991,7 +991,7 @@ public:
|
|||
*
|
||||
* @return The action object with the given tag.
|
||||
*/
|
||||
Action* getActionByTag(int tag);
|
||||
Action* getActionByTag(int tag) const;
|
||||
|
||||
/**
|
||||
* Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).
|
||||
|
@ -1003,7 +1003,10 @@ public:
|
|||
*
|
||||
* @return The number of actions that are running plus the ones that are schedule to run
|
||||
*/
|
||||
unsigned int numberOfRunningActions();
|
||||
unsigned int getNumberOfRunningActions() const;
|
||||
|
||||
/** @deprecated Use getNumberOfRunningActions() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE unsigned int numberOfRunningActions() const { return getNumberOfRunningActions(); };
|
||||
|
||||
/// @} end of Actions
|
||||
|
||||
|
@ -1162,7 +1165,7 @@ public:
|
|||
virtual AffineTransform getNodeToParentTransform() const;
|
||||
|
||||
/** @deprecated use getNodeToParentTransform() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual AffineTransform nodeToParentTransform() const;
|
||||
CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform nodeToParentTransform() const { return getNodeToParentTransform(); }
|
||||
|
||||
/**
|
||||
* Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.
|
||||
|
@ -1171,7 +1174,7 @@ public:
|
|||
virtual AffineTransform getParentToNodeTransform() const;
|
||||
|
||||
/** @deprecated Use getParentToNodeTransform() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual AffineTransform parentToNodeTransform() const;
|
||||
CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform parentToNodeTransform() const { return getParentToNodeTransform(); }
|
||||
|
||||
/**
|
||||
* Returns the world affine transform matrix. The matrix is in Pixels.
|
||||
|
@ -1179,7 +1182,7 @@ public:
|
|||
virtual AffineTransform getNodeToWorldTransform() const;
|
||||
|
||||
/** @deprecated Use getNodeToWorldTransform() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual AffineTransform nodeToWorldTransform() const;
|
||||
CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform nodeToWorldTransform() const { return getNodeToWorldTransform(); }
|
||||
|
||||
/**
|
||||
* Returns the inverse world affine transform matrix. The matrix is in Pixels.
|
||||
|
@ -1187,7 +1190,7 @@ public:
|
|||
virtual AffineTransform getWorldToNodeTransform() const;
|
||||
|
||||
/** @deprecated Use worldToNodeTransform() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual AffineTransform worldToNodeTransform() const;
|
||||
CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform worldToNodeTransform() const { return getWorldToNodeTransform(); }
|
||||
|
||||
/// @} end of Transformations
|
||||
|
||||
|
@ -1409,7 +1412,7 @@ public:
|
|||
virtual void setOpacity(GLubyte opacity) override;
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual bool isCascadeOpacityEnabled() const override;
|
||||
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override;
|
||||
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override;
|
||||
|
||||
virtual const Color3B& getColor(void) const override;
|
||||
virtual const Color3B& getDisplayedColor() const override;
|
||||
|
|
|
@ -43,25 +43,14 @@ NS_CC_BEGIN
|
|||
*/
|
||||
class CC_DLL DrawNode : public Node
|
||||
{
|
||||
protected:
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
|
||||
unsigned int _bufferCapacity;
|
||||
GLsizei _bufferCount;
|
||||
V2F_C4B_T2F *_buffer;
|
||||
|
||||
BlendFunc _blendFunc;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
public:
|
||||
/** creates and initialize a DrawNode node */
|
||||
static DrawNode* create();
|
||||
DrawNode();
|
||||
virtual ~DrawNode();
|
||||
|
||||
virtual bool init();
|
||||
virtual void draw();
|
||||
|
||||
|
||||
/** draw a dot at a position, with a given radius and color */
|
||||
void drawDot(const Point &pos, float radius, const Color4F &color);
|
||||
|
||||
|
@ -77,15 +66,29 @@ public:
|
|||
const BlendFunc& getBlendFunc() const;
|
||||
void setBlendFunc(const BlendFunc &blendFunc);
|
||||
|
||||
DrawNode();
|
||||
|
||||
/** listen the event that coming to foreground on Android
|
||||
*/
|
||||
void listenBackToForeground(Object *obj);
|
||||
|
||||
|
||||
// Overrides
|
||||
virtual void draw() override;
|
||||
|
||||
private:
|
||||
void ensureCapacity(unsigned int count);
|
||||
void render();
|
||||
|
||||
protected:
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
|
||||
unsigned int _bufferCapacity;
|
||||
GLsizei _bufferCount;
|
||||
V2F_C4B_T2F *_buffer;
|
||||
|
||||
BlendFunc _blendFunc;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -208,7 +208,7 @@ void GridBase::beforeDraw(void)
|
|||
_grabber->beforeRender(_texture);
|
||||
}
|
||||
|
||||
void GridBase::afterDraw(cocos2d::Node *pTarget)
|
||||
void GridBase::afterDraw(cocos2d::Node *target)
|
||||
{
|
||||
_grabber->afterRender(_texture);
|
||||
|
||||
|
@ -216,15 +216,15 @@ void GridBase::afterDraw(cocos2d::Node *pTarget)
|
|||
Director *director = Director::getInstance();
|
||||
director->setProjection(_directorProjection);
|
||||
|
||||
if (pTarget->getCamera()->isDirty())
|
||||
if (target->getCamera()->isDirty())
|
||||
{
|
||||
Point offset = pTarget->getAnchorPointInPoints();
|
||||
Point offset = target->getAnchorPointInPoints();
|
||||
|
||||
//
|
||||
// XXX: Camera should be applied in the AnchorPoint
|
||||
//
|
||||
kmGLTranslatef(offset.x, offset.y, 0);
|
||||
pTarget->getCamera()->locate();
|
||||
target->getCamera()->locate();
|
||||
kmGLTranslatef(-offset.x, -offset.y, 0);
|
||||
}
|
||||
|
||||
|
@ -424,12 +424,7 @@ void Grid3D::calculateVertexPoints(void)
|
|||
memcpy(_originalVertices, _vertices, (_gridSize.width+1) * (_gridSize.height+1) * sizeof(Vertex3F));
|
||||
}
|
||||
|
||||
Vertex3F Grid3D::vertex(const Point& pos)
|
||||
{
|
||||
return getVertex(pos);
|
||||
}
|
||||
|
||||
Vertex3F Grid3D::getVertex(const Point& pos)
|
||||
Vertex3F Grid3D::getVertex(const Point& pos) const
|
||||
{
|
||||
CCAssert( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
|
||||
|
||||
|
@ -441,12 +436,7 @@ Vertex3F Grid3D::getVertex(const Point& pos)
|
|||
return vert;
|
||||
}
|
||||
|
||||
Vertex3F Grid3D::originalVertex(const Point& pos)
|
||||
{
|
||||
return getOriginalVertex(pos);
|
||||
}
|
||||
|
||||
Vertex3F Grid3D::getOriginalVertex(const Point& pos)
|
||||
Vertex3F Grid3D::getOriginalVertex(const Point& pos) const
|
||||
{
|
||||
CCAssert( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
|
||||
|
||||
|
@ -662,7 +652,7 @@ void TiledGrid3D::setTile(const Point& pos, const Quad3& coords)
|
|||
memcpy(&vertArray[idx], &coords, sizeof(Quad3));
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3D::getOriginalTile(const Point& pos)
|
||||
Quad3 TiledGrid3D::getOriginalTile(const Point& pos) const
|
||||
{
|
||||
CCAssert( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
|
||||
int idx = (_gridSize.height * pos.x + pos.y) * 4 * 3;
|
||||
|
@ -674,7 +664,7 @@ Quad3 TiledGrid3D::getOriginalTile(const Point& pos)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3D::getTile(const Point& pos)
|
||||
Quad3 TiledGrid3D::getTile(const Point& pos) const
|
||||
{
|
||||
CCAssert( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
|
||||
int idx = (_gridSize.height * pos.x + pos.y) * 4 * 3;
|
||||
|
@ -686,16 +676,6 @@ Quad3 TiledGrid3D::getTile(const Point& pos)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3D::originalTile(const Point& pos)
|
||||
{
|
||||
return getOriginalTile(pos);
|
||||
}
|
||||
|
||||
Quad3 TiledGrid3D::tile(const Point& pos)
|
||||
{
|
||||
return getTile(pos);
|
||||
}
|
||||
|
||||
void TiledGrid3D::reuse(void)
|
||||
{
|
||||
if (_reuseGrid > 0)
|
||||
|
|
|
@ -52,8 +52,16 @@ class GLProgram;
|
|||
class CC_DLL GridBase : public Object
|
||||
{
|
||||
public:
|
||||
/** create one Grid */
|
||||
static GridBase* create(const Size& gridSize, Texture2D *texture, bool flipped);
|
||||
/** create one Grid */
|
||||
static GridBase* create(const Size& gridSize);
|
||||
|
||||
virtual ~GridBase(void);
|
||||
|
||||
bool initWithSize(const Size& gridSize, Texture2D *pTexture, bool bFlipped);
|
||||
bool initWithSize(const Size& gridSize);
|
||||
|
||||
/** whether or not the grid is active */
|
||||
inline bool isActive(void) { return _active; }
|
||||
void setActive(bool bActive);
|
||||
|
@ -74,22 +82,12 @@ public:
|
|||
inline bool isTextureFlipped(void) { return _isTextureFlipped; }
|
||||
void setTextureFlipped(bool bFlipped);
|
||||
|
||||
bool initWithSize(const Size& gridSize, Texture2D *pTexture, bool bFlipped);
|
||||
bool initWithSize(const Size& gridSize);
|
||||
|
||||
void beforeDraw(void);
|
||||
void afterDraw(Node *pTarget);
|
||||
void afterDraw(Node *target);
|
||||
virtual void blit(void);
|
||||
virtual void reuse(void);
|
||||
virtual void calculateVertexPoints(void);
|
||||
|
||||
public:
|
||||
|
||||
/** create one Grid */
|
||||
static GridBase* create(const Size& gridSize, Texture2D *texture, bool flipped);
|
||||
/** create one Grid */
|
||||
static GridBase* create(const Size& gridSize);
|
||||
|
||||
void set2DProjection(void);
|
||||
|
||||
protected:
|
||||
|
@ -112,33 +110,32 @@ class CC_DLL Grid3D : public GridBase
|
|||
, public GLBufferedNode
|
||||
#endif // EMSCRIPTEN
|
||||
{
|
||||
public:
|
||||
Grid3D();
|
||||
~Grid3D(void);
|
||||
|
||||
/** returns the vertex at a given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F vertex(const Point& pos);
|
||||
/** returns the original (non-transformed) vertex at a given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F originalVertex(const Point& pos);
|
||||
|
||||
/** returns the vertex at a given position */
|
||||
Vertex3F getVertex(const Point& pos);
|
||||
/** returns the original (non-transformed) vertex at a given position */
|
||||
Vertex3F getOriginalVertex(const Point& pos);
|
||||
|
||||
/** sets a new vertex at a given position */
|
||||
void setVertex(const Point& pos, const Vertex3F& vertex);
|
||||
|
||||
virtual void blit(void);
|
||||
virtual void reuse(void);
|
||||
virtual void calculateVertexPoints(void);
|
||||
|
||||
public:
|
||||
/** create one Grid */
|
||||
static Grid3D* create(const Size& gridSize, Texture2D *pTexture, bool bFlipped);
|
||||
/** create one Grid */
|
||||
static Grid3D* create(const Size& gridSize);
|
||||
|
||||
|
||||
Grid3D();
|
||||
~Grid3D(void);
|
||||
|
||||
/** returns the vertex at a given position */
|
||||
Vertex3F getVertex(const Point& pos) const;
|
||||
/** @deprecated Use getVertex() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F vertex(const Point& pos) const { return getVertex(pos); }
|
||||
/** returns the original (non-transformed) vertex at a given position */
|
||||
Vertex3F getOriginalVertex(const Point& pos) const;
|
||||
/** @deprecated Use getOriginalVertex() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Vertex3F originalVertex(const Point& pos) const { return getOriginalVertex(pos); }
|
||||
|
||||
/** sets a new vertex at a given position */
|
||||
void setVertex(const Point& pos, const Vertex3F& vertex);
|
||||
|
||||
// Overrides
|
||||
virtual void blit() override;
|
||||
virtual void reuse() override;
|
||||
virtual void calculateVertexPoints() override;
|
||||
|
||||
protected:
|
||||
GLvoid *_texCoordinates;
|
||||
GLvoid *_vertices;
|
||||
|
@ -156,33 +153,31 @@ class CC_DLL TiledGrid3D : public GridBase
|
|||
#endif // EMSCRIPTEN
|
||||
{
|
||||
public:
|
||||
TiledGrid3D();
|
||||
~TiledGrid3D(void);
|
||||
|
||||
/** returns the tile at the given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& pos);
|
||||
/** returns the original tile (untransformed) at the given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& pos);
|
||||
|
||||
/** returns the tile at the given position */
|
||||
Quad3 getTile(const Point& pos);
|
||||
/** returns the original tile (untransformed) at the given position */
|
||||
Quad3 getOriginalTile(const Point& pos);
|
||||
|
||||
/** sets a new tile */
|
||||
void setTile(const Point& pos, const Quad3& coords);
|
||||
|
||||
virtual void blit(void);
|
||||
virtual void reuse(void);
|
||||
virtual void calculateVertexPoints(void);
|
||||
|
||||
public:
|
||||
|
||||
/** create one Grid */
|
||||
static TiledGrid3D* create(const Size& gridSize, Texture2D *pTexture, bool bFlipped);
|
||||
/** create one Grid */
|
||||
static TiledGrid3D* create(const Size& gridSize);
|
||||
|
||||
|
||||
TiledGrid3D();
|
||||
~TiledGrid3D();
|
||||
|
||||
/** returns the tile at the given position */
|
||||
Quad3 getTile(const Point& pos) const;
|
||||
/** returns the tile at the given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& pos) const { return getTile(pos); }
|
||||
/** returns the original tile (untransformed) at the given position */
|
||||
Quad3 getOriginalTile(const Point& pos) const;
|
||||
/** returns the original tile (untransformed) at the given position */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& pos) const { return getOriginalTile(pos); }
|
||||
|
||||
/** sets a new tile */
|
||||
void setTile(const Point& pos, const Quad3& coords);
|
||||
|
||||
// Overrides
|
||||
virtual void blit() override;
|
||||
virtual void reuse() override;
|
||||
virtual void calculateVertexPoints() override;
|
||||
|
||||
protected:
|
||||
GLvoid *_texCoordinates;
|
||||
GLvoid *_vertices;
|
||||
|
|
|
@ -63,13 +63,12 @@ All features from Node are valid, plus the following new features:
|
|||
class CC_DLL Layer : public Node, public TouchDelegate, public KeypadDelegate
|
||||
{
|
||||
public:
|
||||
/** creates a fullscreen black layer */
|
||||
static Layer *create(void);
|
||||
Layer();
|
||||
virtual ~Layer();
|
||||
virtual bool init();
|
||||
|
||||
/** creates a fullscreen black layer */
|
||||
static Layer *create(void);
|
||||
|
||||
// default implements are used to call script callback if exist
|
||||
virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent);
|
||||
virtual void ccTouchMoved(Touch *pTouch, Event *pEvent);
|
||||
|
@ -216,25 +215,17 @@ class CC_DLL LayerColor : public LayerRGBA, public BlendProtocol
|
|||
, public GLBufferedNode
|
||||
#endif // EMSCRIPTEN
|
||||
{
|
||||
protected:
|
||||
Vertex2F _squareVertices[4];
|
||||
Color4F _squareColors[4];
|
||||
|
||||
public:
|
||||
LayerColor();
|
||||
virtual ~LayerColor();
|
||||
|
||||
virtual void draw();
|
||||
virtual void setContentSize(const Size & var);
|
||||
|
||||
/** creates a fullscreen black layer */
|
||||
static LayerColor* create();
|
||||
|
||||
/** creates a Layer with color, width and height in Points */
|
||||
static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height);
|
||||
/** creates a Layer with color. Width and height are the window size. */
|
||||
static LayerColor * create(const Color4B& color);
|
||||
|
||||
LayerColor();
|
||||
virtual ~LayerColor();
|
||||
|
||||
virtual bool init();
|
||||
/** initializes a Layer with color, width and height in Points */
|
||||
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
||||
|
@ -256,11 +247,16 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void draw() override;
|
||||
virtual void setColor(const Color3B &color) override;
|
||||
virtual void setOpacity(GLubyte opacity) override;
|
||||
virtual void setContentSize(const Size & var) override;
|
||||
|
||||
protected:
|
||||
virtual void updateColor();
|
||||
|
||||
Vertex2F _squareVertices[4];
|
||||
Color4F _squareColors[4];
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -288,7 +284,6 @@ If ' compressedInterpolation' is enabled (default mode) you will see both the st
|
|||
class CC_DLL LayerGradient : public LayerColor
|
||||
{
|
||||
public:
|
||||
|
||||
/** Creates a fullscreen black layer */
|
||||
static LayerGradient* create();
|
||||
|
||||
|
@ -311,15 +306,15 @@ public:
|
|||
virtual void setCompressedInterpolation(bool bCompressedInterpolation);
|
||||
virtual bool isCompressedInterpolation() const;
|
||||
|
||||
protected:
|
||||
virtual void updateColor() override;
|
||||
|
||||
CC_PROPERTY_PASS_BY_REF(Color3B, _startColor, StartColor)
|
||||
CC_PROPERTY_PASS_BY_REF(Color3B, _endColor, EndColor)
|
||||
CC_PROPERTY(GLubyte, _startOpacity, StartOpacity)
|
||||
CC_PROPERTY(GLubyte, _endOpacity, EndOpacity)
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _alongVector, Vector)
|
||||
|
||||
protected:
|
||||
virtual void updateColor() override;
|
||||
|
||||
protected:
|
||||
bool _compressedInterpolation;
|
||||
};
|
||||
|
@ -332,16 +327,11 @@ Features:
|
|||
*/
|
||||
class CC_DLL LayerMultiplex : public Layer
|
||||
{
|
||||
protected:
|
||||
unsigned int _enabledLayer;
|
||||
Array* _layers;
|
||||
public:
|
||||
LayerMultiplex();
|
||||
virtual ~LayerMultiplex();
|
||||
|
||||
/** creates and initializes a LayerMultiplex object */
|
||||
static LayerMultiplex* create();
|
||||
|
||||
/** creates a MultiplexLayer with an array of layers.
|
||||
|
||||
/** creates a LayerMultiplex with an array of layers.
|
||||
@since v2.1
|
||||
*/
|
||||
static LayerMultiplex* createWithArray(Array* arrayOfLayers);
|
||||
|
@ -355,24 +345,31 @@ public:
|
|||
*/
|
||||
static LayerMultiplex * createWithLayer(Layer* layer);
|
||||
|
||||
void addLayer(Layer* layer);
|
||||
LayerMultiplex();
|
||||
virtual ~LayerMultiplex();
|
||||
|
||||
/** initializes a MultiplexLayer with one or more layers using a variable argument list. */
|
||||
bool initWithLayers(Layer* layer, va_list params);
|
||||
/** switches to a certain layer indexed by n.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
|
||||
*/
|
||||
|
||||
/** initializes a MultiplexLayer with an array of layers
|
||||
@since v2.1
|
||||
*/
|
||||
@since v2.1
|
||||
*/
|
||||
bool initWithArray(Array* arrayOfLayers);
|
||||
|
||||
void addLayer(Layer* layer);
|
||||
|
||||
/** switches to a certain layer indexed by n.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
|
||||
*/
|
||||
void switchTo(unsigned int n);
|
||||
/** release the current layer and switches to another layer indexed by n.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
|
||||
*/
|
||||
void switchToAndReleaseMe(unsigned int n);
|
||||
|
||||
protected:
|
||||
unsigned int _enabledLayer;
|
||||
Array* _layers;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
|
||||
Scene();
|
||||
virtual ~Scene();
|
||||
|
||||
bool init();
|
||||
|
||||
};
|
||||
|
|
|
@ -55,13 +55,7 @@ enum {
|
|||
*/
|
||||
class CC_DLL Menu : public LayerRGBA
|
||||
{
|
||||
/** whether or not the menu will receive events */
|
||||
bool _enabled;
|
||||
|
||||
public:
|
||||
Menu() : _selectedItem(NULL) {}
|
||||
virtual ~Menu(){}
|
||||
|
||||
/** creates an empty Menu */
|
||||
static Menu* create();
|
||||
|
||||
|
@ -80,6 +74,9 @@ public:
|
|||
/** creates a Menu with MenuItem objects */
|
||||
static Menu* createWithItems(MenuItem *firstItem, va_list args);
|
||||
|
||||
Menu() : _selectedItem(NULL) {}
|
||||
virtual ~Menu(){}
|
||||
|
||||
/** initializes an empty Menu */
|
||||
bool init();
|
||||
|
||||
|
@ -113,34 +110,28 @@ public:
|
|||
/** set event handler priority. By default it is: kMenuTouchPriority */
|
||||
void setHandlerPriority(int newPriority);
|
||||
|
||||
//super methods
|
||||
virtual void addChild(Node * child);
|
||||
virtual void addChild(Node * child, int zOrder);
|
||||
virtual void addChild(Node * child, int zOrder, int tag);
|
||||
virtual void registerWithTouchDispatcher();
|
||||
virtual void removeChild(Node* child, bool cleanup);
|
||||
|
||||
/**
|
||||
@brief For phone event handle functions
|
||||
*/
|
||||
virtual bool ccTouchBegan(Touch* touch, Event* event);
|
||||
virtual void ccTouchEnded(Touch* touch, Event* event);
|
||||
virtual void ccTouchCancelled(Touch *touch, Event* event);
|
||||
virtual void ccTouchMoved(Touch* touch, Event* event);
|
||||
|
||||
/**
|
||||
@since v0.99.5
|
||||
override onExit
|
||||
*/
|
||||
virtual void onExit();
|
||||
|
||||
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB(void) const { return false;}
|
||||
|
||||
virtual bool isEnabled() const { return _enabled; }
|
||||
virtual void setEnabled(bool value) { _enabled = value; };
|
||||
|
||||
// overrides
|
||||
virtual void addChild(Node * child) override;
|
||||
virtual void addChild(Node * child, int zOrder) override;
|
||||
virtual void addChild(Node * child, int zOrder, int tag) override;
|
||||
virtual bool ccTouchBegan(Touch* touch, Event* event) override;
|
||||
virtual void ccTouchEnded(Touch* touch, Event* event) override;
|
||||
virtual void ccTouchCancelled(Touch *touch, Event* event) override;
|
||||
virtual void ccTouchMoved(Touch* touch, Event* event) override;
|
||||
virtual void onExit() override;
|
||||
virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB(void) const override { return false;}
|
||||
|
||||
protected:
|
||||
/** whether or not the menu will receive events */
|
||||
bool _enabled;
|
||||
|
||||
MenuItem* itemForTouch(Touch * touch);
|
||||
tMenuState _state;
|
||||
MenuItem *_selectedItem;
|
||||
|
|
|
@ -135,7 +135,7 @@ bool MenuItem::isEnabled() const
|
|||
return _enabled;
|
||||
}
|
||||
|
||||
Rect MenuItem::rect()
|
||||
Rect MenuItem::rect() const
|
||||
{
|
||||
return Rect( _position.x - _contentSize.width * _anchorPoint.x,
|
||||
_position.y - _contentSize.height * _anchorPoint.y,
|
||||
|
@ -468,7 +468,7 @@ void MenuItemFont::setFontNameObj(const char* name)
|
|||
recreateLabel();
|
||||
}
|
||||
|
||||
const char* MenuItemFont::fontNameObj()
|
||||
const char* MenuItemFont::getFontNameObj() const
|
||||
{
|
||||
return _fontName.c_str();
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ void MenuItemToggle::setEnabled(bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
MenuItem* MenuItemToggle::selectedItem()
|
||||
MenuItem* MenuItemToggle::getSelectedItem()
|
||||
{
|
||||
return (MenuItem*)_subItems->objectAtIndex(_selectedIndex);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,13 @@ class SpriteFrame;
|
|||
class CC_DLL MenuItem : public NodeRGBA
|
||||
{
|
||||
public:
|
||||
/** Creates a MenuItem with no target/selector */
|
||||
static MenuItem* create();
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
static MenuItem* create(const ccMenuCallback& callback);
|
||||
|
||||
MenuItem()
|
||||
: _selected(false)
|
||||
, _enabled(false)
|
||||
|
@ -67,34 +74,30 @@ public:
|
|||
{}
|
||||
virtual ~MenuItem();
|
||||
|
||||
/** Creates a MenuItem with no target/selector */
|
||||
static MenuItem* create();
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
static MenuItem* create(const ccMenuCallback& callback);
|
||||
/** Initializes a MenuItem with a target/selector */
|
||||
bool initWithCallback(const ccMenuCallback& callback);
|
||||
/** Initializes a MenuItem with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget( Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
/** Returns the outside box */
|
||||
Rect rect();
|
||||
Rect rect() const;
|
||||
/** Activate the item */
|
||||
virtual void activate();
|
||||
/** The item was selected (not activated), similar to "mouse-over" */
|
||||
virtual void selected();
|
||||
/** The item was unselected */
|
||||
virtual void unselected();
|
||||
|
||||
/** returns whether or not the item is enabled */
|
||||
virtual bool isEnabled() const;
|
||||
//@note: It's 'setIsEnable' in cocos2d-iphone.
|
||||
/** enables or disables the item */
|
||||
virtual void setEnabled(bool value);
|
||||
/** returns whether or not the item is selected */
|
||||
virtual bool isSelected() const;
|
||||
|
||||
/** set the target/selector of the menu item*/
|
||||
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
/** set the callback to the menu item */
|
||||
void setCallback(const ccMenuCallback& callback);
|
||||
/** set the target/selector of the menu item*/
|
||||
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
protected:
|
||||
bool _selected;
|
||||
|
@ -114,17 +117,7 @@ protected:
|
|||
*/
|
||||
class CC_DLL MenuItemLabel : public MenuItem
|
||||
{
|
||||
/** the color that will be used to disable the item */
|
||||
CC_PROPERTY_PASS_BY_REF(Color3B, _disabledColor, DisabledColor);
|
||||
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
||||
CC_PROPERTY(Node*, _label, Label);
|
||||
public:
|
||||
MenuItemLabel()
|
||||
: _label(NULL)
|
||||
, _originalScale(0.0)
|
||||
{}
|
||||
virtual ~MenuItemLabel();
|
||||
|
||||
/** creates a MenuItemLabel with a Label, target and selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemLabel * create(Node*label, Object* target, SEL_MenuHandler selector);
|
||||
|
||||
|
@ -134,26 +127,35 @@ public:
|
|||
/** creates a MenuItemLabel with a Label. Target and selector will be nil */
|
||||
static MenuItemLabel* create(Node *label);
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
||||
MenuItemLabel()
|
||||
: _label(NULL)
|
||||
, _originalScale(0.0)
|
||||
{}
|
||||
virtual ~MenuItemLabel();
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
bool initWithLabel(Node* label, const ccMenuCallback& callback);
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
||||
|
||||
/** sets a new string to the inner label */
|
||||
void setString(const char * label);
|
||||
// super methods
|
||||
virtual void activate();
|
||||
virtual void selected();
|
||||
virtual void unselected();
|
||||
/** Enable or disabled the MenuItemFont
|
||||
@warning setEnabled changes the RGB color of the font
|
||||
*/
|
||||
virtual void setEnabled(bool enabled);
|
||||
|
||||
// Overrides
|
||||
virtual void activate() override;
|
||||
virtual void selected() override;
|
||||
virtual void unselected() override;
|
||||
virtual void setEnabled(bool enabled) override;
|
||||
|
||||
protected:
|
||||
Color3B _colorBackup;
|
||||
float _originalScale;
|
||||
|
||||
/** the color that will be used to disable the item */
|
||||
CC_PROPERTY_PASS_BY_REF(Color3B, _disabledColor, DisabledColor);
|
||||
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
||||
CC_PROPERTY(Node*, _label, Label);
|
||||
};
|
||||
|
||||
|
||||
|
@ -163,9 +165,6 @@ protected:
|
|||
class CC_DLL MenuItemAtlasFont : public MenuItemLabel
|
||||
{
|
||||
public:
|
||||
MenuItemAtlasFont(){}
|
||||
virtual ~MenuItemAtlasFont(){}
|
||||
|
||||
/** creates a menu item from a string and atlas with a target/selector */
|
||||
static MenuItemAtlasFont* create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
||||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
||||
|
@ -173,11 +172,13 @@ public:
|
|||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
||||
static MenuItemAtlasFont* create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||
|
||||
MenuItemAtlasFont(){}
|
||||
virtual ~MenuItemAtlasFont(){}
|
||||
|
||||
/** initializes a menu item from a string and atlas with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string and atlas with a target/selector */
|
||||
bool initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -187,8 +188,21 @@ public:
|
|||
class CC_DLL MenuItemFont : public MenuItemLabel
|
||||
{
|
||||
public:
|
||||
/** creates a menu item from a string without target/selector. To be used with MenuItemToggle */
|
||||
static MenuItemFont * create(const char *value);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemFont * create(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
static MenuItemFont * create(const char *value, const ccMenuCallback& callback);
|
||||
|
||||
MenuItemFont() : _fontSize(0), _fontName(""){}
|
||||
virtual ~MenuItemFont(){}
|
||||
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
bool initWithString(const char *value, const ccMenuCallback& callback);
|
||||
|
||||
/** set default font size */
|
||||
static void setFontSize(unsigned int s);
|
||||
/** get default font size */
|
||||
|
@ -198,18 +212,6 @@ public:
|
|||
/** get the default font name */
|
||||
static const char *fontName();
|
||||
|
||||
/** creates a menu item from a string without target/selector. To be used with MenuItemToggle */
|
||||
static MenuItemFont * create(const char *value);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemFont * create(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
static MenuItemFont * create(const char *value, const ccMenuCallback& callback);
|
||||
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
bool initWithString(const char *value, const ccMenuCallback& callback);
|
||||
|
||||
/** set font size
|
||||
* c++ can not overload static and non-static member functions with the same parameter types
|
||||
* so change the name to setFontSizeObj
|
||||
|
@ -224,8 +226,12 @@ public:
|
|||
* so change the name to setFontNameObj
|
||||
*/
|
||||
void setFontNameObj(const char* name);
|
||||
|
||||
const char* fontNameObj();
|
||||
|
||||
/** returns the name of the Font */
|
||||
const char* getFontNameObj() const;
|
||||
|
||||
/** deprecated Use getFontNameObj() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE const char* fontNameObj() const { return getFontNameObj(); }
|
||||
|
||||
protected:
|
||||
void recreateLabel();
|
||||
|
@ -245,19 +251,7 @@ protected:
|
|||
*/
|
||||
class CC_DLL MenuItemSprite : public MenuItem
|
||||
{
|
||||
/** the image used when the item is not selected */
|
||||
CC_PROPERTY(Node*, _normalImage, NormalImage);
|
||||
/** the image used when the item is selected */
|
||||
CC_PROPERTY(Node*, _selectedImage, SelectedImage);
|
||||
/** the image used when the item is disabled */
|
||||
CC_PROPERTY(Node*, _disabledImage, DisabledImage);
|
||||
public:
|
||||
MenuItemSprite()
|
||||
:_normalImage(NULL)
|
||||
,_selectedImage(NULL)
|
||||
,_disabledImage(NULL)
|
||||
{}
|
||||
|
||||
/** creates a menu item with a normal, selected and disabled image*/
|
||||
static MenuItemSprite * create(Node* normalSprite, Node* selectedSprite, Node* disabledSprite = NULL);
|
||||
/** creates a menu item with a normal and selected image with target/selector */
|
||||
|
@ -269,6 +263,12 @@ public:
|
|||
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
||||
static MenuItemSprite * create(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||
|
||||
MenuItemSprite()
|
||||
:_normalImage(NULL)
|
||||
,_selectedImage(NULL)
|
||||
,_disabledImage(NULL)
|
||||
{}
|
||||
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||
|
@ -283,6 +283,13 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void updateImagesVisibility();
|
||||
|
||||
/** the image used when the item is not selected */
|
||||
CC_PROPERTY(Node*, _normalImage, NormalImage);
|
||||
/** the image used when the item is selected */
|
||||
CC_PROPERTY(Node*, _selectedImage, SelectedImage);
|
||||
/** the image used when the item is disabled */
|
||||
CC_PROPERTY(Node*, _disabledImage, DisabledImage);
|
||||
};
|
||||
|
||||
|
||||
|
@ -297,9 +304,8 @@ protected:
|
|||
class CC_DLL MenuItemImage : public MenuItemSprite
|
||||
{
|
||||
public:
|
||||
MenuItemImage(){}
|
||||
virtual ~MenuItemImage(){}
|
||||
|
||||
/** Creates an MenuItemImage. */
|
||||
static MenuItemImage* create();
|
||||
/** creates a menu item with a normal and selected image*/
|
||||
static MenuItemImage* create(const char *normalImage, const char *selectedImage);
|
||||
/** creates a menu item with a normal,selected and disabled image*/
|
||||
|
@ -314,6 +320,9 @@ public:
|
|||
/** creates a menu item with a normal,selected and disabled image with a callable object */
|
||||
static MenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage, const ccMenuCallback& callback);
|
||||
|
||||
MenuItemImage(){}
|
||||
virtual ~MenuItemImage(){}
|
||||
|
||||
bool init();
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, Object* target, SEL_MenuHandler selector);
|
||||
|
@ -326,10 +335,6 @@ public:
|
|||
void setSelectedSpriteFrame(SpriteFrame* frame);
|
||||
/** sets the sprite frame for the disabled image */
|
||||
void setDisabledSpriteFrame(SpriteFrame* frame);
|
||||
|
||||
/** Creates an MenuItemImage.
|
||||
*/
|
||||
static MenuItemImage* create();
|
||||
};
|
||||
|
||||
|
||||
|
@ -339,52 +344,55 @@ public:
|
|||
*/
|
||||
class CC_DLL MenuItemToggle : public MenuItem
|
||||
{
|
||||
/** returns the selected item */
|
||||
CC_PROPERTY(unsigned int, _selectedIndex, SelectedIndex);
|
||||
/** MutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_PROPERTY(Array*, _subItems, SubItems);
|
||||
public:
|
||||
/** creates a menu item from a Array with a callable object */
|
||||
static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, Array* menuItems);
|
||||
/** creates a menu item from a list of items with a callable object */
|
||||
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...);
|
||||
/** creates a menu item with no target/selector and no items */
|
||||
static MenuItemToggle* create();
|
||||
/** creates a menu item with a item */
|
||||
static MenuItemToggle* create(MenuItem *item);
|
||||
/** creates a menu item from a Array with a target selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
||||
/** creates a menu item from a list of items with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...);
|
||||
|
||||
MenuItemToggle()
|
||||
: _selectedIndex(0)
|
||||
, _subItems(NULL)
|
||||
{}
|
||||
virtual ~MenuItemToggle();
|
||||
|
||||
/** creates a menu item from a Array with a target selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
||||
/** creates a menu item from a Array with a callable object */
|
||||
static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, Array* menuItems);
|
||||
|
||||
/** creates a menu item from a list of items with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...);
|
||||
/** creates a menu item from a list of items with a callable object */
|
||||
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...);
|
||||
|
||||
/** creates a menu item with no target/selector and no items */
|
||||
static MenuItemToggle* create();
|
||||
|
||||
/** initializes a menu item from a list of items with a target selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, va_list args);
|
||||
/** initializes a menu item from a list of items with a callable object */
|
||||
bool initWithCallback(const ccMenuCallback& callback, MenuItem* item, va_list args);
|
||||
|
||||
/** creates a menu item with a item */
|
||||
static MenuItemToggle* create(MenuItem *item);
|
||||
|
||||
/** initializes a menu item with a item */
|
||||
bool initWithItem(MenuItem *item);
|
||||
/** add more menu item */
|
||||
void addSubItem(MenuItem *item);
|
||||
|
||||
/** return the selected item */
|
||||
MenuItem* selectedItem();
|
||||
// super methods
|
||||
virtual void activate();
|
||||
virtual void selected();
|
||||
virtual void unselected();
|
||||
virtual void setEnabled(bool var);
|
||||
MenuItem* getSelectedItem();
|
||||
/** @deprecated Use getSelectedItem() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE MenuItem* selectedItem() { return getSelectedItem(); }
|
||||
|
||||
// Overrides
|
||||
virtual void activate() override;
|
||||
virtual void selected() override;
|
||||
virtual void unselected() override;
|
||||
virtual void setEnabled(bool var) override;
|
||||
|
||||
protected:
|
||||
/** returns the selected item */
|
||||
CC_PROPERTY(unsigned int, _selectedIndex, SelectedIndex);
|
||||
/** MutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
|
||||
@since v0.7.2
|
||||
*/
|
||||
CC_PROPERTY(Array*, _subItems, SubItems);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,11 +40,6 @@ NS_CC_BEGIN
|
|||
*/
|
||||
class CC_DLL ClippingNode : public Node
|
||||
{
|
||||
protected:
|
||||
Node* _stencil;
|
||||
GLfloat _alphaThreshold;
|
||||
bool _inverted;
|
||||
|
||||
public:
|
||||
/** Creates and initializes a clipping node without a stencil.
|
||||
*/
|
||||
|
@ -66,12 +61,6 @@ public:
|
|||
*/
|
||||
virtual bool init(Node *pStencil);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onEnterTransitionDidFinish();
|
||||
virtual void onExitTransitionDidStart();
|
||||
virtual void onExit();
|
||||
virtual void visit();
|
||||
|
||||
/** The Node to use as a stencil to do the clipping.
|
||||
The stencil node will be retained.
|
||||
This default to nil.
|
||||
|
@ -93,14 +82,26 @@ public:
|
|||
*/
|
||||
bool isInverted() const;
|
||||
void setInverted(bool bInverted);
|
||||
|
||||
|
||||
// Overrides
|
||||
virtual void onEnter() override;
|
||||
virtual void onEnterTransitionDidFinish() override;
|
||||
virtual void onExitTransitionDidStart() override;
|
||||
virtual void onExit() override;
|
||||
virtual void visit() override;
|
||||
|
||||
private:
|
||||
/**draw fullscreen quad to clear stencil bits
|
||||
*/
|
||||
void drawFullScreenQuadClearStencil();
|
||||
|
||||
|
||||
private:
|
||||
ClippingNode();
|
||||
|
||||
protected:
|
||||
Node* _stencil;
|
||||
GLfloat _alphaThreshold;
|
||||
bool _inverted;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -49,14 +49,14 @@ class CC_DLL MotionStreak : public NodeRGBA, public TextureProtocol
|
|||
#endif // EMSCRIPTEN
|
||||
{
|
||||
public:
|
||||
MotionStreak();
|
||||
virtual ~MotionStreak();
|
||||
|
||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename */
|
||||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
|
||||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||
|
||||
MotionStreak();
|
||||
virtual ~MotionStreak();
|
||||
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
||||
|
@ -68,21 +68,6 @@ public:
|
|||
/** Remove all living segments of the ribbon */
|
||||
void reset();
|
||||
|
||||
/** Override super methods */
|
||||
virtual void setPosition(const Point& position);
|
||||
virtual void draw();
|
||||
virtual void update(float delta);
|
||||
|
||||
/* Implement interfaces */
|
||||
virtual Texture2D* getTexture(void);
|
||||
virtual void setTexture(Texture2D *texture);
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc);
|
||||
virtual const BlendFunc& getBlendFunc(void) const;
|
||||
virtual GLubyte getOpacity(void) const;
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void setOpacityModifyRGB(bool bValue);
|
||||
virtual bool isOpacityModifyRGB(void) const;
|
||||
|
||||
/** When fast mode is enabled, new points are added faster but with lower precision */
|
||||
inline bool isFastMode() const { return _fastMode; }
|
||||
inline void setFastMode(bool bFastMode) { _fastMode = bFastMode; }
|
||||
|
@ -92,6 +77,20 @@ public:
|
|||
{
|
||||
_startingPositionInitialized = bStartingPositionInitialized;
|
||||
}
|
||||
|
||||
// Overrides
|
||||
virtual void setPosition(const Point& position) override;
|
||||
virtual void draw() override;
|
||||
virtual void update(float delta) override;
|
||||
virtual Texture2D* getTexture() override;
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
virtual const BlendFunc& getBlendFunc() const override;
|
||||
virtual GLubyte getOpacity() const override;
|
||||
virtual void setOpacity(GLubyte opacity) override;
|
||||
virtual void setOpacityModifyRGB(bool value) override;
|
||||
virtual bool isOpacityModifyRGB() const override;
|
||||
|
||||
protected:
|
||||
bool _fastMode;
|
||||
bool _startingPositionInitialized;
|
||||
|
|
|
@ -59,40 +59,40 @@ class CC_DLL ProgressTimer : public NodeRGBA
|
|||
#endif // EMSCRIPTEN
|
||||
{
|
||||
public:
|
||||
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
||||
static ProgressTimer* create(Sprite* sp);
|
||||
|
||||
ProgressTimer();
|
||||
~ProgressTimer(void);
|
||||
|
||||
/** Change the percentage to change progress. */
|
||||
inline ProgressTimerType getType(void) { return _type; }
|
||||
|
||||
/** Percentages are from 0 to 100 */
|
||||
inline float getPercentage(void) {return _percentage; }
|
||||
|
||||
/** The image to show the progress percentage, retain */
|
||||
inline Sprite* getSprite(void) { return _sprite; }
|
||||
virtual ~ProgressTimer();
|
||||
|
||||
/** Initializes a progress timer with the sprite as the shape the timer goes through */
|
||||
bool initWithSprite(Sprite* sp);
|
||||
|
||||
/** Change the percentage to change progress. */
|
||||
inline ProgressTimerType getType() const { return _type; }
|
||||
|
||||
/** Percentages are from 0 to 100 */
|
||||
inline float getPercentage() const {return _percentage; }
|
||||
|
||||
/** The image to show the progress percentage, retain */
|
||||
inline Sprite* getSprite() const { return _sprite; }
|
||||
|
||||
void setPercentage(float fPercentage);
|
||||
void setSprite(Sprite *pSprite);
|
||||
void setType(ProgressTimerType type);
|
||||
void setReverseProgress(bool reverse);
|
||||
|
||||
virtual void draw(void);
|
||||
void setAnchorPoint(const Point& anchorPoint);
|
||||
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual const Color3B& getColor() const;
|
||||
virtual GLubyte getOpacity() const;
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
|
||||
inline bool isReverseDirection() { return _reverseDirection; };
|
||||
inline void setReverseDirection(bool value) { _reverseDirection = value; };
|
||||
|
||||
public:
|
||||
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
||||
static ProgressTimer* create(Sprite* sp);
|
||||
// Overrides
|
||||
virtual void draw(void) override;
|
||||
void setAnchorPoint(const Point& anchorPoint) override;
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
virtual const Color3B& getColor() const override;
|
||||
virtual GLubyte getOpacity() const override;
|
||||
virtual void setOpacity(GLubyte opacity) override;
|
||||
|
||||
protected:
|
||||
Tex2F textureCoordFromAlphaPoint(Point alpha);
|
||||
Vertex2F vertexFromAlphaPoint(Point alpha);
|
||||
|
|
|
@ -53,19 +53,7 @@ There are also functions for saving the render texture to disk in PNG or JPG for
|
|||
*/
|
||||
class CC_DLL RenderTexture : public Node
|
||||
{
|
||||
/** The Sprite being used.
|
||||
The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
|
||||
The blending function can be changed in runtime by calling:
|
||||
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||
*/
|
||||
CC_PROPERTY(Sprite*, _sprite, Sprite)
|
||||
public:
|
||||
RenderTexture();
|
||||
virtual ~RenderTexture();
|
||||
|
||||
virtual void visit();
|
||||
virtual void draw();
|
||||
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
|
||||
static RenderTexture * create(int w ,int h, Texture2DPixelFormat eFormat, GLuint uDepthStencilFormat);
|
||||
|
||||
|
@ -75,6 +63,9 @@ public:
|
|||
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
|
||||
static RenderTexture * create(int w, int h);
|
||||
|
||||
RenderTexture();
|
||||
virtual ~RenderTexture();
|
||||
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
||||
bool initWithWidthAndHeight(int w, int h, Texture2DPixelFormat eFormat);
|
||||
|
||||
|
@ -157,6 +148,10 @@ public:
|
|||
bool isAutoDraw() const;
|
||||
void setAutoDraw(bool bAutoDraw);
|
||||
|
||||
// Overrides
|
||||
virtual void visit() override;
|
||||
virtual void draw() override;
|
||||
|
||||
private:
|
||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||
|
||||
|
@ -175,6 +170,13 @@ protected:
|
|||
GLclampf _clearDepth;
|
||||
GLint _clearStencil;
|
||||
bool _autoDraw;
|
||||
|
||||
/** The Sprite being used.
|
||||
The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
|
||||
The blending function can be changed in runtime by calling:
|
||||
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||
*/
|
||||
CC_PROPERTY(Sprite*, _sprite, Sprite)
|
||||
};
|
||||
|
||||
// end of textures group
|
||||
|
|
|
@ -67,46 +67,42 @@ class ParticleSystem;
|
|||
class CC_DLL ParticleBatchNode : public Node, public TextureProtocol
|
||||
{
|
||||
public:
|
||||
ParticleBatchNode();
|
||||
virtual ~ParticleBatchNode();
|
||||
|
||||
/** initializes the particle system with Texture2D, a capacity of particles, which particle system to use */
|
||||
static ParticleBatchNode* createWithTexture(Texture2D *tex, unsigned int capacity = kParticleDefaultCapacity);
|
||||
|
||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||
static ParticleBatchNode* create(const char* fileImage, unsigned int capacity = kParticleDefaultCapacity);
|
||||
|
||||
ParticleBatchNode();
|
||||
virtual ~ParticleBatchNode();
|
||||
|
||||
/** initializes the particle system with Texture2D, a capacity of particles */
|
||||
bool initWithTexture(Texture2D *tex, unsigned int capacity);
|
||||
|
||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
|
||||
/** Add a child into the ParticleBatchNode */
|
||||
virtual void addChild(Node * child);
|
||||
virtual void addChild(Node * child, int zOrder);
|
||||
virtual void addChild(Node * child, int zOrder, int tag);
|
||||
|
||||
/** Inserts a child into the ParticleBatchNode */
|
||||
void insertChild(ParticleSystem* pSystem, unsigned int index);
|
||||
|
||||
/** remove child from the ParticleBatchNode */
|
||||
virtual void removeChild(Node* child, bool cleanup);
|
||||
virtual void reorderChild(Node * child, int zOrder);
|
||||
void removeChildAtIndex(unsigned int index, bool doCleanup);
|
||||
void removeAllChildrenWithCleanup(bool doCleanup);
|
||||
|
||||
/** disables a particle by inserting a 0'd quad into the texture atlas */
|
||||
void disableParticle(unsigned int particleIndex);
|
||||
virtual void draw(void);
|
||||
// returns the used texture
|
||||
virtual Texture2D* getTexture(void);
|
||||
// sets a new texture. it will be retained
|
||||
virtual void setTexture(Texture2D *texture);
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc);
|
||||
// returns the blending function used for the texture
|
||||
virtual const BlendFunc& getBlendFunc(void) const;
|
||||
|
||||
// Overrides
|
||||
void visit();
|
||||
virtual void addChild(Node * child) override;
|
||||
virtual void addChild(Node * child, int zOrder) override;
|
||||
virtual void addChild(Node * child, int zOrder, int tag) override;
|
||||
virtual void removeChild(Node* child, bool cleanup) override;
|
||||
virtual void reorderChild(Node * child, int zOrder) override;
|
||||
virtual void draw(void) override;
|
||||
virtual Texture2D* getTexture(void) override;
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
virtual const BlendFunc& getBlendFunc(void) const override;
|
||||
|
||||
private:
|
||||
void updateAllAtlasIndexes();
|
||||
|
@ -117,6 +113,7 @@ private:
|
|||
void updateBlendFunc(void);
|
||||
/** the texture atlas used for drawing the quads */
|
||||
CC_SYNTHESIZE(TextureAtlas*, _textureAtlas, TextureAtlas);
|
||||
|
||||
private:
|
||||
/** the blend function used for drawing the quads */
|
||||
BlendFunc _blendFunc;
|
||||
|
|
|
@ -164,97 +164,64 @@ emitter.startSpin = 0;
|
|||
|
||||
*/
|
||||
class CC_DLL ParticleSystem : public Node, public TextureProtocol
|
||||
{
|
||||
protected:
|
||||
std::string _plistFile;
|
||||
//! time elapsed since the start of the system (in seconds)
|
||||
float _elapsed;
|
||||
|
||||
// Different modes
|
||||
//! Mode A:Gravity + Tangential Accel + Radial Accel
|
||||
struct {
|
||||
/** Gravity value. Only available in 'Gravity' mode. */
|
||||
Point gravity;
|
||||
/** speed of each particle. Only available in 'Gravity' mode. */
|
||||
float speed;
|
||||
/** speed variance of each particle. Only available in 'Gravity' mode. */
|
||||
float speedVar;
|
||||
/** tangential acceleration of each particle. Only available in 'Gravity' mode. */
|
||||
float tangentialAccel;
|
||||
/** tangential acceleration variance of each particle. Only available in 'Gravity' mode. */
|
||||
float tangentialAccelVar;
|
||||
/** radial acceleration of each particle. Only available in 'Gravity' mode. */
|
||||
float radialAccel;
|
||||
/** radial acceleration variance of each particle. Only available in 'Gravity' mode. */
|
||||
float radialAccelVar;
|
||||
/** set the rotation of each particle to its direction Only available in 'Gravity' mode. */
|
||||
bool rotationIsDir;
|
||||
} modeA;
|
||||
|
||||
//! Mode B: circular movement (gravity, radial accel and tangential accel don't are not used in this mode)
|
||||
struct {
|
||||
/** The starting radius of the particles. Only available in 'Radius' mode. */
|
||||
float startRadius;
|
||||
/** The starting radius variance of the particles. Only available in 'Radius' mode. */
|
||||
float startRadiusVar;
|
||||
/** The ending radius of the particles. Only available in 'Radius' mode. */
|
||||
float endRadius;
|
||||
/** The ending radius variance of the particles. Only available in 'Radius' mode. */
|
||||
float endRadiusVar;
|
||||
/** Number of degrees to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
|
||||
float rotatePerSecond;
|
||||
/** Variance in degrees for rotatePerSecond. Only available in 'Radius' mode. */
|
||||
float rotatePerSecondVar;
|
||||
} modeB;
|
||||
|
||||
//! Array of particles
|
||||
tParticle *_particles;
|
||||
|
||||
// color modulate
|
||||
// BOOL colorModulate;
|
||||
|
||||
//! How many particles can be emitted per second
|
||||
float _emitCounter;
|
||||
|
||||
//! particle idx
|
||||
unsigned int _particleIdx;
|
||||
|
||||
// Optimization
|
||||
//CC_UPDATE_PARTICLE_IMP updateParticleImp;
|
||||
//SEL updateParticleSel;
|
||||
|
||||
/** weak reference to the SpriteBatchNode that renders the Sprite */
|
||||
CC_PROPERTY(ParticleBatchNode*, _batchNode, BatchNode);
|
||||
|
||||
// index of system in batch node array
|
||||
CC_SYNTHESIZE(unsigned int, _atlasIndex, AtlasIndex);
|
||||
|
||||
//true if scaled or rotated
|
||||
bool _transformSystemDirty;
|
||||
// Number of allocated particles
|
||||
unsigned int _allocatedParticles;
|
||||
|
||||
/** Is the emitter active */
|
||||
bool _isActive;
|
||||
/** Quantity of particles that are being simulated at the moment */
|
||||
CC_PROPERTY_READONLY(unsigned int, _particleCount, ParticleCount)
|
||||
/** How many seconds the emitter will run. -1 means 'forever' */
|
||||
CC_PROPERTY(float, _duration, Duration)
|
||||
/** sourcePosition of the emitter */
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _sourcePosition, SourcePosition)
|
||||
/** Position variance of the emitter */
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _posVar, PosVar)
|
||||
/** life, and life variation of each particle */
|
||||
CC_PROPERTY(float, _life, Life)
|
||||
/** life variance of each particle */
|
||||
CC_PROPERTY(float, _lifeVar, LifeVar)
|
||||
/** angle and angle variation of each particle */
|
||||
CC_PROPERTY(float, _angle, Angle)
|
||||
/** angle variance of each particle */
|
||||
CC_PROPERTY(float, _angleVar, AngleVar)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
public:
|
||||
/** creates an initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v2.0
|
||||
*/
|
||||
static ParticleSystem * create(const char *plistFile);
|
||||
|
||||
//! create a system with a fixed number of particles
|
||||
static ParticleSystem* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
ParticleSystem();
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
/** initializes a ParticleSystem*/
|
||||
bool init();
|
||||
/** initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithFile(const char *plistFile);
|
||||
|
||||
/** initializes a QuadParticleSystem from a Dictionary.
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary);
|
||||
|
||||
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
||||
@since v2.1
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary, const char *dirname);
|
||||
|
||||
//! Initializes a system with a fixed number of particles
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
//! Add a particle to the emitter
|
||||
bool addParticle();
|
||||
//! Initializes a particle
|
||||
void initParticle(tParticle* particle);
|
||||
//! stop emitting particles. Running particles will continue to run until they die
|
||||
void stopSystem();
|
||||
//! Kill all living particles.
|
||||
void resetSystem();
|
||||
//! whether or not the system is full
|
||||
bool isFull();
|
||||
|
||||
//! should be overridden by subclasses
|
||||
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition);
|
||||
//! should be overridden by subclasses
|
||||
virtual void postStep();
|
||||
|
||||
virtual void updateWithNoTime(void);
|
||||
|
||||
virtual bool isAutoRemoveOnFinish() const;
|
||||
virtual void setAutoRemoveOnFinish(bool var);
|
||||
|
||||
// mode A
|
||||
virtual const Point& getGravity();
|
||||
virtual void setGravity(const Point& g);
|
||||
|
@ -290,12 +257,128 @@ public:
|
|||
virtual void setRotation(float newRotation);
|
||||
virtual void setScaleX(float newScaleX);
|
||||
virtual void setScaleY(float newScaleY);
|
||||
|
||||
|
||||
virtual bool isActive() const;
|
||||
virtual bool isBlendAdditive() const;
|
||||
virtual void setBlendAdditive(bool value);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Overrides
|
||||
virtual void update(float dt) override;
|
||||
|
||||
protected:
|
||||
virtual void updateBlendFunc();
|
||||
|
||||
protected:
|
||||
/** whether or not the particles are using blend additive.
|
||||
If enabled, the following blending function will be used.
|
||||
@code
|
||||
source blend function = GL_SRC_ALPHA;
|
||||
dest blend function = GL_ONE;
|
||||
@endcode
|
||||
*/
|
||||
bool _isBlendAdditive;
|
||||
|
||||
/** whether or not the node will be auto-removed when it has no particles left.
|
||||
By default it is false.
|
||||
@since v0.8
|
||||
*/
|
||||
bool _isAutoRemoveOnFinish;
|
||||
|
||||
std::string _plistFile;
|
||||
//! time elapsed since the start of the system (in seconds)
|
||||
float _elapsed;
|
||||
|
||||
// Different modes
|
||||
//! Mode A:Gravity + Tangential Accel + Radial Accel
|
||||
struct {
|
||||
/** Gravity value. Only available in 'Gravity' mode. */
|
||||
Point gravity;
|
||||
/** speed of each particle. Only available in 'Gravity' mode. */
|
||||
float speed;
|
||||
/** speed variance of each particle. Only available in 'Gravity' mode. */
|
||||
float speedVar;
|
||||
/** tangential acceleration of each particle. Only available in 'Gravity' mode. */
|
||||
float tangentialAccel;
|
||||
/** tangential acceleration variance of each particle. Only available in 'Gravity' mode. */
|
||||
float tangentialAccelVar;
|
||||
/** radial acceleration of each particle. Only available in 'Gravity' mode. */
|
||||
float radialAccel;
|
||||
/** radial acceleration variance of each particle. Only available in 'Gravity' mode. */
|
||||
float radialAccelVar;
|
||||
/** set the rotation of each particle to its direction Only available in 'Gravity' mode. */
|
||||
bool rotationIsDir;
|
||||
} modeA;
|
||||
|
||||
//! Mode B: circular movement (gravity, radial accel and tangential accel don't are not used in this mode)
|
||||
struct {
|
||||
/** The starting radius of the particles. Only available in 'Radius' mode. */
|
||||
float startRadius;
|
||||
/** The starting radius variance of the particles. Only available in 'Radius' mode. */
|
||||
float startRadiusVar;
|
||||
/** The ending radius of the particles. Only available in 'Radius' mode. */
|
||||
float endRadius;
|
||||
/** The ending radius variance of the particles. Only available in 'Radius' mode. */
|
||||
float endRadiusVar;
|
||||
/** Number of degrees to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
|
||||
float rotatePerSecond;
|
||||
/** Variance in degrees for rotatePerSecond. Only available in 'Radius' mode. */
|
||||
float rotatePerSecondVar;
|
||||
} modeB;
|
||||
|
||||
//! Array of particles
|
||||
tParticle *_particles;
|
||||
|
||||
// color modulate
|
||||
// BOOL colorModulate;
|
||||
|
||||
//! How many particles can be emitted per second
|
||||
float _emitCounter;
|
||||
|
||||
//! particle idx
|
||||
unsigned int _particleIdx;
|
||||
|
||||
// Optimization
|
||||
//CC_UPDATE_PARTICLE_IMP updateParticleImp;
|
||||
//SEL updateParticleSel;
|
||||
|
||||
/** weak reference to the SpriteBatchNode that renders the Sprite */
|
||||
CC_PROPERTY(ParticleBatchNode*, _batchNode, BatchNode);
|
||||
|
||||
// index of system in batch node array
|
||||
CC_SYNTHESIZE(unsigned int, _atlasIndex, AtlasIndex);
|
||||
|
||||
//true if scaled or rotated
|
||||
bool _transformSystemDirty;
|
||||
// Number of allocated particles
|
||||
unsigned int _allocatedParticles;
|
||||
|
||||
/** Is the emitter active */
|
||||
bool _isActive;
|
||||
|
||||
|
||||
/** Quantity of particles that are being simulated at the moment */
|
||||
CC_PROPERTY_READONLY(unsigned int, _particleCount, ParticleCount)
|
||||
/** How many seconds the emitter will run. -1 means 'forever' */
|
||||
CC_PROPERTY(float, _duration, Duration)
|
||||
/** sourcePosition of the emitter */
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _sourcePosition, SourcePosition)
|
||||
/** Position variance of the emitter */
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _posVar, PosVar)
|
||||
/** life, and life variation of each particle */
|
||||
CC_PROPERTY(float, _life, Life)
|
||||
/** life variance of each particle */
|
||||
CC_PROPERTY(float, _lifeVar, LifeVar)
|
||||
/** angle and angle variation of each particle */
|
||||
CC_PROPERTY(float, _angle, Angle)
|
||||
/** angle variance of each particle */
|
||||
CC_PROPERTY(float, _angleVar, AngleVar)
|
||||
|
||||
/** Switch between different kind of emitter modes:
|
||||
- kParticleModeGravity: uses gravity, speed, radial and tangential acceleration
|
||||
- kParticleModeRadius: uses radius movement + rotation
|
||||
*/
|
||||
CC_PROPERTY(int, _emitterMode, EmitterMode)
|
||||
|
||||
/** start size in pixels of each particle */
|
||||
CC_PROPERTY(float, _startSize, StartSize)
|
||||
/** size variance in pixels of each particle */
|
||||
|
@ -331,90 +414,10 @@ public:
|
|||
/** does the alpha value modify color */
|
||||
CC_PROPERTY(bool, _opacityModifyRGB, OpacityModifyRGB)
|
||||
|
||||
/** whether or not the particles are using blend additive.
|
||||
If enabled, the following blending function will be used.
|
||||
@code
|
||||
source blend function = GL_SRC_ALPHA;
|
||||
dest blend function = GL_ONE;
|
||||
@endcode
|
||||
*/
|
||||
bool _isBlendAdditive;
|
||||
/** particles movement type: Free or Grouped
|
||||
@since v0.8
|
||||
*/
|
||||
CC_PROPERTY(tPositionType, _positionType, PositionType)
|
||||
/** whether or not the node will be auto-removed when it has no particles left.
|
||||
By default it is false.
|
||||
@since v0.8
|
||||
*/
|
||||
protected:
|
||||
bool _isAutoRemoveOnFinish;
|
||||
public:
|
||||
virtual bool isAutoRemoveOnFinish() const;
|
||||
virtual void setAutoRemoveOnFinish(bool var);
|
||||
|
||||
/** Switch between different kind of emitter modes:
|
||||
- kParticleModeGravity: uses gravity, speed, radial and tangential acceleration
|
||||
- kParticleModeRadius: uses radius movement + rotation
|
||||
*/
|
||||
CC_PROPERTY(int, _emitterMode, EmitterMode)
|
||||
|
||||
public:
|
||||
ParticleSystem();
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
/** creates an initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v2.0
|
||||
*/
|
||||
static ParticleSystem * create(const char *plistFile);
|
||||
|
||||
//! create a system with a fixed number of particles
|
||||
static ParticleSystem* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
/** initializes a ParticleSystem*/
|
||||
bool init();
|
||||
/** initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithFile(const char *plistFile);
|
||||
|
||||
/** initializes a QuadParticleSystem from a Dictionary.
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary);
|
||||
|
||||
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
||||
@since v2.1
|
||||
@since v0.8
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary, const char *dirname);
|
||||
|
||||
//! Initializes a system with a fixed number of particles
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
//! Add a particle to the emitter
|
||||
bool addParticle();
|
||||
//! Initializes a particle
|
||||
void initParticle(tParticle* particle);
|
||||
//! stop emitting particles. Running particles will continue to run until they die
|
||||
void stopSystem();
|
||||
//! Kill all living particles.
|
||||
void resetSystem();
|
||||
//! whether or not the system is full
|
||||
bool isFull();
|
||||
|
||||
//! should be overridden by subclasses
|
||||
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition);
|
||||
//! should be overridden by subclasses
|
||||
virtual void postStep();
|
||||
|
||||
virtual void update(float dt);
|
||||
virtual void updateWithNoTime(void);
|
||||
|
||||
protected:
|
||||
virtual void updateBlendFunc();
|
||||
CC_PROPERTY(tPositionType, _positionType, PositionType)
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -63,14 +63,19 @@ protected:
|
|||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||
|
||||
public:
|
||||
|
||||
/** creates a Particle Emitter */
|
||||
static ParticleSystemQuad * create();
|
||||
/** creates a Particle Emitter with a number of particles */
|
||||
static ParticleSystemQuad * createWithTotalParticles(unsigned int numberOfParticles);
|
||||
/** creates an initializes a ParticleSystemQuad from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
*/
|
||||
static ParticleSystemQuad * create(const char *plistFile);
|
||||
|
||||
ParticleSystemQuad();
|
||||
virtual ~ParticleSystemQuad();
|
||||
|
||||
/** creates an initializes a ParticleSystemQuad from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
*/
|
||||
static ParticleSystemQuad * create(const char *plistFile);
|
||||
|
||||
/** initializes the indices for the vertices*/
|
||||
void initIndices();
|
||||
|
||||
|
@ -87,21 +92,20 @@ public:
|
|||
@since v0.99.4
|
||||
*/
|
||||
void setTextureWithRect(Texture2D *texture, const Rect& rect);
|
||||
// super methods
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual void setTexture(Texture2D* texture);
|
||||
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition);
|
||||
virtual void postStep();
|
||||
virtual void draw();
|
||||
virtual void setBatchNode(ParticleBatchNode* batchNode);
|
||||
virtual void setTotalParticles(unsigned int tp);
|
||||
|
||||
|
||||
/** listen the event that coming to foreground on Android
|
||||
*/
|
||||
void listenBackToForeground(Object *obj);
|
||||
|
||||
static ParticleSystemQuad * create();
|
||||
static ParticleSystemQuad * createWithTotalParticles(unsigned int numberOfParticles);
|
||||
// Overrides
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles) override;
|
||||
virtual void setTexture(Texture2D* texture) override;
|
||||
virtual void updateQuadWithParticle(tParticle* particle, const Point& newPosition) override;
|
||||
virtual void postStep() override;
|
||||
virtual void draw() override;
|
||||
virtual void setBatchNode(ParticleBatchNode* batchNode) override;
|
||||
virtual void setTotalParticles(unsigned int tp) override;
|
||||
|
||||
private:
|
||||
#if CC_TEXTURE_ATLAS_USE_VAO
|
||||
void setupVBOandVAO();
|
||||
|
|
|
@ -310,7 +310,7 @@ public:
|
|||
virtual int executeNotificationEvent(NotificationCenter* pNotificationCenter, const char* pszName) = 0;
|
||||
|
||||
/** execute a callfun event */
|
||||
virtual int executeCallFuncActionEvent(CallFunc* pAction, Object* pTarget = NULL) = 0;
|
||||
virtual int executeCallFuncActionEvent(CallFunc* pAction, Object* target = NULL) = 0;
|
||||
/** execute a schedule function */
|
||||
virtual int executeSchedule(int nHandler, float dt, Node* pNode = NULL) = 0;
|
||||
|
||||
|
|
|
@ -61,9 +61,10 @@ public:
|
|||
/** initializes the animation frame with a spriteframe, number of delay units and a notification user info */
|
||||
bool initWithSpriteFrame(SpriteFrame* spriteFrame, float delayUnits, Dictionary* userInfo);
|
||||
|
||||
/** returns a copy of the AnimationFrame */
|
||||
virtual AnimationFrame *clone() const;
|
||||
// Overrides
|
||||
virtual AnimationFrame *clone() const override;
|
||||
|
||||
protected:
|
||||
/** SpriteFrameName to be used */
|
||||
CC_SYNTHESIZE_RETAIN(SpriteFrame*, _spriteFrame, SpriteFrame)
|
||||
|
||||
|
@ -87,19 +88,16 @@ You can animate a Animation object by using the Animate action. Example:
|
|||
*/
|
||||
class CC_DLL Animation : public Object, public Clonable
|
||||
{
|
||||
public:
|
||||
Animation();
|
||||
~Animation(void);
|
||||
public:
|
||||
/** Creates an animation
|
||||
@since v0.99.5
|
||||
*/
|
||||
@since v0.99.5
|
||||
*/
|
||||
static Animation* create(void);
|
||||
|
||||
/* Creates an animation with an array of SpriteFrame and a delay between frames in seconds.
|
||||
The frames will be added with one "delay unit".
|
||||
@since v0.99.5
|
||||
*/
|
||||
*/
|
||||
static Animation* createWithSpriteFrames(Array* arrayOfSpriteFrameNames, float delay = 0.0f);
|
||||
|
||||
/* Creates an animation with an array of AnimationFrame, the delay per units in seconds and and how many times it should be executed.
|
||||
|
@ -110,22 +108,8 @@ public:
|
|||
return Animation::create(arrayOfAnimationFrameNames, delayPerUnit, 1);
|
||||
}
|
||||
|
||||
/** Adds a SpriteFrame to a Animation.
|
||||
The frame will be added with one "delay unit".
|
||||
*/
|
||||
void addSpriteFrame(SpriteFrame *pFrame);
|
||||
|
||||
/** Adds a frame with an image filename. Internally it will create a SpriteFrame and it will add it.
|
||||
The frame will be added with one "delay unit".
|
||||
Added to facilitate the migration from v0.8 to v0.9.
|
||||
*/
|
||||
void addSpriteFrameWithFileName(const char *pszFileName);
|
||||
|
||||
/** Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.
|
||||
The frame will be added with one "delay unit".
|
||||
Added to facilitate the migration from v0.8 to v0.9.
|
||||
*/
|
||||
void addSpriteFrameWithTexture(Texture2D* pobTexture, const Rect& rect);
|
||||
Animation();
|
||||
virtual ~Animation(void);
|
||||
|
||||
bool init();
|
||||
|
||||
|
@ -139,9 +123,27 @@ public:
|
|||
*/
|
||||
bool initWithAnimationFrames(Array* arrayOfAnimationFrames, float delayPerUnit, unsigned int loops);
|
||||
|
||||
/** returns a clone fo the animation */
|
||||
virtual Animation *clone() const;
|
||||
/** Adds a SpriteFrame to a Animation.
|
||||
The frame will be added with one "delay unit".
|
||||
*/
|
||||
void addSpriteFrame(SpriteFrame *pFrame);
|
||||
|
||||
/** Adds a frame with an image filename. Internally it will create a SpriteFrame and it will add it.
|
||||
The frame will be added with one "delay unit".
|
||||
Added to facilitate the migration from v0.8 to v0.9.
|
||||
*/
|
||||
void addSpriteFrameWithFileName(const char *pszFileName);
|
||||
|
||||
/** Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.
|
||||
The frame will be added with one "delay unit".
|
||||
Added to facilitate the migration from v0.8 to v0.9.
|
||||
*/
|
||||
void addSpriteFrameWithTexture(Texture2D* pobTexture, const Rect& rect);
|
||||
|
||||
// overrides
|
||||
virtual Animation *clone() const override;
|
||||
|
||||
protected:
|
||||
/** total Delay units of the Animation. */
|
||||
CC_SYNTHESIZE_READONLY(float, _totalDelayUnits, TotalDelayUnits)
|
||||
|
||||
|
|
|
@ -53,18 +53,6 @@ void AnimationCache::destroyInstance()
|
|||
CC_SAFE_RELEASE_NULL(s_pSharedAnimationCache);
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
AnimationCache* AnimationCache::sharedAnimationCache(void)
|
||||
{
|
||||
return AnimationCache::getInstance();
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
void AnimationCache::purgeSharedAnimationCache(void)
|
||||
{
|
||||
return AnimationCache::destroyInstance();
|
||||
}
|
||||
|
||||
bool AnimationCache::init()
|
||||
{
|
||||
_animations = new Dictionary();
|
||||
|
@ -127,7 +115,7 @@ void AnimationCache::parseVersion1(Dictionary* animations)
|
|||
CCARRAY_FOREACH(frameNames, pObj)
|
||||
{
|
||||
const char* frameName = static_cast<String*>(pObj)->getCString();
|
||||
SpriteFrame* spriteFrame = frameCache->spriteFrameByName(frameName);
|
||||
SpriteFrame* spriteFrame = frameCache->getSpriteFrameByName(frameName);
|
||||
|
||||
if ( ! spriteFrame ) {
|
||||
CCLOG("cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the SpriteFrameCache. This frame will not be added to the animation.", pElement->getStrKey(), frameName);
|
||||
|
@ -185,7 +173,7 @@ void AnimationCache::parseVersion2(Dictionary* animations)
|
|||
Dictionary* entry = static_cast<Dictionary*>(pObj);
|
||||
|
||||
const char* spriteFrameName = entry->valueForKey("spriteframe")->getCString();
|
||||
SpriteFrame *spriteFrame = frameCache->spriteFrameByName(spriteFrameName);
|
||||
SpriteFrame *spriteFrame = frameCache->getSpriteFrameByName(spriteFrameName);
|
||||
|
||||
if( ! spriteFrame ) {
|
||||
CCLOG("cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the SpriteFrameCache. This frame will not be added to the animation.", name, spriteFrameName);
|
||||
|
|
|
@ -60,10 +60,12 @@ public:
|
|||
static void destroyInstance();
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static AnimationCache* sharedAnimationCache(void);
|
||||
CC_DEPRECATED_ATTRIBUTE static AnimationCache* sharedAnimationCache() { return AnimationCache::getInstance(); }
|
||||
|
||||
/** @deprecatd Use destroyInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache(void);
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache() { return AnimationCache::destroyInstance(); }
|
||||
|
||||
bool init(void);
|
||||
|
||||
/** Adds a Animation with a name.
|
||||
*/
|
||||
|
@ -91,11 +93,10 @@ public:
|
|||
*/
|
||||
void addAnimationsWithFile(const char* plist);
|
||||
|
||||
bool init(void);
|
||||
|
||||
private:
|
||||
void parseVersion1(Dictionary* animations);
|
||||
void parseVersion2(Dictionary* animations);
|
||||
|
||||
private:
|
||||
Dictionary* _animations;
|
||||
static AnimationCache* s_pSharedAnimationCache;
|
||||
|
|
|
@ -118,7 +118,7 @@ Sprite* Sprite::createWithSpriteFrame(SpriteFrame *pSpriteFrame)
|
|||
|
||||
Sprite* Sprite::createWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||
{
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->spriteFrameByName(pszSpriteFrameName);
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(pszSpriteFrameName);
|
||||
|
||||
#if COCOS2D_DEBUG > 0
|
||||
char msg[256] = {0};
|
||||
|
@ -263,7 +263,7 @@ bool Sprite::initWithSpriteFrameName(const char *pszSpriteFrameName)
|
|||
{
|
||||
CCAssert(pszSpriteFrameName != NULL, "");
|
||||
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->spriteFrameByName(pszSpriteFrameName);
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(pszSpriteFrameName);
|
||||
return initWithSpriteFrame(pFrame);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ public:
|
|||
/// @} end of creators group
|
||||
|
||||
|
||||
|
||||
/// @{
|
||||
/// @name Initializers
|
||||
|
||||
|
|
|
@ -63,9 +63,36 @@ class Sprite;
|
|||
class CC_DLL SpriteBatchNode : public Node, public TextureProtocol
|
||||
{
|
||||
public:
|
||||
/** creates a SpriteBatchNode with a texture2d and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
*/
|
||||
static SpriteBatchNode* createWithTexture(Texture2D* tex, unsigned int capacity);
|
||||
static SpriteBatchNode* createWithTexture(Texture2D* tex) {
|
||||
return SpriteBatchNode::createWithTexture(tex, kDefaultSpriteBatchCapacity);
|
||||
}
|
||||
|
||||
/** creates a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
static SpriteBatchNode* create(const char* fileImage, unsigned int capacity);
|
||||
static SpriteBatchNode* create(const char* fileImage) {
|
||||
return SpriteBatchNode::create(fileImage, kDefaultSpriteBatchCapacity);
|
||||
}
|
||||
|
||||
SpriteBatchNode();
|
||||
~SpriteBatchNode();
|
||||
virtual ~SpriteBatchNode();
|
||||
|
||||
/** initializes a SpriteBatchNode with a texture2d and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
*/
|
||||
bool initWithTexture(Texture2D *tex, unsigned int capacity);
|
||||
/** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
bool init();
|
||||
|
||||
// property
|
||||
|
||||
|
@ -83,34 +110,6 @@ public:
|
|||
|
||||
inline Array* getDescendants(void) { return _descendants; }
|
||||
|
||||
/** creates a SpriteBatchNode with a texture2d and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
*/
|
||||
static SpriteBatchNode* createWithTexture(Texture2D* tex, unsigned int capacity);
|
||||
static SpriteBatchNode* createWithTexture(Texture2D* tex) {
|
||||
return SpriteBatchNode::createWithTexture(tex, kDefaultSpriteBatchCapacity);
|
||||
}
|
||||
|
||||
/** creates a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
static SpriteBatchNode* create(const char* fileImage, unsigned int capacity);
|
||||
static SpriteBatchNode* create(const char* fileImage) {
|
||||
return SpriteBatchNode::create(fileImage, kDefaultSpriteBatchCapacity);
|
||||
}
|
||||
|
||||
/** initializes a SpriteBatchNode with a texture2d and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
*/
|
||||
bool initWithTexture(Texture2D *tex, unsigned int capacity);
|
||||
/** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
bool init();
|
||||
|
||||
void increaseAtlasCapacity();
|
||||
|
||||
/** removes a child given a certain index. It will also cleanup the running actions depending on the cleanup parameter.
|
||||
|
|
|
@ -141,7 +141,7 @@ void SpriteFrame::setRectInPixels(const Rect& rectInPixels)
|
|||
_rect = CC_RECT_PIXELS_TO_POINTS(rectInPixels);
|
||||
}
|
||||
|
||||
const Point& SpriteFrame::getOffset(void)
|
||||
const Point& SpriteFrame::getOffset() const
|
||||
{
|
||||
return _offset;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void SpriteFrame::setOffset(const Point& offsets)
|
|||
_offsetInPixels = CC_POINT_POINTS_TO_PIXELS( _offset );
|
||||
}
|
||||
|
||||
const Point& SpriteFrame::getOffsetInPixels(void)
|
||||
const Point& SpriteFrame::getOffsetInPixels() const
|
||||
{
|
||||
return _offsetInPixels;
|
||||
}
|
||||
|
|
|
@ -54,47 +54,6 @@ class Texture2D;
|
|||
class CC_DLL SpriteFrame : public Object, public Clonable
|
||||
{
|
||||
public:
|
||||
// attributes
|
||||
|
||||
inline const Rect& getRectInPixels(void) { return _rectInPixels; }
|
||||
void setRectInPixels(const Rect& rectInPixels);
|
||||
|
||||
inline bool isRotated(void) { return _rotated; }
|
||||
inline void setRotated(bool bRotated) { _rotated = bRotated; }
|
||||
|
||||
/** get rect of the frame */
|
||||
inline const Rect& getRect(void) const { return _rect; }
|
||||
/** set rect of the frame */
|
||||
void setRect(const Rect& rect);
|
||||
|
||||
/** get offset of the frame */
|
||||
const Point& getOffsetInPixels(void);
|
||||
/** set offset of the frame */
|
||||
void setOffsetInPixels(const Point& offsetInPixels);
|
||||
|
||||
/** get original size of the trimmed image */
|
||||
inline const Size& getOriginalSizeInPixels(void) { return _originalSizeInPixels; }
|
||||
/** set original size of the trimmed image */
|
||||
inline void setOriginalSizeInPixels(const Size& sizeInPixels) { _originalSizeInPixels = sizeInPixels; }
|
||||
|
||||
/** get original size of the trimmed image */
|
||||
inline const Size& getOriginalSize(void) { return _originalSize; }
|
||||
/** set original size of the trimmed image */
|
||||
inline void setOriginalSize(const Size& sizeInPixels) { _originalSize = sizeInPixels; }
|
||||
|
||||
/** get texture of the frame */
|
||||
Texture2D* getTexture(void);
|
||||
/** set texture of the frame, the texture is retained */
|
||||
void setTexture(Texture2D* pobTexture);
|
||||
|
||||
const Point& getOffset(void);
|
||||
void setOffset(const Point& offsets);
|
||||
|
||||
public:
|
||||
~SpriteFrame(void);
|
||||
|
||||
/** returns a clone of the SpriteFrame */
|
||||
virtual SpriteFrame *clone() const;
|
||||
|
||||
/** Create a SpriteFrame with a texture filename, rect in points.
|
||||
It is assumed that the frame was not trimmed.
|
||||
|
@ -116,7 +75,8 @@ public:
|
|||
*/
|
||||
static SpriteFrame* createWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
|
||||
|
||||
public:
|
||||
virtual ~SpriteFrame(void);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect in points.
|
||||
It is assumed that the frame was not trimmed.
|
||||
*/
|
||||
|
@ -140,6 +100,44 @@ public:
|
|||
bool initWithTextureFilename(const char* filename, const Rect& rect, bool rotated, const Point& offset, const Size& originalSize);
|
||||
|
||||
|
||||
// attributes
|
||||
inline const Rect& getRectInPixels() const { return _rectInPixels; }
|
||||
void setRectInPixels(const Rect& rectInPixels);
|
||||
|
||||
inline bool isRotated(void) const { return _rotated; }
|
||||
inline void setRotated(bool bRotated) { _rotated = bRotated; }
|
||||
|
||||
/** get rect of the frame */
|
||||
inline const Rect& getRect(void) const { return _rect; }
|
||||
/** set rect of the frame */
|
||||
void setRect(const Rect& rect);
|
||||
|
||||
/** get offset of the frame */
|
||||
const Point& getOffsetInPixels(void) const;
|
||||
/** set offset of the frame */
|
||||
void setOffsetInPixels(const Point& offsetInPixels);
|
||||
|
||||
/** get original size of the trimmed image */
|
||||
inline const Size& getOriginalSizeInPixels(void) const { return _originalSizeInPixels; }
|
||||
/** set original size of the trimmed image */
|
||||
inline void setOriginalSizeInPixels(const Size& sizeInPixels) { _originalSizeInPixels = sizeInPixels; }
|
||||
|
||||
/** get original size of the trimmed image */
|
||||
inline const Size& getOriginalSize(void) const { return _originalSize; }
|
||||
/** set original size of the trimmed image */
|
||||
inline void setOriginalSize(const Size& sizeInPixels) { _originalSize = sizeInPixels; }
|
||||
|
||||
/** get texture of the frame */
|
||||
Texture2D* getTexture(void);
|
||||
/** set texture of the frame, the texture is retained */
|
||||
void setTexture(Texture2D* pobTexture);
|
||||
|
||||
const Point& getOffset(void) const;
|
||||
void setOffset(const Point& offsets);
|
||||
|
||||
// Overrides
|
||||
virtual SpriteFrame *clone() const override;
|
||||
|
||||
protected:
|
||||
Point _offset;
|
||||
Size _originalSize;
|
||||
|
|
|
@ -61,18 +61,6 @@ void SpriteFrameCache::destroyInstance()
|
|||
CC_SAFE_RELEASE_NULL(_sharedSpriteFrameCache);
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
SpriteFrameCache* SpriteFrameCache::sharedSpriteFrameCache(void)
|
||||
{
|
||||
return SpriteFrameCache::getInstance();
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
void SpriteFrameCache::purgeSharedSpriteFrameCache(void)
|
||||
{
|
||||
return SpriteFrameCache::destroyInstance();
|
||||
}
|
||||
|
||||
bool SpriteFrameCache::init(void)
|
||||
{
|
||||
_spriteFrames= new Dictionary();
|
||||
|
@ -405,7 +393,7 @@ void SpriteFrameCache::removeSpriteFramesFromTexture(Texture2D* texture)
|
|||
_spriteFrames->removeObjectsForKeys(keysToRemove);
|
||||
}
|
||||
|
||||
SpriteFrame* SpriteFrameCache::spriteFrameByName(const char *pszName)
|
||||
SpriteFrame* SpriteFrameCache::getSpriteFrameByName(const char *pszName)
|
||||
{
|
||||
SpriteFrame* frame = (SpriteFrame*)_spriteFrames->objectForKey(pszName);
|
||||
if (!frame)
|
||||
|
|
|
@ -57,17 +57,27 @@ class Sprite;
|
|||
*/
|
||||
class CC_DLL SpriteFrameCache : public Object
|
||||
{
|
||||
public:
|
||||
/** Returns the shared instance of the Sprite Frame cache */
|
||||
static SpriteFrameCache* getInstance(void);
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static SpriteFrameCache* sharedSpriteFrameCache() { return SpriteFrameCache::getInstance(); }
|
||||
|
||||
/** Destroys the cache. It releases all the Sprite Frames and the retained instance. */
|
||||
static void destroyInstance();
|
||||
|
||||
/** @deprecated Use destroyInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedSpriteFrameCache() { return SpriteFrameCache::destroyInstance(); }
|
||||
|
||||
protected:
|
||||
// MARMALADE: Made this protected not private, as deriving from this class is pretty useful
|
||||
SpriteFrameCache(void) : _spriteFrames(NULL), _spriteFramesAliases(NULL){}
|
||||
public:
|
||||
bool init(void);
|
||||
~SpriteFrameCache(void);
|
||||
SpriteFrameCache() : _spriteFrames(NULL), _spriteFramesAliases(NULL){}
|
||||
|
||||
public:
|
||||
virtual ~SpriteFrameCache();
|
||||
bool init(void);
|
||||
|
||||
private:
|
||||
/*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
|
||||
*/
|
||||
void addSpriteFramesWithDictionary(Dictionary* pobDictionary, Texture2D *pobTexture);
|
||||
public:
|
||||
/** Adds multiple Sprite Frames from a plist file.
|
||||
* A texture will be loaded automatically. The texture name will composed by replacing the .plist suffix with .png
|
||||
|
@ -112,40 +122,31 @@ public:
|
|||
*/
|
||||
void removeSpriteFramesFromFile(const char* plist);
|
||||
|
||||
private:
|
||||
/** Removes multiple Sprite Frames from Dictionary.
|
||||
* @since v0.99.5
|
||||
*/
|
||||
void removeSpriteFramesFromDictionary(Dictionary* dictionary);
|
||||
public:
|
||||
/** Removes all Sprite Frames associated with the specified textures.
|
||||
* It is convenient to call this method when a specific texture needs to be removed.
|
||||
* @since v0.995.
|
||||
*/
|
||||
* It is convenient to call this method when a specific texture needs to be removed.
|
||||
* @since v0.995.
|
||||
*/
|
||||
void removeSpriteFramesFromTexture(Texture2D* texture);
|
||||
|
||||
/** Returns an Sprite Frame that was previously added.
|
||||
If the name is not found it will return nil.
|
||||
You should retain the returned copy if you are going to use it.
|
||||
*/
|
||||
SpriteFrame* spriteFrameByName(const char *pszName);
|
||||
SpriteFrame* getSpriteFrameByName(const char *name);
|
||||
|
||||
public:
|
||||
/** Returns the shared instance of the Sprite Frame cache */
|
||||
static SpriteFrameCache* getInstance(void);
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static SpriteFrameCache* sharedSpriteFrameCache(void);
|
||||
|
||||
/** Destroys the cache. It releases all the Sprite Frames and the retained instance. */
|
||||
static void destroyInstance();
|
||||
|
||||
/** @deprecated Use destroyInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedSpriteFrameCache(void);
|
||||
/** @deprecated use getSpriteFrameByName() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE SpriteFrame* spriteFrameByName(const char *name) { return getSpriteFrameByName(name); }
|
||||
|
||||
private:
|
||||
// MARMALADE: Made this protected not private, as deriving from this class is pretty useful
|
||||
// SpriteFrameCache(void) : _spriteFrames(NULL), _spriteFramesAliases(NULL){}
|
||||
/*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
|
||||
*/
|
||||
void addSpriteFramesWithDictionary(Dictionary* pobDictionary, Texture2D *pobTexture);
|
||||
|
||||
/** Removes multiple Sprite Frames from Dictionary.
|
||||
* @since v0.99.5
|
||||
*/
|
||||
void removeSpriteFramesFromDictionary(Dictionary* dictionary);
|
||||
|
||||
protected:
|
||||
Dictionary* _spriteFrames;
|
||||
Dictionary* _spriteFramesAliases;
|
||||
|
|
|
@ -55,36 +55,21 @@ To render the quads using an interleaved vertex array list, you should modify th
|
|||
*/
|
||||
class CC_DLL TextureAtlas : public Object
|
||||
{
|
||||
protected:
|
||||
GLushort* _indices;
|
||||
#if CC_TEXTURE_ATLAS_USE_VAO
|
||||
GLuint _VAOname;
|
||||
#endif
|
||||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||
bool _dirty; //indicates whether or not the array buffer of the VBO needs to be updated
|
||||
|
||||
|
||||
/** quantity of quads that are going to be drawn */
|
||||
CC_PROPERTY_READONLY(unsigned int, _totalQuads, TotalQuads)
|
||||
/** quantity of quads that can be stored with the current texture atlas size */
|
||||
CC_PROPERTY_READONLY(unsigned int, _capacity, Capacity)
|
||||
/** Texture of the texture atlas */
|
||||
CC_PROPERTY(Texture2D *, _texture, Texture)
|
||||
/** Quads that are going to be rendered */
|
||||
CC_PROPERTY(V3F_C4B_T2F_Quad *, _quads, Quads)
|
||||
|
||||
public:
|
||||
/** creates a TextureAtlas with an filename and with an initial capacity for Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
*/
|
||||
static TextureAtlas* create(const char* file , unsigned int capacity);
|
||||
|
||||
/** creates a TextureAtlas with a previously initialized Texture2D object, and
|
||||
* with an initial capacity for n Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
*/
|
||||
static TextureAtlas* createWithTexture(Texture2D *texture, unsigned int capacity);
|
||||
|
||||
TextureAtlas();
|
||||
virtual ~TextureAtlas();
|
||||
|
||||
const char* description() const;
|
||||
|
||||
/** creates a TextureAtlas with an filename and with an initial capacity for Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
*/
|
||||
static TextureAtlas* create(const char* file , unsigned int capacity);
|
||||
|
||||
/** initializes a TextureAtlas with a filename and with a certain capacity for Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
*
|
||||
|
@ -92,13 +77,6 @@ public:
|
|||
*/
|
||||
bool initWithFile(const char* file, unsigned int capacity);
|
||||
|
||||
/** creates a TextureAtlas with a previously initialized Texture2D object, and
|
||||
* with an initial capacity for n Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
*/
|
||||
static TextureAtlas* createWithTexture(Texture2D *texture, unsigned int capacity);
|
||||
|
||||
|
||||
/** initializes a TextureAtlas with a previously initialized Texture2D object, and
|
||||
* with an initial capacity for Quads.
|
||||
* The TextureAtlas capacity can be increased in runtime.
|
||||
|
@ -149,7 +127,6 @@ public:
|
|||
*/
|
||||
void removeAllQuads();
|
||||
|
||||
|
||||
/** resize the capacity of the TextureAtlas.
|
||||
* The new capacity can be lower or higher than the current one
|
||||
* It returns YES if the resize was successful.
|
||||
|
@ -208,6 +185,8 @@ public:
|
|||
/** specify if the array buffer of the VBO needs to be updated */
|
||||
inline void setDirty(bool bDirty) { _dirty = bDirty; }
|
||||
|
||||
const char* description() const;
|
||||
|
||||
private:
|
||||
void setupIndices();
|
||||
void mapBuffers();
|
||||
|
@ -216,6 +195,24 @@ private:
|
|||
#else
|
||||
void setupVBO();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
GLushort* _indices;
|
||||
#if CC_TEXTURE_ATLAS_USE_VAO
|
||||
GLuint _VAOname;
|
||||
#endif
|
||||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||
bool _dirty; //indicates whether or not the array buffer of the VBO needs to be updated
|
||||
|
||||
|
||||
/** quantity of quads that are going to be drawn */
|
||||
CC_PROPERTY_READONLY(unsigned int, _totalQuads, TotalQuads)
|
||||
/** quantity of quads that can be stored with the current texture atlas size */
|
||||
CC_PROPERTY_READONLY(unsigned int, _capacity, Capacity)
|
||||
/** Texture of the texture atlas */
|
||||
CC_PROPERTY(Texture2D *, _texture, Texture)
|
||||
/** Quads that are going to be rendered */
|
||||
CC_PROPERTY(V3F_C4B_T2F_Quad *, _quads, Quads)
|
||||
};
|
||||
|
||||
// end of textures group
|
||||
|
|
|
@ -54,12 +54,6 @@ NS_CC_BEGIN
|
|||
|
||||
TextureCache* TextureCache::_sharedTextureCache = nullptr;
|
||||
|
||||
// XXX: deprecated
|
||||
TextureCache * TextureCache::sharedTextureCache()
|
||||
{
|
||||
return TextureCache::getInstance();
|
||||
}
|
||||
|
||||
TextureCache * TextureCache::getInstance()
|
||||
{
|
||||
if (!_sharedTextureCache)
|
||||
|
@ -104,12 +98,6 @@ void TextureCache::destroyInstance()
|
|||
CC_SAFE_RELEASE_NULL(_sharedTextureCache);
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
void TextureCache::purgeSharedTextureCache()
|
||||
{
|
||||
TextureCache::destroyInstance();
|
||||
}
|
||||
|
||||
const char* TextureCache::description() const
|
||||
{
|
||||
return String::createWithFormat("<TextureCache | Number of textures = %u>", _textures->count())->getCString();
|
||||
|
|
|
@ -61,16 +61,16 @@ public:
|
|||
/** Returns the shared instance of the cache */
|
||||
static TextureCache * getInstance();
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static TextureCache * sharedTextureCache() { return TextureCache::getInstance(); }
|
||||
|
||||
/** purges the cache. It releases the retained instance.
|
||||
@since v0.99.0
|
||||
*/
|
||||
static void destroyInstance();
|
||||
|
||||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static TextureCache * sharedTextureCache();
|
||||
|
||||
/** @deprecated Use destroyInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedTextureCache();
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedTextureCache() { return TextureCache::destroyInstance(); }
|
||||
|
||||
/** Reload all textures
|
||||
It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1
|
||||
|
|
|
@ -90,33 +90,33 @@ enum {
|
|||
class TexturePVR : public Object
|
||||
{
|
||||
public:
|
||||
/** creates and initializes a TexturePVR with a path */
|
||||
static TexturePVR* create(const char* path);
|
||||
|
||||
TexturePVR();
|
||||
virtual ~TexturePVR();
|
||||
|
||||
/** initializes a TexturePVR with a path */
|
||||
bool initWithContentsOfFile(const char* path);
|
||||
|
||||
/** creates and initializes a TexturePVR with a path */
|
||||
static TexturePVR* create(const char* path);
|
||||
|
||||
// properties
|
||||
// properties
|
||||
|
||||
/** texture id name */
|
||||
inline unsigned int getName() { return _name; }
|
||||
inline unsigned int getName() const { return _name; }
|
||||
/** texture width */
|
||||
inline unsigned int getWidth() { return _width; }
|
||||
inline unsigned int getWidth() const { return _width; }
|
||||
/** texture height */
|
||||
inline unsigned int getHeight() { return _height; }
|
||||
inline unsigned int getHeight() const { return _height; }
|
||||
/** whether or not the texture has alpha */
|
||||
inline bool hasAlpha() { return _hasAlpha; }
|
||||
inline bool hasAlpha() const { return _hasAlpha; }
|
||||
/** whether or not the texture has premultiplied alpha */
|
||||
inline bool hasPremultipliedAlpha() { return _hasPremultipliedAlpha; }
|
||||
inline bool hasPremultipliedAlpha() const { return _hasPremultipliedAlpha; }
|
||||
/** whether or not the texture should use hasPremultipliedAlpha instead of global default */
|
||||
inline bool isForcePremultipliedAlpha() { return _forcePremultipliedAlpha; }
|
||||
inline bool isForcePremultipliedAlpha() const { return _forcePremultipliedAlpha; }
|
||||
/** how many mipmaps the texture has. 1 means one level (level 0 */
|
||||
inline unsigned int getNumberOfMipmaps() { return _numberOfMipmaps; }
|
||||
inline Texture2DPixelFormat getFormat() { return _format; }
|
||||
inline bool isRetainName() { return _retainName; }
|
||||
inline unsigned int getNumberOfMipmaps() const { return _numberOfMipmaps; }
|
||||
inline Texture2DPixelFormat getFormat() const { return _format; }
|
||||
inline bool isRetainName() const { return _retainName; }
|
||||
inline void setRetainName(bool retainName) { _retainName = retainName; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -94,7 +94,7 @@ void SpriteFrameCacheHelper::addSpriteFrameFromDict(Dictionary *dictionary, Text
|
|||
|
||||
//CCLog("spriteFrameName : %s, imagePath : %s", spriteFrameName.c_str(), _imagePath);
|
||||
|
||||
SpriteFrame *spriteFrame = (SpriteFrame *)SpriteFrameCache::getInstance()->spriteFrameByName(spriteFrameName.c_str());
|
||||
SpriteFrame *spriteFrame = (SpriteFrame *)SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName.c_str());
|
||||
if (spriteFrame)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -129,102 +129,96 @@ private:
|
|||
|
||||
class CCBSetSpriteFrame : public ActionInstant
|
||||
{
|
||||
private:
|
||||
SpriteFrame *mSpriteFrame;
|
||||
|
||||
public:
|
||||
~CCBSetSpriteFrame();
|
||||
|
||||
/** creates a Place action with a position */
|
||||
static CCBSetSpriteFrame* create(SpriteFrame *pSpriteFrame);
|
||||
|
||||
~CCBSetSpriteFrame();
|
||||
|
||||
bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBSetSpriteFrame* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBSetSpriteFrame* reverse() const;
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual CCBSetSpriteFrame* clone() const override;
|
||||
virtual CCBSetSpriteFrame* reverse() const override;
|
||||
|
||||
private:
|
||||
SpriteFrame *mSpriteFrame;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CCBSoundEffect : public ActionInstant
|
||||
{
|
||||
private:
|
||||
std::string mSoundFile;
|
||||
float mPitch, mPan, mGain;
|
||||
|
||||
public:
|
||||
~CCBSoundEffect();
|
||||
|
||||
static CCBSoundEffect* actionWithSoundFile(const std::string &file, float pitch, float pan, float gain);
|
||||
~CCBSoundEffect();
|
||||
bool initWithSoundFile(const std::string &file, float pitch, float pan, float gain);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBSoundEffect* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBSoundEffect* reverse() const;
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual CCBSoundEffect* clone() const override;
|
||||
virtual CCBSoundEffect* reverse() const override;
|
||||
|
||||
private:
|
||||
std::string mSoundFile;
|
||||
float mPitch, mPan, mGain;
|
||||
};
|
||||
|
||||
|
||||
class CCBRotateTo : public ActionInterval
|
||||
{
|
||||
private:
|
||||
float mStartAngle;
|
||||
float mDstAngle;
|
||||
float mDiffAngle;
|
||||
|
||||
public:
|
||||
static CCBRotateTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateTo* reverse() const;
|
||||
// Override
|
||||
virtual void update(float time) override;
|
||||
virtual CCBRotateTo* clone() const override;
|
||||
virtual CCBRotateTo* reverse() const override;
|
||||
virtual void startWithTarget(Node *pNode) override;
|
||||
|
||||
virtual void startWithTarget(Node *pNode);
|
||||
};
|
||||
|
||||
|
||||
class CCBRotateXTo: public ActionInterval {
|
||||
private:
|
||||
float mStartAngle;
|
||||
float mDstAngle;
|
||||
float mDiffAngle;
|
||||
};
|
||||
|
||||
|
||||
class CCBRotateXTo: public ActionInterval
|
||||
{
|
||||
public:
|
||||
static CCBRotateXTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void startWithTarget(Node *pNode);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateXTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateXTo* reverse() const;
|
||||
// Overrides
|
||||
virtual void startWithTarget(Node *pNode) override;
|
||||
virtual CCBRotateXTo* clone() const override;
|
||||
virtual CCBRotateXTo* reverse() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
};
|
||||
|
||||
|
||||
class CCBRotateYTo: public ActionInterval {
|
||||
private:
|
||||
float mStartAngle;
|
||||
float mDstAngle;
|
||||
float mDiffAngle;
|
||||
};
|
||||
|
||||
|
||||
class CCBRotateYTo: public ActionInterval
|
||||
{
|
||||
public:
|
||||
static CCBRotateYTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void startWithTarget(Node *pNode);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateYTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateYTo* reverse() const;
|
||||
// Override
|
||||
virtual void startWithTarget(Node *pNode) override;
|
||||
virtual CCBRotateYTo* clone() const override;
|
||||
virtual CCBRotateYTo* reverse() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
virtual void update(float time);
|
||||
private:
|
||||
float mStartAngle;
|
||||
float mDstAngle;
|
||||
float mDiffAngle;
|
||||
};
|
||||
|
||||
|
||||
|
@ -233,13 +227,9 @@ class CCBEaseInstant : public ActionEase
|
|||
public:
|
||||
static CCBEaseInstant* create(ActionInterval *pAction);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBEaseInstant* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBEaseInstant* reverse() const;
|
||||
|
||||
virtual void update(float dt);
|
||||
virtual CCBEaseInstant* clone() const override;
|
||||
virtual CCBEaseInstant* reverse() const override;
|
||||
virtual void update(float dt) override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -835,7 +835,7 @@ CCBKeyframe* CCBReader::readKeyframe(int type)
|
|||
mLoadedSpriteSheets.insert(spriteSheet);
|
||||
}
|
||||
|
||||
spriteFrame = frameCache->spriteFrameByName(spriteFile.c_str());
|
||||
spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str());
|
||||
}
|
||||
value = spriteFrame;
|
||||
}
|
||||
|
|
|
@ -581,7 +581,7 @@ SpriteFrame * NodeLoader::parsePropTypeSpriteFrame(Node * pNode, Node * pParent,
|
|||
pCCBReader->getLoadedSpriteSheet().insert(spriteSheet);
|
||||
}
|
||||
|
||||
spriteFrame = frameCache->spriteFrameByName(spriteFile.c_str());
|
||||
spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str());
|
||||
}
|
||||
|
||||
if (pCCBReader->getAnimatedProperties()->find(pPropertyName) != pCCBReader->getAnimatedProperties()->end())
|
||||
|
|
|
@ -572,7 +572,7 @@ bool Scale9Sprite::initWithSpriteFrameName(const char* spriteFrameName, Rect cap
|
|||
{
|
||||
CCAssert((SpriteFrameCache::getInstance()) != NULL, "SpriteFrameCache::getInstance() must be non-NULL");
|
||||
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->spriteFrameByName(spriteFrameName);
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
CCAssert(frame != NULL, "CCSpriteFrame must be non-NULL");
|
||||
|
||||
if (NULL == frame) return false;
|
||||
|
|
|
@ -372,7 +372,7 @@ TextLayer::TextLayer(void)
|
|||
void TextLayer::checkAnim(float dt)
|
||||
{
|
||||
Node* s2 = getChildByTag(kTagBackground);
|
||||
if ( s2->numberOfRunningActions() == 0 && s2->getGrid() != NULL)
|
||||
if ( s2->getNumberOfRunningActions() == 0 && s2->getGrid() != NULL)
|
||||
s2->setGrid(NULL);;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
963dd3732308b99e5251cb07db6e2260d3574e29
|
||||
8f4752ee80237d7086bb7f6e3ca19f1c5caf6a12
|
|
@ -110,7 +110,7 @@ void ZwoptexGenericTest::onEnter()
|
|||
layer1->setPosition(Point(s.width/2-80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
|
||||
addChild(layer1);
|
||||
|
||||
sprite1 = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->spriteFrameByName("grossini_dance_01.png"));
|
||||
sprite1 = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("grossini_dance_01.png"));
|
||||
sprite1->setPosition(Point( s.width/2-80, s.height/2));
|
||||
addChild(sprite1);
|
||||
|
||||
|
@ -121,7 +121,7 @@ void ZwoptexGenericTest::onEnter()
|
|||
layer2->setPosition(Point(s.width/2+80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
|
||||
addChild(layer2);
|
||||
|
||||
sprite2 = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->spriteFrameByName("grossini_dance_generic_01.png"));
|
||||
sprite2 = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("grossini_dance_generic_01.png"));
|
||||
sprite2->setPosition(Point( s.width/2 + 80, s.height/2));
|
||||
addChild(sprite2);
|
||||
|
||||
|
@ -185,8 +185,8 @@ void ZwoptexGenericTest::flipSprites(float dt)
|
|||
char str2[32] = {0};
|
||||
sprintf(str1, "grossini_dance_%02d.png", spriteFrameIndex);
|
||||
sprintf(str2, "grossini_dance_generic_%02d.png", spriteFrameIndex);
|
||||
sprite1->setDisplayFrame(SpriteFrameCache::getInstance()->spriteFrameByName(str1));
|
||||
sprite2->setDisplayFrame(SpriteFrameCache::getInstance()->spriteFrameByName(str2));
|
||||
sprite1->setDisplayFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str1));
|
||||
sprite2->setDisplayFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str2));
|
||||
}
|
||||
|
||||
ZwoptexGenericTest::~ZwoptexGenericTest()
|
||||
|
|
Loading…
Reference in New Issue