-
Notifications
You must be signed in to change notification settings - Fork 176
/
react-native-game-engine.d.ts
98 lines (81 loc) · 2.56 KB
/
react-native-game-engine.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Project: https://github.com/bberak/react-native-game-engine
// TypeScript Version: 3.5
declare module "react-native-game-engine" {
import * as React from "react";
import { StyleProp, ViewStyle, ScaledSize } from "react-native";
interface DefaultRendererOptions {
state: any;
screen: ScaledSize;
}
export function DefaultRenderer(defaultRendererOptions: DefaultRendererOptions): any;
export class DefaultTimer {}
interface TouchProcessorOptions {
triggerPressEventBefore: number;
triggerLongPressEventAfter: number;
moveThreshold: number;
}
export function DefaultTouchProcessor (touchProcessorOptions?: TouchProcessorOptions): any;
export interface TimeUpdate {
current: number;
delta: number;
previous: number;
previousDelta: number;
}
export interface GameEngineUpdateEventOptionType {
dispatch: (event: any) => void;
events: Array<any>;
screen: ScaledSize;
time: TimeUpdate;
touches: Array<TouchEvent>;
}
export type GameEngineSystem = (entities: any, update: GameEngineUpdateEventOptionType) => any;
export interface GameEngineProperties {
systems?: any[];
entities?: {} | Promise<any>;
renderer?: any;
touchProcessor?: any;
timer?: any;
running?: boolean;
onEvent?: any;
style?: StyleProp<ViewStyle>;
children?: React.ReactNode;
}
export class GameEngine extends React.Component<GameEngineProperties> {}
export type TouchEventType = 'start' | 'end' | 'move' | 'press' | 'long-press';
export interface TouchEvent {
event: {
changedTouches: Array<TouchEvent>;
identifier: number;
locationX: number;
locationY: number;
pageX: number;
pageY: number;
target: number;
timestamp: number;
touches: Array<TouchEvent>;
};
id: number;
type: TouchEventType;
delta?: {
locationX: number;
locationY: number;
pageX: number;
pageY: number;
timestamp: number;
}
}
interface GameLoopUpdateEventOptionType {
touches: TouchEvent[];
screen: ScaledSize;
time: TimeUpdate;
}
export interface GameLoopProperties {
touchProcessor?: any;
timer?: any;
running?: boolean;
onUpdate?: (args: GameLoopUpdateEventOptionType) => void;
style?: StyleProp<ViewStyle>;
children?: React.ReactNode;
}
export class GameLoop extends React.Component<GameLoopProperties> {}
}