Difference between revisions of "Reference"
From Gamebuino Wiki
m (Finished previous update) |
(→Display: gb.display.getBuffer() added) |
||
Line 105: | Line 105: | ||
== Display == | == Display == | ||
+ | Useful constants: <code>LCDWIDTH, LCDHEIGHT, gb.display.fontWidth, gb.display.fontHeight</code> | ||
+ | |||
General : | General : | ||
<code> | <code> | ||
Line 167: | Line 169: | ||
* [[gb.display.textWrap]] = true/false | * [[gb.display.textWrap]] = true/false | ||
</code> | </code> | ||
− | + | ||
+ | Advanced : | ||
+ | <code> | ||
+ | * [[gb.display.getBuffer]]() | ||
+ | </code> | ||
</div> | </div> |
Revision as of 2014-08-29T19:10:40
Here is listed and explained all Gamebuino specific functions (the Gamebuino Library).
See Arduino Reference for general purpose/basic functions and data types.
Note: Arguments in italic are optional.
Core
User interface :
- gb.titleScreen(F("name"), logo)
- gb.menu(menu, length)
- gb.keyboard(string, length)
- gb.popup(F("text"), duration)
- gb.getDefaultName(string) //10 char
Physics:
- gb.collidePointRect(x1,y1,x2,y2,w,h)
- gb.collideRectRect(x1,y1,w1,h1,x2,y2,w2,h2)
Perfomance monitor :
Buttons
- gb.buttons.pressed(button)
- gb.buttons.released(button)
- gb.buttons.held(button, duration)
- gb.buttons.repeat(button, period)
- gb.buttons.timeHeld(button)
buttons:
BTN_A, BTN_B, BTN_C, BTN_UP, BTN_RIGHT, BTN_DOWN, BTN_LEFT
Sound
- Sound : overall explanation of how the sound library works
Tracks
- gb.sound.playTrack(track, channel)
- gb.sound.stopTrack(channel)
- gb.sound.changePatternSet(patternSet, channel)
Pattern
- gb.sound.playPattern(sound, channel)
- gb.sound.stopPattern(channel)
- gb.sound.setPatternLooping(boolean, channel)
- gb.sound.isPlaying(channel)
Notes & commands
- gb.sound.playNote(pitch, duration, channel)
- gb.sound.command(command, X, Y, channel)
- gb.sound.changeInstrumentSet(instrumentSet, channel)
Build-in sounds
Misc
- gb.sound.setVolume(volume, channel)
- gb.sound.getVolume(channel)
- gb.sound.setInstruments(instruments, channel)
- gb.sound.prescaler
Battery
- gb.battery.voltage
- gb.battery.level
- gb.battery.show = true/false
Backlight
- gb.backlight.set(brightness)
- gb.backlight.automatic = true/false
- gb.backlight.backlightValue
- gb.backlight.ambientLight
The following should be set using SETTINGS.HEX
- gb.backlight.backlightMin = 0 to 255
- gb.backlight.backlightMax = 0 to 255
- gb.backlight.ambientLightMin = 0 to 1024
- gb.backlight.ambientLightMax = 0 to 1024
Display
Useful constants: LCDWIDTH, LCDHEIGHT, gb.display.fontWidth, gb.display.fontHeight
General :
- gb.display.clear()
- gb.display.update()
- gb.display.fillScreen(color)
- gb.display.setColor(color, background)
- gb.display.persistence = true/false
Pixels :
- gb.display.drawPixel(x, y)
- gb.display.getPixel(x, y)
Lines :
- gb.display.drawLine(x0, y0, x1, y1)
- gb.display.drawFastVLine(x, y, h)
- gb.display.drawFastHLine(x, y, w)
Rectangles :
- gb.display.drawRect(x, y, w, h)
- gb.display.fillRect(x, y, w, h)
- gb.display.drawRoundRect(x, y, w, h, r)
- gb.display.fillRoundRect(x, y, w, h, r)
Circles :
- gb.display.drawCircle(x, y, r)
- gb.display.fillCircle(x, y, r)
- gb.display.drawCircleHelper(x, y, r, corner)
- gb.display.fillCircleHelper(x, y, r, corner, delta)
Triangles :
- gb.display.drawTriangle(x0,y0,x1,y1,x2,y2)
- gb.display.fillTriangle(x0,y0,x1,y1,x2,y2)
Bitmaps :
- gb.display.drawBitmap(x,y,bitmap,rotation,flip)
- rotation:
NOROT, ROTCCW, ROT180, ROTCW
- flip:
NOFLIP, FLIPH, FLIPV, FLIPVH
Text :
- gb.display.print(text or numbers)
- gb.display.println(text or numbers)
- gb.display.drawChar(x, y, char, size)
- gb.display.setFont(font)
- gb.display.cursorX = x
- gb.display.cursorY = y
- gb.display.fontSize = size
- gb.display.textWrap = true/false
Advanced :