aboutsummaryrefslogtreecommitdiff
path: root/src/aolayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/aolayer.cpp')
-rw-r--r--src/aolayer.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/aolayer.cpp b/src/aolayer.cpp
index f037b219..5b19c6ac 100644
--- a/src/aolayer.cpp
+++ b/src/aolayer.cpp
@@ -89,6 +89,10 @@ QPixmap AOLayer::get_pixmap(QImage image)
void AOLayer::set_frame(QPixmap f_pixmap)
{
this->setPixmap(f_pixmap);
+ this->center_pixmap(f_pixmap);
+}
+
+void AOLayer::center_pixmap(QPixmap f_pixmap) {
QLabel::move(
x + (f_w - f_pixmap.width()) / 2,
y + (f_h - f_pixmap.height())); // Always center horizontally, always put
@@ -118,6 +122,16 @@ void AOLayer::move(int ax, int ay)
QLabel::move(x, y);
}
+void AOLayer::move_and_center(int ax, int ay)
+{
+ x = ax;
+ y = ay;
+ if (movie_frames.isEmpty()) // safeguard
+ QLabel::move(x,y);
+ else
+ center_pixmap(movie_frames[0]); // just use the first frame since dimensions are all that matter
+}
+
void BackgroundLayer::load_image(QString p_filename)
{
play_once = false;