Skip to content
This repository has been archived by the owner on Nov 13, 2022. It is now read-only.
Tor (torbuntu) edited this page Nov 30, 2021 · 42 revisions

Leikr Engine API

Leikr is still in development so API is subject to change however things are getting more stable.

Full API list

---- Helper ----
getUsedSprites
FPS
HOST_INFO
pause

---- Image API ----
loadImages
drawTexture

---- Map API ----
loadMap
drawMap
getMapTile
setMapTile
removeMapTile
getMapHeight
getMapWidth

---- Color API ----
bgColor
getColor

---- Graphics API ----
tint
setClip
removeClip
drawString
sprite
spriteSc
drawPixel
getPixel
getPixels
drawRect
fillRect
drawCircle
fillCircle
drawLineSegment

---- Sound API ----
getSound
playSound
stopSound
getMusic
playMusic
stopMusic
pauseAudio
listSounds
listMusic

---- System API ----
cos
cosDeg
sin
sinDeg
ceil
floor
randInt
randFloat
round
loadProgram
setFont
loadSpriteSheet

---- Input API ----
button
buttonAny
ButtonPress
key
keyUp
keyPress
mouseClick
mouseX
mouseY

---- Override ----
create
update
render
onPause
onResume

---- Input Override ----
keyDown
keyUp
keyTyped
touchDown
touchUp
touchDragged
mouseMoved
scrolled

---- Experimental ----
compile
eval
parse
loadLib
newInstance

Note:

Engine Objects
lGraphics This object contains all the screen drawing API methods for drawing shapes, maps, sprites, and images. The use case is typically for passing it into non-main class methods. see A
lKeyboard This object can be passed to non main classes to get the keyboard input methods.
lMouse This object can be passed to non main classes to get the mouse input methods.
lControllerA, lControllerB Controller objects for getting controller input in non main classes.
lSystem lSystem contains system level API methods
lData Data read/write helper.
lAudio Audio helper object.
lInput Convenience object for passing around all input objects (lKeyboard, lMouse, lControllerA, lControllerB)

A: For example, if you have a main.groovy and a shape.groovy, and your shape.groovy has a drawLineSegment(x1, y1, x2, y2) method, you can pass lGraphics in as screen to use the screen.line() method to implement the three lines without having to do it on the main render method. So it would then look like Shape.drawLineSegment(screen, x1, y1, x2, y2) inside the render() method on main.groovy

Contents

Home

API

under construction for version 1.10.1

Clone this wiki locally