61 lines
1.2 KiB
Haxe
61 lines
1.2 KiB
Haxe
package kernel.peripherals;
|
|
|
|
import cc.Peripheral;
|
|
import lib.Rect;
|
|
import lib.ScreenPos;
|
|
|
|
class Printer implements IPeripheral {
|
|
public static inline final TYPE_NAME:String = "printer";
|
|
|
|
private final native:cc.periphs.Printer.Printer;
|
|
private final addr:String;
|
|
|
|
public function new(addr:String) {
|
|
this.native = Peripheral.wrap(addr);
|
|
this.addr = addr;
|
|
}
|
|
|
|
public function getAddr():String {
|
|
return addr;
|
|
}
|
|
|
|
public function getType():String {
|
|
return TYPE_NAME;
|
|
}
|
|
|
|
public function write(text:String) {}
|
|
|
|
public function getCurserPos():ScreenPos {
|
|
return new ScreenPos({x: 0, y: 0});
|
|
}
|
|
|
|
public function setCurserPos(pos:ScreenPos) {
|
|
this.native.setCursorPos(pos.x, pos.y);
|
|
}
|
|
|
|
public function getPageSize():Rect {
|
|
var pos = this.native.getPageSize();
|
|
return new Rect({x: 0, y: 0}, {x: pos.x, y: pos.y});
|
|
}
|
|
|
|
public function newPage():Bool {
|
|
return this.native.newPage();
|
|
}
|
|
|
|
public function endPage():Bool {
|
|
return this.native.endPage();
|
|
}
|
|
|
|
public function setPageTitle(title:String) {
|
|
this.native.setPageTitle(title);
|
|
}
|
|
|
|
public function getInkLevel():Float {
|
|
return this.native.getInkLevel();
|
|
}
|
|
|
|
public function getPaperLevel():Int {
|
|
return this.native.getPaperLevel();
|
|
}
|
|
}
|