[client] improve GamepadView
This commit is contained in:
41
src/common/haxe/ru/m/geom/Circle.hx
Normal file
41
src/common/haxe/ru/m/geom/Circle.hx
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user