Add more screen stuff

This commit is contained in:
Michal Moskal
2017-07-05 13:56:13 +01:00
parent 02d8cf7056
commit f9073b3505
5 changed files with 85 additions and 12 deletions

View File

@ -1,11 +1,30 @@
namespace screen {
//% shim=screen::_drawLine
function _drawLine(p0: uint32, p1: uint32, mode: Draw): void {}
function _drawLine(p0: uint32, p1: uint32, mode: Draw): void { }
//% shim=screen::_drawRect
function _drawRect(p0: uint32, p1: uint32, mode: Draw): void {}
function _drawRect(p0: uint32, p1: uint32, mode: Draw): void { }
//% shim=screen::_drawEllipse
function _drawEllipse(p0: uint32, p1: uint32, mode: Draw): void {}
function _drawEllipse(p0: uint32, p1: uint32, mode: Draw): void { }
function pack(x: number, y: number) {
return Math.clamp(0, x, 512) | (Math.clamp(0, y, 512) << 16)
}
export function drawLine(x0: number, y0: number, x1: number, y1: number, mode?: Draw) {
_drawLine(pack(x0, y0), pack(x1, y1), mode)
}
export function drawRect(x: number, y: number, w: number, h: number, mode?: Draw) {
_drawRect(pack(x, y), pack(w, h), mode)
}
export function drawEllipse(x: number, y: number, rx: number, ry: number, mode?: Draw) {
_drawEllipse(pack(x, y), pack(rx, ry), mode)
}
export function drawCircle(x: number, y: number, r: number, mode?: Draw) {
drawEllipse(x, y, r, r, mode)
}
}