Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
sprite.h
Go to the documentation of this file.
1
/*
2
* Vega Strike
3
* Copyright (C) 2001-2002 Daniel Horn
4
*
5
* http://vegastrike.sourceforge.net/
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
*/
21
#ifndef SPRITE_H
22
#define SPRITE_H
23
24
#include "
gfxlib.h
"
25
26
#include "
quaternion.h
"
27
28
#include "
audio/Types.h
"
29
#include "
audio/Source.h
"
30
31
namespace
VSFileSystem
32
{
33
class
VSFile;
34
};
35
36
class
Texture
;
37
38
class
VSSprite
39
{
40
float
xcenter;
41
float
ycenter;
42
float
widtho2;
43
float
heighto2;
44
float
maxs, maxt;
45
float
rotation;
46
Texture
*surface;
47
bool
isAnimation;
48
//For private use only
49
VSSprite
() : surface( 0 ) {}
50
public
:
51
//Construct a sprite out of a spritefile
52
VSSprite
(
const
char
*
file
,
enum
FILTER
texturefilter =
BILINEAR
,
GFXBOOL
force =
GFXFALSE
);
53
//Construct a sprite out of a preloaded texture
54
//@Note will take ownership of 'surface'
55
VSSprite
(
Texture
*surface,
float
xcenter,
float
ycenter,
float
width
,
float
height
,
float
s = 0.
f
,
float
t = 0.
f
,
bool
isAnimation =
false
);
56
VSSprite
(
const
VSSprite
&source );
57
~VSSprite
();
58
//Return true if sprite was loaded successfully
59
bool
LoadSuccess
()
const
;
60
void
Draw
();
70
void
DrawHere
(
Vector
&ll,
Vector
&lr,
Vector
&ur,
Vector
&ul );
71
//Add specified rotation to an already-rotated sprite
72
void
Rotate
(
const
float
&rad )
73
{
74
rotation += rad;
75
}
76
void
SetRotation
(
const
float
&rot );
77
void
GetRotation
(
float
&rot );
78
//Loads the sprite's texture from the given file
79
//@deprecated Unused?
80
void
ReadTexture
(
VSFileSystem::VSFile
*f );
81
void
GetST
(
float
&s,
float
&t );
82
void
SetST
(
const
float
s,
const
float
t );
83
void
SetTime
(
double
newtime
);
84
void
SetPosition
(
const
float
&x1,
const
float
&y1 );
85
void
GetPosition
(
float
&x1,
float
&y1 );
86
void
SetSize
(
float
s1,
float
s2 );
87
void
GetSize
(
float
&x1,
float
&y1 );
88
void
SetTimeSource
( SharedPtr<Audio::Source> source );
89
void
ClearTimeSource
();
90
bool
Done
()
const
;
91
void
Reset
();
92
SharedPtr<Audio::Source>
GetTimeSource
()
const
;
93
//float &Rotation(){return rotation;};
94
Texture
*
getTexture
()
95
{
96
return
surface;
97
}
98
const
Texture
*
getTexture
()
const
99
{
100
return
surface;
101
}
102
};
103
104
#endif
105
src
gfx
sprite.h
Generated on Fri May 29 2015 23:07:28 for Vegastrike 0.5.1 rc1 by
1.8.4