diff --git a/sdlpp/sdlpp_fontconfiguration.cpp b/sdlpp/sdlpp_fontconfiguration.cpp index 351d25b..ef08a5d 100644 --- a/sdlpp/sdlpp_fontconfiguration.cpp +++ b/sdlpp/sdlpp_fontconfiguration.cpp @@ -1,8 +1,10 @@ #include "sdlpp_fontconfiguration.hpp" namespace SDLPP { -FontConfiguration::FontConfiguration( std::shared_ptr< Font > font, const std::string &color, - const std::string &outline_color, double outline_size ) { +FontConfiguration::FontConfiguration( std::shared_ptr< Font > font, + const std::string &color, + const std::string &outline_color, + double outline_size ) { _font = font; _color = color; _outline_color = outline_color; @@ -32,4 +34,4 @@ void FontConfiguration::setColor( const std::string &color ) { void FontConfiguration::setOutlineColor( const std::string &outline_color ) { _outline_color = outline_color; } -} +} // namespace SDLPP diff --git a/sdlpp/sdlpp_line.hpp b/sdlpp/sdlpp_line.hpp index be93db0..eead1a5 100644 --- a/sdlpp/sdlpp_line.hpp +++ b/sdlpp/sdlpp_line.hpp @@ -28,6 +28,7 @@ public: updateMost(); return *this; } + void updateMost() { if ( _start.getY() < _end.getY() ) { top = &_start; @@ -44,28 +45,36 @@ public: right = &_start; } } + const Vec2D< T > &getStart() const { return _start; } + const Vec2D< T > &getEnd() const { return _end; } + double length() const { return vecDistance( _start, _end ); } + double lengthSquared() const { return vecDistanceSquared( _start, _end ); } + void setInfinite( bool infinite ) { _infinite = infinite; } + bool isInfinite() { return _infinite; } + void add( const Vec2D< T > &vec ) { _start += vec; _end += vec; } + const Vec2D< T > &topmost() const { return *top; } diff --git a/sdlpp/sdlpp_renderer.hpp b/sdlpp/sdlpp_renderer.hpp index 657e41e..b5a3186 100644 --- a/sdlpp/sdlpp_renderer.hpp +++ b/sdlpp/sdlpp_renderer.hpp @@ -14,7 +14,7 @@ public: Renderer( Window &window ); virtual ~Renderer(); SDL_Renderer *getRendererPtr(); - Vec2D getDimensions() const; + Vec2D< int > getDimensions() const; int getWidth() const; int getHeight() const; int getSmallerSide() const; diff --git a/sdlpp/sdlpp_scene.cpp b/sdlpp/sdlpp_scene.cpp index 95d460b..6d9ca8e 100644 --- a/sdlpp/sdlpp_scene.cpp +++ b/sdlpp/sdlpp_scene.cpp @@ -163,7 +163,7 @@ const std::shared_ptr< RenderObject > &Scene::leftmost() { const std::shared_ptr< RenderObject > &Scene::rightmost() { return rightmost_obj; } -Vec2D Scene::getDimensions() const { +Vec2D< int > Scene::getDimensions() const { return renderer->getDimensions(); } int Scene::getWidth() const {