SDLPP TextRenderer: actually copy in copySelf
This commit is contained in:
parent
27949f891a
commit
ad1805101c
@ -58,9 +58,13 @@ void TextRenderer::updateSizeAndPosition() {
|
|||||||
updateDstRect();
|
updateDstRect();
|
||||||
}
|
}
|
||||||
std::shared_ptr< RenderObject > TextRenderer::copySelf() {
|
std::shared_ptr< RenderObject > TextRenderer::copySelf() {
|
||||||
// TODO ACTUALLY copy, don't just copy pointers to textures and whatnot,
|
auto ret = std::make_shared< TextRenderer >( *this );
|
||||||
// create new textures!!!
|
copyTo(ret);
|
||||||
return std::make_shared< TextRenderer >( *this );
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextRenderer::copyTo(std::shared_ptr<RenderObject> other) {
|
||||||
|
RectangleRender::copyTo(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextRenderer::updateDstRect() {
|
void TextRenderer::updateDstRect() {
|
||||||
|
@ -25,6 +25,7 @@ public:
|
|||||||
void setTextColor( Font &font, const std::string &color = "FFFFFF",
|
void setTextColor( Font &font, const std::string &color = "FFFFFF",
|
||||||
const std::string &outline_color = "000000",
|
const std::string &outline_color = "000000",
|
||||||
double outline_size = -1 );
|
double outline_size = -1 );
|
||||||
|
// TODO maybe store Font and actually update texture here
|
||||||
void changeText( const std::string &text );
|
void changeText( const std::string &text );
|
||||||
void setFlags( int flags );
|
void setFlags( int flags );
|
||||||
virtual void render() override;
|
virtual void render() override;
|
||||||
@ -32,6 +33,7 @@ public:
|
|||||||
virtual std::shared_ptr< RenderObject > copySelf() override;
|
virtual std::shared_ptr< RenderObject > copySelf() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void copyTo(std::shared_ptr<RenderObject> other) override;
|
||||||
void updateDstRect();
|
void updateDstRect();
|
||||||
std::string _text{};
|
std::string _text{};
|
||||||
int position_flags = 0;
|
int position_flags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user