Improving typings of VirtualJoystick

This commit is contained in:
David Négrier 2021-12-16 10:04:55 +01:00
parent fa2e583d48
commit 98d3a58861
4 changed files with 37 additions and 27 deletions

View File

@ -1,8 +1,8 @@
import type { Direction } from "../../types";
import type { GameScene } from "../Game/GameScene";
import { touchScreenManager } from "../../Touch/TouchScreenManager";
import { MobileJoystick } from "../Components/MobileJoystick";
import { enableUserInputsStore } from "../../Stores/UserInputStore";
import type { Direction } from "phaser3-rex-plugins/plugins/virtualjoystick.js";
interface UserInputManagerDatum {
keyInstance: Phaser.Input.Keyboard.Key;

View File

@ -1,6 +1,39 @@
//import Phaser from "phaser";
declare module "phaser3-rex-plugins/plugins/virtualjoystick.js" {
const content: any; // eslint-disable-line
export default content;
/*const content: any; // eslint-disable-line
export default content;*/
import GameObject = Phaser.GameObjects.GameObject;
import { Scene } from "phaser";
type CursorKey = {
isDown: boolean;
};
export type Direction = "left" | "right" | "up" | "down";
interface CursorKeys extends Record<Direction, CursorKey> {
left: CursorKey;
right: CursorKey;
up: CursorKey;
down: CursorKey;
}
class VirtualJoystick extends GameObject {
constructor(scene: Scene, config: unknown);
enable: boolean;
base: GameObjects.Image;
thumb: GameObjects.Image;
setRadius: (radius: number) => void;
y: number;
x: number;
forceX: number;
forceY: number;
visible: boolean;
createCursorKeys: () => CursorKeys;
}
export default VirtualJoystick;
}
declare module "phaser3-rex-plugins/plugins/gestures-plugin.js" {
const content: any; // eslint-disable-line

View File

@ -1,23 +0,0 @@
import type Phaser from "phaser";
export type CursorKey = {
isDown: boolean;
};
export type Direction = "left" | "right" | "up" | "down";
export interface CursorKeys extends Record<Direction, CursorKey> {
left: CursorKey;
right: CursorKey;
up: CursorKey;
down: CursorKey;
}
export interface IVirtualJoystick extends Phaser.GameObjects.GameObject {
y: number;
x: number;
forceX: number;
forceY: number;
visible: boolean;
createCursorKeys: () => CursorKeys;
}

View File

@ -36,7 +36,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/CatsMiaow/node-grpc-typescript.git"
"url": "https://github.com/CatsMiaow/node-grpc-typescript.git#grpc_tools_node_protoc_ts"
},
"keywords": [
"Node.js",