diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-10-27 13:25:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-27 13:25:03 +0000 |
commit | 6e3e9dfb9857b751f59fd4b40c55e9262ff5a864 (patch) | |
tree | d064b49a4766ab69a0ac6e195868ad4b3443bab3 /core/core_bind.cpp | |
parent | bec9ffacba1385b0ba808f6dbb66abb7dc53639d (diff) | |
parent | 953af98c795066a5a450a3401cc8a4fbc6c12620 (diff) | |
download | redot-engine-6e3e9dfb9857b751f59fd4b40c55e9262ff5a864.tar.gz |
Merge pull request #814 from Spartan322/merge/61accf0
Merge commit godotengine/godot@61accf0
Diffstat (limited to 'core/core_bind.cpp')
-rw-r--r-- | core/core_bind.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 54e7d2e324..9bec2a9504 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -922,6 +922,19 @@ Dictionary Geometry2D::make_atlas(const Vector<Size2> &p_rects) { return ret; } +TypedArray<Point2i> Geometry2D::bresenham_line(const Point2i &p_from, const Point2i &p_to) { + Vector<Point2i> points = ::Geometry2D::bresenham_line(p_from, p_to); + + TypedArray<Point2i> result; + result.resize(points.size()); + + for (int i = 0; i < points.size(); i++) { + result[i] = points[i]; + } + + return result; +} + void Geometry2D::_bind_methods() { ClassDB::bind_method(D_METHOD("is_point_in_circle", "point", "circle_position", "circle_radius"), &Geometry2D::is_point_in_circle); ClassDB::bind_method(D_METHOD("segment_intersects_circle", "segment_from", "segment_to", "circle_position", "circle_radius"), &Geometry2D::segment_intersects_circle); @@ -956,6 +969,8 @@ void Geometry2D::_bind_methods() { ClassDB::bind_method(D_METHOD("make_atlas", "sizes"), &Geometry2D::make_atlas); + ClassDB::bind_method(D_METHOD("bresenham_line", "from", "to"), &Geometry2D::bresenham_line); + BIND_ENUM_CONSTANT(OPERATION_UNION); BIND_ENUM_CONSTANT(OPERATION_DIFFERENCE); BIND_ENUM_CONSTANT(OPERATION_INTERSECTION); |