This commit is contained in:
2023-02-04 23:24:57 +01:00
parent dabc42ea25
commit 3e7d993662
2 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
package kernel.peripherals;
import lib.Rect;
import lib.Pos;
class Printer implements IPeripheral {
private final native:cc.periphs.Printer.Printer;
private final addr:String;
public function new(native: cc.periphs.Printer.Printer, addr: String) {
this.native = native;
this.addr = addr;
}
public function getAddr():String {
return addr;
}
public function write(text: String){
}
public function getCurserPos(): Pos {
return new Pos({x: 0, y: 0});
}
public function setCurserPos(pos: Pos){
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();
}
}