feat: initial commit
This commit is contained in:
commit
faaaa3d324
32 changed files with 77324 additions and 0 deletions
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"geequlim.godot-tools"
|
||||
]
|
||||
}
|
44
flake.lock
generated
Normal file
44
flake.lock
generated
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
17
flake.nix
Normal file
17
flake.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
description = "An opinionated collection of nix packages and templates to scaffold projects with.";
|
||||
|
||||
outputs = { ... }:
|
||||
{
|
||||
templates = {
|
||||
|
||||
godot-js = {
|
||||
path = ./godot-js;
|
||||
description = ''
|
||||
Scaffolds a project using pkgs.godot with https://github.com/godotjs/GodotJS installed containing a justfile which will start the godot editor with the project loaded.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
5
godot-js/.envrc
Normal file
5
godot-js/.envrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
# shellcheck shell=bash
|
||||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
|
||||
fi
|
||||
use flake
|
20
godot-js/.gitignore
vendored
Normal file
20
godot-js/.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
**/.DS_Store
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_credentials.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
# GodotJS example project
|
||||
node_modules/
|
||||
android/
|
151
godot-js/flake.lock
generated
Normal file
151
godot-js/flake.lock
generated
Normal file
|
@ -0,0 +1,151 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": [
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"godot4-withmodules": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1740281046,
|
||||
"narHash": "sha256-zNEJQ9+BmZXRCsTqnSFEP1g7zTQGYncsm24w+95xidg=",
|
||||
"ref": "main",
|
||||
"rev": "fb0fc3a37f4cc073503d6cd822086b12d4005e39",
|
||||
"revCount": 1,
|
||||
"type": "git",
|
||||
"url": "https://git.xnia.org/evar/nix-godot-with-modules.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "main",
|
||||
"type": "git",
|
||||
"url": "https://git.xnia.org/evar/nix-godot-with-modules.git"
|
||||
}
|
||||
},
|
||||
"godotjs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1740188181,
|
||||
"narHash": "sha256-R74u0yjZvbj7ednM7ShE6TM1elxJwayL9/pDWqzdaKs=",
|
||||
"owner": "godotjs",
|
||||
"repo": "GodotJS",
|
||||
"rev": "32509038096f2abe5b9452e053de1eff21f44398",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "godotjs",
|
||||
"repo": "GodotJS",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1739866667,
|
||||
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1740019556,
|
||||
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dad564433178067be1fbdfcce23b546254b6d641",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"godot4-withmodules": "godot4-withmodules",
|
||||
"godotjs": "godotjs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"systems": "systems_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
77
godot-js/flake.nix
Normal file
77
godot-js/flake.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
inputs.godotjs = {
|
||||
url = "github:godotjs/GodotJS";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
inputs.godot4-withmodules.url = "git+https://git.xnia.org/evar/nix-godot-with-modules.git?ref=main";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.systems.url = "github:nix-systems/default";
|
||||
inputs.flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, godot4-withmodules, godotjs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
# pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.godot_4-js-unwrapped = (godot4-withmodules.packages.${system}.godot.withModules [
|
||||
{ name = "GodotJS"; path = godotjs; }
|
||||
])
|
||||
# TODO: This isn't vary nix-native; this should really build a v8 drv from
|
||||
# source from following the instructions here at https://github.com/godotjs/GodotJS/wiki/Building-from-Source
|
||||
# but I don't really feel like it right now, so let's just use some prebuilt deps.
|
||||
.overrideAttrs (prev: let
|
||||
godotJSDeps = pkgs.fetchurl {
|
||||
url = "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_12.4.254.21_r13/v8_12.4.254.21_r13.zip";
|
||||
hash = "sha256-v+0iW9kveu3tD/QFEX+wKhZ3vbmSTVVCErY1LYfW904=";
|
||||
};
|
||||
in {
|
||||
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.p7zip ];
|
||||
postPatch = prev.postPatch +
|
||||
''
|
||||
7z x -omodules/GodotJS ${godotJSDeps}
|
||||
'';
|
||||
});
|
||||
|
||||
packages.godot_4-js = let inherit (self.packages.${system}) godot_4-js-unwrapped; in pkgs.symlinkJoin rec {
|
||||
inherit (godot_4-js-unwrapped) name version;
|
||||
pname = "godot4-js";
|
||||
paths = [ godot_4-js-unwrapped ];
|
||||
postBuild = ''
|
||||
mv $out/bin/${godot_4-js-unwrapped.pname} $out/bin/${pname}
|
||||
'';
|
||||
};
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
self.packages.${system}.godot_4-js
|
||||
|
||||
just
|
||||
pnpm
|
||||
nodejs
|
||||
|
||||
typescript
|
||||
typescript-language-server
|
||||
|
||||
vscodium-fhs
|
||||
(vscode-with-extensions.override {
|
||||
vscodeExtensions = with vscode-extensions; [
|
||||
|
||||
];
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
4
godot-js/justfile
Normal file
4
godot-js/justfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
default:
|
||||
npm --prefix ./src install
|
||||
codium ./src/ >/dev/null 2>&1 &
|
||||
godot4-js ./src/project.godot >/dev/null 2>&1 &
|
2
godot-js/src/.gitattributes
vendored
Normal file
2
godot-js/src/.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
3
godot-js/src/.gitignore
vendored
Normal file
3
godot-js/src/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
5
godot-js/src/.vscode/extensions.json
vendored
Normal file
5
godot-js/src/.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"geequlim.godot-tools"
|
||||
]
|
||||
}
|
13
godot-js/src/.vscode/launch.json
vendored
Normal file
13
godot-js/src/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"name": "Attach (Inspector)",
|
||||
"protocol": "inspector",
|
||||
"address": "127.0.0.1",
|
||||
"port": 9229,
|
||||
}
|
||||
]
|
||||
}
|
3
godot-js/src/.vscode/settings.json
vendored
Normal file
3
godot-js/src/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"godotTools.editorPath.godot4": "godot4-js"
|
||||
}
|
1
godot-js/src/icon.svg
Normal file
1
godot-js/src/icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
After Width: | Height: | Size: 994 B |
37
godot-js/src/icon.svg.import
Normal file
37
godot-js/src/icon.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bmckcridn8evh"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
44
godot-js/src/package-lock.json
generated
Normal file
44
godot-js/src/package-lock.json
generated
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "src",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.30",
|
||||
"typescript": "^5.4.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.17.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.19.tgz",
|
||||
"integrity": "sha512-LEwC7o1ifqg/6r2gn9Dns0f1rhK+fPFDoMiceTJ6kWmVk6bgXBI/9IOWfVan4WiAavK9pIVWdX0/e3J+eEUh5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.7.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
|
||||
"integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
6
godot-js/src/package.json
Normal file
6
godot-js/src/package.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.30",
|
||||
"typescript": "^5.4.3"
|
||||
}
|
||||
}
|
15
godot-js/src/project.godot
Normal file
15
godot-js/src/project.godot
Normal file
|
@ -0,0 +1,15 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="New Game Project"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
113
godot-js/src/tsconfig.json
Normal file
113
godot-js/src/tsconfig.json
Normal file
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
"tsBuildInfoFile": ".godot/.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "CommonJS", /* Specify what module code is generated. */
|
||||
"rootDir": "./", /* Specify the root folder within your source files. */
|
||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
"typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
"./node_modules/@types","./typings"
|
||||
],
|
||||
"types": [
|
||||
"node"
|
||||
], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
"outDir": ".godot/GodotJS", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
"sourceRoot": "../../", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
"newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||
"noEmitOnError": false, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
}
|
||||
}
|
1
godot-js/src/typings/.gdignore
Normal file
1
godot-js/src/typings/.gdignore
Normal file
|
@ -0,0 +1 @@
|
|||
|
282
godot-js/src/typings/godot.minimal.d.ts
vendored
Normal file
282
godot-js/src/typings/godot.minimal.d.ts
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
|
||||
declare module "godot-jsb" {
|
||||
import { Object as GDObject, PackedByteArray, PropertyUsageFlags, PropertyHint, MethodFlags, Variant, Callable0, Callable1, Callable2, Callable3, Callable4, Callable5, StringName, MultiplayerAPI, MultiplayerPeer } from "godot";
|
||||
|
||||
const DEV_ENABLED: boolean;
|
||||
const TOOLS_ENABLED: boolean;
|
||||
|
||||
/** version of GodotJS */
|
||||
const version: string;
|
||||
|
||||
/** impl currently used */
|
||||
const impl: string;
|
||||
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<R = void>(self: GDObject, fn: () => R): Callable0<R>;
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, R = void>(self: GDObject, fn: (v1: T1) => R): Callable1<T1, R>;
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, R = void>(self: GDObject, fn: (v1: T1, v2: T2) => R): Callable2<T1, T2, R>;
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3<T1, T2, T3, R>;
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, T4, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4<T1, T2, T3, T4, R>;
|
||||
/**
|
||||
* Create godot Callable with a bound object `self`.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, T4, T5, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5<T1, T2, T3, T4, T5, R>;
|
||||
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<R = void>(fn: () => R): Callable0<R>;
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, R = void>(fn: (v1: T1) => R): Callable1<T1, R>;
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, R = void>(fn: (v1: T1, v2: T2) => R): Callable2<T1, T2, R>;
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, R = void>(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3<T1, T2, T3, R>;
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, T4, R = void>(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4<T1, T2, T3, T4, R>;
|
||||
/**
|
||||
* Create godot Callable without a bound object.
|
||||
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||
*/
|
||||
function callable<T1, T2, T3, T4, T5, R = void>(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5<T1, T2, T3, T4, T5, R>;
|
||||
|
||||
/**
|
||||
* Explicitly convert a `PackedByteArray`(aka `Vector<uint8_t>`) into a javascript `ArrayBuffer`
|
||||
* @deprecated [WARNING] This free function '_to_array_buffer' is deprecated and will be removed in a future version, use 'PackedByteArray.to_array_buffer()' instead.
|
||||
*/
|
||||
function to_array_buffer(packed: PackedByteArray): ArrayBuffer;
|
||||
|
||||
interface ScriptPropertyInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
class_?: Function;
|
||||
hint?: number;
|
||||
hint_string?: string;
|
||||
usage?: number;
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
type OnReadyEvaluatorFunc = (self: any) => any;
|
||||
|
||||
interface RPCConfig {
|
||||
mode?: MultiplayerAPI.RPCMode,
|
||||
sync?: boolean,
|
||||
transfer_mode?: MultiplayerPeer.TransferMode,
|
||||
transfer_channel?: number,
|
||||
}
|
||||
|
||||
function add_script_signal(target: any, name: string): void;
|
||||
function add_script_property(target: any, details: ScriptPropertyInfo): void;
|
||||
function add_script_ready(target: any, details: { name: string, evaluator: string | OnReadyEvaluatorFunc }): void;
|
||||
function add_script_tool(target: any): void;
|
||||
function add_script_icon(target: any, path: string): void;
|
||||
function add_script_rpc(target: any, propertyKey: string, config: RPCConfig): void;
|
||||
|
||||
// 0: deprecated, 1: experimental, 2: help
|
||||
function set_script_doc(target: any, propertyKey?: string, field: 0 | 1 | 2, message: string): void;
|
||||
|
||||
function add_module(id: string, obj: any): void;
|
||||
function find_module(id: string): any;
|
||||
function notify_microtasks_run(): void;
|
||||
|
||||
/**
|
||||
* Get the transformed type name of a Variant.Type
|
||||
*/
|
||||
function get_type_name(type: Variant.Type): StringName;
|
||||
}
|
||||
|
||||
namespace editor {
|
||||
interface PrimitiveConstantInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
value: number; /* only if type is literal */
|
||||
}
|
||||
|
||||
interface ConstantInfo {
|
||||
name: string;
|
||||
value: number; /** int64_t */
|
||||
}
|
||||
|
||||
interface EnumInfo {
|
||||
name: string;
|
||||
|
||||
literals: Array<string>;
|
||||
is_bitfield: boolean;
|
||||
}
|
||||
|
||||
interface DefaultArgumentInfo {
|
||||
type: Variant.Type;
|
||||
value: any;
|
||||
}
|
||||
|
||||
// we treat godot MethodInfo/MethodBind as the same thing here for simplicity
|
||||
//NOTE some fields will not be set if it's actually a MethodInfo struct
|
||||
interface MethodBind {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
hint_flags: MethodFlags;
|
||||
is_static: boolean;
|
||||
is_const: boolean;
|
||||
is_vararg: boolean;
|
||||
argument_count: number; /** int32_t */
|
||||
|
||||
args_: Array<PropertyInfo>;
|
||||
default_arguments?: Array<DefaultArgumentInfo>;
|
||||
return_: PropertyInfo | undefined;
|
||||
}
|
||||
|
||||
interface PropertyInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
class_name: string;
|
||||
hint: PropertyHint;
|
||||
hint_string: string;
|
||||
usage: PropertyUsageFlags;
|
||||
}
|
||||
|
||||
interface PropertySetGetInfo {
|
||||
name: string;
|
||||
|
||||
type: Variant.Type;
|
||||
index: number;
|
||||
setter: string;
|
||||
getter: string;
|
||||
|
||||
info: PropertyInfo;
|
||||
}
|
||||
|
||||
interface PrimitiveGetSetInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
}
|
||||
|
||||
interface SignalInfo {
|
||||
name: string;
|
||||
method_: MethodBind;
|
||||
}
|
||||
|
||||
interface ArgumentInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
}
|
||||
|
||||
interface ConstructorInfo {
|
||||
arguments: Array<ArgumentInfo>
|
||||
}
|
||||
|
||||
interface OperatorInfo {
|
||||
name: string;
|
||||
return_type: Variant.Type;
|
||||
left_type: Variant.Type;
|
||||
right_type: Variant.Type;
|
||||
}
|
||||
|
||||
interface BasicClassInfo {
|
||||
name: string;
|
||||
methods: Array<MethodBind>;
|
||||
enums?: Array<EnumInfo>;
|
||||
}
|
||||
|
||||
// godot class
|
||||
interface ClassInfo extends BasicClassInfo {
|
||||
super: string;
|
||||
|
||||
properties: Array<PropertySetGetInfo>;
|
||||
virtual_methods: Array<MethodBind>;
|
||||
signals: Array<SignalInfo>;
|
||||
constants?: Array<ConstantInfo>;
|
||||
}
|
||||
|
||||
// variant class
|
||||
interface PrimitiveClassInfo extends BasicClassInfo {
|
||||
// self type
|
||||
type: Variant.Type;
|
||||
|
||||
// valid only if has_indexing
|
||||
element_type?: Variant.Type;
|
||||
|
||||
// true only if is_keyed
|
||||
is_keyed: boolean;
|
||||
|
||||
constructors: Array<ConstructorInfo>;
|
||||
operators: Array<OperatorInfo>;
|
||||
properties: Array<PrimitiveGetSetInfo>;
|
||||
constants?: Array<PrimitiveConstantInfo>;
|
||||
}
|
||||
|
||||
interface SingletonInfo {
|
||||
name: string;
|
||||
class_name: string;
|
||||
user_created: boolean;
|
||||
editor_only: boolean;
|
||||
}
|
||||
|
||||
interface GlobalConstantInfo {
|
||||
name: string;
|
||||
values: { [name: string]: number /** int64_t */ };
|
||||
}
|
||||
|
||||
interface ClassDoc {
|
||||
brief_description: string;
|
||||
|
||||
constants: { [name: string]: { description: string } };
|
||||
methods: { [name: string]: { description: string } };
|
||||
properties: { [name: string]: { description: string } };
|
||||
signals: { [name: string]: { description: string } };
|
||||
}
|
||||
|
||||
function get_class_doc(class_name: string): ClassDoc | undefined;
|
||||
|
||||
/**
|
||||
* get a list of all classes registered in ClassDB
|
||||
*/
|
||||
function get_classes(): Array<ClassInfo>;
|
||||
|
||||
function get_primitive_types(): Array<PrimitiveClassInfo>;
|
||||
|
||||
function get_singletons(): Array<SingletonInfo>;
|
||||
|
||||
function get_global_constants(): Array<GlobalConstantInfo>;
|
||||
|
||||
function get_utility_functions(): Array<MethodBind>;
|
||||
|
||||
function delete_file(filepath: string): void;
|
||||
|
||||
const VERSION_DOCS_URL: string;
|
||||
}
|
||||
}
|
||||
|
189
godot-js/src/typings/godot.mix.d.ts
vendored
Normal file
189
godot-js/src/typings/godot.mix.d.ts
vendored
Normal file
|
@ -0,0 +1,189 @@
|
|||
/// <reference no-default-lib="true"/>
|
||||
declare module "godot" {
|
||||
export const IntegerType: unique symbol;
|
||||
export const FloatType: unique symbol;
|
||||
|
||||
/** A built-in type representing a method or a standalone function.
|
||||
*
|
||||
* @link https://docs.godotengine.org/en/4.2/classes/class_callable.html
|
||||
*/
|
||||
interface AnyCallable {
|
||||
/** Returns `true` if this [Callable] has no target to call the method on. */
|
||||
is_null(): boolean
|
||||
|
||||
/** Returns `true` if this [Callable] is a custom callable. Custom callables are created from [method bind] or [method unbind]. In GDScript, lambda functions are also custom callables. */
|
||||
is_custom(): boolean
|
||||
|
||||
/** Returns `true` if this [Callable] is a standard callable. This method is the opposite of [method is_custom]. Returns `false` if this callable is a lambda function. */
|
||||
is_standard(): boolean
|
||||
|
||||
/** Returns `true` if the callable's object exists and has a valid method name assigned, or is a custom callable. */
|
||||
is_valid(): boolean
|
||||
|
||||
/** Returns the object on which this [Callable] is called. */
|
||||
get_object(): Object
|
||||
|
||||
/** Returns the ID of this [Callable]'s object (see [method Object.get_instance_id]). */
|
||||
get_object_id(): int64
|
||||
|
||||
/** Returns the name of the method represented by this [Callable]. If the callable is a GDScript lambda function, returns the function's name or `"<anonymous lambda>"`. */
|
||||
get_method(): StringName
|
||||
|
||||
/** Returns the total amount of arguments bound (or unbound) via successive [method bind] or [method unbind] calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero. */
|
||||
get_bound_arguments_count(): int64
|
||||
|
||||
/** Return the bound arguments (as long as [method get_bound_arguments_count] is greater than zero), or empty (if [method get_bound_arguments_count] is less than or equal to zero). */
|
||||
get_bound_arguments(): Array
|
||||
|
||||
/** Returns the 32-bit hash value of this [Callable]'s object.
|
||||
*
|
||||
* **Note:** [Callable]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does *not* imply the callables are equal, because different callables can have identical hash values due to hash collisions. The engine uses a 32-bit hash algorithm for [method hash].
|
||||
*/
|
||||
hash(): int64
|
||||
|
||||
/** Returns a copy of this [Callable] with one or more arguments bound. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind].
|
||||
*
|
||||
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
|
||||
*/
|
||||
bind(...vargargs: any[]): AnyCallable
|
||||
|
||||
/** Returns a copy of this [Callable] with one or more arguments bound, reading them from an array. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind].
|
||||
*
|
||||
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
|
||||
*/
|
||||
bindv(arguments_: GArray): AnyCallable
|
||||
|
||||
/** Returns a copy of this [Callable] with a number of arguments unbound. In other words, when the new callable is called the last few arguments supplied by the user are ignored, according to [param argcount]. The remaining arguments are passed to the callable. This allows to use the original callable in a context that attempts to pass more arguments than this callable can handle, e.g. a signal with a fixed number of arguments. See also [method bind].
|
||||
*
|
||||
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
|
||||
*
|
||||
*/
|
||||
unbind(argcount: int64): AnyCallable
|
||||
|
||||
/** Calls the method represented by this [Callable]. Arguments can be passed and should match the method's signature. */
|
||||
call(...vargargs: any[]): any
|
||||
|
||||
/** Calls the method represented by this [Callable]. Unlike [method call], this method expects all arguments to be contained inside the [param arguments] [Array]. */
|
||||
callv(arguments_: GArray): any
|
||||
|
||||
/** Calls the method represented by this [Callable] in deferred mode, i.e. at the end of the current frame. Arguments can be passed and should match the method's signature.
|
||||
*
|
||||
*
|
||||
* **Note:** Deferred calls are processed at idle time. Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
|
||||
* See also [method Object.call_deferred].
|
||||
*/
|
||||
call_deferred(...vargargs: any[]): void
|
||||
}
|
||||
|
||||
/** A built-in type representing a signal of an [Object].
|
||||
*
|
||||
* @link https://docs.godotengine.org/en/4.2/classes/class_signal.html
|
||||
*/
|
||||
interface AnySignal {
|
||||
/** Returns `true` if the signal's name does not exist in its object, or the object is not valid. */
|
||||
is_null(): boolean
|
||||
|
||||
/** Returns the object emitting this signal. */
|
||||
get_object(): Object
|
||||
|
||||
/** Returns the ID of the object emitting this signal (see [method Object.get_instance_id]). */
|
||||
get_object_id(): int64
|
||||
|
||||
/** Returns the name of this signal. */
|
||||
get_name(): StringName
|
||||
|
||||
/** Returns `true` if the specified [Callable] is connected to this signal. */
|
||||
is_connected(callable: AnyCallable): boolean
|
||||
|
||||
/** Returns an [Array] of connections for this signal. Each connection is represented as a [Dictionary] that contains three entries:
|
||||
* - `signal` is a reference to this signal;
|
||||
* - `callable` is a reference to the connected [Callable];
|
||||
* - `flags` is a combination of [enum Object.ConnectFlags].
|
||||
*/
|
||||
get_connections(): Array
|
||||
}
|
||||
|
||||
interface Callable0<R = void> extends AnyCallable {
|
||||
call(): R;
|
||||
}
|
||||
|
||||
interface Callable1<T1, R = void> extends AnyCallable {
|
||||
call(v1: T1): R;
|
||||
}
|
||||
|
||||
interface Callable2<T1, T2, R = void> extends AnyCallable {
|
||||
call(v1: T1, v2, T2): R;
|
||||
}
|
||||
|
||||
interface Callable3<T1, T2, T3, R = void> extends AnyCallable {
|
||||
call(v1: T1, v2: T2, v3: T3): R;
|
||||
}
|
||||
|
||||
interface Callable4<T1, T2, T3, T4, R = void> extends AnyCallable {
|
||||
call(v1: T1, v2: T2, v3: T3, v4: T4): R;
|
||||
}
|
||||
|
||||
interface Callable5<T1, T2, T3, T4, T5, R = void> extends AnyCallable {
|
||||
call(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): R;
|
||||
}
|
||||
|
||||
interface Signal0 extends AnySignal {
|
||||
connect(callable: Callable0, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable0): void;
|
||||
is_connected(callable: Callable0): boolean;
|
||||
emit(): void;
|
||||
|
||||
as_promise(): Promise<void>;
|
||||
}
|
||||
|
||||
interface Signal1<T1> extends AnySignal {
|
||||
connect(callable: Callable1<T1>, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable1<T1>): void;
|
||||
is_connected(callable: Callable1<T1>): boolean;
|
||||
emit(v1: T1): void;
|
||||
|
||||
// the first argument is used as the resolved value
|
||||
as_promise(): Promise<T1>;
|
||||
}
|
||||
|
||||
interface Signal2<T1, T2> extends AnySignal {
|
||||
connect(callable: Callable2<T1, T2>, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable2<T1, T2>): void;
|
||||
is_connected(callable: Callable2<T1, T2>): boolean;
|
||||
emit(v1: T1, v2: T2): void;
|
||||
|
||||
// the first argument is used as the resolved value
|
||||
as_promise(): Promise<T1>;
|
||||
}
|
||||
|
||||
interface Signal3<T1, T2, T3> extends AnySignal {
|
||||
connect(callable: Callable3<T1, T2, T3>, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable3<T1, T2, T3>): void;
|
||||
is_connected(callable: Callable3<T1, T2, T3>): boolean;
|
||||
emit(v1: T1, v2: T2, v3: T3): void;
|
||||
|
||||
// the first argument is used as the resolved value
|
||||
as_promise(): Promise<T1>;
|
||||
}
|
||||
|
||||
interface Signal4<T1, T2, T3, T4> extends AnySignal {
|
||||
connect(callable: Callable4<T1, T2, T3, T4>, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable4<T1, T2, T3, T4>): void;
|
||||
is_connected(callable: Callable4<T1, T2, T3, T4>): boolean;
|
||||
emit(v1: T1, v2: T2, v3: T3, v4: T4): void;
|
||||
|
||||
// the first argument is used as the resolved value
|
||||
as_promise(): Promise<T1>;
|
||||
}
|
||||
|
||||
interface Signal5<T1, T2, T3, T4, T5> extends AnySignal {
|
||||
connect(callable: Callable5<T1, T2, T3, T4, T5>, flags: int64 = 0): void;
|
||||
disconnect(callable: Callable5<T1, T2, T3, T4, T5>): void;
|
||||
is_connected(callable: Callable5<T1, T2, T3, T4, T5>): boolean;
|
||||
emit(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): void;
|
||||
|
||||
// the first argument is used as the resolved value
|
||||
as_promise(): Promise<T1>;
|
||||
}
|
||||
|
||||
}
|
11169
godot-js/src/typings/godot0.gen.d.ts
vendored
Normal file
11169
godot-js/src/typings/godot0.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9358
godot-js/src/typings/godot1.gen.d.ts
vendored
Normal file
9358
godot-js/src/typings/godot1.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9303
godot-js/src/typings/godot2.gen.d.ts
vendored
Normal file
9303
godot-js/src/typings/godot2.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9521
godot-js/src/typings/godot3.gen.d.ts
vendored
Normal file
9521
godot-js/src/typings/godot3.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9806
godot-js/src/typings/godot4.gen.d.ts
vendored
Normal file
9806
godot-js/src/typings/godot4.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9677
godot-js/src/typings/godot5.gen.d.ts
vendored
Normal file
9677
godot-js/src/typings/godot5.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
9426
godot-js/src/typings/godot6.gen.d.ts
vendored
Normal file
9426
godot-js/src/typings/godot6.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
7876
godot-js/src/typings/godot7.gen.d.ts
vendored
Normal file
7876
godot-js/src/typings/godot7.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
64
godot-js/src/typings/jsb.editor.bundle.d.ts
vendored
Normal file
64
godot-js/src/typings/jsb.editor.bundle.d.ts
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
declare module "jsb.editor.codegen" {
|
||||
import * as jsb from "godot-jsb";
|
||||
export class TypeDB {
|
||||
singletons: {
|
||||
[name: string]: jsb.editor.SingletonInfo;
|
||||
};
|
||||
classes: {
|
||||
[name: string]: jsb.editor.ClassInfo;
|
||||
};
|
||||
primitive_types: {
|
||||
[name: string]: jsb.editor.PrimitiveClassInfo;
|
||||
};
|
||||
primitive_type_names: {
|
||||
[type: number]: string;
|
||||
};
|
||||
globals: {
|
||||
[name: string]: jsb.editor.GlobalConstantInfo;
|
||||
};
|
||||
utilities: {
|
||||
[name: string]: jsb.editor.MethodBind;
|
||||
};
|
||||
class_docs: {
|
||||
[name: string]: jsb.editor.ClassDoc | false;
|
||||
};
|
||||
constructor();
|
||||
find_doc(class_name: string): jsb.editor.ClassDoc | undefined;
|
||||
is_primitive_type(name: string): boolean;
|
||||
is_valid_method_name(name: string): boolean;
|
||||
make_classname(class_name: string, used_as_input: boolean): string;
|
||||
make_typename(info: jsb.editor.PropertyInfo, used_as_input: boolean): string;
|
||||
make_arg(info: jsb.editor.PropertyInfo, type_replacer?: (name: string) => string): string;
|
||||
make_literal_value(value: jsb.editor.DefaultArgumentInfo): string;
|
||||
replace_type_inplace(name: string | undefined, type_replacer?: (name: string) => string): string;
|
||||
make_arg_default_value(method_info: jsb.editor.MethodBind, index: number, type_replacer?: (name: string) => string): string;
|
||||
make_args(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string;
|
||||
make_return(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string;
|
||||
make_signal_type(method_info: jsb.editor.MethodBind): string;
|
||||
}
|
||||
export default class TSDCodeGen {
|
||||
private _split_index;
|
||||
private _outDir;
|
||||
private _splitter;
|
||||
private _types;
|
||||
constructor(outDir: string);
|
||||
private make_path;
|
||||
private new_splitter;
|
||||
private split;
|
||||
private cleanup;
|
||||
has_class(name?: string): boolean;
|
||||
emit(): void;
|
||||
private emit_mock;
|
||||
private emit_singletons;
|
||||
private emit_utilities;
|
||||
private emit_globals;
|
||||
private emit_godot;
|
||||
private emit_godot_primitive;
|
||||
private emit_godot_class;
|
||||
}
|
||||
}
|
||||
declare module "jsb.editor.main" {
|
||||
import { PackedStringArray } from "godot";
|
||||
export function auto_complete(pattern: string): PackedStringArray;
|
||||
export function run_npm_install(): void;
|
||||
}
|
87
godot-js/src/typings/jsb.runtime.bundle.d.ts
vendored
Normal file
87
godot-js/src/typings/jsb.runtime.bundle.d.ts
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
declare module "godot.annotations" {
|
||||
import { PropertyHint, PropertyUsageFlags, Variant, MultiplayerAPI, MultiplayerPeer } from "godot";
|
||||
import * as jsb from "godot-jsb";
|
||||
export interface EnumPlaceholder {
|
||||
}
|
||||
export interface TypePairPlaceholder {
|
||||
}
|
||||
export function EnumType(type: any): EnumPlaceholder;
|
||||
export function TypePair(key: ClassDescriptor, value: ClassDescriptor): TypePairPlaceholder;
|
||||
export type ClassDescriptor = Function | Symbol | EnumPlaceholder | TypePairPlaceholder;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function signal(): (target: any, key: string) => void;
|
||||
export function export_multiline(): (target: any, key: string) => void;
|
||||
export function export_range(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void;
|
||||
export function export_range_i(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void;
|
||||
/** String as a path to a file, custom filter provided as hint. */
|
||||
export function export_file(filter: string): (target: any, key: string) => void;
|
||||
export function export_dir(filter: string): (target: any, key: string) => void;
|
||||
export function export_global_file(filter: string): (target: any, key: string) => void;
|
||||
export function export_global_dir(filter: string): (target: any, key: string) => void;
|
||||
export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only"): (target: any, key: string) => void;
|
||||
/**
|
||||
* A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })`
|
||||
*/
|
||||
export function export_array(clazz: ClassDescriptor): (target: any, key: string) => void;
|
||||
/**
|
||||
* A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })`
|
||||
*/
|
||||
export function export_dictionary(key_class: ClassDescriptor, value_class: ClassDescriptor): (target: any, key: string) => void;
|
||||
export function export_object(class_: ClassDescriptor): (target: any, key: string) => void;
|
||||
/**
|
||||
* [low level export]
|
||||
*/
|
||||
export function export_(type: Variant.Type, details?: {
|
||||
class_?: ClassDescriptor;
|
||||
hint?: PropertyHint;
|
||||
hint_string?: string;
|
||||
usage?: PropertyUsageFlags;
|
||||
}): (target: any, key: string) => void;
|
||||
/**
|
||||
* In Godot, class members can be exported.
|
||||
* This means their value gets saved along with the resource (such as the scene) they're attached to.
|
||||
* They will also be available for editing in the property editor.
|
||||
* Exporting is done by using the `@export_var` (or `@export_`) annotation.
|
||||
*/
|
||||
export function export_var(type: Variant.Type, details?: {
|
||||
class_?: ClassDescriptor;
|
||||
hint?: PropertyHint;
|
||||
hint_string?: string;
|
||||
usage?: PropertyUsageFlags;
|
||||
}): (target: any, key: string) => void;
|
||||
/**
|
||||
* NOTE only int value enums are allowed
|
||||
*/
|
||||
export function export_enum(enum_type: any): (target: any, key: string) => void;
|
||||
/**
|
||||
* NOTE only int value enums are allowed
|
||||
*/
|
||||
export function export_flags(enum_type: any): (target: any, key: string) => void;
|
||||
export interface RPCConfig {
|
||||
mode?: MultiplayerAPI.RPCMode;
|
||||
sync?: "call_remote" | "call_local";
|
||||
transfer_mode?: MultiplayerPeer.TransferMode;
|
||||
transfer_channel?: number;
|
||||
}
|
||||
export function rpc(config?: RPCConfig): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
|
||||
/**
|
||||
* auto initialized on ready (before _ready called)
|
||||
* @param evaluator for now, only string is accepted
|
||||
*/
|
||||
export function onready(evaluator: string | jsb.internal.OnReadyEvaluatorFunc): (target: any, key: string) => void;
|
||||
export function tool(): (target: any) => void;
|
||||
export function icon(path: string): (target: any) => void;
|
||||
export function deprecated(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
|
||||
export function experimental(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
|
||||
export function help(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
|
||||
}
|
||||
declare module "godot.typeloader" {
|
||||
/**
|
||||
* @param type the loaded type or function in godot module
|
||||
*/
|
||||
export type TypeLoadedCallback = (type: any) => void;
|
||||
export function on_type_loaded(type_name: string | string[], callback: TypeLoadedCallback): void;
|
||||
}
|
||||
declare module "jsb.core" { }
|
Loading…
Add table
Add a link
Reference in a new issue