OpenXcom  1.0
Open-source clone of the original X-Com
ExtraSprites.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <yaml-cpp/yaml.h>
21 #include <string>
22 #include <map>
23 
24 namespace OpenXcom
25 {
26 
27 class Surface;
28 class SurfaceSet;
29 
34 {
35 private:
36  std::string _type;
37  std::map<int, std::string> _sprites;
38  int _width, _height;
39  bool _singleImage;
40  int _modIndex, _subX, _subY;
41  bool _loaded;
42 
43  Surface *getFrame(SurfaceSet *set, int index, bool adding) const;
44 public:
46  ExtraSprites();
48  virtual ~ExtraSprites();
50  void load(const YAML::Node &node, int modIndex);
52  std::string getType() const;
54  std::map<int, std::string> *getSprites();
56  int getWidth() const;
58  int getHeight() const;
60  bool getSingleImage() const;
62  int getModIndex() const;
64  int getSubX() const;
66  int getSubY() const;
68  bool isLoaded() const;
70  static bool isImageFile(const std::string &filename);
72  Surface *loadSurface(Surface *surface);
75 };
76 
77 }
For adding a set of extra sprite data to the game.
Definition: ExtraSprites.h:33
int getSubX() const
Gets the x subdivision.
Definition: ExtraSprites.cpp:119
virtual ~ExtraSprites()
Cleans up the external sprite set.
Definition: ExtraSprites.cpp:40
Surface * loadSurface(Surface *surface)
Load the external sprite into a surface.
Definition: ExtraSprites.cpp:164
int getSubY() const
Gets the y subdivision.
Definition: ExtraSprites.cpp:128
std::map< int, std::string > * getSprites()
Gets the list of sprites defined by this mod.
Definition: ExtraSprites.cpp:74
bool getSingleImage() const
Checks if this is a single surface, or a set of surfaces.
Definition: ExtraSprites.cpp:101
static bool isImageFile(const std::string &filename)
Checks if a filename is a valid image file.
Definition: ExtraSprites.cpp:147
std::string getType() const
Gets the sprite&#39;s type.
Definition: ExtraSprites.cpp:65
int getHeight() const
Gets the height of the surfaces (used for single images and new spritesets).
Definition: ExtraSprites.cpp:92
Container of a set of surfaces.
Definition: SurfaceSet.h:35
bool isLoaded() const
Has this sprite been loaded?
Definition: ExtraSprites.cpp:137
ExtraSprites()
Creates a blank external sprite set.
Definition: ExtraSprites.cpp:33
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
int getModIndex() const
Gets the mod index for this external sprite set.
Definition: ExtraSprites.cpp:110
SurfaceSet * loadSurfaceSet(SurfaceSet *set)
Load the external sprite into a surface set.
Definition: ExtraSprites.cpp:189
int getWidth() const
Gets the width of the surfaces (used for single images and new spritesets).
Definition: ExtraSprites.cpp:83
void load(const YAML::Node &node, int modIndex)
Loads the data from YAML.
Definition: ExtraSprites.cpp:49
Definition: BaseInfoState.cpp:40