ManaPlus
src
gui
fonts
textchunksmall.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2011-2019 The ManaPlus Developers
4
* Copyright (C) 2019-2021 Andrei Karas
5
*
6
* This file is part of The ManaPlus Client.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#include "
gui/fonts/textchunksmall.h
"
23
24
#include "
gui/fonts/font.h
"
25
26
#include "
debug.h
"
27
28
TextChunkSmall::TextChunkSmall
(
const
std::string &text0,
29
const
Color
&color0,
30
const
Color
&color1) :
31
text(text0),
32
color(color0),
33
color2(color1)
34
{
35
}
36
37
TextChunkSmall::TextChunkSmall
(
const
TextChunkSmall
&old) :
38
text(old.text),
39
color(old.color),
40
color2(old.color2)
41
{
42
}
43
44
TextChunkSmall
&
TextChunkSmall::operator=
(
const
TextChunkSmall
&chunk)
45
{
46
text
= chunk.
text
;
47
color
= chunk.
color
;
48
color2
= chunk.
color2
;
49
return
*
this
;
50
}
51
52
bool
TextChunkSmall::operator==
(
const
TextChunkSmall
&chunk)
const
53
{
54
return
chunk.
text
==
text
&&
55
chunk.
color
==
color
&&
56
chunk.
color2
==
color2
;
57
}
58
59
bool
TextChunkSmall::operator<
(
const
TextChunkSmall
&chunk)
const
60
{
61
if
(chunk.
text
!=
text
)
62
return
chunk.
text
>
text
;
63
64
const
Color
&
restrict
c = chunk.
color
;
65
if
(c.r !=
color
.
r
)
66
return
c.
r
>
color
.
r
;
67
if
(c.g !=
color
.
g
)
68
return
c.g >
color
.
g
;
69
if
(c.b !=
color
.
b
)
70
return
c.b >
color
.
b
;
71
72
const
Color
&
restrict
c2 = chunk.
color2
;
73
if
(c2.r !=
color2
.
r
)
74
return
c2.
r
>
color2
.
r
;
75
if
(c2.g !=
color2
.
g
)
76
return
c2.g >
color2
.
g
;
77
if
(c2.b !=
color2
.
b
)
78
return
c2.b >
color2
.
b
;
79
80
if
(c.a !=
color
.
a
&&
Font::mSoftMode
)
81
return
c.a >
color
.
a
;
82
83
return
false
;
84
}
Color
Definition:
color.h:76
Color::a
unsigned int a
Definition:
color.h:251
Color::b
unsigned int b
Definition:
color.h:245
Color::r
unsigned int r
Definition:
color.h:235
Color::g
unsigned int g
Definition:
color.h:240
Font::mSoftMode
static bool mSoftMode
Definition:
font.h:140
TextChunkSmall
Definition:
textchunksmall.h:32
TextChunkSmall::TextChunkSmall
TextChunkSmall(const std::string &text0, const Color &color0, const Color &color1)
Definition:
textchunksmall.cpp:28
TextChunkSmall::color2
Color color2
Definition:
textchunksmall.h:48
TextChunkSmall::operator==
bool operator==(const TextChunkSmall &chunk) const
Definition:
textchunksmall.cpp:52
TextChunkSmall::operator=
TextChunkSmall & operator=(const TextChunkSmall &chunk)
Definition:
textchunksmall.cpp:44
TextChunkSmall::text
std::string text
Definition:
textchunksmall.h:46
TextChunkSmall::color
Color color
Definition:
textchunksmall.h:47
TextChunkSmall::operator<
bool operator<(const TextChunkSmall &chunk) const
Definition:
textchunksmall.cpp:59
debug.h
font.h
restrict
#define restrict
Definition:
localconsts.h:165
textchunksmall.h
Generated on Wed Mar 17 2021 19:19:06 for ManaPlus by
1.9.1