game/sdlpp/sdlpp_rectrenderer.hpp

90 lines
4.2 KiB
C++
Raw Normal View History

2020-11-21 19:57:40 +00:00
#ifndef SDLPP_HPP_RECT_RENDERER
#define SDLPP_HPP_RECT_RENDERER
#include "sdlpp_common.hpp"
#include "sdlpp_renderobject.hpp"
#include "sdlpp_rectcolider.hpp"
#include "sdlpp_circlecolider.hpp"
2020-11-21 19:57:40 +00:00
namespace SDLPP {
2020-11-22 22:37:55 +00:00
class SDLPPSCOPE RectangleRender : public RenderObject {
2020-11-21 19:57:40 +00:00
public:
RectangleRender() = delete;
virtual ~RectangleRender(){};
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r );
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r,
const std::shared_ptr< Texture > &t, int source_x,
int source_y, int source_width, int source_height );
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r,
const std::shared_ptr< Texture > &t,
2021-03-07 13:06:55 +00:00
const SDL_Rect &source_rect = { -1, -1, -1, -1 } );
2020-11-21 19:57:40 +00:00
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r,
const std::string &img_or_color, bool is_polygon = false );
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r,
2021-03-07 13:06:55 +00:00
const std::string &img, int source_x, int source_y,
int source_width, int source_height );
RectangleRender( double x, double y, double w, double h,
const std::shared_ptr< Renderer > &r,
2021-03-07 13:06:55 +00:00
const std::string &img, const SDL_Rect &source_rect );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r,
const std::shared_ptr< Texture > &t, int source_x,
int source_y, int source_width, int source_height );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r,
const std::shared_ptr< Texture > &t,
const SDL_Rect &source_rect = { -1, -1, -1, -1 } );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r,
const std::string &img_or_color, bool is_polygon = false );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r,
const std::string &img, int source_x, int source_y,
int source_width, int source_height );
RectangleRender( const Vec2D< double > &top_left,
const Vec2D< double > &size,
const std::shared_ptr< Renderer > &r,
const std::string &img, const SDL_Rect &source_rect );
2020-11-21 19:57:40 +00:00
virtual void setColor( const std::string &color ) override;
virtual void setOutlineColor( const std::string &color ) override;
virtual void specialAction( int /*UNUSED*/ ) override {}
2020-11-21 19:57:40 +00:00
virtual void custom_move( int /*UNUSED*/ ) override {}
virtual std::pair< Vec2D< double >, Vec2D< double > >
getDoubleRect() const override;
2020-11-21 19:57:40 +00:00
virtual int leftmost() override;
virtual int topmost() override;
virtual int rightmost() override;
virtual int bottommost() override;
virtual int collisionPushX() override;
virtual int collisionPushY() override;
virtual int collisionWidth() override;
virtual int collisionHeight() override;
virtual void updateSizeAndPosition() override;
virtual SDL_Rect getRect() override;
virtual void centerX() override;
virtual std::shared_ptr< RenderObject > copySelf() override;
std::string getColor() const;
protected:
virtual void copyTo( std::shared_ptr< RenderObject > other ) override;
2020-11-21 19:57:40 +00:00
void updateXY();
Vec2D< double > original_size;
Vec2D< double > size;
2020-11-21 19:57:40 +00:00
std::string color = "";
};
} // end of namespace SDLPP
#endif