added canvas debug print
This commit is contained in:
parent
f21dd48106
commit
ec7535ccb6
@ -18,6 +18,24 @@ class Debug {
|
|||||||
Log.debug("CC/MC version:" + ComputerCraft._HOST);
|
Log.debug("CC/MC version:" + ComputerCraft._HOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function printCanvasToConsole(canvas: Canvas) {
|
||||||
|
var lines: Array<String> = [];
|
||||||
|
|
||||||
|
for (pos => pixel in canvas){
|
||||||
|
if (lines[pos.y] == null) {
|
||||||
|
lines[pos.y] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lines[pos.y].length < pos.x) {
|
||||||
|
lines[pos.y] += NativeStringTools.rep(" ", pos.x - lines[pos.y].length);
|
||||||
|
}
|
||||||
|
|
||||||
|
lines[pos.y] = lines[pos.y].substr(0, pos.x) + pixel.char + lines[pos.y].substr(pos.x + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.debug("\n" + lines.join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
#if webconsole
|
#if webconsole
|
||||||
public static function printWeb(msg:String) {
|
public static function printWeb(msg:String) {
|
||||||
HTTP.request("http://127.0.0.1:8080/"+Net.instance.networkID,msg);
|
HTTP.request("http://127.0.0.1:8080/"+Net.instance.networkID,msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user