SDLPP: can set minimal width/height on rectangle renderer
This commit is contained in:
@@ -146,6 +146,10 @@ void RectangleRender::updateSizeAndPosition() {
|
||||
rect.h =
|
||||
std::round( ( current.getY() + original_size.getY() ) * dimension ) -
|
||||
rect.y;
|
||||
if(rect.w < min_size.getX())
|
||||
rect.w = min_size.getX();
|
||||
if(rect.h < min_size.getY())
|
||||
rect.h = min_size.getY();
|
||||
if ( polygon )
|
||||
polygon->updateCollision( collisionPushX(), collisionPushY(),
|
||||
collisionWidth(), collisionHeight(),
|
||||
@@ -169,4 +173,14 @@ void RectangleRender::copyTo( std::shared_ptr< RenderObject > other ) {
|
||||
std::string RectangleRender::getColor() const {
|
||||
return color;
|
||||
}
|
||||
void RectangleRender::setMinWidth( uint64_t width ) {
|
||||
min_size = {width, min_size.getY()};
|
||||
}
|
||||
void RectangleRender::setMinHeight( uint64_t height ) {
|
||||
min_size = {min_size.getX(), height};
|
||||
}
|
||||
void RectangleRender::setSize( Vec2D< double > size ) {
|
||||
original_size = size;
|
||||
updateSizeAndPosition();
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
Reference in New Issue
Block a user