Mercurial > malikania
comparison libclient/malikania/sprite.hpp @ 43:fabbe1759cec
Misc: switch to mlk namespace, closes #589
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 29 Nov 2016 22:25:17 +0100 |
parents | a47a4477f347 |
children | 858621081b95 |
comparison
equal
deleted
inserted
replaced
42:a47a4477f347 | 43:fabbe1759cec |
---|---|
24 * \brief Sprite description. | 24 * \brief Sprite description. |
25 */ | 25 */ |
26 | 26 |
27 #include "image.hpp" | 27 #include "image.hpp" |
28 | 28 |
29 namespace malikania { | 29 namespace mlk { |
30 | 30 |
31 /** | 31 /** |
32 * \brief A Sprite is an image divided into cells. | 32 * \brief A Sprite is an image divided into cells. |
33 */ | 33 */ |
34 class sprite { | 34 class sprite { |
35 private: | 35 private: |
36 malikania::image m_image; | 36 mlk::image m_image; |
37 malikania::size m_cell; | 37 mlk::size m_cell; |
38 malikania::size m_margin; | 38 mlk::size m_margin; |
39 malikania::size m_space; | 39 mlk::size m_space; |
40 malikania::size m_size; | 40 mlk::size m_size; |
41 unsigned m_rows; | 41 unsigned m_rows; |
42 unsigned m_columns; | 42 unsigned m_columns; |
43 | 43 |
44 public: | 44 public: |
45 /** | 45 /** |
50 * \param cell size of cell in the image | 50 * \param cell size of cell in the image |
51 * \param margin the optional space from borders | 51 * \param margin the optional space from borders |
52 * \param space the optional space between cells | 52 * \param space the optional space between cells |
53 * \param size the sprite size (if 0, taken from the image) | 53 * \param size the sprite size (if 0, taken from the image) |
54 */ | 54 */ |
55 sprite(malikania::image image, | 55 sprite(mlk::image image, |
56 malikania::size cell, | 56 mlk::size cell, |
57 malikania::size margin = { 0, 0 }, | 57 mlk::size margin = { 0, 0 }, |
58 malikania::size space = { 0, 0 }, | 58 mlk::size space = { 0, 0 }, |
59 malikania::size size = { 0, 0 }) noexcept; | 59 mlk::size size = { 0, 0 }) noexcept; |
60 | 60 |
61 /** | 61 /** |
62 * Get the underlying image. | 62 * Get the underlying image. |
63 * | 63 * |
64 * \return the image | 64 * \return the image |
65 */ | 65 */ |
66 inline const malikania::image& image() const noexcept | 66 inline const mlk::image& image() const noexcept |
67 { | 67 { |
68 return m_image; | 68 return m_image; |
69 } | 69 } |
70 | 70 |
71 /** | 71 /** |
72 * Overloaded function. | 72 * Overloaded function. |
73 * | 73 * |
74 * \return the image | 74 * \return the image |
75 */ | 75 */ |
76 inline malikania::image& image() noexcept | 76 inline mlk::image& image() noexcept |
77 { | 77 { |
78 return m_image; | 78 return m_image; |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
137 * \param position the position in the window | 137 * \param position the position in the window |
138 */ | 138 */ |
139 void draw(window& window, unsigned cell, const point& position); | 139 void draw(window& window, unsigned cell, const point& position); |
140 }; | 140 }; |
141 | 141 |
142 } // !malikania | 142 } // !mlk |
143 | 143 |
144 #endif // !MALIKANIA_SPRITE_HPP | 144 #endif // !MALIKANIA_SPRITE_HPP |