HoverRace
2.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
engine
Display
Picture.h
Go to the documentation of this file.
1
2
// Picture.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 "
Res.h
"
25
26
#include "
Box.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
Display;
41
class
Texture;
42
}
43
}
44
45
namespace
HoverRace
{
46
namespace
Display {
47
52
class
MR_DllDeclare
Picture
:
public
Box
53
{
54
using
SUPER
=
Box
;
55
56
public
:
57
struct
Props
58
{
59
enum
60
{
61
TEXTURE = SUPER::Props::NEXT_,
62
COLOR
,
63
NEXT_
,
64
};
65
};
66
67
public
:
68
Picture
(std::shared_ptr<
Res<Texture>
> texture,
69
const
Vec2
&size,
const
Color
color =
COLOR_WHITE
,
70
uiLayoutFlags_t
layoutFlags = 0);
71
Picture
(std::shared_ptr<
Res<Texture>
> texture,
72
double
w,
double
h,
const
Color
color =
COLOR_WHITE
,
73
uiLayoutFlags_t
layoutFlags = 0);
74
virtual
~Picture
() { }
75
76
public
:
77
virtual
void
AttachView
(
Display
&disp) { AttachViewDynamic(disp,
this
); }
78
79
public
:
80
81
std::shared_ptr<Res<Texture>>
ShareTexture
()
const
{
return
texture; }
82
void
SetTexture(std::shared_ptr<
Res<Texture>
> texture);
83
84
const
Color
GetColor
()
const
{
return
color; }
85
void
SetColor(
const
Color
color);
86
87
private
:
88
std::shared_ptr<Res<Texture>>
texture
;
89
Color
color
;
90
};
91
92
}
// namespace Display
93
}
// namespace HoverRace
94
95
#undef MR_DllDeclare
HoverRace::Display::Picture
Draws a single texture.
Definition:
Picture.h:52
HoverRace::Display::Color
Definition:
Color.h:40
HoverRace::Display::Picture::texture
std::shared_ptr< Res< Texture > > texture
Definition:
Picture.h:88
HoverRace::Display::UiViewModel
Base class for UI (2D) components.
Definition:
UiViewModel.h:56
HoverRace::Display::Res< Texture >
Base class for loadable textures.
Definition:
Res.h:94
HoverRace::Display::COLOR_WHITE
constexpr Color COLOR_WHITE
Definition:
Color.h:64
HoverRace::Display::Box
Base class for low-level bounded widgets.
Definition:
Box.h:51
Res.h
HoverRace::Display::Picture::Props::NEXT_
First index for subclasses.
Definition:
Picture.h:63
HoverRace::Vec2
Definition:
Vec.h:38
HoverRace::Display::uiLayoutFlags_t
MR_UInt32 uiLayoutFlags_t
Definition:
UiLayoutFlags.h:53
HoverRace::Display::Picture::Props::COLOR
Definition:
Picture.h:62
HoverRace::Display::Display
Base class for display managers.
Definition:
Display.h:73
HoverRace::Display::Picture::color
Color color
Definition:
Picture.h:89
HoverRace::Display::Picture::GetColor
const Color GetColor() const
Definition:
Picture.h:84
HoverRace::Display::Picture::ShareTexture
std::shared_ptr< Res< Texture > > ShareTexture() const
Definition:
Picture.h:81
HoverRace
Definition:
Announcement.h:24
Box.h
HoverRace::Display::Picture::~Picture
virtual ~Picture()
Definition:
Picture.h:74
HoverRace::Display::Picture::Props
Definition:
Picture.h:57
MR_DllDeclare
#define MR_DllDeclare
Definition:
Picture.h:35
HoverRace::Display::Picture::AttachView
virtual void AttachView(Display &disp)
Definition:
Picture.h:77
1.8.11