Add separate type for Icons (same repr as buffer)

This commit is contained in:
Michal Moskal
2017-10-30 13:04:12 +00:00
parent c085094394
commit f6e350cf9f
5 changed files with 149 additions and 88 deletions

35
libs/core/shims.d.ts vendored
View File

@ -78,17 +78,36 @@ declare namespace screen {
}
declare namespace screen {
/** Double size of an icon. */
//% shim=screen::doubleIcon
function doubleIcon(buf: Buffer): Buffer;
/** Draw an icon on the screen. */
//% shim=screen::drawIcon
function drawIcon(x: int32, y: int32, buf: Buffer, mode: Draw): void;
/** Clear screen and reset font to normal. */
//% shim=screen::clear
function clear(): void;
/** Makes an icon bound to a buffer. */
//% shim=screen::iconOf
function iconOf(buf: Buffer): Icon;
}
declare interface Icon {
/** Returns the underlaying Buffer object. */
//% property shim=IconMethods::buffer
buffer: Buffer;
/** Returns the width of an icon. */
//% property shim=IconMethods::width
width: int32;
/** Returns the height of an icon. */
//% property shim=IconMethods::height
height: int32;
/** Double size of an icon. */
//% shim=IconMethods::doubled
doubled(): Icon;
/** Draw an icon on the screen. */
//% shim=IconMethods::draw
draw(x: int32, y: int32, mode: Draw): void;
}
declare namespace output {