SDLPP: Renderer/Scene - use Vec2D instead of std::pair
This commit is contained in:
parent
aaae85a932
commit
6ecdb6d90d
@ -17,26 +17,26 @@ Renderer::~Renderer() {
|
||||
SDL_Renderer *Renderer::getRendererPtr() {
|
||||
return renderer;
|
||||
}
|
||||
std::pair< int, int > Renderer::getDimensions() const {
|
||||
Vec2D< int > Renderer::getDimensions() const {
|
||||
int width = 0, height = 0;
|
||||
SDL_GetRendererOutputSize( renderer, &width, &height );
|
||||
return { width, height };
|
||||
}
|
||||
int Renderer::getWidth() const {
|
||||
return getDimensions().first;
|
||||
return getDimensions().getX();
|
||||
}
|
||||
int Renderer::getHeight() const {
|
||||
return getDimensions().second;
|
||||
return getDimensions().getY();
|
||||
}
|
||||
int Renderer::getSmallerSide() const {
|
||||
auto dimensions = getDimensions();
|
||||
return dimensions.first < dimensions.second ? dimensions.first
|
||||
: dimensions.second;
|
||||
return dimensions.getX() < dimensions.getY() ? dimensions.getX()
|
||||
: dimensions.getY();
|
||||
}
|
||||
int Renderer::getLargerSide() const {
|
||||
auto dimensions = getDimensions();
|
||||
return dimensions.first > dimensions.second ? dimensions.first
|
||||
: dimensions.second;
|
||||
return dimensions.getX() > dimensions.getY() ? dimensions.getX()
|
||||
: dimensions.getY();
|
||||
}
|
||||
void Renderer::setBlendMode( SDL_BlendMode blendMode ) {
|
||||
SDL_SetRenderDrawBlendMode( renderer, blendMode );
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "sdlpp_common.hpp"
|
||||
#include "sdlpp_window.hpp"
|
||||
#include "sdlpp_vector.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -13,7 +14,7 @@ public:
|
||||
Renderer( Window &window );
|
||||
virtual ~Renderer();
|
||||
SDL_Renderer *getRendererPtr();
|
||||
std::pair< int, int > getDimensions() const;
|
||||
Vec2D<int> getDimensions() const;
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
int getSmallerSide() const;
|
||||
|
@ -163,7 +163,7 @@ const std::shared_ptr< RenderObject > &Scene::leftmost() {
|
||||
const std::shared_ptr< RenderObject > &Scene::rightmost() {
|
||||
return rightmost_obj;
|
||||
}
|
||||
std::pair< int, int > Scene::getDimensions() const {
|
||||
Vec2D<int> Scene::getDimensions() const {
|
||||
return renderer->getDimensions();
|
||||
}
|
||||
int Scene::getWidth() const {
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
void moveEverything( double x, double y );
|
||||
const std::shared_ptr< RenderObject > &leftmost();
|
||||
const std::shared_ptr< RenderObject > &rightmost();
|
||||
std::pair< int, int > getDimensions() const;
|
||||
Vec2D< int > getDimensions() const;
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
Renderer &getRenderer();
|
||||
|
Loading…
Reference in New Issue
Block a user