Split sdlpp into smaller files
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#ifndef SDLPP_HPP_TEXT_RENDERER
|
||||
#define SDLPP_HPP_TEXT_RENDERER
|
||||
|
||||
#include "sdlpp_common.hpp"
|
||||
#include "sdlpp_rectrenderer.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace SDLPP {
|
||||
class TextRenderer : public RectangleRender {
|
||||
public:
|
||||
TextRenderer() = delete;
|
||||
TextRenderer( double x, double y, double w, double h,
|
||||
std::shared_ptr< Renderer > &r );
|
||||
TextRenderer( double x, double y, double w, double h,
|
||||
std::shared_ptr< Renderer > &r, Font &font,
|
||||
const std::string &text, const std::string &color = "FFFFFF",
|
||||
const std::string &outline_color = "000000",
|
||||
int outline_size = -1, int flags = SDLPP_TEXT_CENTER );
|
||||
void setText( Font &font, const std::string &text,
|
||||
const std::string &color = "FFFFFF",
|
||||
const std::string &outline_color = "000000",
|
||||
int outline_size = -1 );
|
||||
void setTextColor( Font &font, const std::string &color = "FFFFFF",
|
||||
const std::string &outline_color = "000000",
|
||||
int outline_size = -1 );
|
||||
void changeText( const std::string &text );
|
||||
void setFlags( int flags );
|
||||
virtual void render() override;
|
||||
virtual void updateSizeAndPosition() override;
|
||||
virtual std::shared_ptr< RenderObject > copySelf() override;
|
||||
|
||||
private:
|
||||
void updateDstRect();
|
||||
std::string _text{};
|
||||
int position_flags = 0;
|
||||
SDL_Rect dst_rect{};
|
||||
};
|
||||
} // end of namespace SDLPP
|
||||
#endif
|
||||
Reference in New Issue
Block a user