Dragonfly 4.20
A text-based game engine
Frame.h
1///
2/// A sprite frame
3///
4
5#ifndef __FRAME_H__
6#define __FRAME_H__
7
8// System includes.
9#include <string>
10
11// Engine includes.
12#include "Color.h"
13#include "Vector.h"
14
15namespace df {
16
17class Frame {
18
19 private:
20 int m_width; ///< Width of frame
21 int m_height; ///< Height of frame
22 std::string m_frame_str; ///< All frame characters stored as string.
23
24 public:
25 /// Create empty frame.
27
28 /// Create frame of indicated width and height with string.
29 Frame(int new_width, int new_height, std::string frame_str);
30
31 /// Set width of frame.
32 void setWidth(int new_width);
33
34 /// Get width of frame.
35 int getWidth() const;
36
37 /// Set height of frame.
38 void setHeight(int new_height);
39
40 /// Get height of frame.
41 int getHeight() const;
42
43 /// Set frame characters (stored as string).
44 void setString(std::string new_frame_str);
45
46 /// Get frame characters (stored as string).
47 std::string getString() const;
48
49 /// Draw self, centered at position (x,y) with color.
50 /// Don't draw transparent characters (0 means none).
51 /// Return 0 if ok, else -1.
52 /// Note: top-left coordinate is (0,0).
53 int draw(Vector position, Color color, char transparency) const;
54};
55
56} // end of namespace df
57#endif //__FRAME_H__
Definition: Frame.h:17
int m_height
Height of frame.
Definition: Frame.h:21
int getWidth() const
Get width of frame.
std::string m_frame_str
All frame characters stored as string.
Definition: Frame.h:22
std::string getString() const
Get frame characters (stored as string).
Frame()
Create empty frame.
void setHeight(int new_height)
Set height of frame.
int getHeight() const
Get height of frame.
void setString(std::string new_frame_str)
Set frame characters (stored as string).
Frame(int new_width, int new_height, std::string frame_str)
Create frame of indicated width and height with string.
int draw(Vector position, Color color, char transparency) const
Draw self, centered at position (x,y) with color.
void setWidth(int new_width)
Set width of frame.
int m_width
Width of frame.
Definition: Frame.h:20
Definition: Vector.h:12
An animation for a sprite.
Definition: Animation.h:15
Color
Colors Dragonfly recognizes.
Definition: Color.h:11