blob: 07871c29c139fb495a3db95a12088a488123e014 (
plain)
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
|
export type Screen = 'main-menu' | 'typing-game' | 'end-screen';
export interface Stats {
wpm: number;
rawWpm: number;
accuracy: number;
time: number;
correctChars: number;
incorrectChars: number;
totalChars: number;
currentStreak: number;
bestStreak: number;
}
export interface GameState {
screen: Screen;
currentText: string;
currentAttribution?: string;
input: string;
startTime: number | null;
isRunning: boolean;
stats: Stats;
}
export enum Theme {
Light = 'light',
Dark = 'dark'
}
export interface ThemeColors {
primary: string;
secondary: string;
background: string;
text: string;
error: string;
success: string;
}
export interface TyperPunkGame {
handle_input(input: string): void;
handle_backspace(ctrl: boolean): boolean;
get_stats(): [number, number];
get_stats_and_input(): [string, number, number];
is_finished(): boolean;
get_text(): string;
get_input(): string;
set_text(text: string): void;
start(): void;
get_wpm(): number;
get_time_elapsed(): number;
get_raw_wpm(): number;
}
export type TyperPunk = TyperPunkGame;
|