OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UnitSprite.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_UNITSPRITE_H
20 #define OPENXCOM_UNITSPRITE_H
21 
22 #include "../Engine/Surface.h"
23 
24 namespace OpenXcom
25 {
26 
27 class BattleUnit;
28 class BattleItem;
29 class SurfaceSet;
30 
35 class UnitSprite : public Surface
36 {
37 private:
38  BattleUnit *_unit;
39  BattleItem *_itemA, *_itemB;
40  SurfaceSet *_unitSurface, *_itemSurfaceA, *_itemSurfaceB;
41  int _part, _animationFrame, _drawingRoutine;
43  void drawRoutine0();
45  void drawRoutine1();
47  void drawRoutine2();
49  void drawRoutine3();
51  void drawRoutine4();
53  void drawRoutine5();
55  void drawRoutine6();
57  void drawRoutine7();
59  void drawRoutine8();
61  void drawRoutine9();
63  void sortRifles();
64 public:
66  UnitSprite(int width, int height, int x, int y);
68  ~UnitSprite();
70  void setSurfaces(SurfaceSet *unitSurface, SurfaceSet *itemSurfaceA, SurfaceSet *itemSurfaceB);
72  void setBattleUnit(BattleUnit *unit, int part = 0);
74  void setBattleItem(BattleItem *item);
76  void setAnimationFrame(int frame);
78  void draw();
79 };
80 
81 }
82 
83 #endif
~UnitSprite()
Cleans up the UnitSprite.
Definition: UnitSprite.cpp:55
void setBattleUnit(BattleUnit *unit, int part=0)
Sets the battleunit to be rendered.
Definition: UnitSprite.cpp:79
UnitSprite(int width, int height, int x, int y)
Creates a new UnitSprite at the specified position and size.
Definition: UnitSprite.cpp:48
Container of a set of surfaces.
Definition: SurfaceSet.h:38
Represents a single item in the battlescape.
Definition: BattleItem.h:39
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void draw()
Draws the unit.
Definition: UnitSprite.cpp:141
A class that renders a specific unit, given its render rules combining the right frames from the surf...
Definition: UnitSprite.h:35
void setAnimationFrame(int frame)
Sets the animation frame.
Definition: UnitSprite.cpp:133
void setSurfaces(SurfaceSet *unitSurface, SurfaceSet *itemSurfaceA, SurfaceSet *itemSurfaceB)
Sets surfacesets for rendering.
Definition: UnitSprite.cpp:66
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
void setBattleItem(BattleItem *item)
Sets the battleitem to be rendered.
Definition: UnitSprite.cpp:90