Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
error: ‘sf::FloatRect’ has no member named ‘getPosition’
Print
Pages: [
1
]
Author
Topic: error: ‘sf::FloatRect’ has no member named ‘getPosition’ (Read 3167 times)
0 Members and 1 Guest are viewing this topic.
MickeyKnox
Jr. Member
Posts: 53
error: ‘sf::FloatRect’ has no member named ‘getPosition’
«
on:
August 25, 2024, 10:32:15 pm »
From this code
sprite.getGlobalBounds().getPosition()
I get this error:
error: ‘sf::FloatRect’ {aka ‘class sf::Rect<float>’} has no member named ‘getPosition’
26 | info.setPosition(image->sprite.getGlobalBounds().getPosition());
| ^~~~~~~~~~~
Accoding to the documentation
Rect
does
have a member
getPosition
:
https://www.sfml-dev.org/documentation/2.6.1/classsf_1_1Rect.php
What am I missing?
Logged
MickeyKnox
Jr. Member
Posts: 53
Re: error: ‘sf::FloatRect’ has no member named ‘getPosition’
«
Reply #1 on:
August 25, 2024, 10:37:01 pm »
Ups my bad. I just realized that I'm still on SFML 2.5.1. Accoding to the changelog, the missing function was introduced in 2.6
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11030
Re: error: ‘sf::FloatRect’ has no member named ‘getPosition’
«
Reply #2 on:
August 25, 2024, 11:11:10 pm »
Yep, it's been added in 2.6.
I highly recommend to update SFML
As a side note for SFML 3 users, the functions were replaced in favor of data members
position
and
size
.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
error: ‘sf::FloatRect’ has no member named ‘getPosition’