HoverRace  2.0
SdlKeycapIconView.h
Go to the documentation of this file.
1 
2 // SdlKeycapIconView.h
3 //
4 // Copyright (c) 2014, 2016 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 "SdlDisplay.h"
25 #include "SdlTexture.h"
26 #include "SdlView.h"
27 
28 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
29 # ifdef MR_ENGINE
30 # define MR_DllDeclare __declspec( dllexport )
31 # else
32 # define MR_DllDeclare __declspec( dllimport )
33 # endif
34 #else
35 # define MR_DllDeclare
36 #endif
37 
38 namespace HoverRace {
39  namespace Display {
40  class KeycapIcon;
41  }
42 }
43 struct SDL_Surface;
44 
45 namespace HoverRace {
46 namespace Display {
47 namespace SDL {
48 
53 class MR_DllDeclare SdlKeycapIconView : public SdlView<KeycapIcon>
54 {
56 
57 public:
59  virtual ~SdlKeycapIconView();
60 
61 public:
62  void OnModelUpdate(int prop) override;
63 
64 public:
65  Vec3 Measure() override;
66  void PrepareRender() override;
67  void Render() override;
68 
69 private:
70  void UpdateTexture();
71  void UpdateTextureColor();
72 
73 private:
74  std::unique_ptr<SdlTexture> texture;
76  int width;
77  int height;
78  int realWidth;
80  double unscaledWidth;
82  boost::signals2::scoped_connection uiScaleChangedConnection;
83 };
84 
85 } // namespace SDL
86 } // namespace Display
87 } // namespace HoverRace
88 
89 #undef MR_DllDeclare
bool colorChanged
Definition: SdlKeycapIconView.h:75
#define MR_DllDeclare
Definition: SdlKeycapIconView.h:35
SDL view for KeycapIcon.
Definition: SdlKeycapIconView.h:53
Icon for a keycap (keyboard key or gamepad button(.
Definition: KeycapIcon.h:43
int realHeight
Definition: SdlKeycapIconView.h:79
boost::signals2::scoped_connection uiScaleChangedConnection
Definition: SdlKeycapIconView.h:82
int height
Definition: SdlKeycapIconView.h:77
int width
Definition: SdlKeycapIconView.h:76
Definition: Announcement.h:24
std::unique_ptr< SdlTexture > texture
Definition: SdlKeycapIconView.h:74
Definition: Vec.h:114
double unscaledHeight
Definition: SdlKeycapIconView.h:81
Base class for views that use SDL for rendering.
Definition: SdlView.h:54
int realWidth
Definition: SdlKeycapIconView.h:78
SDL-based software rendering.
Definition: SdlDisplay.h:60
double unscaledWidth
Definition: SdlKeycapIconView.h:80