mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 01:55:25 -04:00
599ccb677f
* This allows to generate interesting visual effects, which can be controlled by events. For example, you can use an outline on an object to highlight, make the player glow when launching a spell, blur objects, etc... * A new "effects" tab is now present in the objects editor. From there, you can add visual effects, that were already available for layers, customize them from this editor. * Actions and conditions are available to manipulate effects and change their parameters during the game. * Learn more on the wiki: http://wiki.compilgames.net/doku.php/gdevelop5/objects/effects Co-authored-by: Florian Rival <Florian.Rival@gmail.com>
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
/*
|
|
* GDevelop JS Platform
|
|
* 2013 Florian Rival (Florian.Rival@gmail.com)
|
|
*/
|
|
namespace gdjs {
|
|
/**
|
|
* The TextEntryRuntimeObject allows to capture text typed on the keyboard.
|
|
*/
|
|
export class TextEntryRuntimeObject extends gdjs.RuntimeObject {
|
|
_str: string = '';
|
|
_activated: boolean = true;
|
|
_renderer: gdjs.TextEntryRuntimeObjectRenderer;
|
|
|
|
/**
|
|
* @param runtimeScene The scene the object belongs to.
|
|
* @param textEntryObjectData The initial properties of the object
|
|
*/
|
|
constructor(
|
|
runtimeScene: gdjs.RuntimeScene,
|
|
textEntryObjectData: ObjectData
|
|
) {
|
|
super(runtimeScene, textEntryObjectData);
|
|
this._renderer = new gdjs.TextEntryRuntimeObjectRenderer(this);
|
|
|
|
// *ALWAYS* call `this.onCreated()` at the very end of your object constructor.
|
|
this.onCreated();
|
|
}
|
|
|
|
updateFromObjectData(oldObjectData, newObjectData): boolean {
|
|
// Nothing to update.
|
|
return true;
|
|
}
|
|
|
|
onDestroyFromScene(runtimeScene): void {
|
|
super.onDestroyFromScene(runtimeScene);
|
|
if (this._renderer.onDestroy) {
|
|
this._renderer.onDestroy();
|
|
}
|
|
}
|
|
|
|
update(runtimeScene: gdjs.RuntimeScene): void {
|
|
if ((this._renderer as any).getString) {
|
|
this._str = (this._renderer as any).getString();
|
|
}
|
|
}
|
|
|
|
getString(): string {
|
|
return this._str;
|
|
}
|
|
|
|
setString(str: string): void {
|
|
this._str = str;
|
|
this._renderer.updateString();
|
|
}
|
|
|
|
isActivated(): boolean {
|
|
return this._activated;
|
|
}
|
|
|
|
activate(enable: boolean) {
|
|
this._activated = enable;
|
|
this._renderer.activate(this._activated);
|
|
}
|
|
}
|
|
gdjs.registerObject(
|
|
'TextEntryObject::TextEntry',
|
|
gdjs.TextEntryRuntimeObject
|
|
);
|
|
}
|