Download
Documentation
Development
Examples
Donations
Contributions
Forum
Sources
API
Display
2D
texture_group.h
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2013 The ClanLib Team
4
**
5
** This software is provided 'as-is', without any express or implied
6
** warranty. In no event will the authors be held liable for any damages
7
** arising from the use of this software.
8
**
9
** Permission is granted to anyone to use this software for any purpose,
10
** including commercial applications, and to alter it and redistribute it
11
** freely, subject to the following restrictions:
12
**
13
** 1. The origin of this software must not be misrepresented; you must not
14
** claim that you wrote the original software. If you use this software
15
** in a product, an acknowledgment in the product documentation would be
16
** appreciated but is not required.
17
** 2. Altered source versions must be plainly marked as such, and must not be
18
** misrepresented as being the original software.
19
** 3. This notice may not be removed or altered from any source distribution.
20
**
21
** Note: Some of the libraries ClanLib may link to may have additional
22
** requirements or restrictions.
23
**
24
** File Author(s):
25
**
26
** Kenneth Gangstoe
27
** Magnus Norddahl
28
*/
29
30
31
#pragma once
32
33
#include "../api_display.h"
34
#include <memory>
35
36
namespace
clan
37
{
40
41
class
Size;
42
class
Rect;
43
class
Texture2D;
44
class
Subtexture;
45
class
TextureGroup_Impl;
46
class
GraphicContext;
47
49
class
CL_API_DISPLAY
TextureGroup
50
{
53
public
:
55
enum
TextureAllocationPolicy
56
{
57
create_new_texture
,
58
search_previous_textures
59
};
60
64
public
:
66
TextureGroup
();
67
69
TextureGroup
(
const
Size
&texture_sizes);
70
71
~
TextureGroup
();
72
76
public
:
77
79
bool
is_null
()
const
{
return
!impl; }
80
82
void
throw_if_null()
const
;
83
85
int
get_subtexture_count()
const
;
86
88
int
get_subtexture_count(
unsigned
int
texture_index)
const
;
89
91
int
get_texture_count()
const
;
92
94
TextureAllocationPolicy get_texture_allocation_policy()
const
;
95
97
Size
get_texture_sizes()
const
;
98
100
std::vector<Texture2D> get_textures()
const
;
101
105
public
:
107
Subtexture
add(
GraphicContext
&context,
const
Size
&size);
108
114
void
remove
(
Subtexture
&subtexture);
115
117
void
set_texture_allocation_policy(TextureAllocationPolicy policy);
118
123
void
insert_texture(
Texture2D
&texture,
const
Rect
&texture_rect);
124
128
private
:
129
std::shared_ptr<TextureGroup_Impl> impl;
131
};
132
133
}
134
clan::Subtexture
Sub-texture description.
Definition:
subtexture.h:46
clan::TextureGroup::create_new_texture
Definition:
texture_group.h:57
clan::TextureGroup::TextureAllocationPolicy
TextureAllocationPolicy
Texture allocation policy.
Definition:
texture_group.h:55
clan::Rect
2D (left,top,right,bottom) rectangle structure - Integer
Definition:
rect.h:453
clan::Texture2D
2D texture object class.
Definition:
texture_2d.h:42
clan::TextureGroup
Texture grouping class.
Definition:
texture_group.h:49
clan::GraphicContext
Interface to drawing graphics.
Definition:
graphic_context.h:257
clan::Size
2D (width,height) size structure - Integer
Definition:
size.h:157
clan::TextureGroup::is_null
bool is_null() const
Returns true if this object is invalid.
Definition:
texture_group.h:79