Graphics
Drawing primitives, text, fonts, display information and the native graphics bindings. The screen is 480x272, colors are 16-bit RGB565 integers (0xF800 red, 0x07E0 green, 0x001F blue). Integer arguments of native drawing calls accept any number and floor it.
Conventions on every page: Availability says whether a symbol exists on the console BIOS, the emulator, or both. c8b and C8B are the same table.
Contents
- State, colors and offset
c8b.graphics.clearc8b.graphics.setColorc8b.graphics.getColorc8b.graphics.setBackgroundColorc8b.graphics.getBackgroundColorc8b.graphics.setDrawOffsetc8b.graphics.getDrawOffsetc8b.graphics.setClipRectc8b.graphics.getClipRectc8b.graphics.clearClipRectc8b.graphics.setImageDrawModec8b.graphics.getImageDrawModec8b.graphics.setDitherPatternc8b.graphics.setLineWidthc8b.graphics.getLineWidthc8b.graphics.setStrokeLocationc8b.graphics.getStrokeLocation
- Drawing targets
- Primitives
c8b.graphics.drawPixelc8b.graphics.drawLinec8b.graphics.drawRectc8b.graphics.fillRectc8b.graphics.drawRoundRectc8b.graphics.fillRoundRectc8b.graphics.drawCirclec8b.graphics.fillCirclec8b.graphics.drawCircleAtPointc8b.graphics.fillCircleAtPointc8b.graphics.drawCircleInRectc8b.graphics.fillCircleInRectc8b.graphics.drawEllipsec8b.graphics.fillEllipsec8b.graphics.drawEllipseInRectc8b.graphics.fillEllipseInRectc8b.graphics.drawTrianglec8b.graphics.fillTrianglec8b.graphics.drawPolygonc8b.graphics.fillPolygon
- Text and fonts
c8b.graphics.drawTextc8b.graphics.drawTextAlignedc8b.graphics.drawTextInRectc8b.graphics.getTextSizec8b.graphics.setFontc8b.graphics.getFontc8b.graphics.font.newc8b.graphics.font.getDefaultc8b.graphics.font:drawTextc8b.graphics.font:drawTextAlignedc8b.graphics.font:getTextWidthc8b.graphics.font:getHeightc8b.graphics.font:isValidc8b.graphics.font:setOutlinec8b.graphics.font:hasOutlinekTextAlignment.leftkTextAlignment.rightkTextAlignment.center
- Font class (global Font)
Font.newFont:drawTextFont:drawTextWithColorFont:drawTextAlignedFont:getTextWidthFont:getHeightFont:getNativeRefFont:setTextColorFont:getTextColorFont:setOutlineFont:hasOutlineFont:getOutlineColorFont:setLetterSpacingFont:getLetterSpacingFont:setTrackingFont:getTrackingFont:setLeadingFont:getLeading
- Display
- Constants
c8b.graphics.kColorBlackc8b.graphics.kColorWhitec8b.graphics.kColorClearc8b.graphics.kDrawModeCopyc8b.graphics.kDrawModeWhiteTransparentc8b.graphics.kDrawModeBlackTransparentc8b.graphics.kDrawModeFillWhitec8b.graphics.kDrawModeFillBlackc8b.graphics.kDrawModeXORc8b.graphics.kDrawModeNXORc8b.graphics.kDrawModeInvertedc8b.graphics.kImageUnflippedc8b.graphics.kImageFlippedXc8b.graphics.kImageFlippedYc8b.graphics.kImageFlippedXYc8b.graphics.kStrokeCenteredc8b.graphics.kStrokeInsidec8b.graphics.kStrokeOutsidegfx
- Low-level bindings (C8B.*)
C8B.Font_freeC8B.Font_loadC8B.Font_drawTextC8B.Font_getHeightC8B.Graphics_clearC8B.Display_presentC8B.Font_getDefaultC8B.Font_getLeadingC8B.Font_hasOutlineC8B.Font_setLeadingC8B.Font_setOutlineC8B.Display_getWidthC8B.Font_getTrackingC8B.Font_setTrackingC8B.Display_getHeightC8B.Font_getTextColorC8B.Font_getTextWidthC8B.Font_setTextColorC8B.Graphics_drawLineC8B.Graphics_drawRectC8B.Graphics_fillRectC8B.Graphics_getColorC8B.Graphics_setColorC8B.Graphics_drawPixelC8B.Graphics_drawCircleC8B.Graphics_fillCircleC8B.Graphics_popContextC8B.Font_drawTextAlignedC8B.Font_getOutlineColorC8B.Graphics_drawEllipseC8B.Graphics_drawPolygonC8B.Graphics_fillEllipseC8B.Graphics_fillPolygonC8B.Graphics_getClipRectC8B.Graphics_pushContextC8B.Graphics_setClipRectC8B.Font_getLetterSpacingC8B.Font_setLetterSpacingC8B.Graphics_drawTriangleC8B.Graphics_fillTriangleC8B.Graphics_getLineWidthC8B.Graphics_setLineWidthC8B.Display_getRefreshRateC8B.Display_setRefreshRateC8B.Display_setWindowTitleC8B.Font_drawTextWithColorC8B.Graphics_clearClipRectC8B.Graphics_drawRoundRectC8B.Graphics_fillRoundRectC8B.Graphics_setDrawOffsetC8B.Graphics_clearWithAlphaC8B.Graphics_getDrawOffsetXC8B.Graphics_getDrawOffsetYC8B.Graphics_getDisplayWidthC8B.Graphics_getDisplayHeightC8B.Graphics_getImageDrawModeC8B.Graphics_setDitherPatternC8B.Graphics_setImageDrawModeC8B.Graphics_clearDitherPatternC8B.Graphics_getBackgroundColorC8B.Graphics_setBackgroundColorC8B.Graphics_drawLineWithCurrentColorC8B.Graphics_drawRectWithCurrentColorC8B.Graphics_fillRectWithCurrentColor
State, colors and offset
c8b.graphics.clear
c8b.graphics.clear([color])
Fills the current drawing target (screen, or the image pushed with pushContext/lockFocus) with an RGB565 color. Defaults to 0 (black).
- Availability: Console (BIOS) and emulator
- Note: Clears to 0 (black) by default, not to the background color.
gfx.clear(gfx.kColorBlack)
c8b.graphics.setColor
c8b.graphics.setColor(color)
Sets the draw color used by primitives drawn without an explicit color. Colors are 16-bit RGB565 integers; kColorClear (-1) makes primitives draw nothing (fillRect clears to transparent).
- Availability: Console (BIOS) and emulator
c8b.graphics.getColor
c8b.graphics.getColor()
Returns the current draw color.
- Returns: integer (RGB565)
- Availability: Console (BIOS) and emulator
c8b.graphics.setBackgroundColor
c8b.graphics.setBackgroundColor(color)
Sets the background color. 0, 1 and 2 are treated as the constants black, white and clear and mapped to 0x0000, 0xFFFF and -1; other values are used as RGB565.
- Availability: Console (BIOS) and emulator
- Note: The RGB565 values 0x0001 and 0x0002 cannot be used as colors here.
c8b.graphics.getBackgroundColor
c8b.graphics.getBackgroundColor()
Returns the stored background color (RGB565, or -1 for clear).
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.graphics.setDrawOffset
c8b.graphics.setDrawOffset(x, y)
Sets the camera offset added to subsequent drawing (floored). Sprites and tilemaps honour it unless set to ignore it.
- Availability: Console (BIOS) and emulator
gfx.setDrawOffset(-camX, -camY)
c8b.graphics.getDrawOffset
c8b.graphics.getDrawOffset()
Returns the draw offset.
- Returns: x, y
- Availability: Console (BIOS) and emulator
c8b.graphics.setClipRect
c8b.graphics.setClipRect(x, y, width, height)
Restricts drawing to a screen rectangle.
- Availability: Console (BIOS) and emulator
c8b.graphics.getClipRect
c8b.graphics.getClipRect()
Returns the clip rectangle.
- Returns: x, y, width, height
- Availability: Console (BIOS) and emulator
c8b.graphics.clearClipRect
c8b.graphics.clearClipRect()
Removes the clip rectangle.
- Availability: Console (BIOS) and emulator
c8b.graphics.setImageDrawMode
c8b.graphics.setImageDrawMode(mode)
Sets how images are composited (kDrawMode* constants).
- Availability: Console (BIOS) and emulator
c8b.graphics.getImageDrawMode
c8b.graphics.getImageDrawMode()
Returns the image draw mode.
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.graphics.setDitherPattern
c8b.graphics.setDitherPattern(alpha, [ditherType])
Sets a dither pattern for subsequent fills; ditherType defaults to 6 (Bayer 4x4). alpha is 0.0-1.0.
- Availability: Console (BIOS) and emulator
c8b.graphics.setLineWidth
c8b.graphics.setLineWidth(width)
Sets the stroke width (floored, minimum 1).
- Availability: Console (BIOS) and emulator
c8b.graphics.getLineWidth
c8b.graphics.getLineWidth()
Returns the stroke width.
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.graphics.setStrokeLocation
c8b.graphics.setStrokeLocation(location)
Stores a stroke location (kStroke* constant). The value is only recorded; no drawing code reads it.
- Availability: Console (BIOS) and emulator
c8b.graphics.getStrokeLocation
c8b.graphics.getStrokeLocation()
Returns the value stored by setStrokeLocation (default 0).
- Returns: integer
- Availability: Console (BIOS) and emulator
Drawing targets
c8b.graphics.pushContext
c8b.graphics.pushContext([image])
Redirects drawing into an image (any object with _cppRef, ptr or getNativeRef()); nil draws to the screen. Pair with popContext; contexts left open are closed by the runtime after each frame.
- Availability: Console (BIOS) and emulator
gfx.pushContext(img)
gfx.fillRect(0, 0, 8, 8)
gfx.popContext()
c8b.graphics.popContext
c8b.graphics.popContext()
Restores the previous drawing target.
- Availability: Console (BIOS) and emulator
c8b.graphics.lockFocus
c8b.graphics.lockFocus(image)
Calls pushContext(image).
- Availability: Console (BIOS) and emulator
c8b.graphics.unlockFocus
c8b.graphics.unlockFocus()
Calls popContext().
- Availability: Console (BIOS) and emulator
Primitives
c8b.graphics.drawPixel
c8b.graphics.drawPixel(x, y, [color])
Draws one pixel in color or the current color.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawLine
c8b.graphics.drawLine(x1, y1, x2, y2, [color])
Draws a line in color or the current color (coordinates floored natively).
- Availability: Console (BIOS) and emulator
c8b.graphics.drawRect
c8b.graphics.drawRect(x, y, width, height, [color])
Draws a rectangle outline (floored).
- Availability: Console (BIOS) and emulator
- Note: Takes numbers, not a rect.
c8b.graphics.fillRect
c8b.graphics.fillRect(x, y, width, height, [color])
Fills a rectangle. With kColorClear (explicit or current) the area is cleared to transparent.
- Availability: Console (BIOS) and emulator
- Note: Takes numbers, not a rect.
gfx.fillRect(10, 10, 100, 20, 0xF800) -- red
c8b.graphics.drawRoundRect
c8b.graphics.drawRoundRect(x, y, w, h, radius) | (rect, radius)
Rounded-rectangle outline in the current color.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillRoundRect
c8b.graphics.fillRoundRect(x, y, w, h, radius) | (rect, radius)
Filled rounded rectangle in the current color.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawCircle
c8b.graphics.drawCircle(cx, cy, radius, [color])
Circle outline centred at (cx, cy).
- Availability: Console (BIOS) and emulator
c8b.graphics.fillCircle
c8b.graphics.fillCircle(cx, cy, radius, [color])
Filled circle centred at (cx, cy).
- Availability: Console (BIOS) and emulator
c8b.graphics.drawCircleAtPoint
c8b.graphics.drawCircleAtPoint(x, y, radius) | (point, radius)
Circle outline, current color.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillCircleAtPoint
c8b.graphics.fillCircleAtPoint(x, y, radius) | (point, radius)
Filled circle, current color.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawCircleInRect
c8b.graphics.drawCircleInRect(x, y, w, h) | (rect)
Largest circle fitting the rectangle (radius min(w,h)/2), outline.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillCircleInRect
c8b.graphics.fillCircleInRect(x, y, w, h) | (rect)
Largest circle fitting the rectangle, filled.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawEllipse
c8b.graphics.drawEllipse(cx, cy, rx, ry, [color])
Ellipse outline from centre and radii.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillEllipse
c8b.graphics.fillEllipse(cx, cy, rx, ry, [color])
Filled ellipse from centre and radii.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawEllipseInRect
c8b.graphics.drawEllipseInRect(x, y, w, h) | (rect)
Ellipse inscribed in the rectangle, outline.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillEllipseInRect
c8b.graphics.fillEllipseInRect(x, y, w, h) | (rect)
Ellipse inscribed in the rectangle, filled.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawTriangle
c8b.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, [color])
Triangle outline.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillTriangle
c8b.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, [color])
Filled triangle.
- Availability: Console (BIOS) and emulator
c8b.graphics.drawPolygon
c8b.graphics.drawPolygon(x1, y1, x2, y2, ...) | (points) | (polygon)
Closed polygon outline in the current color. Accepts numbers, a flat {x1, y1, ...} table or an object with getPointCount()/getPointAt(i). Up to 64 points.
- Availability: Console (BIOS) and emulator
c8b.graphics.fillPolygon
c8b.graphics.fillPolygon(x1, y1, x2, y2, ...) | (points) | (polygon)
Filled polygon in the current color (same argument forms as drawPolygon).
- Availability: Console (BIOS) and emulator
Text and fonts
c8b.graphics.drawText
c8b.graphics.drawText(text, x, y, [color])
Draws text (tostring applied) with the current font at floored coordinates.
- Availability: Console (BIOS) and emulator
- Note:
*bold*and_italic_markup is not supported.
gfx.drawText("Score: " .. score, 8, 8, 0xFFFF)
c8b.graphics.drawTextAligned
c8b.graphics.drawTextAligned(text, x, y, alignment, [color])
Draws text aligned at x (kTextAlignment.left/center/right).
- Availability: Console (BIOS) and emulator
gfx.drawTextAligned("PAUSED", 240, 130, kTextAlignment.center)
c8b.graphics.drawTextInRect
c8b.graphics.drawTextInRect(text, x, y, w, h, [leading], [truncationString], [alignment], [font]) | (text, rect, ...)
Word-wraps text into the rectangle (also at newlines) and truncates the last visible line with truncationString.
- Returns: width, height, wasTruncated
- Availability: Console (BIOS) and emulator
c8b.graphics.getTextSize
c8b.graphics.getTextSize(text)
Measures text with the current font.
- Returns: width, height
- Availability: Console (BIOS) and emulator
c8b.graphics.setFont
c8b.graphics.setFont(font)
Sets the font used by drawText and related functions.
- Availability: Console (BIOS) and emulator
c8b.graphics.getFont
c8b.graphics.getFont()
Returns the current font object.
- Availability: Console (BIOS) and emulator
c8b.graphics.font.new
c8b.graphics.font.new(path)
Loads a font file; returns a font object (native font freed on garbage collection) or nil.
- Availability: Console (BIOS) and emulator
local f = gfx.font.new("fonts/hud")
gfx.setFont(f)
c8b.graphics.font.getDefault
c8b.graphics.font.getDefault()
Returns the shared system font wrapped as a font object.
- Availability: Console (BIOS) and emulator
c8b.graphics.font:drawText
font:drawText(text, x, y, [color])
Draws text with this font object.
- Availability: Console (BIOS) and emulator
c8b.graphics.font:drawTextAligned
font:drawTextAligned(text, x, y, alignment, [color])
Draws aligned text with this font object.
- Availability: Console (BIOS) and emulator
c8b.graphics.font:getTextWidth
font:getTextWidth(text)
Pixel width of text.
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.graphics.font:getHeight
font:getHeight()
Font height in pixels.
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.graphics.font:isValid
font:isValid()
Reports whether the font is valid.
- Returns: boolean
- Availability: Console (BIOS) and emulator
- Note: Do not call this function: it raises an error on a loaded font.
c8b.graphics.font:setOutline
font:setOutline(enabled, [color])
Enables a glyph outline (color default 0x0000).
- Availability: Console (BIOS) and emulator
c8b.graphics.font:hasOutline
font:hasOutline()
Whether the outline is on.
- Returns: boolean
- Availability: Console (BIOS) and emulator
kTextAlignment.left
kTextAlignment.left = 0
Left alignment (global table).
- Availability: Console (BIOS) and emulator
kTextAlignment.right
kTextAlignment.right = 1
Right alignment.
- Availability: Console (BIOS) and emulator
kTextAlignment.center
kTextAlignment.center = 2
Centre alignment.
- Availability: Console (BIOS) and emulator
Font class (global Font)
Font.new
Font.new(path) | Font(path)
Creates an object of the global Font class. Unlike c8b.graphics.font.new it exposes color, spacing and leading setters. Fonts created this way are not used by gfx.setFont/drawText.
- Availability: Console (BIOS) and emulator
Font:drawText
Font:drawText(text, x, y)
Draws text in the font text color.
- Availability: Console (BIOS) and emulator
Font:drawTextWithColor
Font:drawTextWithColor(text, x, y, color)
Draws text in an RGB565 color.
- Availability: Console (BIOS) and emulator
Font:drawTextAligned
Font:drawTextAligned(text, x, y, alignment)
Draws aligned text (kTextAlignment).
- Availability: Console (BIOS) and emulator
Font:getTextWidth
Font:getTextWidth(text)
Text width in pixels.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:getHeight
Font:getHeight()
Font height in pixels.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:getNativeRef
Font:getNativeRef()
Native font handle.
- Returns: light userdata
- Availability: Console (BIOS) and emulator
Font:setTextColor
Font:setTextColor(color)
Default text color (RGB565).
- Availability: Console (BIOS) and emulator
Font:getTextColor
Font:getTextColor()
Returns the text color.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:setOutline
Font:setOutline(enabled, [color])
Enables/disables the glyph outline.
- Availability: Console (BIOS) and emulator
Font:hasOutline
Font:hasOutline()
Whether the outline is on.
- Returns: boolean
- Availability: Console (BIOS) and emulator
Font:getOutlineColor
Font:getOutlineColor()
Outline color.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:setLetterSpacing
Font:setLetterSpacing(pixels)
Extra spacing between letters.
- Availability: Console (BIOS) and emulator
Font:getLetterSpacing
Font:getLetterSpacing()
Letter spacing.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:setTracking
Font:setTracking(pixels)
Same as letter spacing (alias).
- Availability: Console (BIOS) and emulator
Font:getTracking
Font:getTracking()
Tracking.
- Returns: integer
- Availability: Console (BIOS) and emulator
Font:setLeading
Font:setLeading(pixels)
Line spacing for multi-line text.
- Availability: Console (BIOS) and emulator
Font:getLeading
Font:getLeading()
Leading.
- Returns: integer
- Availability: Console (BIOS) and emulator
Display
c8b.display.getWidth
c8b.display.getWidth()
Display width (480).
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.display.getHeight
c8b.display.getHeight()
Display height (272).
- Returns: integer
- Availability: Console (BIOS) and emulator
c8b.display.getSize
c8b.display.getSize()
Display size.
- Returns: width, height
- Availability: Console (BIOS) and emulator
c8b.display.setRefreshRate
c8b.display.setRefreshRate(fps)
Sets the target frame rate.
- Availability: Console (BIOS) and emulator
c8b.display.getRefreshRate
c8b.display.getRefreshRate()
Returns the target frame rate.
- Returns: number
- Availability: Console (BIOS) and emulator
Constants
c8b.graphics.kColorBlack
c8b.graphics.kColorBlack = 0x0000
Black (RGB565).
- Availability: Console (BIOS) and emulator
c8b.graphics.kColorWhite
c8b.graphics.kColorWhite = 0xFFFF
White (RGB565).
- Availability: Console (BIOS) and emulator
c8b.graphics.kColorClear
c8b.graphics.kColorClear = -1
Transparent: primitives draw nothing, fillRect clears to transparent, image.new(w, h, kColorClear) makes a transparent image.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeCopy
c8b.graphics.kDrawModeCopy = 0
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeWhiteTransparent
c8b.graphics.kDrawModeWhiteTransparent = 1
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeBlackTransparent
c8b.graphics.kDrawModeBlackTransparent = 2
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeFillWhite
c8b.graphics.kDrawModeFillWhite = 3
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeFillBlack
c8b.graphics.kDrawModeFillBlack = 4
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeXOR
c8b.graphics.kDrawModeXOR = 5
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeNXOR
c8b.graphics.kDrawModeNXOR = 6
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kDrawModeInverted
c8b.graphics.kDrawModeInverted = 7
Image draw mode for setImageDrawMode.
- Availability: Console (BIOS) and emulator
c8b.graphics.kImageUnflipped
c8b.graphics.kImageUnflipped = 0
Flip argument for image and sprite drawing.
- Availability: Console (BIOS) and emulator
c8b.graphics.kImageFlippedX
c8b.graphics.kImageFlippedX = 1
Flip argument for image and sprite drawing.
- Availability: Console (BIOS) and emulator
c8b.graphics.kImageFlippedY
c8b.graphics.kImageFlippedY = 2
Flip argument for image and sprite drawing.
- Availability: Console (BIOS) and emulator
c8b.graphics.kImageFlippedXY
c8b.graphics.kImageFlippedXY = 3
Flip argument for image and sprite drawing.
- Availability: Console (BIOS) and emulator
c8b.graphics.kStrokeCentered
c8b.graphics.kStrokeCentered = 0
Stroke location (stored only, see setStrokeLocation).
- Availability: Console (BIOS) and emulator
c8b.graphics.kStrokeInside
c8b.graphics.kStrokeInside = 1
Stroke location (stored only, see setStrokeLocation).
- Availability: Console (BIOS) and emulator
c8b.graphics.kStrokeOutside
c8b.graphics.kStrokeOutside = 2
Stroke location (stored only, see setStrokeLocation).
- Availability: Console (BIOS) and emulator
gfx
gfx = c8b.graphics
Global shorthand table created by the SDK (same table as c8b.graphics).
- Availability: Console (BIOS) and emulator
Low-level bindings (C8B.*)
C8B.Font_free
C8B.Font_free(font)
Frees a font loaded with Font_load.
- Availability: Console (BIOS) and emulator
C8B.Font_load
C8B.Font_load(path)
Native font binding: load.
- Returns: 1 value(s): handle, nil
- Availability: Console (BIOS) and emulator
C8B.Font_drawText
C8B.Font_drawText(font, text, x, y)
Native font binding: draw text.
- Availability: Console (BIOS) and emulator
C8B.Font_getHeight
C8B.Font_getHeight(font)
Native font binding: get height.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_clear
C8B.Graphics_clear(color)
Native graphics binding: clear.
- Availability: Console (BIOS) and emulator
C8B.Display_present
C8B.Display_present()
Presents the framebuffer immediately (normally done by the runtime after c8b.update).
- Availability: Console (BIOS) and emulator
C8B.Font_getDefault
C8B.Font_getDefault()
Native font binding: get default.
- Returns: 1 value(s): handle, nil
- Availability: Console (BIOS) and emulator
C8B.Font_getLeading
C8B.Font_getLeading(font)
Native font binding: get leading.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_hasOutline
C8B.Font_hasOutline(font)
Native font binding: has outline.
- Returns: 1 value(s): boolean
- Availability: Console (BIOS) and emulator
C8B.Font_setLeading
C8B.Font_setLeading(font, leading)
Native font binding: set leading.
- Availability: Console (BIOS) and emulator
C8B.Font_setOutline
C8B.Font_setOutline(font, enabled, color)
Native font binding: set outline.
- Availability: Console (BIOS) and emulator
C8B.Display_getWidth
C8B.Display_getWidth()
Native display binding: get width.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_getTracking
C8B.Font_getTracking(font)
Native font binding: get tracking.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_setTracking
C8B.Font_setTracking(font, tracking)
Native font binding: set tracking.
- Availability: Console (BIOS) and emulator
C8B.Display_getHeight
C8B.Display_getHeight()
Native display binding: get height.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_getTextColor
C8B.Font_getTextColor(font)
Native font binding: get text color.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_getTextWidth
C8B.Font_getTextWidth(font, text)
Native font binding: get text width.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_setTextColor
C8B.Font_setTextColor(font, color)
Native font binding: set text color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawLine
C8B.Graphics_drawLine(x1, y1, x2, y2, [color])
Native graphics binding: draw line.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawRect
C8B.Graphics_drawRect(x, y, width, height, [color])
Native graphics binding: draw rect.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillRect
C8B.Graphics_fillRect(x, y, width, height, [color])
Native graphics binding: fill rect.
- Availability: Console (BIOS) and emulator
C8B.Graphics_getColor
C8B.Graphics_getColor()
Native graphics binding: get color.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_setColor
C8B.Graphics_setColor(color)
Native graphics binding: set color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawPixel
C8B.Graphics_drawPixel(x, y, [color])
Native graphics binding: draw pixel.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawCircle
C8B.Graphics_drawCircle(cx, cy, radius, [color])
Native graphics binding: draw circle.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillCircle
C8B.Graphics_fillCircle(cx, cy, radius, [color])
Native graphics binding: fill circle.
- Availability: Console (BIOS) and emulator
C8B.Graphics_popContext
C8B.Graphics_popContext()
Native graphics binding: pop context.
- Availability: Console (BIOS) and emulator
C8B.Font_drawTextAligned
C8B.Font_drawTextAligned(font, text, x, y, [alignment=0], [color=0])
Native font binding: draw text aligned.
- Availability: Console (BIOS) and emulator
C8B.Font_getOutlineColor
C8B.Font_getOutlineColor(font)
Native font binding: get outline color.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawEllipse
C8B.Graphics_drawEllipse(cx, cy, rx, ry, [color])
Native graphics binding: draw ellipse.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawPolygon
C8B.Graphics_drawPolygon(points, color)
Native graphics binding: draw polygon.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillEllipse
C8B.Graphics_fillEllipse(cx, cy, rx, ry, [color])
Native graphics binding: fill ellipse.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillPolygon
C8B.Graphics_fillPolygon(points, color)
Native graphics binding: fill polygon.
- Availability: Console (BIOS) and emulator
C8B.Graphics_getClipRect
C8B.Graphics_getClipRect()
Native graphics binding: get clip rect.
- Returns: 4 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_pushContext
C8B.Graphics_pushContext(image)
Native graphics binding: push context.
- Availability: Console (BIOS) and emulator
C8B.Graphics_setClipRect
C8B.Graphics_setClipRect(x, y, width, height)
Native graphics binding: set clip rect.
- Availability: Console (BIOS) and emulator
C8B.Font_getLetterSpacing
C8B.Font_getLetterSpacing(font)
Native font binding: get letter spacing.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Font_setLetterSpacing
C8B.Font_setLetterSpacing(font, spacing)
Native font binding: set letter spacing.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawTriangle
C8B.Graphics_drawTriangle(x1, y1, x2, y2, x3, y3, [color])
Native graphics binding: draw triangle.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillTriangle
C8B.Graphics_fillTriangle(x1, y1, x2, y2, x3, y3, [color])
Native graphics binding: fill triangle.
- Availability: Console (BIOS) and emulator
C8B.Graphics_getLineWidth
C8B.Graphics_getLineWidth()
Native graphics binding: get line width.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_setLineWidth
C8B.Graphics_setLineWidth(width)
Native graphics binding: set line width.
- Availability: Console (BIOS) and emulator
C8B.Display_getRefreshRate
C8B.Display_getRefreshRate()
Native display binding: get refresh rate.
- Returns: 1 value(s): number
- Availability: Console (BIOS) and emulator
C8B.Display_setRefreshRate
C8B.Display_setRefreshRate(rate)
Native display binding: set refresh rate.
- Availability: Console (BIOS) and emulator
C8B.Display_setWindowTitle
C8B.Display_setWindowTitle(title)
Emulator: sets the window title. On the console the binding exists but is compiled as a no-op.
- Availability: Console (BIOS) and emulator
C8B.Font_drawTextWithColor
C8B.Font_drawTextWithColor(font, text, x, y, color)
Native font binding: draw text with color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_clearClipRect
C8B.Graphics_clearClipRect()
Native graphics binding: clear clip rect.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawRoundRect
C8B.Graphics_drawRoundRect(x, y, width, height, radius, color)
Native graphics binding: draw round rect.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillRoundRect
C8B.Graphics_fillRoundRect(x, y, width, height, radius, color)
Native graphics binding: fill round rect.
- Availability: Console (BIOS) and emulator
C8B.Graphics_setDrawOffset
C8B.Graphics_setDrawOffset(x, y)
Native graphics binding: set draw offset.
- Availability: Console (BIOS) and emulator
C8B.Graphics_clearWithAlpha
C8B.Graphics_clearWithAlpha(color, alpha)
Clears the current target to color with 4-bit alpha.
- Availability: Console (BIOS) and emulator
C8B.Graphics_getDrawOffsetX
C8B.Graphics_getDrawOffsetX()
Native graphics binding: get draw offset x.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_getDrawOffsetY
C8B.Graphics_getDrawOffsetY()
Native graphics binding: get draw offset y.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_getDisplayWidth
C8B.Graphics_getDisplayWidth()
Display width.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_getDisplayHeight
C8B.Graphics_getDisplayHeight()
Display height.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_getImageDrawMode
C8B.Graphics_getImageDrawMode()
Native graphics binding: get image draw mode.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_setDitherPattern
C8B.Graphics_setDitherPattern(alpha, ditherType)
Native graphics binding: set dither pattern.
- Availability: Console (BIOS) and emulator
C8B.Graphics_setImageDrawMode
C8B.Graphics_setImageDrawMode(mode)
Native graphics binding: set image draw mode.
- Availability: Console (BIOS) and emulator
C8B.Graphics_clearDitherPattern
C8B.Graphics_clearDitherPattern()
Removes the dither pattern.
- Availability: Console (BIOS) and emulator
C8B.Graphics_getBackgroundColor
C8B.Graphics_getBackgroundColor()
Native graphics binding: get background color.
- Returns: 1 value(s): integer
- Availability: Console (BIOS) and emulator
C8B.Graphics_setBackgroundColor
C8B.Graphics_setBackgroundColor(color)
Native graphics binding: set background color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawLineWithCurrentColor
C8B.Graphics_drawLineWithCurrentColor(x1, y1, x2, y2)
Line in the current color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_drawRectWithCurrentColor
C8B.Graphics_drawRectWithCurrentColor(x, y, width, height)
Rect outline in the current color.
- Availability: Console (BIOS) and emulator
C8B.Graphics_fillRectWithCurrentColor
C8B.Graphics_fillRectWithCurrentColor(x, y, width, height)
Filled rect in the current color.
- Availability: Console (BIOS) and emulator