HoverRace  2.0
SdlActiveTextView.h
Go to the documentation of this file.
1 
2 // SdlActiveTextView.h
3 //
4 // Copyright (c) 2015 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 "../TypeCase.h"
25 
26 #include "SdlDisplay.h"
27 #include "SdlView.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 ActiveText;
42  }
43 }
44 
45 namespace HoverRace {
46 namespace Display {
47 namespace SDL {
48 
49 class MR_DllDeclare SdlActiveTextView : public SdlView<ActiveText>
50 {
52 
53 public:
55  virtual ~SdlActiveTextView();
56 
57 public:
58  void OnModelUpdate(int prop) override;
59 
60 public:
61  Vec3 Measure() override;
62  void PrepareRender() override;
63  void Render() override;
64 
65 private:
66  void OnUiScaleChanged();
67  void UpdateTexture();
68 
69 private:
70  std::shared_ptr<TypeCase> typeCase;
73  int width;
74  int height;
75  double unscaledWidth;
77  boost::signals2::scoped_connection uiScaleChangedConnection;
78 };
79 
80 } // namespace SDL
81 } // namespace Display
82 } // namespace HoverRace
83 
84 #undef MR_DllDeclare
double unscaledHeight
Definition: SdlActiveTextView.h:76
double unscaledWidth
Definition: SdlActiveTextView.h:75
Definition: SdlActiveTextView.h:49
bool needsUpdate
Definition: SdlActiveTextView.h:72
TypeLine typeLine
Definition: SdlActiveTextView.h:71
#define MR_DllDeclare
Definition: SdlActiveTextView.h:36
boost::signals2::scoped_connection uiScaleChangedConnection
Definition: SdlActiveTextView.h:77
A line of text, prepared by a TypeCase.
Definition: TypeCase.h:156
int height
Definition: SdlActiveTextView.h:74
A text widget where the contents may change often (i.e., updated every few frames, or even every frame).
Definition: ActiveText.h:49
Definition: Announcement.h:24
Definition: Vec.h:114
std::shared_ptr< TypeCase > typeCase
Definition: SdlActiveTextView.h:70
Base class for views that use SDL for rendering.
Definition: SdlView.h:54
SDL-based software rendering.
Definition: SdlDisplay.h:60
int width
Definition: SdlActiveTextView.h:73