]> git.tdb.fi Git - libs/gl.git/commitdiff
Immediate update camera aspect in View::set_camera
authorMikko Rasa <tdb@tdb.fi>
Tue, 6 Dec 2016 21:34:16 +0000 (23:34 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 7 Dec 2016 00:28:34 +0000 (02:28 +0200)
source/view.cpp

index 115a4b0cd77eefc93c5a6db580e943eeaf6a81c9..1518b6ee76b6012f51a4774ba7b5a5635e554d9d 100644 (file)
@@ -22,6 +22,8 @@ View::View(Graphics::Window &w, Graphics::GLContext &c):
 void View::set_camera(Camera *c)
 {
        camera = c;
+       if(camera)
+               camera->set_aspect(static_cast<float>(window.get_width())/window.get_height());
 }
 
 void View::set_content(Renderable *r)