SDLPP: add option to specify render object alignment
This commit is contained in:
@@ -124,11 +124,6 @@ SDL_Rect CircleRender::getRect() {
|
||||
return rect;
|
||||
}
|
||||
|
||||
void CircleRender::centerX() {
|
||||
centerx = true;
|
||||
updateSizeAndPosition();
|
||||
}
|
||||
|
||||
std::shared_ptr< RenderObject > CircleRender::copySelf() {
|
||||
auto ret = std::make_shared< CircleRender >( *this );
|
||||
copyTo( ret );
|
||||
@@ -142,23 +137,4 @@ void CircleRender::copyTo( std::shared_ptr< RenderObject > other ) {
|
||||
std::string CircleRender::getColor() const {
|
||||
return color;
|
||||
}
|
||||
|
||||
void CircleRender::updateXY() {
|
||||
if ( !centerx ) {
|
||||
current = original;
|
||||
return;
|
||||
}
|
||||
auto width = renderer->getWidth();
|
||||
auto height = renderer->getHeight();
|
||||
double x_, y_;
|
||||
if ( width > height ) {
|
||||
auto multiplier =
|
||||
static_cast< double >( width ) / static_cast< double >( height );
|
||||
x_ = original.getX() + static_cast< double >( multiplier - 1 ) / 2;
|
||||
} else {
|
||||
x_ = original.getX();
|
||||
}
|
||||
y_ = original.getY();
|
||||
current = { x_, y_ };
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
Reference in New Issue
Block a user