@defold-typescript/library-types 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +52 -0
- package/README.md +78 -0
- package/api-doc/boom.boom.json +26 -0
- package/api-doc/bridge.bridge.json +1653 -0
- package/api-doc/bzAnim.bzLibrary.json +156 -0
- package/api-doc/defcon.console.json +109 -0
- package/api-doc/defmath.defmath.json +1381 -0
- package/api-doc/defsave.defsave.json +175 -0
- package/api-doc/deftest.deftest.json +71 -0
- package/api-doc/dicebag.dicebag.json +323 -0
- package/api-doc/event.event.json +238 -0
- package/api-doc/gooey.gooey.json +963 -0
- package/api-doc/immutable.immutable.json +63 -0
- package/api-doc/in.accelerometer.json +281 -0
- package/api-doc/in.button.json +148 -0
- package/api-doc/in.cursor.json +203 -0
- package/api-doc/in.gesture.json +206 -0
- package/api-doc/in.keyboard.json +45 -0
- package/api-doc/in.mapper.json +141 -0
- package/api-doc/in.onscreen.json +265 -0
- package/api-doc/in.state.json +195 -0
- package/api-doc/in.textbox.json +213 -0
- package/api-doc/in.triggers.json +1260 -0
- package/api-doc/lang.lang.json +411 -0
- package/api-doc/log.log.json +50 -0
- package/api-doc/metrics.fps.json +88 -0
- package/api-doc/metrics.mem.json +80 -0
- package/api-doc/monarch.monarch.json +1065 -0
- package/api-doc/monarch.transitions.easings.json +206 -0
- package/api-doc/monarch.transitions.gui.json +445 -0
- package/api-doc/nakama.engine.defold.json +165 -0
- package/api-doc/nakama.nakama.json +6574 -0
- package/api-doc/nakama.util.log.json +25 -0
- package/api-doc/narrator.narrator.json +150 -0
- package/api-doc/orthographic.camera.json +1019 -0
- package/api-doc/persist.persist.json +142 -0
- package/api-doc/platypus.platypus.json +631 -0
- package/api-doc/proto.proto.json +355 -0
- package/api-doc/rendy.rendy.json +408 -0
- package/api-doc/richtext.color.json +219 -0
- package/api-doc/richtext.richtext.json +382 -0
- package/api-doc/richtext.tags.json +67 -0
- package/api-doc/saver.saver.json +553 -0
- package/api-doc/saver.storage.json +174 -0
- package/api-doc/squid.squid.json +660 -0
- package/api-doc/starly.starly.json +488 -0
- package/api-doc/tweener.tweener.json +419 -0
- package/api-doc/yagames.yagames.json +1465 -0
- package/api-doc/zzfx.api.json +85 -0
- package/generated/boom.boom.d.ts +1585 -0
- package/generated/bridge.bridge.d.ts +533 -0
- package/generated/bzAnim.bzLibrary.d.ts +93 -0
- package/generated/defcon.console.d.ts +24 -0
- package/generated/defmath.defmath.d.ts +194 -0
- package/generated/defsave.defsave.d.ts +31 -0
- package/generated/deftest.deftest.d.ts +47 -0
- package/generated/dicebag.dicebag.d.ts +90 -0
- package/generated/event.event.d.ts +54 -0
- package/generated/gooey.gooey.d.ts +261 -0
- package/generated/immutable.immutable.d.ts +13 -0
- package/generated/in.accelerometer.d.ts +37 -0
- package/generated/in.button.d.ts +20 -0
- package/generated/in.cursor.d.ts +33 -0
- package/generated/in.gesture.d.ts +64 -0
- package/generated/in.keyboard.d.ts +18 -0
- package/generated/in.mapper.d.ts +23 -0
- package/generated/in.onscreen.d.ts +58 -0
- package/generated/in.state.d.ts +34 -0
- package/generated/in.textbox.d.ts +26 -0
- package/generated/in.triggers.d.ts +180 -0
- package/generated/lang.lang.d.ts +33 -0
- package/generated/log.log.d.ts +40 -0
- package/generated/metrics.fps.d.ts +16 -0
- package/generated/metrics.mem.d.ts +16 -0
- package/generated/monarch.monarch.d.ts +412 -0
- package/generated/monarch.transitions.easings.d.ts +65 -0
- package/generated/monarch.transitions.gui.d.ts +197 -0
- package/generated/nakama.engine.defold.d.ts +24 -0
- package/generated/nakama.nakama.d.ts +594 -0
- package/generated/nakama.util.log.d.ts +10 -0
- package/generated/narrator.narrator.d.ts +66 -0
- package/generated/orthographic.camera.d.ts +308 -0
- package/generated/persist.persist.d.ts +34 -0
- package/generated/platypus.platypus.d.ts +76 -0
- package/generated/proto.proto.d.ts +36 -0
- package/generated/rendy.rendy.d.ts +184 -0
- package/generated/richtext.color.d.ts +33 -0
- package/generated/richtext.richtext.d.ts +126 -0
- package/generated/richtext.tags.d.ts +12 -0
- package/generated/saver.saver.d.ts +44 -0
- package/generated/saver.storage.d.ts +16 -0
- package/generated/squid.squid.d.ts +106 -0
- package/generated/starly.starly.d.ts +148 -0
- package/generated/tweener.tweener.d.ts +151 -0
- package/generated/yagames.yagames.d.ts +279 -0
- package/generated/zzfx.api.d.ts +20 -0
- package/library-classification.json +726 -0
- package/library-targets.json +291 -0
- package/package.json +180 -0
- package/scripts/extract-api-doc.ts +418 -0
- package/scripts/sync-library-types.ts +542 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see {@link https://github.com/britzl/defold-richtext|Github Source}
|
|
3
|
+
* @example `import * as richtext from 'richtext.richtext'`
|
|
4
|
+
* @noResolution
|
|
5
|
+
*/
|
|
6
|
+
declare module 'richtext.richtext' {
|
|
7
|
+
type FontSettings = {
|
|
8
|
+
regular: Hash;
|
|
9
|
+
italic: Hash;
|
|
10
|
+
bold: Hash;
|
|
11
|
+
bold_italic: Hash;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type FontsTable = {
|
|
15
|
+
[name: string]: FontSettings;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type LayersTable = {
|
|
19
|
+
fonts: LuaMap<Hash, Hash>; // { [font: hash]: hash };
|
|
20
|
+
images: LuaMap<Hash, Hash>; // { [texture: hash]: hash };
|
|
21
|
+
spinescenes: LuaMap<Hash, Hash>; // { [spinescene: hash]: hash };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type Settings = {
|
|
25
|
+
width?: number;
|
|
26
|
+
position?: Vector3;
|
|
27
|
+
size?: number;
|
|
28
|
+
parent?: Opaque<"node">;
|
|
29
|
+
fonts?: FontsTable;
|
|
30
|
+
layers?: LayersTable;
|
|
31
|
+
color?: Vector4;
|
|
32
|
+
shadow?: Vector4;
|
|
33
|
+
outline?: Vector4;
|
|
34
|
+
align?: Alignment;
|
|
35
|
+
valign?: VAlignment;
|
|
36
|
+
line_spacing?: number;
|
|
37
|
+
paragraph_spacing?: number;
|
|
38
|
+
image_pixel_grid_snap?: boolean;
|
|
39
|
+
combine_words?: boolean;
|
|
40
|
+
dryrun?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type Word = {
|
|
44
|
+
size: number;
|
|
45
|
+
color: Vector4;
|
|
46
|
+
shadow: Vector4;
|
|
47
|
+
outline: Vector4;
|
|
48
|
+
node: Opaque<"node">;
|
|
49
|
+
metrics: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
total_width: number;
|
|
53
|
+
max_descent?: number;
|
|
54
|
+
max_ascent?: number;
|
|
55
|
+
};
|
|
56
|
+
font: string;
|
|
57
|
+
text: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type TextMetrics = {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
char_count: number;
|
|
64
|
+
img_count: number;
|
|
65
|
+
spine_count: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Creates rich text gui nodes from a text containing markup. */
|
|
69
|
+
export function create(
|
|
70
|
+
text: string,
|
|
71
|
+
font: string,
|
|
72
|
+
settings?: Settings,
|
|
73
|
+
): LuaMultiReturn<[Word[], TextMetrics]>;
|
|
74
|
+
|
|
75
|
+
/** Get all words with a specific tag. */
|
|
76
|
+
export function tagged(words: Word[], tag: string): Word[];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Truncate a text down to a specific length. This function has two modes of operation:
|
|
80
|
+
* 1) It can truncate the text on a per word basis or
|
|
81
|
+
* 2) on a per character/image basis.
|
|
82
|
+
* The function will disable nodes that shouldn't be visible and in the case of truncating
|
|
83
|
+
* on a per character basis also update the text in nodes that should be partially visible.
|
|
84
|
+
* The text metrics of a truncated word will be updated.
|
|
85
|
+
*/
|
|
86
|
+
export function truncate(
|
|
87
|
+
words: Word[],
|
|
88
|
+
length: number,
|
|
89
|
+
options?: { words: boolean },
|
|
90
|
+
): Word;
|
|
91
|
+
|
|
92
|
+
/** Get the length of a text ignoring any tags except image and spine tags which are treated as having a length of 1. */
|
|
93
|
+
export function length(text: Word[] | string): number;
|
|
94
|
+
|
|
95
|
+
/** Split a word into it's characters, including the creation of the gui nodes. Each of the characters will be given the same attributes as the word, and they will be positioned correctly within the word. */
|
|
96
|
+
export function characters(word: Word): Word[];
|
|
97
|
+
|
|
98
|
+
/** Call this function when a click/touch has been detected and your text contains words with an a tag. These words act as "hyperlinks" and will generate a message when clicked. */
|
|
99
|
+
export function on_click(
|
|
100
|
+
words: Word[],
|
|
101
|
+
action: {
|
|
102
|
+
node_id: Hash;
|
|
103
|
+
text: string;
|
|
104
|
+
screen_x: number;
|
|
105
|
+
screen_y: number;
|
|
106
|
+
tags: string[];
|
|
107
|
+
},
|
|
108
|
+
): boolean;
|
|
109
|
+
|
|
110
|
+
/** Removes all gui text nodes created by richtext.create(). */
|
|
111
|
+
export function remove(words: Word[]): void;
|
|
112
|
+
|
|
113
|
+
/** Returns the words created by richtext.create() as a plain text string without any formatting or tags. Linebreaks are included in the returned string. */
|
|
114
|
+
export function plaintext(words: Word[]): string;
|
|
115
|
+
|
|
116
|
+
type Alignment = Hash & Readonly<{ __brand: 'richtext.alignment' }>;
|
|
117
|
+
type VAlignment = Hash & Readonly<{ __brand: 'richtext.v.alignment' }>;
|
|
118
|
+
|
|
119
|
+
export const ALIGN_LEFT: Alignment;
|
|
120
|
+
export const ALIGN_CENTER: Alignment;
|
|
121
|
+
export const ALIGN_RIGHT: Alignment;
|
|
122
|
+
export const ALIGN_JUSTIFY: Alignment;
|
|
123
|
+
export const VALIGN_TOP: VAlignment;
|
|
124
|
+
export const VALIGN_MIDDLE: VAlignment;
|
|
125
|
+
export const VALIGN_BOTTOM: VAlignment;
|
|
126
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see {@link https://github.com/britzl/defold-richtext|Github Source}
|
|
3
|
+
* @example `import * as tags from 'richtext.tags'`
|
|
4
|
+
* @noResolution
|
|
5
|
+
*/
|
|
6
|
+
declare module 'richtext.tags' {
|
|
7
|
+
export function register(
|
|
8
|
+
tag: string,
|
|
9
|
+
fn: (params?: string, settings?: {}) => void,
|
|
10
|
+
): void;
|
|
11
|
+
export function apply(tag: string, params?: string, settings?: {}): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @see {@link https://github.com/Insality/defold-saver|Github Source}
|
|
7
|
+
* @see {@link https://github.com/Insality/defold-saver/blob/main/API_REFERENCE.md|API Reference}
|
|
8
|
+
* @example `import * as saver from 'saver.saver'`
|
|
9
|
+
* @noResolution
|
|
10
|
+
*/
|
|
11
|
+
declare module 'saver.saver' {
|
|
12
|
+
interface LoggerInstance {
|
|
13
|
+
trace(this: any, message: string, data?: {}): void;
|
|
14
|
+
debug(this: any, message: string, data?: {}): void;
|
|
15
|
+
info(this: any, message: string, data?: {}): void;
|
|
16
|
+
warn(this: any, message: string, data?: {}): void;
|
|
17
|
+
error(this: any, message: string, data?: {}): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function init(): void;
|
|
21
|
+
export function bind_save_part(keyId: string, tableReference: any): void;
|
|
22
|
+
export function save_game_state(fileName?: string): boolean;
|
|
23
|
+
export function load_game_state(fileName?: string): boolean;
|
|
24
|
+
export function get_game_state(): unknown;
|
|
25
|
+
export function set_game_state(state: any): boolean;
|
|
26
|
+
export function save_file_by_path(data: any, filePath: string): boolean;
|
|
27
|
+
export function load_file_by_path(path: string): unknown;
|
|
28
|
+
export function save_file_by_name(data: any, fileName: string): boolean;
|
|
29
|
+
export function load_file_by_name(fileName: string): unknown;
|
|
30
|
+
export function set_autosave_timer(seconds: number): void;
|
|
31
|
+
export function get_save_path(fileName?: string): string;
|
|
32
|
+
export function get_save_version(): number;
|
|
33
|
+
export function set_migrations(
|
|
34
|
+
migrationList: ((
|
|
35
|
+
this: void,
|
|
36
|
+
gameState: any,
|
|
37
|
+
logger: LoggerInstance,
|
|
38
|
+
) => any)[],
|
|
39
|
+
): void;
|
|
40
|
+
export function apply_migrations(): void;
|
|
41
|
+
export function set_logger(logger: LoggerInstance): void;
|
|
42
|
+
export function set_logger(remove_logger: undefined): void;
|
|
43
|
+
export function get_current_game_project_folder(): string | undefined;
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see {@link https://github.com/Insality/defold-saver|Github Source}
|
|
6
|
+
* @see {@link https://github.com/Insality/defold-saver/blob/main/API_REFERENCE.md|API Reference}
|
|
7
|
+
* @example `import * as storage from 'saver.storage'`
|
|
8
|
+
* @noResolution
|
|
9
|
+
*/
|
|
10
|
+
declare module 'saver.storage' {
|
|
11
|
+
export function set(id: string, value: boolean | number | string): boolean;
|
|
12
|
+
export function get(id: string, defaultValue?: any): unknown;
|
|
13
|
+
export function get_number(id: string, defaultValue?: number): number;
|
|
14
|
+
export function get_string(id: string, defaultValue?: string): string;
|
|
15
|
+
export function get_boolean(id: string, defaultValue?: boolean): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Squid is a standalone injectable system for saveable logging of user logs, errors and crashes for Defold.
|
|
5
|
+
* @see {@link https://github.com/paweljarosz/squid|Github Source}
|
|
6
|
+
* @example `import * as squid from 'squid.squid'`
|
|
7
|
+
* @noResolution
|
|
8
|
+
*/
|
|
9
|
+
declare module 'squid.squid' {
|
|
10
|
+
type SquidConfig = {
|
|
11
|
+
app_catalog: string;
|
|
12
|
+
log_file_name: string;
|
|
13
|
+
log_file_extension: string;
|
|
14
|
+
is_enabled: boolean;
|
|
15
|
+
is_enabled_in_release: boolean;
|
|
16
|
+
is_printing: boolean;
|
|
17
|
+
is_saving: boolean;
|
|
18
|
+
is_adding_timestamp: boolean;
|
|
19
|
+
is_using_allowlist: boolean;
|
|
20
|
+
days_to_delete_logs: number;
|
|
21
|
+
min_log_level: number;
|
|
22
|
+
unsaved_logs_buffer: number;
|
|
23
|
+
max_data_length: number;
|
|
24
|
+
max_data_depth: number;
|
|
25
|
+
is_printing_crashes: boolean;
|
|
26
|
+
is_saving_crashes: boolean;
|
|
27
|
+
crash_file_name: string;
|
|
28
|
+
crash_file_extension: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
interface SquidShared {
|
|
32
|
+
ALLOWLIST: { [key: string]: boolean };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @noSelf **/
|
|
36
|
+
interface CoreModule extends SquidShared {
|
|
37
|
+
TRACE: number;
|
|
38
|
+
DEBUG: number;
|
|
39
|
+
INFO: number;
|
|
40
|
+
WARN: number;
|
|
41
|
+
ERROR: number;
|
|
42
|
+
/** Create a new instance of the Squid logger */
|
|
43
|
+
['new'](tag?: string, is_allowed?: boolean): SquidInstance;
|
|
44
|
+
|
|
45
|
+
/** Get Squid configuration */
|
|
46
|
+
get_config(): SquidConfig;
|
|
47
|
+
/** Set and use user configuration */
|
|
48
|
+
set_config(config: SquidConfig): void;
|
|
49
|
+
|
|
50
|
+
/** Initialize Squid for error and crash handling and logging */
|
|
51
|
+
init(): void;
|
|
52
|
+
|
|
53
|
+
/** Set if logs should be saved to file */
|
|
54
|
+
set_allowed(tag: string, enabled: boolean): void;
|
|
55
|
+
|
|
56
|
+
trace(message: string, data?: AnyNotNil, tag?: string): void;
|
|
57
|
+
debug(message: string, data?: AnyNotNil, tag?: string): void;
|
|
58
|
+
info(message: string, data?: AnyNotNil, tag?: string): void;
|
|
59
|
+
warn(message: string, data?: AnyNotNil, tag?: string): void;
|
|
60
|
+
error(message: string, data?: AnyNotNil, tag?: string): void;
|
|
61
|
+
|
|
62
|
+
/** Log message with provided level, message, data and tag */
|
|
63
|
+
log(message: string, level: number, data?: AnyNotNil, tag?: string): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Explicitly save buffer of unsaved logs to file
|
|
67
|
+
* @returns true if saved logs successfully, false otherwise
|
|
68
|
+
*/
|
|
69
|
+
save_logs(): boolean;
|
|
70
|
+
|
|
71
|
+
/** Finalize Squid logging - check for crashes and saved all unsaved buffered logs */
|
|
72
|
+
final(): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface SquidInstance extends SquidShared {
|
|
76
|
+
tag: string;
|
|
77
|
+
|
|
78
|
+
/** Initialize Squid for error and crash handling and logging */
|
|
79
|
+
init(): void;
|
|
80
|
+
|
|
81
|
+
/** Set if logs should be saved to file */
|
|
82
|
+
set_allowed(tag: string, enabled: boolean): void;
|
|
83
|
+
|
|
84
|
+
trace(message: string, data?: AnyNotNil, tag?: string): void;
|
|
85
|
+
debug(message: string, data?: AnyNotNil, tag?: string): void;
|
|
86
|
+
info(message: string, data?: AnyNotNil, tag?: string): void;
|
|
87
|
+
warn(message: string, data?: AnyNotNil, tag?: string): void;
|
|
88
|
+
error(message: string, data?: AnyNotNil, tag?: string): void;
|
|
89
|
+
|
|
90
|
+
/** Log message with provided level, message, data and tag */
|
|
91
|
+
log(message: string, level: number, data?: AnyNotNil, tag?: string): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Explicitly save buffer of unsaved logs to file
|
|
95
|
+
* @returns true if saved logs successfully, false otherwise
|
|
96
|
+
*/
|
|
97
|
+
save_logs(): boolean;
|
|
98
|
+
|
|
99
|
+
/** Finalize Squid logging - check for crashes and saved all unsaved buffered logs */
|
|
100
|
+
final(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type Squid = Readonly<CoreModule>;
|
|
104
|
+
const exportThis: Squid;
|
|
105
|
+
export = exportThis;
|
|
106
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see {@link https://github.com/VowSoftware/starly|Github Source}
|
|
5
|
+
* @example `import * as starly from 'starly.starly'`
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module 'starly.starly' {
|
|
9
|
+
interface CoreModule {
|
|
10
|
+
c_display_width: number;
|
|
11
|
+
c_display_height: number;
|
|
12
|
+
c_display_ratio: number;
|
|
13
|
+
c_behavior_center: Hash;
|
|
14
|
+
c_behavior_expand: Hash;
|
|
15
|
+
c_behavior_mixed: Hash;
|
|
16
|
+
c_behavior_stretch: Hash;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a camera. This function is called automatically in the game object's script component.
|
|
20
|
+
* @param id Camera game object id.
|
|
21
|
+
*/
|
|
22
|
+
create(id: Hash): void;
|
|
23
|
+
/**
|
|
24
|
+
* Destroys a camera. This function is called automatically in the game object's script component.
|
|
25
|
+
* @param id Camera game object id.
|
|
26
|
+
*/
|
|
27
|
+
destroy(id: Hash): void;
|
|
28
|
+
/**
|
|
29
|
+
* Activates a camera. This function should be called in the render script before any making any draw calls.
|
|
30
|
+
* @param id Camera game object id.
|
|
31
|
+
* @returns frustum
|
|
32
|
+
*/
|
|
33
|
+
activate(id: Hash): Matrix4;
|
|
34
|
+
/**
|
|
35
|
+
* Shakes a camera.
|
|
36
|
+
* @param id Camera game object id.
|
|
37
|
+
* @param count Amount of pingpong movements.
|
|
38
|
+
* @param duration Duration of each pingpong.
|
|
39
|
+
* @param radius Distance of each pingpong.
|
|
40
|
+
* @param [durationScalar] After each pingpong, the duration is scaled by this value.
|
|
41
|
+
* @param [radiusScalar] After each pingpong, the radius is scaled by this value.
|
|
42
|
+
*/
|
|
43
|
+
shake(
|
|
44
|
+
id: Hash,
|
|
45
|
+
count: number,
|
|
46
|
+
duration: number,
|
|
47
|
+
radius: number,
|
|
48
|
+
durationScalar?: number,
|
|
49
|
+
radiusScalar?: number,
|
|
50
|
+
): void;
|
|
51
|
+
/**
|
|
52
|
+
* Cancels an ongoing camera shake.
|
|
53
|
+
* @param id Camera game object id.
|
|
54
|
+
*/
|
|
55
|
+
cancel_shake(id: Hash): void;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if a camera is shaking.
|
|
58
|
+
* @param id Camera game object id.
|
|
59
|
+
*/
|
|
60
|
+
is_shaking(id: Hash): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the position offset of a camera after moving distance units, accounting for zoom and rotation.
|
|
63
|
+
* @param id Camera game object id.
|
|
64
|
+
* @param distance Position offset, before accounting for zoom and rotation.
|
|
65
|
+
* @param absolute Determines if `distance` is in absolute world coordinates, which ignore rotation.
|
|
66
|
+
*/
|
|
67
|
+
get_offset(
|
|
68
|
+
id: Hash,
|
|
69
|
+
distance: Vector3,
|
|
70
|
+
absolute: boolean,
|
|
71
|
+
): Vector3;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the world area of a camera, which is defined as the rectangular area of the world that the camera can see, in world coordinates.
|
|
74
|
+
* @param id Camera game object id.
|
|
75
|
+
* @returns x, y, width, height
|
|
76
|
+
*/
|
|
77
|
+
get_world_area(id: Hash): LuaMultiReturn<[number, number, number, number]>;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the center position, minimum zoom, and minimum world area of a camera that can see all positions.
|
|
80
|
+
*
|
|
81
|
+
* This function was inspired by Super Smash Bros, where the camera moves and zooms to center and include all characters, with only a small amount of padding to the sides of the window.
|
|
82
|
+
* @param id Camera game object id.
|
|
83
|
+
* @param positions Array of `vector3` positions, in world coordinates.
|
|
84
|
+
* @returns position, zoom, x, y, width, height
|
|
85
|
+
*/
|
|
86
|
+
get_tight_world_area(
|
|
87
|
+
id: Hash,
|
|
88
|
+
positions: Vector3[],
|
|
89
|
+
): LuaMultiReturn<[Vector3, number, number, number, number, number]>;
|
|
90
|
+
/**
|
|
91
|
+
* Converts screen coordinates to world coordinates.
|
|
92
|
+
* @param id Camera game object id.
|
|
93
|
+
* @param screenX
|
|
94
|
+
* @param screenY
|
|
95
|
+
* @param [visible] Determines if the cursor must be visible to the camera. If `true`, then this function returns `undefined` when the cursor is outside the camera's viewport.
|
|
96
|
+
*/
|
|
97
|
+
screen_to_world(
|
|
98
|
+
id: Hash,
|
|
99
|
+
screenX: number,
|
|
100
|
+
screenY: number,
|
|
101
|
+
visible?: boolean,
|
|
102
|
+
): Vector3 | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Converts world coordinates to screen coordinates.
|
|
105
|
+
* @param id Camera game object id.
|
|
106
|
+
* @param worldPosition
|
|
107
|
+
* @param [visible] Determines if the cursor must be visible to the camera. If `true`, then this function returns `undefined` when the cursor is outside the camera's viewport.
|
|
108
|
+
*/
|
|
109
|
+
world_to_screen(
|
|
110
|
+
id: Hash,
|
|
111
|
+
worldPosition: Vector3,
|
|
112
|
+
visible?: boolean,
|
|
113
|
+
): Vector3 | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Gets the viewport of a camera, in screen coordinates.
|
|
116
|
+
* @param id Camera game object id.
|
|
117
|
+
* @returns x, y, width, height
|
|
118
|
+
*/
|
|
119
|
+
get_viewport(id: Hash): LuaMultiReturn<[number, number, number, number]>;
|
|
120
|
+
/**
|
|
121
|
+
* Gets the view of a camera.
|
|
122
|
+
* @param id Camera game object id.
|
|
123
|
+
*/
|
|
124
|
+
get_view(id: Hash): Matrix4;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the projection of a camera.
|
|
127
|
+
* @param id Camera game object id.
|
|
128
|
+
*/
|
|
129
|
+
get_projection(id: Hash): Matrix4;
|
|
130
|
+
}
|
|
131
|
+
type CameraMap = LuaMap<
|
|
132
|
+
Hash,
|
|
133
|
+
{
|
|
134
|
+
behavior: Hash;
|
|
135
|
+
viewport_x: number;
|
|
136
|
+
viewport_y: number;
|
|
137
|
+
viewport_width: number;
|
|
138
|
+
viewport_height: number;
|
|
139
|
+
near: number;
|
|
140
|
+
far: number;
|
|
141
|
+
zoom: number;
|
|
142
|
+
}
|
|
143
|
+
>;
|
|
144
|
+
|
|
145
|
+
type Starley = CameraMap & Readonly<CoreModule>;
|
|
146
|
+
const exportThis: Starley;
|
|
147
|
+
export = exportThis;
|
|
148
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Timer Based Defold Tween Library
|
|
5
|
+
* @see {@link https://github.com/Insality/defold-tweener|Github Source}
|
|
6
|
+
* @noResolution
|
|
7
|
+
*/
|
|
8
|
+
declare module 'tweener.tweener' {
|
|
9
|
+
type TweenFunc = Readonly<{ __brand: 'tweener' }> & number;
|
|
10
|
+
type AnyTweenFunc =
|
|
11
|
+
| TweenFunc
|
|
12
|
+
| typeof go.EASING_INBACK
|
|
13
|
+
| typeof go.EASING_INBOUNCE
|
|
14
|
+
| typeof go.EASING_INCIRC
|
|
15
|
+
| typeof go.EASING_INCUBIC
|
|
16
|
+
| typeof go.EASING_INELASTIC
|
|
17
|
+
| typeof go.EASING_INEXPO
|
|
18
|
+
| typeof go.EASING_INOUTBACK
|
|
19
|
+
| typeof go.EASING_INOUTBOUNCE
|
|
20
|
+
| typeof go.EASING_INOUTCIRC
|
|
21
|
+
| typeof go.EASING_INOUTCUBIC
|
|
22
|
+
| typeof go.EASING_INOUTELASTIC
|
|
23
|
+
| typeof go.EASING_INOUTEXPO
|
|
24
|
+
| typeof go.EASING_INOUTQUAD
|
|
25
|
+
| typeof go.EASING_INOUTQUART
|
|
26
|
+
| typeof go.EASING_INOUTQUINT
|
|
27
|
+
| typeof go.EASING_INOUTSINE
|
|
28
|
+
| typeof go.EASING_INQUAD
|
|
29
|
+
| typeof go.EASING_INQUART
|
|
30
|
+
| typeof go.EASING_INQUINT
|
|
31
|
+
| typeof go.EASING_INSINE
|
|
32
|
+
| typeof go.EASING_LINEAR
|
|
33
|
+
| typeof go.EASING_OUTBACK
|
|
34
|
+
| typeof go.EASING_OUTBOUNCE
|
|
35
|
+
| typeof go.EASING_OUTCIRC
|
|
36
|
+
| typeof go.EASING_OUTCUBIC
|
|
37
|
+
| typeof go.EASING_OUTELASTIC
|
|
38
|
+
| typeof go.EASING_OUTEXPO
|
|
39
|
+
| typeof go.EASING_OUTINBACK
|
|
40
|
+
| typeof go.EASING_OUTINBOUNCE
|
|
41
|
+
| typeof go.EASING_OUTINCIRC
|
|
42
|
+
| typeof go.EASING_OUTINCUBIC
|
|
43
|
+
| typeof go.EASING_OUTINELASTIC
|
|
44
|
+
| typeof go.EASING_OUTINEXPO
|
|
45
|
+
| typeof go.EASING_OUTINQUAD
|
|
46
|
+
| typeof go.EASING_OUTINQUART
|
|
47
|
+
| typeof go.EASING_OUTINQUINT
|
|
48
|
+
| typeof go.EASING_OUTINSINE
|
|
49
|
+
| typeof go.EASING_OUTQUAD
|
|
50
|
+
| typeof go.EASING_OUTQUART
|
|
51
|
+
| typeof go.EASING_OUTQUINT
|
|
52
|
+
| typeof go.EASING_OUTSINE
|
|
53
|
+
| typeof gui.EASING_INBACK
|
|
54
|
+
| typeof gui.EASING_INBOUNCE
|
|
55
|
+
| typeof gui.EASING_INCIRC
|
|
56
|
+
| typeof gui.EASING_INCUBIC
|
|
57
|
+
| typeof gui.EASING_INELASTIC
|
|
58
|
+
| typeof gui.EASING_INEXPO
|
|
59
|
+
| typeof gui.EASING_INOUTBACK
|
|
60
|
+
| typeof gui.EASING_INOUTBOUNCE
|
|
61
|
+
| typeof gui.EASING_INOUTCIRC
|
|
62
|
+
| typeof gui.EASING_INOUTCUBIC
|
|
63
|
+
| typeof gui.EASING_INOUTELASTIC
|
|
64
|
+
| typeof gui.EASING_INOUTEXPO
|
|
65
|
+
| typeof gui.EASING_INOUTQUAD
|
|
66
|
+
| typeof gui.EASING_INOUTQUART
|
|
67
|
+
| typeof gui.EASING_INOUTQUINT
|
|
68
|
+
| typeof gui.EASING_INOUTSINE
|
|
69
|
+
| typeof gui.EASING_INQUAD
|
|
70
|
+
| typeof gui.EASING_INQUART
|
|
71
|
+
| typeof gui.EASING_INQUINT
|
|
72
|
+
| typeof gui.EASING_INSINE
|
|
73
|
+
| typeof gui.EASING_LINEAR
|
|
74
|
+
| typeof gui.EASING_OUTBACK
|
|
75
|
+
| typeof gui.EASING_OUTBOUNCE
|
|
76
|
+
| typeof gui.EASING_OUTCIRC
|
|
77
|
+
| typeof gui.EASING_OUTCUBIC
|
|
78
|
+
| typeof gui.EASING_OUTELASTIC
|
|
79
|
+
| typeof gui.EASING_OUTEXPO
|
|
80
|
+
| typeof gui.EASING_OUTINBACK
|
|
81
|
+
| typeof gui.EASING_OUTINBOUNCE
|
|
82
|
+
| typeof gui.EASING_OUTINCIRC
|
|
83
|
+
| typeof gui.EASING_OUTINCUBIC
|
|
84
|
+
| typeof gui.EASING_OUTINELASTIC
|
|
85
|
+
| typeof gui.EASING_OUTINEXPO
|
|
86
|
+
| typeof gui.EASING_OUTINQUAD
|
|
87
|
+
| typeof gui.EASING_OUTINQUART
|
|
88
|
+
| typeof gui.EASING_OUTINQUINT
|
|
89
|
+
| typeof gui.EASING_OUTINSINE
|
|
90
|
+
| typeof gui.EASING_OUTQUAD
|
|
91
|
+
| typeof gui.EASING_OUTQUART
|
|
92
|
+
| typeof gui.EASING_OUTQUINT
|
|
93
|
+
| typeof gui.EASING_OUTSINE;
|
|
94
|
+
export const insine: TweenFunc;
|
|
95
|
+
export const inquad: TweenFunc;
|
|
96
|
+
export const incubic: TweenFunc;
|
|
97
|
+
export const incirc: TweenFunc;
|
|
98
|
+
export const inquart: TweenFunc;
|
|
99
|
+
export const inquint: TweenFunc;
|
|
100
|
+
export const inexpo: TweenFunc;
|
|
101
|
+
export const inback: TweenFunc;
|
|
102
|
+
export const inelastic: TweenFunc;
|
|
103
|
+
export const inbounce: TweenFunc;
|
|
104
|
+
export const outsine: TweenFunc;
|
|
105
|
+
export const outquad: TweenFunc;
|
|
106
|
+
export const outcubic: TweenFunc;
|
|
107
|
+
export const outcirc: TweenFunc;
|
|
108
|
+
export const outquart: TweenFunc;
|
|
109
|
+
export const outquint: TweenFunc;
|
|
110
|
+
export const outexpo: TweenFunc;
|
|
111
|
+
export const outback: TweenFunc;
|
|
112
|
+
export const outelastic: TweenFunc;
|
|
113
|
+
export const outbounce: TweenFunc;
|
|
114
|
+
export const inoutsine: TweenFunc;
|
|
115
|
+
export const inoutquad: TweenFunc;
|
|
116
|
+
export const inoutcubic: TweenFunc;
|
|
117
|
+
export const inoutcirc: TweenFunc;
|
|
118
|
+
export const inoutquart: TweenFunc;
|
|
119
|
+
export const inoutquint: TweenFunc;
|
|
120
|
+
export const inoutexpo: TweenFunc;
|
|
121
|
+
export const inoutback: TweenFunc;
|
|
122
|
+
export const inoutelastic: TweenFunc;
|
|
123
|
+
export const inoutbounce: TweenFunc;
|
|
124
|
+
export const outinsine: TweenFunc;
|
|
125
|
+
export const outinquad: TweenFunc;
|
|
126
|
+
export const outincubic: TweenFunc;
|
|
127
|
+
export const outincirc: TweenFunc;
|
|
128
|
+
export const outinquart: TweenFunc;
|
|
129
|
+
export const outinquint: TweenFunc;
|
|
130
|
+
export const outinexpo: TweenFunc;
|
|
131
|
+
export const outinback: TweenFunc;
|
|
132
|
+
export const outinelastic: TweenFunc;
|
|
133
|
+
export const outinbounce: TweenFunc;
|
|
134
|
+
|
|
135
|
+
export function tween(
|
|
136
|
+
tween_function: AnyTweenFunc,
|
|
137
|
+
from: number,
|
|
138
|
+
to: number,
|
|
139
|
+
time: number,
|
|
140
|
+
callback: (value: number, is_final_call: boolean) => void,
|
|
141
|
+
dt?: number,
|
|
142
|
+
): Hash;
|
|
143
|
+
|
|
144
|
+
export function ease(
|
|
145
|
+
tween_function: AnyTweenFunc,
|
|
146
|
+
from: number,
|
|
147
|
+
to: number,
|
|
148
|
+
time: number,
|
|
149
|
+
time_elapsed: number,
|
|
150
|
+
): number;
|
|
151
|
+
}
|