aboutsummaryrefslogtreecommitdiff
path: root/src/aolayer.cpp
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-02-09 14:57:29 -0600
committerGitHub <noreply@github.com>2021-02-09 14:57:29 -0600
commite6ced659226d685199146719fc91b5b60890de98 (patch)
tree664ed8b3dde378de911632ea3a8ec2c46b8c54eb /src/aolayer.cpp
parent8162783e8b3cb5fb6c136aba072328b3d0de76d5 (diff)
Fix expanded_desk_mods (2-5) being nonfunctional (#451)
Also fix backgrounds appearing off to the left if they are less wide than the viewport. i am in agony Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
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;