ManaPlus
ambientlayer.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2009-2010 The Mana Developers
4  * Copyright (C) 2011-2019 The ManaPlus Developers
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef RESOURCES_AMBIENTLAYER_H
23 #define RESOURCES_AMBIENTLAYER_H
24 
26 
27 #include "localconsts.h"
28 
29 class Graphics;
30 class Image;
31 class Map;
32 
34 {
35  public:
36  friend class Map;
37 
48  AmbientLayer(const std::string &name,
49  Image *const img,
50  const float parallax,
51  const float parallaxY,
52  const float posX,
53  const float posY,
54  const float speedX,
55  const float speedY,
56  const bool keepRatio,
57  const int mask);
58 
60 
62 
63  void update(const int timePassed,
64  const float dx,
65  const float dy);
66 
67  void draw(Graphics *const graphics,
68  const int x,
69  const int y) const A_NONNULL(2);
70 
71  int calcMemoryLocal() const override;
72 
73  std::string getCounterName() const override final
74  { return mName; }
75 
76  private:
77  const std::string mName;
79  float mParallaxX;
80  float mParallaxY;
81  float mPosX;
82  float mPosY;
83  float mSpeedX;
84  float mSpeedY;
85  int mMask;
86  bool mKeepRatio;
87 };
88 
89 #endif // RESOURCES_AMBIENTLAYER_H
AmbientLayer::mName
const std::string mName
Definition: ambientlayer.h:77
AmbientLayer::mSpeedX
float mSpeedX
Definition: ambientlayer.h:83
MemoryCounter
Definition: memorycounter.h:28
AmbientLayer::getCounterName
std::string getCounterName() const
Definition: ambientlayer.h:73
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
AmbientLayer::mMask
int mMask
Definition: ambientlayer.h:85
Image
Definition: image.h:67
memorycounter.h
Graphics
Definition: graphics.h:107
AmbientLayer::~AmbientLayer
~AmbientLayer()
Definition: ambientlayer.cpp:87
localconsts.h
AmbientLayer::mParallaxY
float mParallaxY
Definition: ambientlayer.h:80
final
#define final
Definition: localconsts.h:45
AmbientLayer::mPosX
float mPosX
Definition: ambientlayer.h:81
x
x
Definition: graphics_calcImageRect.hpp:72
AmbientLayer::update
void update(const int timePassed, const float dx, const float dy)
Definition: ambientlayer.cpp:96
AmbientLayer::mImage
Image * mImage
Definition: ambientlayer.h:78
override
#define override
Definition: localconsts.h:46
std
Definition: mseprimitives.h:398
AmbientLayer::draw
void draw(Graphics *const graphics, const int x, const int y) const
Definition: ambientlayer.cpp:126
AmbientLayer::calcMemoryLocal
int calcMemoryLocal() const
Definition: ambientlayer.cpp:151
Map
Definition: map.h:71
AmbientLayer::mParallaxX
float mParallaxX
Definition: ambientlayer.h:79
AmbientLayer::AmbientLayer
AmbientLayer(const std::string &name, Image *const img, const float parallax, const float parallaxY, const float posX, const float posY, const float speedX, const float speedY, const bool keepRatio, const int mask)
Definition: ambientlayer.cpp:36
AmbientLayer::mPosY
float mPosY
Definition: ambientlayer.h:82
AmbientLayer::mSpeedY
float mSpeedY
Definition: ambientlayer.h:84
AmbientLayer
Definition: ambientlayer.h:33
y
y
Definition: graphics_calcImageRect.hpp:72
A_NONNULL
#define A_NONNULL(...)
Definition: localconsts.h:167
AmbientLayer::mKeepRatio
bool mKeepRatio
Definition: ambientlayer.h:86