PIXI Controls: Custom hitArea for DPAD

This commit is contained in:
OleSTEEP 2024-03-22 01:31:46 +03:00
parent 1dd604a661
commit 82e62f6422
2 changed files with 2 additions and 0 deletions

View file

@ -57,6 +57,7 @@ ONSControls.createDPad = function() {
container.interactive = true;
container.pressed = false;
container.pressed_button = null;
container.hitArea = new PIXI.Polygon([-30,-83, 30,-83, 30,-30, 83,-30, 83,30, 30,30, 30,82, -30,82, -30,30, -83, 30, -83,-30, -30,-30]);
container.down = function(x, y) {
if (Math.abs(x) > container.width / 2 || Math.abs(y) > container.height / 2) {
return; // Pointer out of dpad, ignoring event