-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when is Camera.contentPosition used? #11
Comments
Content position is set so that you know where the content's left bottom position is in the viewport. It is not being used, because scale modes need only scale factor to be calculated and then applied to the scene. |
So it is the viewport that actually gets centered? I don't see that implemented in the code either ... Maybe I missed it somehow? |
This is the line that creates the scaled orthographic matrix: https://github.com/elnormous/ouzel/blob/master/ouzel/scene/Camera.cpp#L91 |
I fully understand this orthographic matrix. However when I use the engine, say with an example device screen size of 1200x1920, and targetContentSize of 600x800, the contentScale is correctly set to 2. But when I try to draw a 600x800 sprite at position (0, 0), it is drawn on the bottom left corner of the device screen. I am expecting it being drawn vertically centered on the screen, WITHOUT manually setting the position, hence the question. |
|
What scale mode are you using? Can you please post your code somewhere? |
nothing special here. Basically it boils down to
|
Ah.. I see. Ouzel has center of the screen as the origin, whereas I'm assuming the bottom-left corner.. How interesting.. |
I can see that in SHOW_ALL mode of the camera, contentSize is scaled and contentPosition is set. However upon drawing, is contentPosition taken into account?
Say I have a screen (portrait) of 1200x1920, I set targetContentSize to be (600x400), the content is scaled to 1200x800. When drawing, this 1200x800 rectangle should be centered vertically,shouldn't it? I fail to see where in the engine that process this step.
The text was updated successfully, but these errors were encountered: