SuperTuxKart
Loading...
Searching...
No Matches
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>
25using namespace irr;
26
27class XMLNode;
28
33class MovingTexture : public NoCopy
34{
35private:
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
52public:
53 MovingTexture(core::matrix4 *matrix, const XMLNode &node);
54 MovingTexture(core::matrix4 *matrix, float dx, float dy);
55 MovingTexture(float dx, float dy);
56 virtual ~MovingTexture();
57
59 void setSpeed(float dx, float dy) {m_dx = dx; m_dy = dy;}
61 void setTextureMatrix(core::matrix4 *matrix) {m_matrix=matrix;}
62 void setSPTM(float* sp_tm) { m_sp_tm = sp_tm; }
63 virtual void update (float dt);
64 virtual void reset ();
65}
66; // MovingTexture
67
68#endif
69
Handles animated textures (textures that move)
Definition: moving_texture.hpp:34
void setTextureMatrix(core::matrix4 *matrix)
Sets the texture matrix.
Definition: moving_texture.hpp:61
virtual void reset()
Resets at (re)start of a race.
Definition: moving_texture.cpp:102
float m_x
Current x,y position.
Definition: moving_texture.hpp:45
virtual void update(float dt)
Updates the transform of an animated texture.
Definition: moving_texture.cpp:120
float m_dx
Translation increment per second.
Definition: moving_texture.hpp:37
virtual ~MovingTexture()
Destructor for an animated texture.
Definition: moving_texture.cpp:95
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:59
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
utility class used to parse XML files
Definition: xml_node.hpp:48