ManaPlus
imageset.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef RESOURCES_IMAGESET_H
25 #define RESOURCES_IMAGESET_H
26 
27 #include "resources/resource.h"
28 
29 #include "utils/vector.h"
30 
31 #include "localconsts.h"
32 
33 class Image;
34 
38 class ImageSet notfinal : public Resource
39 {
40  public:
44  ImageSet(Image *const img,
45  const int w,
46  const int h,
47  const int margin,
48  const int spacing);
49 
51 
52 
55  ~ImageSet() override;
56 
61  { return mWidth; }
62 
67  { return mHeight; }
68 
69  typedef STD_VECTOR<Image*>::size_type size_type;
70 
71  Image* get(const size_type i) const A_WARN_UNUSED;
72 
74  { return mImages.size(); }
75 
77  { return mOffsetX; }
78 
79  void setOffsetX(const int n) noexcept2
80  { mOffsetX = n; }
81 
83  { return mOffsetY; }
84 
85  void setOffsetY(const int n) noexcept2
86  { mOffsetY = n; }
87 
88  const STD_VECTOR<Image*> &getImages() const noexcept2 A_WARN_UNUSED
89  { return mImages; }
90 
91  int calcMemoryLocal() const override;
92 
93  private:
94  STD_VECTOR<Image*> mImages;
95 
96  int mWidth;
97  int mHeight;
98  int mOffsetX;
99  int mOffsetY;
100 };
101 
102 #endif // RESOURCES_IMAGESET_H
int getWidth() const
Definition: imageset.h:60
~ImageSet()
Definition: imageset.cpp:62
std::vector< Image * > mImages
Definition: imageset.h:94
int mOffsetY
Definition: imageset.h:99
Image * get(const size_type i) const
Definition: imageset.cpp:67
int mWidth
Definition: imageset.h:96
void setOffsetX(const int n)
Definition: imageset.h:79
int getOffsetY() const
Definition: imageset.h:82
int mOffsetX
Definition: imageset.h:98
ImageSet(Image *const img, const int w, const int h, const int margin, const int spacing)
Definition: imageset.cpp:35
size_type size() const
Definition: imageset.h:73
std::vector< Image * >::size_type size_type
Definition: imageset.h:69
int getOffsetX() const
Definition: imageset.h:76
int mHeight
Definition: imageset.h:97
int calcMemoryLocal() const
Definition: imageset.cpp:78
void setOffsetY(const int n)
Definition: imageset.h:85
const std::vector< Image * > & getImages() const
Definition: imageset.h:88
int getHeight() const
Definition: imageset.h:66
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define notfinal
Definition: localconsts.h:261
#define noexcept2
Definition: localconsts.h:50
#define A_DELETE_COPY(func)
Definition: localconsts.h:53