]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a convenience method to get the aspect ratio of View
authorMikko Rasa <tdb@tdb.fi>
Fri, 7 Oct 2016 12:37:39 +0000 (15:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 7 Oct 2016 12:37:39 +0000 (15:37 +0300)
source/view.h

index 81d7e051de0ec22d4757d61fcb31160cd269cd3c..acd5a65cfec98a1753642dfcb75c4393e879ed31 100644 (file)
@@ -32,6 +32,7 @@ public:
        Graphics::GLContext &get_context() { return context; }
        unsigned get_width() const { return window.get_width(); }
        unsigned get_height() const { return window.get_height(); }
+       float get_aspect() const { return static_cast<float>(get_width())/get_height(); }
 
        void set_content(const Renderable *);
        void synchronize_camera_aspect(Camera &);