fallahn / xygine

2D engine / framework built around SFML
218 stars 19 forks source link

Rendered content is offset on the y axis and gets cut off if moved up #121

Closed sro5h closed 4 years ago

sro5h commented 4 years ago

I just started trying out xygine and if i draw a sf::RectangleShape at position (0,0) the shape does not appear in the top left corner of the window. Instead it is move down a little and if i move it up (eg. to (0, -10)) it gets cut off.
The console window renders as expected though and this also happens if i draw text using the Text component to the window.
I am on Fedora 31 and am using SFML 2.5 and the master branch of xygine. I also added a screenshot: rendering_test

fallahn commented 4 years ago

Hi! Thanks for trying xygine. This is because the default view of a scene is automatically cropped to 16:9, with a world view of 1920x1080. As your window is not 16:9 the view is cropping the scene. It's hard to see because the scene background is black, disguising the black bars at the top and bottom of your window. If you want the view to fill the entire screen you need to create a new entity with a Camera component and set the camera's view to match the window. Then use xy::Scene::setActiveCamera() to set the new entity as the scene camera.

sro5h commented 4 years ago

I suspected i was missing something, thanks for clearing it up. So far i really like working with xygine :) By 'world view' you mean the world coordinate system right?

fallahn commented 4 years ago

Yes, world view = world coordinates (sorry the right words didn't come to me at the time). I'm glad you like it, I'd love to see what you do with it!