90 lines
4.2 KiB
C++
90 lines
4.2 KiB
C++
#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"
|
|
|
|
namespace SDLPP {
|
|
class SDLPPSCOPE RectangleRender : public RenderObject {
|
|
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,
|
|
const SDL_Rect &source_rect = { -1, -1, -1, -1 } );
|
|
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,
|
|
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,
|
|
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 );
|
|
virtual void setColor( const std::string &color ) override;
|
|
virtual void setOutlineColor( const std::string &color ) override;
|
|
virtual void specialAction( int /*UNUSED*/ ) override {}
|
|
virtual void custom_move( int /*UNUSED*/ ) override {}
|
|
virtual std::pair< Vec2D< double >, Vec2D< double > >
|
|
getDoubleRect() const override;
|
|
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;
|
|
void updateXY();
|
|
Vec2D< double > original_size;
|
|
Vec2D< double > size;
|
|
std::string color = "";
|
|
};
|
|
} // end of namespace SDLPP
|
|
#endif
|