HoverRace  2.0
Wallpaper.h
Go to the documentation of this file.
1 
2 // Wallpaper.h
3 //
4 // Copyright (c) 2014 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "Color.h"
25 #include "Res.h"
26 
27 #include "Background.h"
28 
29 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
30 # ifdef MR_ENGINE
31 # define MR_DllDeclare __declspec( dllexport )
32 # else
33 # define MR_DllDeclare __declspec( dllimport )
34 # endif
35 #else
36 # define MR_DllDeclare
37 #endif
38 
39 namespace HoverRace {
40  namespace Display {
41  class Display;
42  class Texture;
43  }
44 }
45 
46 namespace HoverRace {
47 namespace Display {
48 
54 {
55  typedef Background SUPER;
56 
57  public:
58  struct Props
59  {
60  enum
61  {
62  FILL = SUPER::Props::NEXT_,
65  };
66  };
67 
68  enum class Fill
69  {
70  ZOOM,
71  STRETCH,
72  };
73 
74  public:
75  Wallpaper(std::shared_ptr<Res<Texture>> texture,
76  Fill fill = Fill::ZOOM, double opacity = 1.0,
77  const Color color = COLOR_WHITE);
78  virtual ~Wallpaper();
79 
80  public:
81  virtual void AttachView(Display &disp) { AttachViewDynamic(disp, this); }
82 
83  public:
84  Fill GetFill() const { return fill; }
85  void SetFill(Fill fill);
86 
87  const Color GetColor() const { return color; }
88  void SetColor(const Color color);
89 
90  std::shared_ptr<Res<Texture>> GetTexture() const { return texture; }
91 
92  private:
94  std::shared_ptr<Res<Texture>> texture;
96 };
97 
98 } // namespace Display
99 } // namespace HoverRace
100 
101 #undef MR_DllDeclare
Definition: Color.h:40
Definition: Wallpaper.h:58
First index for subclasses.
Definition: Wallpaper.h:64
Paints a texture across the entire screen.
Definition: Wallpaper.h:53
Fill
Definition: Wallpaper.h:68
Fill fill
Definition: Wallpaper.h:93
Base class for loadable textures.
Definition: Res.h:94
constexpr Color COLOR_WHITE
Definition: Color.h:64
const Color GetColor() const
Definition: Wallpaper.h:87
std::shared_ptr< Res< Texture > > texture
Definition: Wallpaper.h:94
virtual void AttachView(Display &disp)
Definition: Wallpaper.h:81
Base class for views that fill the entire screen.
Definition: Background.h:43
std::shared_ptr< Res< Texture > > GetTexture() const
Definition: Wallpaper.h:90
Base class for display managers.
Definition: Display.h:73
Color color
Definition: Wallpaper.h:95
Fill GetFill() const
Definition: Wallpaper.h:84
Definition: Announcement.h:24
#define MR_DllDeclare
Definition: Wallpaper.h:36
Background SUPER
Definition: Wallpaper.h:55