Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
[SOLVED]SFML text class not working
Print
Pages: [
1
]
Author
Topic: [SOLVED]SFML text class not working (Read 6314 times)
0 Members and 1 Guest are viewing this topic.
Atifhossain
Newbie
Posts: 5
[SOLVED]SFML text class not working
«
on:
March 14, 2013, 08:55:31 pm »
Here's the code
#include <SFML/Graphics.hpp>
int
main
(
)
{
sf
::
RenderWindow
App
(
sf
::
VideoMode
(
447
,
340
)
,
"SFML App"
)
;
sf
::
Text
text
(
"Hello"
)
;
while
(
App.
isOpen
(
)
)
{
sf
::
Event
Event
;
while
(
App.
pollEvent
(
Event
)
)
{
if
(
Event.
type
==
sf
::
Event
::
Closed
)
App.
close
(
)
;
App.
clear
(
)
;
App.
draw
(
text
)
;
App.
display
(
)
;
}
}
}
It says :
error : no matching function for call to 'sf::Text::Text(const char [6])'
«
Last Edit: March 15, 2013, 12:03:09 pm by Atifhossain
»
Logged
victorlevasseur
Full Member
Posts: 206
Re: SFML text class not working
«
Reply #1 on:
March 14, 2013, 08:59:20 pm »
Hello,
If you use a more recent version of SFML thant the 2.0RC, you have to set a font when you initialize the sf::Text because there is no default font anymore.
Logged
kimci86
Full Member
Posts: 128
Re: SFML text class not working
«
Reply #2 on:
March 14, 2013, 10:02:58 pm »
Hi,
It makes me notice that the documentation for sf::Text needs an update.
The usage example is outdated.
See this line.
Logged
Nexus
SFML Team
Hero Member
Posts: 6287
Thor Developer
Re: SFML text class not working
«
Reply #3 on:
March 14, 2013, 10:50:16 pm »
Yes, and the
explicit
isn't necessary anymore
Something I already thought about, is whether using the
explicit
keyword always (except for copy/move constructors) would be worth a try. It might at least help against changing constructor APIs where adapting
explicit
always is forgotten...
Logged
Zloxx II
: action platformer
Thor Library
: particle systems, animations, dot products, ...
SFML Game Development
:
Laurent
Administrator
Hero Member
Posts: 32498
Re: SFML text class not working
«
Reply #4 on:
March 15, 2013, 08:12:34 am »
It's fixed, thanks for your feedback.
Logged
Laurent Gomila - SFML developer
Atifhossain
Newbie
Posts: 5
Re: SFML text class not working
«
Reply #5 on:
March 15, 2013, 08:57:20 am »
Hey thanks everybody ! It 's working fine now
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
[SOLVED]SFML text class not working
anything