HoverRace  2.0
SdlLabelView.h
Go to the documentation of this file.
1 
2 // SdlLabelView.h
3 //
4 // Copyright (c) 2013, 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 "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 Label;
41  }
42 }
43 
44 namespace HoverRace {
45 namespace Display {
46 namespace SDL {
47 
48 class MR_DllDeclare SdlLabelView : public SdlView<Label>
49 {
51 
52 public:
53  SdlLabelView(SdlDisplay &disp, Label &model);
54  virtual ~SdlLabelView();
55 
56 public:
57  void OnModelUpdate(int prop) override;
58 
59 public:
60  Vec3 Measure() override;
61  void PrepareRender() override;
62  void Render() override;
63 
64 private:
65  void UpdateBlank();
66  void UpdateTexture();
67  void UpdateTextureColor();
68 
69 private:
70  std::unique_ptr<SdlTexture> texture;
72  int width;
73  int height;
74  int realWidth;
76  double unscaledWidth;
78  boost::signals2::scoped_connection uiScaleChangedConnection;
79 };
80 
81 } // namespace SDL
82 } // namespace Display
83 } // namespace HoverRace
84 
85 #undef MR_DllDeclare
double unscaledWidth
Definition: SdlLabelView.h:76
Definition: SdlLabelView.h:48
int realHeight
Definition: SdlLabelView.h:75
A static text label.
Definition: Label.h:51
int width
Definition: SdlLabelView.h:72
bool colorChanged
Definition: SdlLabelView.h:71
std::unique_ptr< SdlTexture > texture
Definition: SdlLabelView.h:70
boost::signals2::scoped_connection uiScaleChangedConnection
Definition: SdlLabelView.h:78
Definition: Announcement.h:24
double unscaledHeight
Definition: SdlLabelView.h:77
int realWidth
Definition: SdlLabelView.h:74
Definition: Vec.h:114
int height
Definition: SdlLabelView.h:73
#define MR_DllDeclare
Definition: SdlLabelView.h:35
Base class for views that use SDL for rendering.
Definition: SdlView.h:54
SDL-based software rendering.
Definition: SdlDisplay.h:60