Difference between revisions of "Reference"

From Gamebuino Wiki
Jump to: navigation, search
m ("Library" link removed)
 
(65 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
The Reference lists and explains all the functions of the [[Library]].
+
Here is listed and explained all Gamebuino specific functions, part of the Gamebuino Library (see [[Getting started]] to install it).
  
Arguments in ''italic'' are optional.
+
See [http://arduino.cc/en/Reference/HomePage Arduino Reference] for general purpose/basic functions and data types.
<div style="float:left;width:25em;margin-right:2em;">
 
  
== core ==
+
Note: Arguments in ''italic'' are optional.
 +
<div style="float:left;width:480px;margin-right:10px;">
 +
 
 +
== Core ==
 
<code>
 
<code>
* [[gb.begin]](''F("name")'', ''logo'')
+
* [[gb.begin]]()
 +
* [[gb.titleScreen]](''F("name")'', ''logo'')
 
* [[gb.update]]()
 
* [[gb.update]]()
 
* [[gb.setFrameRate]](fps)
 
* [[gb.setFrameRate]](fps)
 +
* [[gb.pickRandomSeed]]()
 +
* [[gb.changeGame]]()
 
* [[gb.frameCount]]
 
* [[gb.frameCount]]
 +
* [[gb.getDefaultName]](string) //10 char
 
</code>
 
</code>
 
User interface :
 
User interface :
 
<code>
 
<code>
* [[changeGame()]]
 
 
* [[gb.menu]](menu, length)
 
* [[gb.menu]](menu, length)
* [[gb.keyboard]](text, length)
+
* [[gb.keyboard]](string, length)
* [[gb.popup]](F("text"))
+
* [[gb.popup]](F("text"), duration)
* [[gb.adjustVolume]]()
+
</code>
 +
Physics:
 +
<code>
 +
* [[gb.collidePointRect]](x1,y1,x2,y2,w,h)
 +
* [[gb.collideRectRect]](x1,y1,w1,h1,x2,y2,w2,h2)
 +
* [[gb.collideBitmapBitmap]](x1, y1, b1, x2, y2, b2)
 
</code>
 
</code>
 
Perfomance monitor :
 
Perfomance monitor :
 
<code>
 
<code>
 
* [[gb.getCpuLoad]]()
 
* [[gb.getCpuLoad]]()
* [[gb.freeRam]]()
+
* [[gb.getFreeRam]]()
 
* [[gb.frameDurationMicros]]
 
* [[gb.frameDurationMicros]]
 
</code>
 
</code>
  
== buttons ==
+
== Buttons ==
 
<code>
 
<code>
 
* [[gb.buttons.pressed]](button)
 
* [[gb.buttons.pressed]](button)
Line 34: Line 44:
 
* [[gb.buttons.repeat]](button, period)
 
* [[gb.buttons.repeat]](button, period)
 
* [[gb.buttons.timeHeld]](button)
 
* [[gb.buttons.timeHeld]](button)
 +
buttons:
 +
 +
BTN_A, BTN_B, BTN_C, BTN_UP, BTN_RIGHT, BTN_DOWN, BTN_LEFT
 
</code>
 
</code>
  
== sound ==
+
== Sound ==
Play :
+
* [[Sound]] : overall explanation of how the sound library works
<code>
 
* [[gb.sound.play]]()
 
* [[gb.sound.isPlaying]]()
 
* [[gb.sound.stop]]()
 
* [[gb.sound.setLooping]]()
 
</code>
 
  
Volume :
+
Tracks<code>
<code>
+
* [[gb.sound.playTrack]](track, channel)
* [[gb.sound.setGlobalVolume]]()
+
* [[gb.sound.stopTrack]](''channel'')
* [[gb.sound.getGlobalVolume]]()
+
* [[gb.sound.changePatternSet]](patternSet, channel)
* [[gb.sound.setChannelVolume]]()
+
</code>Pattern<code>
* [[gb.sound.getChannelVolume]]()
+
* [[gb.sound.playPattern]](sound, channel)
 +
* [[gb.sound.stopPattern]](''channel'')
 +
* [[gb.sound.setPatternLooping]](boolean, channel)
 +
* [[gb.sound.isPlaying]](channel)
 +
</code>Notes & commands<code>
 +
* [[gb.sound.playNote]](pitch, duration, channel)
 +
* [[gb.sound.command]](command, X, Y, channel)
 +
* [[gb.sound.changeInstrumentSet]](instrumentSet, channel)
 
</code>
 
</code>
  
Build-in sounds :
+
Build-in sounds
 
<code>
 
<code>
 
* [[gb.sound.playOK]]()
 
* [[gb.sound.playOK]]()
Line 60: Line 74:
 
</code>
 
</code>
  
== battery ==
+
Misc
 +
<code>
 +
* [[gb.sound.setVolume]](volume, ''channel'')
 +
* [[gb.sound.getVolume]](''channel'')
 +
* [[gb.sound.setInstruments]](instruments, channel)
 +
* [[gb.sound.prescaler]]
 +
</code>
 +
 
 +
== Battery ==
 
<code>
 
<code>
* [[gb.battery.getVoltage]]()
+
* [[gb.battery.voltage]]
* [[gb.battery.getLevel]]()
+
* [[gb.battery.level]]
* [[gb.battery.display]]()
+
* [[gb.battery.show]] = true/false
 
</code>
 
</code>
  
== backlight ==
+
== Backlight ==
 
<code>
 
<code>
* [[gb.backlight.set]]()
+
* [[gb.backlight.set]](brightness)
* [[gb.backlight.setAuto]]()
+
* [[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
 
</code>
 
</code>
  
</div><div style="float:left;width:25em;margin-right:2em;">
+
</div><div style="float:left;width:480px;margin-right:0;">
 +
 
 +
== Display ==
 +
Useful constants: <code>LCDWIDTH, LCDHEIGHT, gb.display.fontWidth, gb.display.fontHeight</code>
  
== display ==
 
 
General :
 
General :
 
<code>
 
<code>
* [[gb.display.setContrast]]()
 
 
* [[gb.display.clear]]()
 
* [[gb.display.clear]]()
 
* [[gb.display.update]]()
 
* [[gb.display.update]]()
* [[gb.display.fillScreen]]()
+
* [[gb.display.fillScreen]](color)
* [[gb.display.persistance]]
+
* [[gb.display.setColor]](color, ''background'')
 +
* [[gb.display.persistence]] = true/false
 
</code>
 
</code>
  
 
Pixels :
 
Pixels :
 
<code>
 
<code>
* [[gb.display.drawPixel]]()
+
* [[gb.display.drawPixel]](x, y)
* [[gb.display.getPixel]]()
+
* [[gb.display.getPixel]](x, y)
 
</code>
 
</code>
  
 
Lines :
 
Lines :
 
<code>
 
<code>
* [[gb.display.drawLine]]()
+
* [[gb.display.drawLine]](x0, y0, x1, y1)
* [[gb.display.drawFastVLine]]()
+
* [[gb.display.drawFastVLine]](x, y, h)
* [[gb.display.drawFastHLine]]()
+
* [[gb.display.drawFastHLine]](x, y, w)
 
</code>
 
</code>
  
 
Rectangles :
 
Rectangles :
 
<code>
 
<code>
* [[gb.display.drawRect]]()
+
* [[gb.display.drawRect]](x, y, w, h)
* [[gb.display.fillRect]]()
+
* [[gb.display.fillRect]](x, y, w, h)
* [[gb.display.drawRoundRect]]()
+
* [[gb.display.drawRoundRect]](x, y, w, h, r)
* [[gb.display.fillRoundRect]]()
+
* [[gb.display.fillRoundRect]](x, y, w, h, r)
 
</code>
 
</code>
  
 
Circles :
 
Circles :
 
<code>
 
<code>
* [[gb.display.drawCircle]]()
+
* [[gb.display.drawCircle]](x, y, r)
* [[gb.display.drawCircleHelper]]()
+
* [[gb.display.fillCircle]](x, y, r)
* [[gb.display.fillCircle]]()
+
* [[gb.display.drawCircleHelper]](x, y, r, corner)
* [[gb.display.fillCircleHelper]]()
+
* [[gb.display.fillCircleHelper]](x, y, r, corner, delta)
 
</code>
 
</code>
  
 
Triangles :
 
Triangles :
 
<code>
 
<code>
* [[gb.display.drawTriangle]]()
+
* [[gb.display.drawTriangle]](x0,y0,x1,y1,x2,y2)
* [[gb.display.fillTriangle]]()
+
* [[gb.display.fillTriangle]](x0,y0,x1,y1,x2,y2)
 
</code>
 
</code>
  
 
Bitmaps :
 
Bitmaps :
 
<code>
 
<code>
* [[gb.display.drawBitmap]]()
+
* [[gb.display.drawBitmap]](x,y,bitmap,''rotation'',''flip'')
* [[gb.display.setBitmapColor]]()
 
 
</code>
 
</code>
 +
* rotation: <code>NOROT, ROTCCW, ROT180, ROTCW</code>
 +
* flip: <code>NOFLIP, FLIPH, FLIPV, FLIPVH</code>
  
 
Text :
 
Text :
 
<code>
 
<code>
* [[gb.display.drawChar]]()
+
* [[gb.display.print]](text or numbers)
* [[gb.display.print]]()
+
* [[gb.display.println]](text or numbers)
* [[gb.display.setCursor]]()
+
* [[gb.display.drawChar]](x, y, char, size)
* [[gb.display.setTextColor]]()
+
* [[gb.display.setFont]](font)
* [[gb.display.setTextSize]]()
+
* [[gb.display.cursorX]] = x
* [[gb.display.setTextWrap]]()
+
* [[gb.display.cursorY]] = y
 +
* [[gb.display.fontSize]] = size
 +
* [[gb.display.textWrap]] = true/false
 
</code>
 
</code>
  
 +
Advanced :
 +
<code>
 +
* [[gb.display.getBuffer]]()
 +
* [[gb.display.getBitmapPixel]](bitmap, x, y)
 +
</code>
  
 
</div>
 
</div>

Latest revision as of 2014-09-06T12:22:52

Here is listed and explained all Gamebuino specific functions, part of the Gamebuino Library (see Getting started to install it).

See Arduino Reference for general purpose/basic functions and data types.

Note: Arguments in italic are optional.

Core

User interface :

Physics:

Perfomance monitor :

Buttons

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

Pattern

Notes & commands

Build-in sounds

Misc

Battery

Backlight

The following should be set using SETTINGS.HEX

Display

Useful constants: LCDWIDTH, LCDHEIGHT, gb.display.fontWidth, gb.display.fontHeight

General :

Pixels :

Lines :

Rectangles :

Circles :

Triangles :

Bitmaps :

  • rotation: NOROT, ROTCCW, ROT180, ROTCW
  • flip: NOFLIP, FLIPH, FLIPV, FLIPVH

Text :

Advanced :