GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/resources/ambientlayer.h Lines: 0 2 0.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009-2010  The Mana Developers
4
 *  Copyright (C) 2011-2017  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
25
#include "resources/memorycounter.h"
26
27
#include "localconsts.h"
28
29
class Graphics;
30
class Image;
31
class Map;
32
33
class AmbientLayer final : public MemoryCounter
34
{
35
    public:
36
        friend class Map;
37
38
        /**
39
         * Constructor.
40
         *
41
         * @param img       the image this overlay displays
42
         * @param parallax  scroll factor based on camera position
43
         * @param speedX    scrolling speed in x-direction
44
         * @param speedY    scrolling speed in y-direction
45
         * @param keepRatio  rescale the image to keep
46
         * the same ratio than in 800x600 resolution mode.
47
         */
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
59
        A_DELETE_COPY(AmbientLayer)
60
61
        ~AmbientLayer();
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;
78
        Image *mImage;
79
        float mParallaxX;
80
        float mParallaxY;
81
        float mPosX;             /**< Current layer X position. */
82
        float mPosY;             /**< Current layer Y position. */
83
        float mSpeedX;           /**< Scrolling speed in X direction. */
84
        float mSpeedY;           /**< Scrolling speed in Y direction. */
85
        int mMask;
86
        bool mKeepRatio;         /**< Keep overlay ratio on every resolution */
87
};
88
89
#endif  // RESOURCES_AMBIENTLAYER_H