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
GFX_clear
Summary
Clear a layer with a given color.
Inputs
color - a color in ARGB8888 format to clear a layer with
Synopsis
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
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
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
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
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
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
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
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
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
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
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
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
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
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
GFX_render
Summary
Start rendering process.
Synopsis
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
GFX_removeBakedImage
Summary
Disposes previously baked image and frees the resources.
Inputs
- id - an ID of the baked image
Synopsis
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
GFX_setFpsWindow
Summary
Controls the visibility of FPS window.
Inputs
- show - 1 to show FPS windows, 0 to hide it
Synopsis
GFX_getAssetsCount
Summary
Returns a number of visual assets currently used by the application.
Synopsis
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
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
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
GFX_removeShader
Summary
Removes currently activated shader.
Synopsis