SFML community forums

Help => General => Topic started by: stavsen on February 08, 2018, 09:56:46 pm

Title: how does translate work?
Post by: stavsen on February 08, 2018, 09:56:46 pm
Hi
I've got a sprite which im drawing to the screen with a transform

what im consfused about it that my windows width is 600 px
and i called the transforms translate function, parsing (300, 0)
so i expected my sprite to be drawn in the middle of the screen (+the width of the sprite)
but it goes way off the screen?

And when i parse, say, (200,0) it moves almost to the end of the window ? even though its width is 600 ?

whats going on ?

doesn't translate "move" the transform by the pixels parsed in ?
i looked in the documentation, but it only says that the values parsed to translate are the offsets? but it it in pixels? or is it relative to the screen size?
Title: Re: how does translate work?
Post by: eXpl0it3r on February 08, 2018, 11:46:23 pm
What do you mean with "parsed"?

So what's your code?
Title: Re: how does translate work?
Post by: Hapax on February 08, 2018, 11:49:11 pm
The values used in translation are effectively in the current view's co-ordinate system when drawing the drawable object.
So, the translated position of a drawable is based on the view, which may have a size different to the window's pixel size.