Difference between revisions of "Reference"
m (→display: added setContrast argument) |
(→core: added pickRandomSeed) |
||
Line 13: | Line 13: | ||
* [[gb.setFrameRate]](fps) | * [[gb.setFrameRate]](fps) | ||
* [[gb.frameCount]] | * [[gb.frameCount]] | ||
+ | * [[gb.pickRandomSeed]]() | ||
</code> | </code> | ||
User interface : | User interface : |
Revision as of 2014-05-28T19:41:46
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
- gb.begin(F("name"), logo)
- gb.update()
- gb.setFrameRate(fps)
- gb.frameCount
- gb.pickRandomSeed()
User interface :
- gb.changeGame()
- gb.getDefaultName(string) //10 char
- gb.menu(menu, length)
- gb.keyboard(string, length)
- gb.popup(F("text"), duration)
- gb.adjustVolume()
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
Note : sound library will be changed soon to allow the use of instruments, the following functions are just here for reference until then
Play :
- gb.sound.play(sound, channel)
- gb.sound.isPlaying(channel)
- gb.sound.stop(channel)
- gb.sound.setLooping(channel, true/false)
- gb.sound.prescaler
Volume :
- gb.sound.setVolume(volume, channel)
- gb.sound.getVolume(channel)
Build-in sounds :
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
General :
- gb.display.setContrast(value)
- gb.display.clear()
- gb.display.update()
- gb.display.fillScreen(color)
- gb.display.persistence = true/false
- gb.setColor(color, background)
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)
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: FLIPH, FLIPV, FLIPVH
Text :
- gb.display.drawChar(x, y, char, size)
- gb.display.print(text)
- gb.display.setCursor(x, y)
- gb.display.setTextSize(size)
- gb.display.setTextWrap(true/false)
useful constants: LCDWIDTH, LCDHEIGHT, FONTWIDTH, FONTHEIGHT