-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aeb2e3e
commit 353c5c1
Showing
3 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,58 @@ | ||
package flixel.math; | ||
|
||
import haxe.ds.Vector; | ||
import raylib.Vector2; | ||
|
||
typedef FlxPoint = Vector2; | ||
using raylib.RayMath; | ||
|
||
@:forward | ||
@:publicFields | ||
abstract FlxPoint(Vector2) to Vector2 from Vector2 { | ||
public var x(get, set):Float; | ||
|
||
public var y(get, set):Float; | ||
|
||
inline function new(x:Float = 0, y:Float = 0) { | ||
this = Vector2.create(x, y); | ||
} | ||
|
||
@:op(a + b) | ||
static inline function add(a:FlxPoint, b:FlxPoint):FlxPoint { | ||
return a.vector2Add(b); | ||
} | ||
|
||
@:op(a - b) | ||
static inline function subtract(a:FlxPoint, b:FlxPoint):FlxPoint { | ||
return a.vector2Subtract(b); | ||
} | ||
|
||
@:op(a * b) | ||
static inline function multiply(a:FlxPoint, b:FlxPoint):FlxPoint { | ||
return Vector2.create(a.x * b.x, a.y * b.y); | ||
} | ||
|
||
@:op(a / b) | ||
static inline function divide(a:FlxPoint, b:FlxPoint):FlxPoint { | ||
return Vector2.create(a.x / b.x, a.y / b.y); | ||
} | ||
|
||
@:noCompletion | ||
private inline function set_x(x:Float):Float { | ||
return this.x = x; | ||
} | ||
|
||
@:noCompletion | ||
private inline function get_x():Float { | ||
return this.x; | ||
} | ||
|
||
@:noCompletion | ||
private inline function set_y(y:Float):Float { | ||
return this.y = y; | ||
} | ||
|
||
@:noCompletion | ||
private inline function get_y():Float { | ||
return this.y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters