SFML community forums
Help => Graphics => Topic started by: Kebab85 on December 21, 2019, 04:23:02 pm
-
Hello.
I'm pretty new at this and having a hard time trouble shoot this my self and i can't find the information i need on the board.
For some reason the mapPixelToCoords function doesn't seem to exist for me, i use version 2.5.1-1.
I'm not sure where i could be wrong but i try to use this from a window. obj just as shown in your tutorial.
g++ output: ”class sf::Window” doesn't have a member with the name ”mapPixelToCoords”
(Sry bad translated from my native language)
Do i forget to declare something? Missing something when compiling? Version problems?
Sry if i explain things bad, i'm not schooled for programming and don't know all terms and bad english.
Best regards
Kebab
-
It's part of RenderTarget and as such part of RenderWindow and RenderTexture, but not part of sf::Window. :)
-
Tyvm :D
Not sure i understand the answer but ill dig some more with that in mind :)
I assume this inheritance is what you describe to me.
https://www.sfml-dev.org/documentation/2.5.1-fr/classsf_1_1RenderWindow.php
To me the tutorial looked like i should create a RenderWindow named window then access it.
But i need to somehow access this function earlier in the chain.
sf::RenderWindow::mapPixelToCoords seems to show the function, would it be correct to just use it like this?
If so, any idea why i fail to understand that tutorial?
I don't see anything there that explains that.
Again tyvm for the help.
-
If you not doing any rendering, you aren't using any view co-ordinates so there are none to convert to and from pixel positions. If you are using sf::Window, you refer to positions in the window by their pixels. One common usage for mapPixelToCoords is for mouse position. If you are using just sf::Window, the mouse position is in pixels and you can use that position directly.