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