Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F135229
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
(
const
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
Fri, Jun 26, 1:47 AM (3 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
73048
Default Alt Text
banner.cpp (1 KB)
Attached To
Mode
R82 deerportal
Attached
Detach File
Event Timeline