Skip to content
This repository has been archived by the owner on Nov 13, 2022. It is now read-only.

Graphics

Tor (torbuntu) edited this page Apr 17, 2021 · 13 revisions

Graphics: Raw Drawing, Images, Sprites, Text and Maps

Version 1.0.7

The Leikr display resolution is limited to 240x160. While the system provides 34 indexed palette colors, there is no actual restriction on colors that Leikr can display either via loaded images or by supplying an RGB String value to a drawing method.

For Colors API which is also part of the Graphics object, see Colors

The Leikr Graphics Object contains the API for graphics, see Helper

params in [] are optional

Raw Drawing
void drawPixel(color, x, y)
void drawRect(color, x, y, w, h)
void fillRect(color, x, y, w, h)
void drawCircle(color, x, y, r)
void fillCircle(color, x, y, r)
void drawLineSegment(color, x1, y1, x2, y2)
Textures
void loadImages()
void drawTexture(name, x, y)
void drawTexture(name, x, y, w, h)
void drawTexture(name, x, y, w, h, flipv)
Sprites
void sprite(id, x, y, [size])
void sprite(id, x, y, rotation, [size])
void sprite(id, x, y, flipX, flipY, [size])
void sprite(id, x, y, flipX, flipY, rotation, [size])
void sprite(ids[], x, y, w, h, [size])
void sprite(ids[], x, y, w, h, flipX, flipY, [size])
void spriteSc(id, x, y, scale, [size])
void spriteSc(id, x, y, scaleX, scaleY, [size])
void spriteSc(id, x, y, scaleX, scaleY, degree, [size])
void spriteSc(id, x, y, scaleX, scaleY, flipX, flipY, [size])
void spriteSc(id, x, y, scaleX, scaleY, flipX, flipY, degree, [size])
Strings
void drawString(color, text, x, y)
void drawString(color, text, x, y, width)
void drawString(color, text, x, y, width, int align)
Maps
void loadMap(map)
void drawMap()
void drawMap(x, y, [layer])
void drawMap(x, y, sx, sy, w, h, [layer])
int getMapTile(x, y, [layer])
void setMapTile(id, x, y, [layer])
void removeMapTile(x, y, [layer])
int getMapHeight()
int getMapWidth()
Other
void tint(color) Sets the tint based on color index (0 through 34)
void tint() Removes any set tint
int getPixel(x,y) Gets the indexed color from a pixel given x,y coordinates. If the color is not in the index returns 0
void setClip( x, y, w, h)
void removeClip()

Contents

Home

API

under construction for version 1.10.1

Clone this wiki locally