Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F145217
banner.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
banner.cpp
View Options
#include
"banner.h"
Banner
::
Banner
(
sf
::
Font
*
gameFont
)
:
active
(
false
),
textStr
(
""
),
timeDownCounter
(
0
)
{
text
.
setFont
(
*
gameFont
);
text
.
setCharacterSize
(
100
);
}
void
Banner
::
setText
(
std
::
string
newText
)
{
textStr
=
newText
;
text
.
setString
(
textStr
);
active
=
true
;
timeDownCounter
=
1.5
;
// 204,76
// 840, 718
// In [1]: 840 - 204
// Out[1]: 636
// In [2]: 718 - 76
// Out[2]: 642
// In [3]:
sf
::
FloatRect
rectTxt
=
text
.
getLocalBounds
();
text
.
setPosition
(((
636
/
2
)
-
(
rectTxt
.
width
/
2
))
+
204
,((
642
/
2
)
-
(
rectTxt
.
height
/
2
))
+
20
);
}
void
Banner
::
update
(
sf
::
Time
frameTime
)
{
if
(
active
){
if
(
timeDownCounter
>
0
){
timeDownCounter
-=
frameTime
.
asSeconds
();
}
if
(
timeDownCounter
<=
0
){
active
=
false
;
setText
(
""
);
}
}
}
void
Banner
::
draw
(
sf
::
RenderTarget
&
target
,
sf
::
RenderStates
states
)
const
{
states
.
transform
*=
getTransform
();
target
.
draw
(
text
,
states
);
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Aug 16, 7:13 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
77390
Default Alt Text
banner.cpp (1 KB)
Attached To
Mode
R82 deerportal
Attached
Detach File
Event Timeline