mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
d0bd6b7376
* support input dispatch event for Editor * update internal * fix eslint * fix bug * update
77 lines
2.6 KiB
TypeScript
77 lines
2.6 KiB
TypeScript
declare module 'pal/input' {
|
|
type TouchCallback = (res: import('cocos/input/types').EventTouch) => void;
|
|
/**
|
|
* Class designed for touch input.
|
|
*/
|
|
export class TouchInputSource {
|
|
/**
|
|
* Register the touch event callback.
|
|
*/
|
|
public on (eventType: import('cocos/input/types/event-enum').InputEventType, callback: TouchCallback, target?: any);
|
|
}
|
|
|
|
type MouseCallback = (res: import('cocos/input/types').EventMouse) => void;
|
|
/**
|
|
* Class designed for mouse input.
|
|
*/
|
|
export class MouseInputSource {
|
|
/**
|
|
* Register the mouse event callback.
|
|
*/
|
|
public on (eventType: import('cocos/input/types/event-enum').InputEventType, callback: MouseCallback, target?: any);
|
|
|
|
public dispatchMouseDownEvent? (nativeMouseEvent: any);
|
|
public dispatchMouseMoveEvent? (nativeMouseEvent: any);
|
|
public dispatchMouseUpEvent? (nativeMouseEvent: any);
|
|
public dispatchScrollEvent? (nativeMouseEvent: any);
|
|
}
|
|
|
|
type KeyboardCallback = (res: import('cocos/input/types').EventKeyboard) => void;
|
|
/**
|
|
* Class Designed for keyboard input.
|
|
*/
|
|
export class KeyboardInputSource {
|
|
/**
|
|
* Register the keyboard event callback.
|
|
*/
|
|
public on (eventType: import('cocos/input/types/event-enum').InputEventType, callback: KeyboardCallback, target?: any);
|
|
|
|
public dispatchKeyboardDownEvent? (nativeKeyboardEvent: any);
|
|
public dispatchKeyboardUpEvent? (nativeKeyboardEvent: any);
|
|
}
|
|
|
|
/**
|
|
* Class designed for gamepad input
|
|
*/
|
|
export class GamepadInputSource {
|
|
// TODO: add more details for GamepadInputSource class
|
|
}
|
|
|
|
type AccelerometerCallback = (res: import('cocos/input/types').EventAcceleration) => void;
|
|
/**
|
|
* Class designed for accelerometer input
|
|
*/
|
|
export class AccelerometerInputSource {
|
|
/**
|
|
* Asynchronously start the accelerometer.
|
|
* TODO: return a promise.
|
|
*/
|
|
public start ();
|
|
/**
|
|
* Stop the accelerometer.
|
|
* TODO: return a promise.
|
|
*/
|
|
public stop ();
|
|
/**
|
|
* Set interval of the accelerometer callback.
|
|
* The interval is in mile seconds.
|
|
* @param intervalInMileSeconds interval in mile seconds.
|
|
*/
|
|
public setInterval (intervalInMileSeconds: number);
|
|
/**
|
|
* Register the acceleration event callback.
|
|
*/
|
|
public on (eventType: import('cocos/input/types/event-enum').InputEventType, callback: AccelerometerCallback, target?: any);
|
|
}
|
|
}
|