mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
add language declaration and samples for LoomScript
LoomScript is the scripting language for the Loom SDK. It has an ActionScript3-like syntax with added C#-esque capabilities. Loom SDK: https://github.com/LoomSDK/LoomSDK
This commit is contained in:
38
samples/LoomScript/HelloWorld.ls
Normal file
38
samples/LoomScript/HelloWorld.ls
Normal file
@@ -0,0 +1,38 @@
|
||||
package
|
||||
{
|
||||
import loom.Application;
|
||||
import loom2d.display.StageScaleMode;
|
||||
import loom2d.ui.SimpleLabel;
|
||||
|
||||
/**
|
||||
The HelloWorld app renders a label with its name on it,
|
||||
and traces 'hello' to the log.
|
||||
*/
|
||||
public class HelloWorld extends Application
|
||||
{
|
||||
|
||||
override public function run():void
|
||||
{
|
||||
stage.scaleMode = StageScaleMode.LETTERBOX;
|
||||
centeredMessage(simpleLabel, this.getFullTypeName());
|
||||
|
||||
trace("hello");
|
||||
}
|
||||
|
||||
// a convenience getter that generates a label and adds it to the stage
|
||||
private function get simpleLabel():SimpleLabel
|
||||
{
|
||||
return stage.addChild(new SimpleLabel("assets/Curse-hd.fnt")) as SimpleLabel;
|
||||
}
|
||||
|
||||
// a utility to set the label's text and then center it on the stage
|
||||
private function centeredMessage(label:SimpleLabel, msg:String):void
|
||||
{
|
||||
label.text = msg;
|
||||
label.center();
|
||||
label.x = stage.stageWidth / 2;
|
||||
label.y = (stage.stageHeight / 2) - (label.height / 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user