Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
222516a8
Unverified
Commit
222516a8
authored
Feb 21, 2018
by
Rémi Verschelde
Committed by
GitHub
Feb 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16756 from willnationsdev/shifted-rect-sprite
Simplify detection of Sprite clicks
parents
4009c017
b0bdb445
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
sprite.cpp
scene/2d/sprite.cpp
+3
-1
sprite.h
scene/2d/sprite.h
+3
-1
No files found.
scene/2d/sprite.cpp
View file @
222516a8
...
...
@@ -297,7 +297,7 @@ bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
return
c
.
a
>
0.01
;
}
Rect2
Sprite
::
_edit_
get_rect
()
const
{
Rect2
Sprite
::
get_rect
()
const
{
if
(
texture
.
is_null
())
return
Rect2
(
0
,
0
,
1
,
1
);
...
...
@@ -374,6 +374,8 @@ void Sprite::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"set_hframes"
,
"hframes"
),
&
Sprite
::
set_hframes
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_hframes"
),
&
Sprite
::
get_hframes
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_rect"
),
&
Sprite
::
get_rect
);
ADD_SIGNAL
(
MethodInfo
(
"frame_changed"
));
ADD_SIGNAL
(
MethodInfo
(
"texture_changed"
));
...
...
scene/2d/sprite.h
View file @
222516a8
...
...
@@ -72,7 +72,7 @@ public:
virtual
Point2
_edit_get_pivot
()
const
;
virtual
bool
_edit_use_pivot
()
const
;
virtual
bool
_edit_is_selected_on_click
(
const
Point2
&
p_point
,
double
p_tolerance
)
const
;
virtual
Rect2
_edit_get_rect
()
const
;
virtual
Rect2
_edit_get_rect
()
const
{
return
get_rect
();
}
void
set_texture
(
const
Ref
<
Texture
>
&
p_texture
);
Ref
<
Texture
>
get_texture
()
const
;
...
...
@@ -110,6 +110,8 @@ public:
void
set_hframes
(
int
p_amount
);
int
get_hframes
()
const
;
Rect2
get_rect
()
const
;
Sprite
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment