View source code: https://github.com/a-mean-blogger/text-game-maker-js/blob/master/src/managers/screen-manager/screen-manager.js
Class (extends TM.ILoopObject)
A class that creates instances builds HTML canvas on the browser. the instance can prints or delete texts on the canvas screen. The main class of Text Game Maker JS.
new TM.ScreenManager(customSreenSetting, customCharGroups)
true
after calling init function, false
after calling inactivate. The Object status(active/inactive) can be checked by this property.**You can add "/n " in text to break line. The cursor moves to the initial x position of text after the line break.
**You can "/r" in text to move the cursor to the first column of Screen.
**Any color formats that support HTML5 Canvas can be used for color and backgoundColor. For examples: 'red', '#fff', '#fa4ede', rgb(255, 100, 70)', 'rgba(255, 255, 255, 0.5)'...
**View example source code: screen-manager-tutorial.js
Create an instance of TM.ScreenManager and assign to var TMS(Text Game Maker Screen).
var TMS = new TM.ScreenManger();
Print "Hello World" at the current cursor location.
TMS.insertText("Hello World\n");
Type these commands into the browser console on this page to test.
//print red "Hello World" at the current cursor location and break line. TMS.insertText("Hello World\n", "red"); //print red "Hello World" with white background color at the current cursor location and break line. TMS.insertText("Hello World\n", "red", "#fff"); //print red "Hello World" at (5,5) and break line. TMS.insertTextAt(5, 5, "Hello World\n", "red"); TMS.clearScreen(); //clear Screen TMS.fillScreen("A"); //fill Screen with "A" TMS.fillScreen("A", null, "white"); //fill Screen with white color
Comments
Login with SNS account to write comments. see details