Welcome to mirror list, hosted at ThFree Co, Russian Federation.

controller.hpp « anim - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4326624dcd594a32c2ae2b04caa3ac0216ddd23e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once

#include "std/shared_ptr.hpp"

#include "base/thread.hpp"
#include "base/threaded_list.hpp"

namespace anim
{
  class Task;

  // Animation controller class.
  class Controller
  {
  private:

    typedef shared_ptr<Task> TTaskPtr;
    // Container for tasks
    typedef list<TTaskPtr> TTasks;

    ThreadedList<TTaskPtr> m_tasks;
    // Task for the current step.
    TTasks m_tasksList;

    int m_LockCount = 0;
    bool m_hasVisualTasks = false;

  public:

    struct Guard
    {
      Controller * m_controller;
      Guard(Controller * controller);
      ~Guard();
    };

    // Adding animation task to the controller
    void AddTask(TTaskPtr const & task);
    // Do we have animation tasks, which are currently running?
    bool HasTasks();
    // Do we have visual animation tasks, which are currently running?
    bool HasVisualTasks();
    // Lock/Unlock controller. Locked controller
    // is considered to be in "transition" mode from one task to another
    // and this situation is taken into account into RenderPolicy when
    // checking for "need redraw" status.
    void Lock();
    void Unlock();
    // Getting current lock count
    int LockCount();
    // Perform single animation step
    void PerformStep();
    // Getting current simulation time
    double GetCurrentTime() const;
  };
}