mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Add a way to swap some types of objects
This commit is contained in:
parent
acebd488aa
commit
92925a9620
@ -81,4 +81,8 @@ int Point::GetY() const {
|
||||
return point_->y;
|
||||
}
|
||||
|
||||
void Point::Swap(Point& other) noexcept {
|
||||
point_.swap(other.point_);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
|
||||
int GetX() const;
|
||||
int GetY() const;
|
||||
|
||||
void Swap(Point& other) noexcept;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -111,4 +111,8 @@ int Rect::GetY2() const {
|
||||
return rect_->y + rect_->h;
|
||||
}
|
||||
|
||||
void Rect::Swap(Rect& other) noexcept {
|
||||
rect_.swap(other.rect_);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
int GetH() const;
|
||||
int GetX2() const;
|
||||
int GetY2() const;
|
||||
|
||||
void Swap(Rect& other) noexcept;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -56,4 +56,10 @@ void Texture::SetAlphaMod(Uint8 alpha) {
|
||||
throw Exception("SDL_SetTextureAlphaMod failed");
|
||||
}
|
||||
|
||||
void Texture::Swap(Texture& other) noexcept {
|
||||
SDL_Texture* tmp = other.texture_;
|
||||
other.texture_ = texture_;
|
||||
texture_ = tmp;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
void SetBlendMode(SDL_BlendMode blendMode);
|
||||
void SetAlphaMod(Uint8 alpha);
|
||||
|
||||
void Swap(Texture& other) noexcept;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user