summaryrefslogtreecommitdiff
path: root/src/resources/ambientlayer.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-28 20:56:41 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-28 20:57:58 +0100
commit264be2108c51837fa92085f6c839e66aebbcfc9e (patch)
treee1f535d4cda5f399e5e622f6154690a0a4e08c4b /src/resources/ambientlayer.h
parentd86a1df562e00a6e930683534b9d001f45a951ff (diff)
downloadmana-client-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.gz
mana-client-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.bz2
mana-client-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.xz
mana-client-264be2108c51837fa92085f6c839e66aebbcfc9e.zip
Added support for map/layer mask
A custom "Mask" property on a layer or a "foregroundXmask" property on a map can now be used in combination with the SMSG_MAP_MASK to dynamically disable certain map layers from the server. Feature previously seen on ManaPlus and implemented for Mana client for compatibility. Also added a ResourceRef class for automating the Resource reference counting. Closes #44
Diffstat (limited to 'src/resources/ambientlayer.h')
-rw-r--r--src/resources/ambientlayer.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/resources/ambientlayer.h b/src/resources/ambientlayer.h
index 9ccf5194..def2090b 100644
--- a/src/resources/ambientlayer.h
+++ b/src/resources/ambientlayer.h
@@ -21,6 +21,8 @@
#ifndef RESOURCES_AMBIENTOVERLAY_H
#define RESOURCES_AMBIENTOVERLAY_H
+#include "resource.h"
+
class Graphics;
class Image;
@@ -31,29 +33,24 @@ class AmbientLayer
* Constructor.
*
* @param img the image this overlay displays
- * @param parallax scroll factor based on camera position
- * @param speedX scrolling speed in x-direction
- * @param speedY scrolling speed in y-direction
- * @param keepRatio rescale the image to keep
- * the same ratio than in 800x600 resolution mode.
*/
- AmbientLayer(Image *img, float parallax,
- float speedX, float speedY, bool keepRatio = false);
-
+ AmbientLayer(Image *img);
~AmbientLayer();
void update(int timePassed, float dx, float dy);
void draw(Graphics *graphics, int x, int y);
+ float mParallax = 0; /**< Scroll factor based on camera position. */
+ float mSpeedX = 0; /**< Scrolling speed in X direction. */
+ float mSpeedY = 0; /**< Scrolling speed in Y direction. */
+ int mMask = 1;
+ bool mKeepRatio = false; /**< Keep overlay ratio on every resolution like in 800x600 */
+
private:
- Image *mImage;
- float mParallax;
- float mPosX; /**< Current layer X position. */
- float mPosY; /**< Current layer Y position. */
- float mSpeedX; /**< Scrolling speed in X direction. */
- float mSpeedY; /**< Scrolling speed in Y direction. */
- bool mKeepRatio; /**< Keep overlay ratio on every resolution */
+ ResourceRef<Image> mImage;
+ float mPosX = 0; /**< Current layer X position. */
+ float mPosY = 0; /**< Current layer Y position. */
};
#endif