hx3d
1
2D/3D Simple Game Framework
Main Page
Namespaces
Classes
Files
File List
engine
include
hx3d
graphics
sprite.hpp
1
/*
2
Sprite.
3
Copyright (C) 2015 Denis BOURGE
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
This library 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 GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18
USA
19
*/
20
21
#ifndef HX3D_GRAPHICS_SPRITE
22
#define HX3D_GRAPHICS_SPRITE
23
24
#include "hx3d/graphics/mesh.hpp"
25
#include "hx3d/graphics/texture.hpp"
26
#include "hx3d/graphics/framebuffer.hpp"
27
#include "hx3d/graphics/texture_region.hpp"
28
29
namespace
hx3d
{
30
namespace
graphics {
31
62
class
Sprite
:
public
Mesh
{
63
64
public
:
65
71
Sprite
();
72
78
void
setTexture
(
const
Ptr<Texture>
& texture);
79
85
void
setTexture
(
Framebuffer
& buffer);
86
92
void
setTexture
(
TextureRegion
& region);
93
99
Ptr<Texture>
getTexture
();
100
104
void
scaleTexture
();
105
106
virtual
void
draw
(
Ptr<Shader>
shader)
override
;
107
108
private
:
110
Ptr<Texture>
_texture;
111
};
112
113
}
/* graphics */
114
}
/* hx3d */
115
116
#endif
hx3d::graphics::Sprite::Sprite
Sprite()
Create a sprite without texture.
Definition:
sprite.cpp:28
hx3d::graphics::Sprite::setTexture
void setTexture(const Ptr< Texture > &texture)
Set the sprite texture.
Definition:
sprite.cpp:36
hx3d
hx3d framework namespace
Definition:
audio.hpp:26
hx3d::graphics::Sprite::draw
virtual void draw(Ptr< Shader > shader) override
Draw the mesh using a shader.
Definition:
sprite.cpp:94
hx3d::graphics::TextureRegion
Defines a rectangle in a texture.
Definition:
texture_region.hpp:38
hx3d::graphics::Sprite::scaleTexture
void scaleTexture()
Scale the texture coordinates following the texture size.
Definition:
sprite.cpp:78
hx3d::graphics::Sprite
2D texture manipulation.
Definition:
sprite.hpp:62
hx3d::graphics::Mesh
Displayable 2D/3D element.
Definition:
mesh.hpp:41
hx3d::graphics::Framebuffer
Render-to-texture buffer.
Definition:
framebuffer.hpp:37
hx3d::graphics::Sprite::getTexture
Ptr< Texture > getTexture()
Get the sprite texture.
Definition:
sprite.cpp:74
hx3d::Ptr
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition:
ptr.hpp:34
Generated by
1.8.11