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

render_policy.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed9cdb3db604c266918b47ba71eca1772e071f52 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once

#include "../yg/color.hpp"

#include "../std/function.hpp"
#include "../std/shared_ptr.hpp"

#include "../geometry/rect2d.hpp"

class PaintEvent;
class ScreenBase;

namespace yg
{
  namespace gl
  {
    class RenderContext;
  }

  class ResourceManager;
}

class WindowHandle;

class RenderPolicy
{
public:

  typedef function<void(shared_ptr<PaintEvent>, ScreenBase const &, m2::RectD const &, m2::RectD const &, int)> TRenderFn;

private:

  yg::Color m_bgColor;
  shared_ptr<yg::ResourceManager> m_resourceManager;
  shared_ptr<WindowHandle> m_windowHandle;
  TRenderFn m_renderFn;

protected:

  yg::Color const & bgColor() const;
  shared_ptr<yg::ResourceManager> const & resourceManager() const;
  shared_ptr<WindowHandle> const & windowHandle() const;
  TRenderFn renderFn() const;

public:

  /// constructor
  RenderPolicy(shared_ptr<WindowHandle> const & windowHandle, TRenderFn const & renderFn);
  virtual ~RenderPolicy() {}
  /// starting frame
  virtual void BeginFrame(shared_ptr<PaintEvent> const & e, ScreenBase const & s);
  /// drawing single frame
  virtual void DrawFrame(shared_ptr<PaintEvent> const & e, ScreenBase const & s) = 0;
  /// ending frame
  virtual void EndFrame(shared_ptr<PaintEvent> const & e, ScreenBase const & s);
  /// processing resize request
  virtual m2::RectI const OnSize(int w, int h);
  /// initialize render policy
  virtual void Initialize(shared_ptr<yg::gl::RenderContext> const & primaryContext,
                          shared_ptr<yg::ResourceManager> const & resourceManager) = 0;

  /// reacting on navigation actions
  /// @{
  virtual void StartDrag(m2::PointD const & pt, double timeInSec);
  virtual void DoDrag(m2::PointD const & pt, double timeInSec);
  virtual void StopDrag(m2::PointD const & pt, double timeInSec);

  virtual void StartScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec);
  virtual void DoScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec);
  virtual void StopScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec);

  virtual void StartRotate(double a, double timeInSec);
  virtual void DoRotate(double a, double timeInSec);
  virtual void StopRotate(double a, double timeInSec);
  /// @}
};