Main Page
Related Pages
Classes
Files
File List
scene
2d
sprite.h
1
/*************************************************************************/
2
/* sprite.h */
3
/*************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* http://www.godotengine.org */
7
/*************************************************************************/
8
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
9
/* */
10
/* Permission is hereby granted, free of charge, to any person obtaining */
11
/* a copy of this software and associated documentation files (the */
12
/* "Software"), to deal in the Software without restriction, including */
13
/* without limitation the rights to use, copy, modify, merge, publish, */
14
/* distribute, sublicense, and/or sell copies of the Software, and to */
15
/* permit persons to whom the Software is furnished to do so, subject to */
16
/* the following conditions: */
17
/* */
18
/* The above copyright notice and this permission notice shall be */
19
/* included in all copies or substantial portions of the Software. */
20
/* */
21
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
22
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
23
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
25
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
26
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
27
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
28
/*************************************************************************/
29
#ifndef SPRITE_H
30
#define SPRITE_H
31
32
#include "scene/2d/node_2d.h"
33
#include "scene/resources/texture.h"
34
35
36
class
Sprite
:
public
Node2D
{
37
38
OBJ_TYPE(
Sprite
,
Node2D
);
39
40
Ref<Texture>
texture;
41
42
bool
centered;
43
Point2
offset;
44
45
bool
hflip;
46
bool
vflip;
47
bool
region;
48
Rect2
region_rect;
49
50
int
frame;
51
52
int
vframes;
53
int
hframes;
54
55
Color
modulate;
56
57
58
protected
:
59
60
void
_notification(
int
p_what);
61
62
static
void
_bind_methods();;
63
64
public
:
65
66
virtual
void
edit_set_pivot(
const
Point2
& p_pivot);
67
virtual
Point2
edit_get_pivot()
const
;
68
virtual
bool
edit_has_pivot()
const
;
69
70
void
set_texture(
const
Ref<Texture>
& p_texture);
71
Ref<Texture>
get_texture()
const
;
72
73
void
set_centered(
bool
p_center);
74
bool
is_centered()
const
;
75
76
void
set_offset(
const
Point2
& p_offset);
77
Point2
get_offset()
const
;
78
79
void
set_flip_h(
bool
p_flip);
80
bool
is_flipped_h()
const
;
81
82
void
set_flip_v(
bool
p_flip);
83
bool
is_flipped_v()
const
;
84
85
void
set_region(
bool
p_region);
86
bool
is_region()
const
;
87
88
void
set_region_rect(
const
Rect2
& p_region_rect);
89
Rect2
get_region_rect()
const
;
90
91
void
set_frame(
int
p_frame);
92
int
get_frame()
const
;
93
94
void
set_vframes(
int
p_amount);
95
int
get_vframes()
const
;
96
97
void
set_hframes(
int
p_amount);
98
int
get_hframes()
const
;
99
100
void
set_modulate(
const
Color
& p_color);
101
Color
get_modulate()
const
;
102
103
virtual
Rect2
get_item_rect()
const
;
104
105
Sprite
();
106
};
107
108
class
ViewportSprite
:
public
Node2D
{
109
110
OBJ_TYPE(
ViewportSprite
,
Node2D
);
111
112
Ref<Texture>
texture;
113
NodePath
viewport_path;
114
115
bool
centered;
116
Point2
offset;
117
Color
modulate;
118
119
protected
:
120
121
void
_notification(
int
p_what);
122
123
static
void
_bind_methods();;
124
125
public
:
126
127
virtual
void
edit_set_pivot(
const
Point2
& p_pivot);
128
virtual
Point2
edit_get_pivot()
const
;
129
virtual
bool
edit_has_pivot()
const
;
130
131
void
set_viewport_path(
const
NodePath
& p_viewport);
132
NodePath
get_viewport_path()
const
;
133
134
void
set_centered(
bool
p_center);
135
bool
is_centered()
const
;
136
137
void
set_offset(
const
Point2
& p_offset);
138
Point2
get_offset()
const
;
139
140
void
set_modulate(
const
Color
& p_color);
141
Color
get_modulate()
const
;
142
143
virtual
Rect2
get_item_rect()
const
;
144
145
ViewportSprite
();
146
};
147
148
#endif // SPRITE_H
Ref< Texture >
NodePath
Definition:
path_db.h:41
ViewportSprite
Definition:
sprite.h:108
Color
Definition:
color.h:37
Rect2
Definition:
math_2d.h:204
Sprite
Definition:
sprite.h:36
Vector2
Definition:
math_2d.h:65
Node2D
Definition:
node_2d.h:34
Generated on Wed Jul 13 2016 13:21:00 by
1.8.11