[client] improve GamepadView

This commit is contained in:
2019-07-23 17:37:59 +03:00
parent e8e3a6f1b3
commit 42138cd4ad
14 changed files with 269 additions and 65 deletions

View File

@@ -0,0 +1,41 @@
package ru.m.geom;
abstract Circle(Array<Float>) {
public var x(get, set):Float;
public var y(get, set):Float;
public var radius(get, set):Float;
public function new(x:Float = 0, y:Float = 0, radius:Float = 0) {
this = [
x, y, radius,
];
}
private inline function get_x():Float {
return this[0];
}
private inline function set_x(value:Float):Float {
return this[0] = value;
}
private inline function get_y():Float {
return this[1];
}
private inline function set_y(value:Float):Float {
return this[1] = value;
}
private inline function get_radius():Float {
return this[2];
}
private inline function set_radius(value:Float):Float {
return this[2] = value;
}
public function contain(point:Point):Bool {
return Math.sqrt(Math.pow(point.x - x, 2) + Math.pow(point.y - y, 2)) < radius;
}
}