Godot with Great JavaScript/TypeScript
Import the plugin in a Godot project and use it like GDS:
import { Button } from "@godot/classes/button";
import { GodotClass } from "@godot/core/class_defined";
import { Label } from "@godot/classes/label";
@GodotClass
export class ClickGype extends Button {
#label?: Label;
#count = 0;
public _ready(): void {
this.#label = this.get_node("../Label");
this.pressed.connect(new Callable(this, this.add_count));
}
public add_count() {
this.#label!.text = (this.#count++).toString();
}
public _process(delta: number): void {
}
}
Examples can be viewed in the example
directory.
The source repository does not contain compiled binaries, so the addons directory needs to import the plugin itself.
Notes:
- Godot's
variant
types are globally scoped and can be used withoutimport
. - Godot's
object
classes are all ingodot/classes/xxxx
, such asgodot/classes/node
. - Godot's utility functions are in the
GD
singleton, e.g.GD.print()
.
- ✅ Run a JS/TS script
- ✅ Add JS/TS bindings for Godot API
- 🟦 Implement new version of GMUI with JS/TS binding
- 🟨 Add editor support for JS/TS
- 🟦🟨✅...
On Linux, you can run it directly without manually configuring GCC.
On Windows, download mingw64 (posix version) and set the PATH env variable.
Windows: ./build.ps1