WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. API
  4. Graphics
Mission NodeSDK 6.3C++API Reference

Graphics

Graphics GFX getAssetId Summary Get an image ID by the filename. Description Usually an application uses image IDs to draw sprites and backgrounds. But somet...

API / SDK 6.3 / C++ / API Reference

Graphics

GFX_getAssetId

Summary

Get an image ID by the filename.

Description

Usually an application uses image IDs to draw sprites and backgrounds. But sometimes IDs are unknown, e.g. in common libraries, or they change rapidly during development. This interface can be used to get an ID of the image by its filename in the runtime.

Inputs

  • spriteName - an image filename for which ID is requested

Return value

The ID of image with a given filename or -1 in case of error.

Synopsis

Graphics
CPP
1i32_t GFX_getAssetId(const char* spriteName);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_clear

Summary

Clear a layer with a given color.

Inputs

color - a color in ARGB8888 format to clear a layer with

Synopsis

Graphics
CPP
1i32_t GFX_clear(u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawText

Summary

Draw a formatted text by the specified coordinates with a given color, scale, text align and a rotation angle.

Inputs

  • x, y - coordinates of the text center
  • scale - percentage scale, max font size is 200x200px (100%)
  • angle - clockwise rotation angle in degrees
  • fontId - not applicable, reserved for future use
  • align - text alignment
  • color - a color in ARGB8888 format to draw text with
  • text - formatted string

Synopsis

Graphics
CPP
1i32_t GFX_drawText(i32_t x, i32_t y, u32_t scale, u32_t angle, u32_t align, u32_t color, const char* text);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawPoint

Summary

Draw a point specified by its coordinates with a given color.

Inputs

  • x, y - coordinates of point to draw
  • color - a color in ARGB8888 format to draw point with

Synopsis

Graphics
CPP
1i32_t GFX_drawPoint(i32_t x, i32_t y, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawCircle

Summary

Draw a circle at the given point with given radius, color and line width.

Inputs

  • x, y - coordinates of the circle center
  • radius - radius of the circle
  • width - line width used to draw the circle
  • color - a color in ARGB8888 format to draw circle with

Synopsis

Graphics
CPP
1i32_t GFX_drawCircle(i32_t x, i32_t y, u32_t radius, u32_t width, u32_t fill, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawSolidCircle

Summary

Draw a solid circle at the given point with given radius and color.

THIS FUNCTION IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE

Inputs

  • x, y - coordinates of the circle center
  • radius - radius of the circle
  • color - a color in ARGB8888 format to draw circle with

Synopsis

Graphics
CPP
1i32_t GFX_drawSolidCircle(i32_t x, i32_t y, u32_t radius, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawArc

Summary

Draw an arc at the given point with given radius, line width, color and angles.

Inputs

  • x, y - coordinates of the arc center
  • radius - radius of the arc
  • width - line width used to draw the arc
  • from - starting angle of the arc
  • to - ending angle of the arc
  • color - a color in ARGB8888 format to draw arc with

Synopsis

Graphics
CPP
1i32_t GFX_drawArc(i32_t x, i32_t y, u32_t radius, u32_t width, u32_t from, u32_t to, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawSector

Summary

Draw a filled circular sector, connecting the arc to the circle's center like a piece of pie.

Inputs

  • x, y - coordinates of the circle's center
  • radius - radius of the circle
  • from - starting angle of the sector
  • to - ending angle of the sector
  • color - a color in ARGB8888 format to draw arc with

Synopsis

Graphics
CPP
1i32_t GFX_drawSector(i32_t x, i32_t y, u32_t radius, u32_t from, u32_t to, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawLine

Summary

Draw a line with from a given point to another one and given width and color.

Inputs

  • x0, y0 - coordinates of the line starting point
  • x1, y1 - coordinates of the line ending point
  • width - line width to draw
  • color - a color in ARGB8888 format to draw line with

Synopsis

Graphics
CPP
1i32_t GFX_drawLine(i32_t x0, i32_t y0, i32_t x1, i32_t y1, u32_t thickness, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawRectangle

Summary

Draw a solid rectangle at a given position with specified dimensions and a color.

Inputs

  • x, y, w, h - top left corner coordinates and dimensions of the rectangle to draw
  • color - a color in ARGB8888 format to draw rectangle with

Synopsis

Graphics
CPP
1i32_t GFX_drawRectangle(i32_t x, i32_t y, i32_t w, i32_t h, u32_t color);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_bakeImage

Summary

Set an ID of a memory buffer to save next rendering result.

Description

Specifies the image that will be created by combining the group of graphical primitives used between GFX_bakeImage() and GFX_render() according their order and taking into account alpha channel in images. HW has a limitation and can combine no more than 4 layers simultaneously, so if there are more primitives then they will be combined in a cascade. Useful for creating complex images like backgrounds for later usage.

Inputs

  • id - an ID of image to access later
  • width, height - image dimensions
  • format - color format of baked image

Synopsis

Graphics
CPP
1i32_t GFX_bakeImage(spriteID_t id, u32_t width, u32_t height, GFX_PixelFormat_t format);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_setRenderTarget

Summary

Set a screen which will be used to display next rendering result.

Description

Cube module is a special device which has 3 independent screens to display graphics. GFX_setRenderTarget() specifies a screen number which will be used to display a next rendering result. Graphics primitives used in between GFX_setRenderTarget() and GFX_render() calls will be combined together according their order and taking into account alpha channel in images. Resulting image will be immediately flushed onto the given screen. HW has a limitation and can combine no more than 4 layers simultaneously, so if there are more primitives then they will be combined in a cascade. To display anything on the screen GFX_setRenderTarget() has to be always called.

Inputs

display - a screen number to render the resulting image on

Synopsis

Graphics
CPP
1i32_t GFX_setRenderTarget(u32_t display);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawImage

Summary

Draw an image from application assets at a specified position and with given transformations.

Inputs

  • x, y - coordinates of the image center to draw
  • scale_x, scale_y - horizontal and vertical scaling coefficients, 100 is a full size picture
  • opacity - opacity of the entire image, 0 is fully transparent
  • colorKey - transparent background color, pixels of that color will not be used for rendering, it is useful for image with color format without alpha channel, e.g. RGB565
  • angle - clockwise rotation angle in degrees
  • mirror - mirroring mode
  • id - an ID of assets image to draw

Synopsis

Graphics
CPP
1i32_t GFX_drawImage(spriteID_t id, i32_t x, i32_t y, u32_t opacity, u32_t colorKey, u32_t scale_x, u32_t scale_y, u32_t angle, u32_t mirror);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawBakedImage

Summary

Draw a previously baked image at a specified position and with given transformations.

Inputs

  • x, y - coordinates of the image center to draw
  • scale_x, scale_y - horizontal and vertical scaling coefficients, 100 is a full size picture
  • opacity - opacity of the entire image, 0 is fully transparent
  • colorKey - transparent background color, pixels of that color will not be used for rendering, it is useful for image with color format without alpha channel, e.g. RGB565
  • angle - clockwise rotation angle in degrees
  • mirror - mirroring mode
  • id - an ID of the baked image to draw

Synopsis

Graphics
CPP
1i32_t GFX_drawBakedImage(i32_t x, i32_t y, u32_t opacity, u32_t colorKey, u32_t scale_x, u32_t scale_y, u32_t angle, u32_t mirror, spriteID_t id);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawParticles

Summary

Draw particle system with given parameters.

Inputs

  • x, y - coordinates of the particle emitter center to draw
  • opacity - opacity of the entire particle system, 0 is fully transparent
  • colorKey - transparent background color, pixels of that color will not be used for rendering, it is useful for image with color format without alpha channel, e.g. RGB565
  • angle - clockwise rotation angle in degrees
  • id - an ID of the assets image to use as a particle
  • particle - a particle parameters
  • emission - a particle emission parameters

Synopsis

Graphics
CPP
1i32_t GFX_drawParticles(i32_t x, i32_t y, u32_t opacity, u32_t colorKey, u32_t angle, u32_t id, Cubios::GFX_Particle_t* particle);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_drawQrCode

Summary

Renders a QR Code.

Inputs

  • x, y - coordinates of the particle emitter center to draw
  • size - a size of a single QR code bit element (a single square) in pixels
  • color0 - foreground color, the color that is assigned to the elements that represent binary ones
  • color1 - background color, the color that is assigned to the elements that represent binary zeroes
  • angle - clockwise rotation angle in degrees
  • id - an ID of the asset image
  • text - a text to encode, 256 characters max

Synopsis

Graphics
CPP
1i32_t GFX_drawQRCode(i32_t x, i32_t y, u32_t size, u32_t color0, u32_t color1, u32_t angle, u32_t id, const char *text);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_render

Summary

Start rendering process.

Synopsis

Graphics
CPP
1i32_t GFX_render();
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_clearCache

Summary

Clear all cached images

Description

Oldest accessed image cache will be automatically freed if there is not enough memory to cache a new image. This function forces this process, e.g. when switch game levels.

Synopsis

Graphics
CPP
1i32_t GFX_clearCache();
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_removeBakedImage

Summary

Disposes previously baked image and frees the resources.

Inputs

  • id - an ID of the baked image

Synopsis

Graphics
CPP
1i32_t GFX_removeBakedImage(spriteID_t id);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_cacheImages

Summary

Force platform to cache application images.

Description

Platform automatically reads and caches images from flash when the application draws an image. Flash operations are synchronous and may cause delays especially when reading large portions of data. To prevent the application from lags it is possible to cache image data in advance. However if application requests to draw a non-cached image and there is not enough memory then oldest accessed images will be removed from cache. Also there is a limit of 256 for a total number of cached images.

Inputs

  • spriteIDs - array with IDs of images to cache
  • count - size of spriteIDs array

Return value

Number of cached images or negative value if an error happened. Error codes:

-1 invalid function arguments count -2 invalid imageList array

Synopsis

Graphics
CPP
1i32_t GFX_cacheImages(spriteID_t spriteIDs, u32_t count);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_setFpsWindow

Summary

Controls the visibility of FPS window.

Inputs

  • show - 1 to show FPS windows, 0 to hide it

Synopsis

Graphics
CPP
1i32_t GFX_setFpsWindow(u32_t show);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_getAssetsCount

Summary

Returns a number of visual assets currently used by the application.

Synopsis

Graphics
CPP
1i32_t GFX_getAssetsCount()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_setFillShader

Summary

Activates a fill shader.

Description

If a fill shader activated and set up with a particular color, all consequtive draw calls will be using that color as a fill color.

Inputs

  • color - a fill color that will be applied to the vector primitives while the shader is in user

Synopsis

Graphics
CPP
1i32_t GFX_setFillShader(u32_t color)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_setLinearGradientShader

Summary

Activates a linear gradient shader.

Description

If a linear gradient shader activated and set up with a particular colors, all consequtive draw calls will be using the linear gradient as a fill method.

Inputs

  • x0,y0 - coordinates of a starting point of the gradient
  • x1,y1 - coordinates of an ending point of the gradient
  • color0,color1 - colors of a starting and an ending point of the gradient

Synopsis

Graphics
CPP
1i32_t GFX_setLinearGradientShader(u32_t x0, u32_t y0, u32_t x1, u32_t y1, u32_t color0, u32_t color1)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_setRadialGradientShader

Summary

Activates a radial gradient shader.

Description

If a radial gradient shader activated and set up with a particular colors, all consequtive draw calls will be using the radial gradient as a fill method.

Inputs

  • x0,y0 - coordinates of a center point of the gradient
  • radius - a radius of the gradient
  • color0,color1 - colors of a center and an edge of the gradient

Synopsis

Graphics
CPP
1i32_t GFX_setRadialGradientShader(u32_t x0, u32_t y0, u32_t radius, u32_t color0, u32_t color1)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

GFX_removeShader

Summary

Removes currently activated shader.

Synopsis

Graphics
CPP
1i32_t GFX_removeShader()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Jump Grid

On This Page

GFX getAssetIdGFX clearGFX drawTextGFX drawPointGFX drawCircleGFX drawSolidCircleGFX drawArcGFX drawSectorGFX drawLineGFX drawRectangleGFX bakeImageGFX setRenderTargetGFX drawImageGFX drawBakedImageGFX drawParticlesGFX drawQrCodeGFX renderGFX clearCacheGFX removeBakedImageGFX cacheImagesGFX setFpsWindowGFX getAssetsCountGFX setFillShaderGFX setLinearGradientShaderGFX setRadialGradientShaderGFX removeShader
Context Rail

Related nodes

Global Defines
API / SDK 6.3 / C++ / API Reference
Data Structures
API / SDK 6.3 / C++ / API Reference
Enumerated Types
API / SDK 6.3 / C++ / API Reference
Application
API / SDK 6.3 / C++ / API Reference
Previous Node
Application
API / SDK 6.3 / C++ / API Reference
Next Node
Topology
API / SDK 6.3 / C++ / API Reference