-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animator_8hpp_source.html
157 lines (155 loc) · 18.9 KB
/
Animator_8hpp_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SPC-H Platformer Engine: includes/spic-prj-api/Animator.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SPC-H Platformer Engine
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_09e761304027c904456130627fd4dcf5.html">includes</a></li><li class="navelem"><a class="el" href="dir_de77370fa4c160312bb88f5d1919228b.html">spic-prj-api</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Animator.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="Animator_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef ANIMATOR_H_</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define ANIMATOR_H_</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>  </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "<a class="code" href="Component_8hpp.html">Component.hpp</a>"</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "<a class="code" href="Sprite_8hpp.html">Sprite.hpp</a>"</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="AnimatedSprite_8hpp.html">Texture/AnimatedSprite.hpp</a>"</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "<a class="code" href="Point_8hpp.html">Point.hpp</a>"</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "<a class="code" href="Transform_8hpp.html">Transform.hpp</a>"</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <boost/serialization/access.hpp></span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <boost/serialization/map.hpp></span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <boost/serialization/shared_ptr.hpp></span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  </div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="keyword">namespace </span><a class="code" href="namespacespic.html">spic</a> {</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  </div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="classspic_1_1Animator.html"> 18</a></span>  <span class="keyword">class </span><a class="code" href="classspic_1_1Animator.html">Animator</a> : <span class="keyword">public</span> <a class="code" href="classspic_1_1Component.html">Component</a> {</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classspic_1_1Animator.html#a642e7e5ef249464b5c36349af0cf569b"> 21</a></span>  <a class="code" href="classspic_1_1Animator.html#a642e7e5ef249464b5c36349af0cf569b">Animator</a>();</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  </div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="classspic_1_1Animator.html#a61f5161567dedafc07df9b990966108c"> 23</a></span>  <a class="code" href="classspic_1_1Animator.html#a61f5161567dedafc07df9b990966108c">~Animator</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keyword">template</span><<span class="keyword">typename</span> archive></div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classspic_1_1Animator.html#a9d966a16421122e06af58a4e2a97ad6f"> 26</a></span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#a9d966a16421122e06af58a4e2a97ad6f">serialize</a>(archive &ar, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="comment">/*version*/</span>) {</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  ar & boost::serialization::base_object<Component, Animator>(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  boost::serialization::void_cast_register<Animator, Component>();</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  ar & _animationMap;</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  ar & _currentAnimation;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  ar & _isPlaying;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  ar & _isLooping;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  }</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <a class="code" href="classspic_1_1Animator.html#a642e7e5ef249464b5c36349af0cf569b">Animator</a>(<span class="keyword">const</span> <a class="code" href="classplatformer__engine_1_1AnimatedSprite.html">platformer_engine::AnimatedSprite</a> &animatedSprite, <span class="keywordtype">bool</span> isPlaying = <span class="keyword">true</span>,</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordtype">bool</span> isLooping = <span class="keyword">true</span>);</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  </div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#a1568a4800f79b98bdd8ce3f485810fe2">Play</a>(<span class="keywordtype">bool</span> looping);</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#a061b63d83ceb2dceec94d6ec0c0f73b4">Stop</a>();</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#ad04ef28434661b7e75cb96c0d53c3a9b">AddAnimation</a>(<span class="keyword">const</span> <a class="code" href="classplatformer__engine_1_1AnimatedSprite.html">platformer_engine::AnimatedSprite</a> &animatedSprite);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  </div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#a3f6cd3b24b2755d4ab8a5c3a3c16328a">SetActiveAnimation</a>(<span class="keyword">const</span> std::string &animationId);</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  </div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#ac2f0c8e2c66b3f8b5a17aaee9f053a35">Render</a>(<a class="code" href="structspic_1_1Transform.html">spic::Transform</a> transform);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  </div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordtype">void</span> <a class="code" href="classspic_1_1Animator.html#a00ecab65e0af6fd70acfd9f7302b5d8d">Update</a>(<span class="keywordtype">double</span> speedMultiplier);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  </div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keyword">auto</span> <span class="keyword">inline</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classspic_1_1Animator.html#a5552d9b8588fa350c3bc9dd7f5e0de99"> 76</a></span>  <a class="code" href="classspic_1_1Animator.html#a5552d9b8588fa350c3bc9dd7f5e0de99">GetLoadedAnimations</a>() -> std::map<std::string, std::shared_ptr<platformer_engine::AnimatedSprite>> { <span class="keywordflow">return</span> _animationMap; };</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  </div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  std::map<std::string, std::shared_ptr<platformer_engine::AnimatedSprite>> _animationMap;</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  std::shared_ptr<platformer_engine::AnimatedSprite> _currentAnimation{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordtype">bool</span> _isPlaying = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">bool</span> _isLooping = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  };</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  </div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> } <span class="comment">// namespace spic</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="preprocessor">#endif </span><span class="comment">// ANIMATOR_H_</span></div>
<div class="ttc" id="aAnimatedSprite_8hpp_html"><div class="ttname"><a href="AnimatedSprite_8hpp.html">AnimatedSprite.hpp</a></div></div>
<div class="ttc" id="aComponent_8hpp_html"><div class="ttname"><a href="Component_8hpp.html">Component.hpp</a></div></div>
<div class="ttc" id="aPoint_8hpp_html"><div class="ttname"><a href="Point_8hpp.html">Point.hpp</a></div></div>
<div class="ttc" id="aSprite_8hpp_html"><div class="ttname"><a href="Sprite_8hpp.html">Sprite.hpp</a></div></div>
<div class="ttc" id="aTransform_8hpp_html"><div class="ttname"><a href="Transform_8hpp.html">Transform.hpp</a></div></div>
<div class="ttc" id="aclassplatformer__engine_1_1AnimatedSprite_html"><div class="ttname"><a href="classplatformer__engine_1_1AnimatedSprite.html">platformer_engine::AnimatedSprite</a></div><div class="ttdoc">AnimatedSprite class which is used to animate sprites.</div><div class="ttdef"><b>Definition:</b> AnimatedSprite.hpp:16</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html"><div class="ttname"><a href="classspic_1_1Animator.html">spic::Animator</a></div><div class="ttdoc">A component which can play animated sequences of sprites.</div><div class="ttdef"><b>Definition:</b> Animator.hpp:18</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a00ecab65e0af6fd70acfd9f7302b5d8d"><div class="ttname"><a href="classspic_1_1Animator.html#a00ecab65e0af6fd70acfd9f7302b5d8d">spic::Animator::Update</a></div><div class="ttdeci">void Update(double speedMultiplier)</div><div class="ttdoc">Update the animated sprite (current frame)</div><div class="ttdef"><b>Definition:</b> Animator.cpp:52</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a061b63d83ceb2dceec94d6ec0c0f73b4"><div class="ttname"><a href="classspic_1_1Animator.html#a061b63d83ceb2dceec94d6ec0c0f73b4">spic::Animator::Stop</a></div><div class="ttdeci">void Stop()</div><div class="ttdoc">Stop playing the image sequence. Whatever sprite was displayed last will remain shown....</div><div class="ttdef"><b>Definition:</b> Animator.cpp:65</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a1568a4800f79b98bdd8ce3f485810fe2"><div class="ttname"><a href="classspic_1_1Animator.html#a1568a4800f79b98bdd8ce3f485810fe2">spic::Animator::Play</a></div><div class="ttdeci">void Play(bool looping)</div><div class="ttdoc">Start playing the image sequence.</div><div class="ttdef"><b>Definition:</b> Animator.cpp:60</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a3f6cd3b24b2755d4ab8a5c3a3c16328a"><div class="ttname"><a href="classspic_1_1Animator.html#a3f6cd3b24b2755d4ab8a5c3a3c16328a">spic::Animator::SetActiveAnimation</a></div><div class="ttdeci">void SetActiveAnimation(const std::string &animationId)</div><div class="ttdoc">Set the current animation.</div><div class="ttdef"><b>Definition:</b> Animator.cpp:18</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a5552d9b8588fa350c3bc9dd7f5e0de99"><div class="ttname"><a href="classspic_1_1Animator.html#a5552d9b8588fa350c3bc9dd7f5e0de99">spic::Animator::GetLoadedAnimations</a></div><div class="ttdeci">auto GetLoadedAnimations() -> std::map< std::string, std::shared_ptr< platformer_engine::AnimatedSprite >></div><div class="ttdef"><b>Definition:</b> Animator.hpp:76</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a61f5161567dedafc07df9b990966108c"><div class="ttname"><a href="classspic_1_1Animator.html#a61f5161567dedafc07df9b990966108c">spic::Animator::~Animator</a></div><div class="ttdeci">~Animator()=default</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a642e7e5ef249464b5c36349af0cf569b"><div class="ttname"><a href="classspic_1_1Animator.html#a642e7e5ef249464b5c36349af0cf569b">spic::Animator::Animator</a></div><div class="ttdeci">Animator()</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_a9d966a16421122e06af58a4e2a97ad6f"><div class="ttname"><a href="classspic_1_1Animator.html#a9d966a16421122e06af58a4e2a97ad6f">spic::Animator::serialize</a></div><div class="ttdeci">void serialize(archive &ar, const unsigned)</div><div class="ttdef"><b>Definition:</b> Animator.hpp:26</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_ac2f0c8e2c66b3f8b5a17aaee9f053a35"><div class="ttname"><a href="classspic_1_1Animator.html#ac2f0c8e2c66b3f8b5a17aaee9f053a35">spic::Animator::Render</a></div><div class="ttdeci">void Render(spic::Transform transform)</div><div class="ttdoc">Render the current animated sprite.</div><div class="ttdef"><b>Definition:</b> Animator.cpp:47</div></div>
<div class="ttc" id="aclassspic_1_1Animator_html_ad04ef28434661b7e75cb96c0d53c3a9b"><div class="ttname"><a href="classspic_1_1Animator.html#ad04ef28434661b7e75cb96c0d53c3a9b">spic::Animator::AddAnimation</a></div><div class="ttdeci">void AddAnimation(const platformer_engine::AnimatedSprite &animatedSprite)</div><div class="ttdoc">Add an animation to the Animator.</div><div class="ttdef"><b>Definition:</b> Animator.cpp:10</div></div>
<div class="ttc" id="aclassspic_1_1Component_html"><div class="ttname"><a href="classspic_1_1Component.html">spic::Component</a></div><div class="ttdoc">Base class for all components.</div><div class="ttdef"><b>Definition:</b> Component.hpp:23</div></div>
<div class="ttc" id="anamespacespic_html"><div class="ttname"><a href="namespacespic.html">spic</a></div><div class="ttdef"><b>Definition:</b> AudioNotFoundException.hpp:7</div></div>
<div class="ttc" id="astructspic_1_1Transform_html"><div class="ttname"><a href="structspic_1_1Transform.html">spic::Transform</a></div><div class="ttdoc">Instances of this class represent specific 2D transformations. @spicapi.</div><div class="ttdef"><b>Definition:</b> Transform.hpp:11</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>