SuperTuxKart
moving_texture.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2006-2015 Joerg Henrichs
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef MOVING_TEXTURE_HPP
20 #define MOVING_TEXTURE_HPP
21 
22 #include "utils/no_copy.hpp"
23 #include <string>
24 #include <matrix4.h>
25 using namespace irr;
26 
27 class XMLNode;
28 
34 {
35 private:
37  float m_dx, m_dy;
38 
40  float m_dt;
41  float m_count;
42  bool m_isAnimatedByStep;
43 
45  float m_x, m_y;
47  core::matrix4 *m_matrix;
48 
49  // For sp
50  float* m_sp_tm;
51 
52 public:
53  MovingTexture(core::matrix4 *matrix, const XMLNode &node);
54  MovingTexture(core::matrix4 *matrix, float dx, float dy);
55  MovingTexture(float dx, float dy, float dt = 0.0f,
56  bool animated_by_step = false);
57  virtual ~MovingTexture();
58 
60  void setSpeed(float dx, float dy) {m_dx = dx; m_dy = dy;}
62  void setTextureMatrix(core::matrix4 *matrix) {m_matrix=matrix;}
63  void setSPTM(float* sp_tm) { m_sp_tm = sp_tm; }
64  virtual void update (float dt);
65  virtual void reset ();
66  float getCurrentX() const { return m_x; }
67  float getCurrentY() const { return m_y; }
68 }
69 ; // MovingTexture
70 
71 #endif
72 
Handles animated textures (textures that move)
Definition: moving_texture.hpp:34
void setTextureMatrix(core::matrix4 *matrix)
Sets the texture matrix.
Definition: moving_texture.hpp:62
float m_x
Current x,y position.
Definition: moving_texture.hpp:45
float m_dx
Translation increment per second.
Definition: moving_texture.hpp:37
core::matrix4 * m_matrix
The texture matrix of this texture.
Definition: moving_texture.hpp:47
float m_dt
Delta set by user and count.
Definition: moving_texture.hpp:40
void setSpeed(float dx, float dy)
Sets the speed of the animation.
Definition: moving_texture.hpp:60
utility class used to parse XML files
Definition: xml_node.hpp:48
void update(float dt)
Updates all widgets that need to be updated.
Definition: engine.cpp:872