ManaPlus
Public Member Functions | Static Public Member Functions | Static Private Attributes
DelayedManager Class Reference

#include <delayedmanager.h>

Public Member Functions

 DelayedManager ()
 

Static Public Member Functions

static void addDelayedAnimation (AnimationDelayLoad *const animation)
 
static void delayedLoad ()
 
static void removeDelayLoad (const AnimationDelayLoad *const delayedLoad)
 

Static Private Attributes

static DelayedAnim mDelayedAnimations
 

Detailed Description

A class for loading and managing resources.

Definition at line 37 of file delayedmanager.h.

Constructor & Destructor Documentation

◆ DelayedManager()

DelayedManager::DelayedManager ( )
inline

Definition at line 40 of file delayedmanager.h.

41  { }

Member Function Documentation

◆ addDelayedAnimation()

static void DelayedManager::addDelayedAnimation ( AnimationDelayLoad *const  animation)
inlinestatic

Definition at line 45 of file delayedmanager.h.

46  { mDelayedAnimations.push_back(animation); }
static DelayedAnim mDelayedAnimations

References mDelayedAnimations.

Referenced by AnimatedSprite::setDelayLoad().

◆ delayedLoad()

void DelayedManager::delayedLoad ( )
static

Definition at line 33 of file delayedmanager.cpp.

34 {
35  BLOCK_START("DelayedManager::delayedLoad")
36  static int loadTime = 0;
37  if (loadTime < cur_time)
38  {
39  loadTime = tick_time;
40 
41  int k = 0;
43  const DelayedAnimIter it_end = mDelayedAnimations.end();
44  while (it != it_end && k < 1)
45  {
46  (*it)->load();
47  AnimationDelayLoad *tmp = *it;
48  it = mDelayedAnimations.erase(it);
49  delete tmp;
50  k ++;
51  }
52  const int time2 = tick_time;
53  if (time2 > loadTime)
54  loadTime = time2 + (time2 - loadTime) * 2 + 10;
55  else
56  loadTime = time2 + 3;
57  }
58  BLOCK_END("DelayedManager::delayedLoad")
59 }
volatile time_t cur_time
Definition: timer.cpp:58
DelayedAnim::iterator DelayedAnimIter
if(!vert) return
volatile int tick_time
Definition: timer.cpp:53
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, cur_time, mDelayedAnimations, and tick_time.

Referenced by removeDelayLoad(), and Game::slowLogic().

◆ removeDelayLoad()

void DelayedManager::removeDelayLoad ( const AnimationDelayLoad *const  delayedLoad)
static

Definition at line 61 of file delayedmanager.cpp.

63 {
65  {
66  if (*it == delayedLoad)
67  {
68  mDelayedAnimations.erase(it);
69  return;
70  }
71  }
72 }
static void delayedLoad()
#define FOR_EACH(type, iter, array)
Definition: foreach.h:25

References delayedLoad(), FOR_EACH, and mDelayedAnimations.

Referenced by AnimatedSprite::setDelayLoad(), and AnimatedSprite::~AnimatedSprite().

Field Documentation

◆ mDelayedAnimations

DelayedAnim DelayedManager::mDelayedAnimations
staticprivate

Definition at line 55 of file delayedmanager.h.

Referenced by addDelayedAnimation(), delayedLoad(), and removeDelayLoad().


The documentation for this class was generated from the following files: