game/sdlpp/sdlpp_rectrenderer.hpp
2021-03-07 14:06:55 +01:00

66 lines
2.8 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 );
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< std::pair< double, double >,
std::pair< double, 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();
double og_w;
double og_h;
double w_;
double h_;
std::string color = "";
};
} // end of namespace SDLPP
#endif