Skip to content

Commit 5a9cee2

Browse files
committed
Update docs
1 parent 41aefce commit 5a9cee2

201 files changed

Lines changed: 4883 additions & 1309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
declare class ScreenManager{
2+
/**
3+
* Adds a screen into the client.
4+
* @param cmd The screen toadd
5+
*/
6+
registerScreen(screen: Screen): void;
7+
}

definitions/feature/screen.d.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
interface ScreenEvents {
2+
/**
3+
* Calls on the screen being enabled.
4+
* @param ignoreAnimations If the screen should not have an opening animation.
5+
*/
6+
"enable": (ignoreAnimations: boolean) => void,
7+
8+
/**
9+
* Called on the screen being disabled.
10+
*/
11+
"disable": () => void,
12+
13+
/**
14+
* Called on every frame; use this to render something arbitrary.
15+
* @note This gets called whether the screen is on or off - this may be useful for animations.
16+
*/
17+
"render": () => void,
18+
19+
/**
20+
* Calls when the screen receives a key event.
21+
* @param key The key code
22+
* @param state The key's state. (true = down, false = up)
23+
* @returns Return `true` to cancel, `false` to pass through
24+
*/
25+
"key": (key: KeyCode, state: boolean) => boolean | void;
26+
27+
/**
28+
* Calls when the screen receives a mouse event.
29+
* @param button The mouse button
30+
* @param wheelDelta Scrolling direction and magnitude if it's a scroll event (positive = scroll up, negative = scroll down)
31+
* @param state The mouse's state (true = down, false = up)
32+
* @returns Return `true` to cancel, `false` to pass through
33+
*/
34+
"mouse": (button: MouseButton, wheelDelta: number, state: boolean) => boolean | void;
35+
}
36+
37+
declare class Screen {
38+
/**
39+
* Creates a screen. Must be registered, otherwise leaks may happen.
40+
* @param name The internal screen name.
41+
*/
42+
constructor(name: string, key: KeyCode);
43+
44+
/**
45+
* The name of the screen
46+
*/
47+
readonly name: string;
48+
49+
/**
50+
* Check if a certain point is hovered (usually by the mouse cursor).
51+
* @note Use this instead of doing your own bounds check, because this may prevent clicking through layered UIs.
52+
* @param rect The rectangle to check bounds
53+
* @param point The point to check (by default, mouse position.)
54+
*/
55+
isHover(rect: Rect, point?: Vector2): boolean;
56+
57+
/**
58+
* If the screen is currently on or off
59+
*/
60+
isActive(): boolean;
61+
62+
/**
63+
* Get the key used to activate the screen.
64+
*/
65+
getKey(): KeyCode;
66+
67+
/**
68+
* Set the key used to activate the screen.
69+
* @param key The key code to set to
70+
*/
71+
setKey(key: KeyCode): void;
72+
73+
on: <K extends keyof ScreenEvents>(eventName: K, handler: ScreenEvents[K]) => void;
74+
75+
76+
toString(): string;
77+
}

definitions/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
/// <reference path="./feature/module.d.ts" />
3030
/// <reference path="./feature/setting.d.ts" />
3131
/// <reference path="./feature/hudmodule.d.ts" />
32+
/// <reference path="./feature/screen.d.ts" />
33+
3234
/// <reference path="./feature/manager/mmgr.d.ts" />
3335
/// <reference path="./feature/manager/commandmgr.d.ts" />
36+
/// <reference path="./feature/manager/screenmgr.d.ts" />
3437

3538
/// <reference path="./api/TextColor.d.ts" />

definitions/latite.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ interface Latite {
278278
*/
279279
getCommandManager(): CommandManager;
280280

281+
/**
282+
* Gets the screen manager. Use this to register screens.
283+
*/
284+
getScreenManager(): ScreenManager;
285+
281286
/**
282287
* The Latite Client version. Example: "v2.0.0"
283288
*/

definitions/lib/filesystem.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,12 @@ declare namespace include {
5757
* @param path The path to the directory.
5858
*/
5959
readDirectory(path: string): string[];
60+
61+
/**
62+
* Moves (or renames) files and directories.
63+
* @param from Source path
64+
* @param to Destination path
65+
*/
66+
move(from: string, to: string): void;
6067
}
6168
}

definitions/world/item.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ declare class Item {
1010
* The translate name of the item (e.g. `item.stone`)
1111
*/
1212
public readonly translateName: string;
13+
14+
/**
15+
* Maximum damage of the item type.
16+
*/
17+
public readonly maxDamage: number;
1318
}
1419

1520
/**

docs-markdown/exports.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
- [feature/hudmodule](module.feature_hudmodule/index.md)
1414
- [feature/manager/commandmgr](module.feature_manager_commandmgr/index.md)
1515
- [feature/manager/mmgr](module.feature_manager_mmgr/index.md)
16+
- [feature/manager/screenmgr](module.feature_manager_screenmgr/index.md)
1617
- [feature/module](module.feature_module/index.md)
18+
- [feature/screen](module.feature_screen/index.md)
1719
- [feature/setting](module.feature_setting/index.md)
1820
- [game](module.game/index.md)
1921
- [gfx/Texture](module.gfx_Texture/index.md)

0 commit comments

Comments
 (0)