2017-07-05 14:06:58 +02:00
|
|
|
namespace screen {
|
|
|
|
//% shim=screen::_drawLine
|
2017-07-05 14:56:13 +02:00
|
|
|
function _drawLine(p0: uint32, p1: uint32, mode: Draw): void { }
|
2017-07-05 14:06:58 +02:00
|
|
|
|
|
|
|
//% shim=screen::_drawRect
|
2017-07-05 14:56:13 +02:00
|
|
|
function _drawRect(p0: uint32, p1: uint32, mode: Draw): void { }
|
2017-07-05 14:06:58 +02:00
|
|
|
|
|
|
|
//% shim=screen::_drawEllipse
|
2017-07-05 14:56:13 +02:00
|
|
|
function _drawEllipse(p0: uint32, p1: uint32, mode: Draw): void { }
|
2017-07-05 14:06:58 +02:00
|
|
|
|
2017-07-05 14:56:13 +02:00
|
|
|
function pack(x: number, y: number) {
|
2017-07-05 18:53:22 +02:00
|
|
|
return Math.clamp(0, 512, x) | (Math.clamp(0, 512, y) << 16)
|
2017-07-05 14:56:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
2017-07-05 14:06:58 +02:00
|
|
|
}
|