<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wowcube.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PavelZh</id>
	<title>WowWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wowcube.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PavelZh"/>
	<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/wiki/Special:Contributions/PavelZh"/>
	<updated>2026-04-30T06:18:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=75</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=75"/>
		<updated>2020-09-10T15:08:08Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: /* abi_CMD_DYNAMIC_TEXTURE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCube executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
====Graphics 2D acceleration (G2D)====&lt;br /&gt;
WOWCube provides the 2D acceleration interfaces to enhance gaming experience . Basically G2D engine allows to blend up to the 4 image layers at once with a HW acceleration. However there is no limit of layers, they are blended in a cascade. For example, if Pawn script requested 7 layers to be blended then 2 HW blending will occur:&lt;br /&gt;
[[File:Cascade.png|center|G2D cascading scheme]]&lt;br /&gt;
Result of the blending can be saved as an internal G2D resource or flushed immediately on the specified display. Internal G2D resources can be used as an usual bitmap primitive ([[API#abi_CMD_BITMAP|abi_CMD_BITMAP]]) or reused as an input for the next G2D action.&lt;br /&gt;
Basic coordinate principle:&lt;br /&gt;
[[File:G2d_coordinates.png|center|G2D coordinates sceme]]&lt;br /&gt;
Coordinates are limited from -2048 to 2047. Maximum layers size is 240x240.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_BITMAP=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_BITMAP and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended into internal G2D resource. This API is not intended for frequent usage. It is better suited for complex background generation on game initialization or dynamic resource modification triggered by rare game events.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource that will be generated from blending layers presented between abi_CMD_G2D_BEGIN_BITMAP and the subsequent [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]]. G2D engine can keep up to 3 different resources with IDs: 0, 1 and 2.&lt;br /&gt;
: ''width'' &lt;br /&gt;
:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.&lt;br /&gt;
: ''height'' &lt;br /&gt;
:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_DISPLAY=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_DISPLAY and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended directly into display framebuffer. Obviously this API is designed for rendering scene on game tick. This API is not limited by layers count as well as [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]. However it is strictly recommended to blend no more than 4 layers. Otherwise cascade blending will be initiated resulting in some FPS drop.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''display''&lt;br /&gt;
:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_SPRITE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies game resource which will be used as a layer for blending.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource to be uses as a layer.&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: Indicates if an internal G2D resource is specified or not.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of the bitmap center to place on the layer.&lt;br /&gt;
: ''alpha''&lt;br /&gt;
:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Layer's source key - a color in ARGB8888 format to be avoided.&lt;br /&gt;
: ''rotation''&lt;br /&gt;
:: Clockwise rotation angle in degrees. It is possible to specify free angle, but only right angles have HW acceleration. Currently rotation only applicable for external resources.&lt;br /&gt;
: ''mirror''&lt;br /&gt;
:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_RECTANGLE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies rectangle area which will be used as layer of blending. This API is not intended for frequent usage, i.e. particles generation. It is better suited for changing image background or applying color mask.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''width''&lt;br /&gt;
:: Rectangle width.&lt;br /&gt;
: ''height''&lt;br /&gt;
:: Rectangle height.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Rectangle color in ARGB8888 format.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_END=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_END()&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_END() and [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]/[[API#abi_CMD_G2D_BEGIN_DISPLAY|abi_CMD_G2D_BEGIN_DISPLAY]] delimits the group of layers to be blended. After abi_CMD_G2D_END call final blending will be initiated and results will be stored according to the begin comand.&lt;br /&gt;
&lt;br /&gt;
=====Examples=====&lt;br /&gt;
1. Render into inner G2D resource buffer #face and display it on the display #face. Please, note that last argument of abi_CMD_BITMAP is a `true` flag, which means G2D resource should be used:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_REDRAW(face);&lt;br /&gt;
 ...&lt;br /&gt;
2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(face, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
=====abi_CMD_TEXT=====&lt;br /&gt;
API:&lt;br /&gt;
  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)&lt;br /&gt;
Description:&lt;br /&gt;
: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''text''&lt;br /&gt;
:: Array of chars.&lt;br /&gt;
: ''fontResID''&lt;br /&gt;
:: Custom font resource identifier.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''scale'', ''angle''&lt;br /&gt;
:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)&lt;br /&gt;
: ''r'', ''g'', ''b''&lt;br /&gt;
:: Font color in RGB format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);&lt;br /&gt;
&lt;br /&gt;
====TEXTURE drawing functions====&lt;br /&gt;
=====abi_CMD_DYNAMIC_TEXTURE=====&lt;br /&gt;
&lt;br /&gt;
API:&lt;br /&gt;
&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
: Render a texture with chosen algorithm and parameters.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''effectId''&lt;br /&gt;
:: Define algorithm to render texture. &lt;br /&gt;
:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC &lt;br /&gt;
&lt;br /&gt;
: ''time ''&lt;br /&gt;
:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.&lt;br /&gt;
: ''args'', ''argsCount''&lt;br /&gt;
:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.&lt;br /&gt;
:: Size of array depends on algorithm. For example mosaic algorithm has size of settings equals 10 bytes , so we must use aligned 4 bytes - 12 bytes array and argsCount = 3&lt;br /&gt;
&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: false - Use pawn default buffer to draw texture.&lt;br /&gt;
:: true - Use g2d buffer to draw texture - not supported now.&lt;br /&gt;
&lt;br /&gt;
'''G2D_DYNAMIC_TEXTURE_MOSAIC''' alogrithm description&lt;br /&gt;
&lt;br /&gt;
:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte&lt;br /&gt;
&lt;br /&gt;
:Noise factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Time factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Color factors :&lt;br /&gt;
::r : values from 0 to 10&lt;br /&gt;
::g : values from 0 to 10&lt;br /&gt;
::b : values from 0 to 10&lt;br /&gt;
:Zoom factor :&lt;br /&gt;
::zoom  values from 0 to 10&lt;br /&gt;
&lt;br /&gt;
For example we want to set all parameters above with values in order 1,2,3,4,5,6,7,8,9,10. Take in attention that each parameter is 1 byte we must make array of 32-bit values&lt;br /&gt;
0x04030201, 0x08070605, 0x00000A09&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };&lt;br /&gt;
 mosaic_effect_settings_length = 3;&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=74</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=74"/>
		<updated>2020-09-10T08:43:42Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: /* abi_CMD_DYNAMIC_TEXTURE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCube executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
====Graphics 2D acceleration (G2D)====&lt;br /&gt;
WOWCube provides the 2D acceleration interfaces to enhance gaming experience . Basically G2D engine allows to blend up to the 4 image layers at once with a HW acceleration. However there is no limit of layers, they are blended in a cascade. For example, if Pawn script requested 7 layers to be blended then 2 HW blending will occur:&lt;br /&gt;
[[File:Cascade.png|center|G2D cascading scheme]]&lt;br /&gt;
Result of the blending can be saved as an internal G2D resource or flushed immediately on the specified display. Internal G2D resources can be used as an usual bitmap primitive ([[API#abi_CMD_BITMAP|abi_CMD_BITMAP]]) or reused as an input for the next G2D action.&lt;br /&gt;
Basic coordinate principle:&lt;br /&gt;
[[File:G2d_coordinates.png|center|G2D coordinates sceme]]&lt;br /&gt;
Coordinates are limited from -2048 to 2047. Maximum layers size is 240x240.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_BITMAP=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_BITMAP and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended into internal G2D resource. This API is not intended for frequent usage. It is better suited for complex background generation on game initialization or dynamic resource modification triggered by rare game events.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource that will be generated from blending layers presented between abi_CMD_G2D_BEGIN_BITMAP and the subsequent [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]]. G2D engine can keep up to 3 different resources with IDs: 0, 1 and 2.&lt;br /&gt;
: ''width'' &lt;br /&gt;
:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.&lt;br /&gt;
: ''height'' &lt;br /&gt;
:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_DISPLAY=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_DISPLAY and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended directly into display framebuffer. Obviously this API is designed for rendering scene on game tick. This API is not limited by layers count as well as [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]. However it is strictly recommended to blend no more than 4 layers. Otherwise cascade blending will be initiated resulting in some FPS drop.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''display''&lt;br /&gt;
:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_SPRITE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies game resource which will be used as a layer for blending.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource to be uses as a layer.&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: Indicates if an internal G2D resource is specified or not.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of the bitmap center to place on the layer.&lt;br /&gt;
: ''alpha''&lt;br /&gt;
:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Layer's source key - a color in ARGB8888 format to be avoided.&lt;br /&gt;
: ''rotation''&lt;br /&gt;
:: Clockwise rotation angle in degrees. It is possible to specify free angle, but only right angles have HW acceleration. Currently rotation only applicable for external resources.&lt;br /&gt;
: ''mirror''&lt;br /&gt;
:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_RECTANGLE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies rectangle area which will be used as layer of blending. This API is not intended for frequent usage, i.e. particles generation. It is better suited for changing image background or applying color mask.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''width''&lt;br /&gt;
:: Rectangle width.&lt;br /&gt;
: ''height''&lt;br /&gt;
:: Rectangle height.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Rectangle color in ARGB8888 format.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_END=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_END()&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_END() and [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]/[[API#abi_CMD_G2D_BEGIN_DISPLAY|abi_CMD_G2D_BEGIN_DISPLAY]] delimits the group of layers to be blended. After abi_CMD_G2D_END call final blending will be initiated and results will be stored according to the begin comand.&lt;br /&gt;
&lt;br /&gt;
=====Examples=====&lt;br /&gt;
1. Render into inner G2D resource buffer #face and display it on the display #face. Please, note that last argument of abi_CMD_BITMAP is a `true` flag, which means G2D resource should be used:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_REDRAW(face);&lt;br /&gt;
 ...&lt;br /&gt;
2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(face, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
=====abi_CMD_TEXT=====&lt;br /&gt;
API:&lt;br /&gt;
  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)&lt;br /&gt;
Description:&lt;br /&gt;
: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''text''&lt;br /&gt;
:: Array of chars.&lt;br /&gt;
: ''fontResID''&lt;br /&gt;
:: Custom font resource identifier.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''scale'', ''angle''&lt;br /&gt;
:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)&lt;br /&gt;
: ''r'', ''g'', ''b''&lt;br /&gt;
:: Font color in RGB format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);&lt;br /&gt;
&lt;br /&gt;
====TEXTURE drawing functions====&lt;br /&gt;
=====abi_CMD_DYNAMIC_TEXTURE=====&lt;br /&gt;
&lt;br /&gt;
API:&lt;br /&gt;
&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
: Render a texture with chosen algorithm and parameters.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''effectId''&lt;br /&gt;
:: Define algorithm to render texture. &lt;br /&gt;
:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC &lt;br /&gt;
&lt;br /&gt;
: ''time ''&lt;br /&gt;
:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.&lt;br /&gt;
: ''args'', ''argsCount''&lt;br /&gt;
:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.&lt;br /&gt;
:: Size of array depends on algorithm. For example mosaic algorithm has size of settings equals 10 bytes , so we must use aligned 4 bytes - 12 bytes array and argsCount = 3&lt;br /&gt;
&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: false - Use pawn default buffer to draw texture.&lt;br /&gt;
:: true - Use g2d buffer to draw texture - not supported now.&lt;br /&gt;
&lt;br /&gt;
'''G2D_DYNAMIC_TEXTURE_MOSAIC''' alogrithm description&lt;br /&gt;
&lt;br /&gt;
:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte&lt;br /&gt;
&lt;br /&gt;
:Noise factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Time factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Color factors :&lt;br /&gt;
::r : values from 0 to 10&lt;br /&gt;
::g : values from 0 to 10&lt;br /&gt;
::b : values from 0 to 10&lt;br /&gt;
:Zoom factor :&lt;br /&gt;
::zoom  values from 0 to 10&lt;br /&gt;
&lt;br /&gt;
For example we want to set all parameters above with values in order 1,2,3,4,5,6,7,8,9,10. Take in attention that each parameter is 1 byte we must make array of 32-bit values&lt;br /&gt;
0x04030201, 0x08070605, 0x00000A09&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };&lt;br /&gt;
 mosaic_effect_settings_length = 3;&lt;br /&gt;
 abi_CMD_TEXT(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=73</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=73"/>
		<updated>2020-09-10T08:40:29Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: /* abi_CMD_DYNAMIC_TEXTURE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCube executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
====Graphics 2D acceleration (G2D)====&lt;br /&gt;
WOWCube provides the 2D acceleration interfaces to enhance gaming experience . Basically G2D engine allows to blend up to the 4 image layers at once with a HW acceleration. However there is no limit of layers, they are blended in a cascade. For example, if Pawn script requested 7 layers to be blended then 2 HW blending will occur:&lt;br /&gt;
[[File:Cascade.png|center|G2D cascading scheme]]&lt;br /&gt;
Result of the blending can be saved as an internal G2D resource or flushed immediately on the specified display. Internal G2D resources can be used as an usual bitmap primitive ([[API#abi_CMD_BITMAP|abi_CMD_BITMAP]]) or reused as an input for the next G2D action.&lt;br /&gt;
Basic coordinate principle:&lt;br /&gt;
[[File:G2d_coordinates.png|center|G2D coordinates sceme]]&lt;br /&gt;
Coordinates are limited from -2048 to 2047. Maximum layers size is 240x240.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_BITMAP=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_BITMAP and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended into internal G2D resource. This API is not intended for frequent usage. It is better suited for complex background generation on game initialization or dynamic resource modification triggered by rare game events.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource that will be generated from blending layers presented between abi_CMD_G2D_BEGIN_BITMAP and the subsequent [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]]. G2D engine can keep up to 3 different resources with IDs: 0, 1 and 2.&lt;br /&gt;
: ''width'' &lt;br /&gt;
:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.&lt;br /&gt;
: ''height'' &lt;br /&gt;
:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_DISPLAY=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_DISPLAY and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended directly into display framebuffer. Obviously this API is designed for rendering scene on game tick. This API is not limited by layers count as well as [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]. However it is strictly recommended to blend no more than 4 layers. Otherwise cascade blending will be initiated resulting in some FPS drop.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''display''&lt;br /&gt;
:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_SPRITE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies game resource which will be used as a layer for blending.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource to be uses as a layer.&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: Indicates if an internal G2D resource is specified or not.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of the bitmap center to place on the layer.&lt;br /&gt;
: ''alpha''&lt;br /&gt;
:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Layer's source key - a color in ARGB8888 format to be avoided.&lt;br /&gt;
: ''rotation''&lt;br /&gt;
:: Clockwise rotation angle in degrees. It is possible to specify free angle, but only right angles have HW acceleration. Currently rotation only applicable for external resources.&lt;br /&gt;
: ''mirror''&lt;br /&gt;
:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_RECTANGLE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies rectangle area which will be used as layer of blending. This API is not intended for frequent usage, i.e. particles generation. It is better suited for changing image background or applying color mask.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''width''&lt;br /&gt;
:: Rectangle width.&lt;br /&gt;
: ''height''&lt;br /&gt;
:: Rectangle height.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Rectangle color in ARGB8888 format.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_END=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_END()&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_END() and [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]/[[API#abi_CMD_G2D_BEGIN_DISPLAY|abi_CMD_G2D_BEGIN_DISPLAY]] delimits the group of layers to be blended. After abi_CMD_G2D_END call final blending will be initiated and results will be stored according to the begin comand.&lt;br /&gt;
&lt;br /&gt;
=====Examples=====&lt;br /&gt;
1. Render into inner G2D resource buffer #face and display it on the display #face. Please, note that last argument of abi_CMD_BITMAP is a `true` flag, which means G2D resource should be used:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_REDRAW(face);&lt;br /&gt;
 ...&lt;br /&gt;
2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(face, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
=====abi_CMD_TEXT=====&lt;br /&gt;
API:&lt;br /&gt;
  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)&lt;br /&gt;
Description:&lt;br /&gt;
: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''text''&lt;br /&gt;
:: Array of chars.&lt;br /&gt;
: ''fontResID''&lt;br /&gt;
:: Custom font resource identifier.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''scale'', ''angle''&lt;br /&gt;
:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)&lt;br /&gt;
: ''r'', ''g'', ''b''&lt;br /&gt;
:: Font color in RGB format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);&lt;br /&gt;
&lt;br /&gt;
====TEXTURE drawing functions====&lt;br /&gt;
=====abi_CMD_DYNAMIC_TEXTURE=====&lt;br /&gt;
&lt;br /&gt;
API:&lt;br /&gt;
&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
: Render a texture with chosen algorithm and parameters.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''effectId''&lt;br /&gt;
:: Define algorithm to render texture. &lt;br /&gt;
:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC &lt;br /&gt;
&lt;br /&gt;
: ''time ''&lt;br /&gt;
:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.&lt;br /&gt;
: ''args'', ''argsCount''&lt;br /&gt;
:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.&lt;br /&gt;
:: Size of array depends on algorithm. For example mosaic algorithm has size of settings equals 10 bytes , so we must use aligned 4 bytes - 12 bytes array and argsCount = 3&lt;br /&gt;
&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: false - Use pawn default buffer to draw texture.&lt;br /&gt;
:: true - Use g2d buffer to draw texture - not supported now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* G2D_DYNAMIC_TEXTURE_MOSAIC */ alogrithm description&lt;br /&gt;
&lt;br /&gt;
:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte&lt;br /&gt;
&lt;br /&gt;
:Noise factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Time factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Color factors :&lt;br /&gt;
::r : values from 0 to 10&lt;br /&gt;
::g : values from 0 to 10&lt;br /&gt;
::b : values from 0 to 10&lt;br /&gt;
:Zoom factor :&lt;br /&gt;
::zoom  values from 0 to 10&lt;br /&gt;
&lt;br /&gt;
For example we want to set all parameters above with values in order 1,2,3,4,5,6,7,8,9,10. Take in attention that each parameter is 1 byte we must make array of 32-bit values&lt;br /&gt;
0x04030201, 0x08070605, 0x00000A09&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };&lt;br /&gt;
 mosaic_effect_settings_length = 3;&lt;br /&gt;
 abi_CMD_TEXT(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=72</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=72"/>
		<updated>2020-09-10T08:39:41Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: /* abi_CMD_DYNAMIC_TEXTURE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCube executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
====Graphics 2D acceleration (G2D)====&lt;br /&gt;
WOWCube provides the 2D acceleration interfaces to enhance gaming experience . Basically G2D engine allows to blend up to the 4 image layers at once with a HW acceleration. However there is no limit of layers, they are blended in a cascade. For example, if Pawn script requested 7 layers to be blended then 2 HW blending will occur:&lt;br /&gt;
[[File:Cascade.png|center|G2D cascading scheme]]&lt;br /&gt;
Result of the blending can be saved as an internal G2D resource or flushed immediately on the specified display. Internal G2D resources can be used as an usual bitmap primitive ([[API#abi_CMD_BITMAP|abi_CMD_BITMAP]]) or reused as an input for the next G2D action.&lt;br /&gt;
Basic coordinate principle:&lt;br /&gt;
[[File:G2d_coordinates.png|center|G2D coordinates sceme]]&lt;br /&gt;
Coordinates are limited from -2048 to 2047. Maximum layers size is 240x240.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_BITMAP=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_BITMAP and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended into internal G2D resource. This API is not intended for frequent usage. It is better suited for complex background generation on game initialization or dynamic resource modification triggered by rare game events.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource that will be generated from blending layers presented between abi_CMD_G2D_BEGIN_BITMAP and the subsequent [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]]. G2D engine can keep up to 3 different resources with IDs: 0, 1 and 2.&lt;br /&gt;
: ''width'' &lt;br /&gt;
:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.&lt;br /&gt;
: ''height'' &lt;br /&gt;
:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_DISPLAY=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_DISPLAY and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended directly into display framebuffer. Obviously this API is designed for rendering scene on game tick. This API is not limited by layers count as well as [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]. However it is strictly recommended to blend no more than 4 layers. Otherwise cascade blending will be initiated resulting in some FPS drop.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''display''&lt;br /&gt;
:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_SPRITE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies game resource which will be used as a layer for blending.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource to be uses as a layer.&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: Indicates if an internal G2D resource is specified or not.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of the bitmap center to place on the layer.&lt;br /&gt;
: ''alpha''&lt;br /&gt;
:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Layer's source key - a color in ARGB8888 format to be avoided.&lt;br /&gt;
: ''rotation''&lt;br /&gt;
:: Clockwise rotation angle in degrees. It is possible to specify free angle, but only right angles have HW acceleration. Currently rotation only applicable for external resources.&lt;br /&gt;
: ''mirror''&lt;br /&gt;
:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_RECTANGLE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies rectangle area which will be used as layer of blending. This API is not intended for frequent usage, i.e. particles generation. It is better suited for changing image background or applying color mask.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''width''&lt;br /&gt;
:: Rectangle width.&lt;br /&gt;
: ''height''&lt;br /&gt;
:: Rectangle height.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Rectangle color in ARGB8888 format.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_END=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_END()&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_END() and [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]/[[API#abi_CMD_G2D_BEGIN_DISPLAY|abi_CMD_G2D_BEGIN_DISPLAY]] delimits the group of layers to be blended. After abi_CMD_G2D_END call final blending will be initiated and results will be stored according to the begin comand.&lt;br /&gt;
&lt;br /&gt;
=====Examples=====&lt;br /&gt;
1. Render into inner G2D resource buffer #face and display it on the display #face. Please, note that last argument of abi_CMD_BITMAP is a `true` flag, which means G2D resource should be used:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_REDRAW(face);&lt;br /&gt;
 ...&lt;br /&gt;
2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(face, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
=====abi_CMD_TEXT=====&lt;br /&gt;
API:&lt;br /&gt;
  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)&lt;br /&gt;
Description:&lt;br /&gt;
: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''text''&lt;br /&gt;
:: Array of chars.&lt;br /&gt;
: ''fontResID''&lt;br /&gt;
:: Custom font resource identifier.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''scale'', ''angle''&lt;br /&gt;
:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)&lt;br /&gt;
: ''r'', ''g'', ''b''&lt;br /&gt;
:: Font color in RGB format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);&lt;br /&gt;
&lt;br /&gt;
====TEXTURE drawing functions====&lt;br /&gt;
=====abi_CMD_DYNAMIC_TEXTURE=====&lt;br /&gt;
&lt;br /&gt;
API:&lt;br /&gt;
&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
: Render a texture with chosen algorithm and parameters.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''effectId''&lt;br /&gt;
:: Define algorithm to render texture. &lt;br /&gt;
:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC &lt;br /&gt;
&lt;br /&gt;
: ''time ''&lt;br /&gt;
:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.&lt;br /&gt;
: ''args'', ''argsCount''&lt;br /&gt;
:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.&lt;br /&gt;
:: Size of array depends on algorithm. For example mosaic algorithm has size of settings equals 10 bytes , so we must use aligned 4 bytes - 12 bytes array and argsCount = 3&lt;br /&gt;
&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: false - Use pawn default buffer to draw texture.&lt;br /&gt;
:: true - Use g2d buffer to draw texture - not supported now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*G2D_DYNAMIC_TEXTURE_MOSAIC*/ alogrithm description&lt;br /&gt;
&lt;br /&gt;
:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte&lt;br /&gt;
&lt;br /&gt;
:Noise factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Time factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Color factors :&lt;br /&gt;
::r : values from 0 to 10&lt;br /&gt;
::g : values from 0 to 10&lt;br /&gt;
::b : values from 0 to 10&lt;br /&gt;
:Zoom factor :&lt;br /&gt;
::zoom  values from 0 to 10&lt;br /&gt;
&lt;br /&gt;
For example we want to set all parameters above with values in order 1,2,3,4,5,6,7,8,9,10. Take in attention that each parameter is 1 byte we must make array of 32-bit values&lt;br /&gt;
0x04030201, 0x08070605, 0x00000A09&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };&lt;br /&gt;
 mosaic_effect_settings_length = 3;&lt;br /&gt;
 abi_CMD_TEXT(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=71</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=71"/>
		<updated>2020-09-10T08:39:22Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: /* abi_CMD_DYNAMIC_TEXTURE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCube executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
====Graphics 2D acceleration (G2D)====&lt;br /&gt;
WOWCube provides the 2D acceleration interfaces to enhance gaming experience . Basically G2D engine allows to blend up to the 4 image layers at once with a HW acceleration. However there is no limit of layers, they are blended in a cascade. For example, if Pawn script requested 7 layers to be blended then 2 HW blending will occur:&lt;br /&gt;
[[File:Cascade.png|center|G2D cascading scheme]]&lt;br /&gt;
Result of the blending can be saved as an internal G2D resource or flushed immediately on the specified display. Internal G2D resources can be used as an usual bitmap primitive ([[API#abi_CMD_BITMAP|abi_CMD_BITMAP]]) or reused as an input for the next G2D action.&lt;br /&gt;
Basic coordinate principle:&lt;br /&gt;
[[File:G2d_coordinates.png|center|G2D coordinates sceme]]&lt;br /&gt;
Coordinates are limited from -2048 to 2047. Maximum layers size is 240x240.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_BITMAP=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_BITMAP and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended into internal G2D resource. This API is not intended for frequent usage. It is better suited for complex background generation on game initialization or dynamic resource modification triggered by rare game events.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource that will be generated from blending layers presented between abi_CMD_G2D_BEGIN_BITMAP and the subsequent [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]]. G2D engine can keep up to 3 different resources with IDs: 0, 1 and 2.&lt;br /&gt;
: ''width'' &lt;br /&gt;
:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.&lt;br /&gt;
: ''height'' &lt;br /&gt;
:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_BEGIN_DISPLAY=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_BEGIN_DISPLAY and [[API#abi_CMD_G2D_END|abi_CMD_G2D_END]] delimits the group of layers to be blended directly into display framebuffer. Obviously this API is designed for rendering scene on game tick. This API is not limited by layers count as well as [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]. However it is strictly recommended to blend no more than 4 layers. Otherwise cascade blending will be initiated resulting in some FPS drop.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''display''&lt;br /&gt;
:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.&lt;br /&gt;
: ''replace'' &lt;br /&gt;
:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_SPRITE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies game resource which will be used as a layer for blending.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''resID''&lt;br /&gt;
:: ID of the resource to be uses as a layer.&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: Indicates if an internal G2D resource is specified or not.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of the bitmap center to place on the layer.&lt;br /&gt;
: ''alpha''&lt;br /&gt;
:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Layer's source key - a color in ARGB8888 format to be avoided.&lt;br /&gt;
: ''rotation''&lt;br /&gt;
:: Clockwise rotation angle in degrees. It is possible to specify free angle, but only right angles have HW acceleration. Currently rotation only applicable for external resources.&lt;br /&gt;
: ''mirror''&lt;br /&gt;
:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_ADD_RECTANGLE=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)&lt;br /&gt;
Description:&lt;br /&gt;
: Specifies rectangle area which will be used as layer of blending. This API is not intended for frequent usage, i.e. particles generation. It is better suited for changing image background or applying color mask.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''width''&lt;br /&gt;
:: Rectangle width.&lt;br /&gt;
: ''height''&lt;br /&gt;
:: Rectangle height.&lt;br /&gt;
: ''color''&lt;br /&gt;
:: Rectangle color in ARGB8888 format.&lt;br /&gt;
&lt;br /&gt;
=====abi_CMD_G2D_END=====&lt;br /&gt;
Syntax:&lt;br /&gt;
 abi_CMD_G2D_END()&lt;br /&gt;
Description:&lt;br /&gt;
: abi_CMD_G2D_END() and [[API#abi_CMD_G2D_BEGIN_BITMAP|abi_CMD_G2D_BEGIN_BITMAP]]/[[API#abi_CMD_G2D_BEGIN_DISPLAY|abi_CMD_G2D_BEGIN_DISPLAY]] delimits the group of layers to be blended. After abi_CMD_G2D_END call final blending will be initiated and results will be stored according to the begin comand.&lt;br /&gt;
&lt;br /&gt;
=====Examples=====&lt;br /&gt;
1. Render into inner G2D resource buffer #face and display it on the display #face. Please, note that last argument of abi_CMD_BITMAP is a `true` flag, which means G2D resource should be used:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_REDRAW(face);&lt;br /&gt;
 ...&lt;br /&gt;
2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:&lt;br /&gt;
 ...&lt;br /&gt;
 abi_CMD_G2D_BEGIN_DISPLAY(face, true);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);&lt;br /&gt;
 abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);&lt;br /&gt;
 abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);&lt;br /&gt;
 abi_CMD_G2D_END();&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
=====abi_CMD_TEXT=====&lt;br /&gt;
API:&lt;br /&gt;
  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)&lt;br /&gt;
Description:&lt;br /&gt;
: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''text''&lt;br /&gt;
:: Array of chars.&lt;br /&gt;
: ''fontResID''&lt;br /&gt;
:: Custom font resource identifier.&lt;br /&gt;
: ''x'', ''y''&lt;br /&gt;
:: Coordinates of top left rectangle corner.&lt;br /&gt;
: ''scale'', ''angle''&lt;br /&gt;
:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)&lt;br /&gt;
: ''r'', ''g'', ''b''&lt;br /&gt;
:: Font color in RGB format.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);&lt;br /&gt;
&lt;br /&gt;
====TEXTURE drawing functions====&lt;br /&gt;
=====abi_CMD_DYNAMIC_TEXTURE=====&lt;br /&gt;
&lt;br /&gt;
API:&lt;br /&gt;
&lt;br /&gt;
 abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
: Render a texture with chosen algorithm and parameters.&lt;br /&gt;
Arguments:&lt;br /&gt;
: ''effectId''&lt;br /&gt;
:: Define algorithm to render texture. &lt;br /&gt;
:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC &lt;br /&gt;
&lt;br /&gt;
: ''time ''&lt;br /&gt;
:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.&lt;br /&gt;
: ''args'', ''argsCount''&lt;br /&gt;
:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.&lt;br /&gt;
:: Size of array depends on algorithm. For example mosaic algorithm has size of settings equals 10 bytes , so we must use aligned 4 bytes - 12 bytes array and argsCount = 3&lt;br /&gt;
&lt;br /&gt;
: ''g2d''&lt;br /&gt;
:: false - Use pawn default buffer to draw texture.&lt;br /&gt;
:: true - Use g2d buffer to draw texture - not supported now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*G2D_DYNAMIC_TEXTURE_MOSAIC*/ alogrithm description&lt;br /&gt;
&lt;br /&gt;
:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte&lt;br /&gt;
&lt;br /&gt;
:Noise factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Time factors :&lt;br /&gt;
::factor x : values from 0 to 10&lt;br /&gt;
::factor y : values from 0 to 10&lt;br /&gt;
::factor xy : values from 0 to 10&lt;br /&gt;
:Color factors :&lt;br /&gt;
::r : values from 0 to 10&lt;br /&gt;
::g : values from 0 to 10&lt;br /&gt;
::b : values from 0 to 10&lt;br /&gt;
:Zoom factor :&lt;br /&gt;
::zoom  values from 0 to 10&lt;br /&gt;
&lt;br /&gt;
For example we want to set all parameters above with values in order 1,2,3,4,5,6,7,8,9,10. Take in attention that each parameter is 1 byte we must make array of 32-bit values&lt;br /&gt;
0x04030201, 0x08070605, 0x00000A09&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };&lt;br /&gt;
 mosaic_effect_settings_length = 3;&lt;br /&gt;
 abi_CMD_TEXT(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=49</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=49"/>
		<updated>2020-08-27T08:14:59Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCUBE executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Firmware API==&lt;br /&gt;
===Common Libraries===&lt;br /&gt;
&lt;br /&gt;
====math_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/math_g2d.h&lt;br /&gt;
 Contains functions to work with fixed point, vectors, matrix, quaternion and colors.&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
====tests_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/tests_g2d.h&lt;br /&gt;
 Contains functions to for debug and testing purposes.&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
 Measure execution time of foo() method&lt;br /&gt;
 G2D_beginMeasure();&lt;br /&gt;
 foo();&lt;br /&gt;
 uint32_t time = G2D_endMeasure();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====Cube 3D====  &lt;br /&gt;
Located at cubios/graphics/effects_cube3d.h &lt;br /&gt;
&lt;br /&gt;
General purpose to use this effect comes from requirements to menu item groups.&lt;br /&gt;
&lt;br /&gt;
Effect allows to draw 3d cube with properties&lt;br /&gt;
 - border width ( in fixed32_t units from 0 to 1 )&lt;br /&gt;
 - border color ( in rgb565 format )&lt;br /&gt;
 - clip rect    ( rectangle in the buffer to draw cube)&lt;br /&gt;
 - buffer       ( start address of custom buffer to draw )&lt;br /&gt;
 - pitch        ( pitch of the buffer - used to calculate address in memory for next 'line' in buffer  address(x,y) = startAddress + x + y * pitch&lt;br /&gt;
 - textures     ( array of pointer to custom textures to draw )&lt;br /&gt;
 - texturesIds[24]  ( index of texture must be show on cube face, each face contains 4 cells ( 0 top-left, 1 top-right, 2 bottom-left, 3 bottom-right)  &lt;br /&gt;
                      index = faceId * 4 + cellIndex  &lt;br /&gt;
                     for example we need set 1st texture to 3rd face and top-right cell = 3 * 4 + 1 = 13  :&lt;br /&gt;
                           texuresIds[13] = 1; &lt;br /&gt;
                           texuresIds[13] = 0; zero will mean that there must be empty cell&lt;br /&gt;
                     )&lt;br /&gt;
&lt;br /&gt;
To find live example of usage look at the function effect_cube3d_render_test(framebuffer_t fb, uint32_t currentTime)&lt;br /&gt;
There implemented animation of two cubes flying around screen center &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
G2D acceleration is implemented as a separate task which handles all communication with G2D accelerator. It has mailbox for requests and it also provides utility functions to fill up this mail box for other tasks. Communication is done in OpenGL style, any other task can ask to prepare layers blending, add some layers to blend and initiate blending process.]]&lt;br /&gt;
Currently result is stored in 3 internal buffers (one for each modules face) and ADD_BITMAP command is modified to access buffers in a primitive way. It is also supposed to render directly into display framebuffer (TBD).&lt;br /&gt;
There is a way to wait until rendering is complete for other tasks.&lt;br /&gt;
Task is implemented as a NFA&lt;br /&gt;
&lt;br /&gt;
[[File:G2D acceleration.png|thumb|right|280px| G2D acceleration paradigm]]&lt;br /&gt;
&lt;br /&gt;
====Graphic primitives====&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, 90, 160, 4, current_angles[face], 255, 0, 0);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=48</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=48"/>
		<updated>2020-08-27T08:14:09Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCUBE executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Firmware API==&lt;br /&gt;
===Common Libraries===&lt;br /&gt;
&lt;br /&gt;
====math_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/math_g2d.h&lt;br /&gt;
 Contains functions to work with fixed point, vectors, matrix, quaternion and colors.&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
====tests_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/tests_g2d.h&lt;br /&gt;
 Contains functions to for debug and testing purposes.&lt;br /&gt;
&lt;br /&gt;
 1. Measure execution time of foo() method&lt;br /&gt;
 Example :&lt;br /&gt;
&lt;br /&gt;
 G2D_beginMeasure();&lt;br /&gt;
 foo();&lt;br /&gt;
 uint32_t time = G2D_endMeasure();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====Cube 3D====  &lt;br /&gt;
Located at cubios/graphics/effects_cube3d.h &lt;br /&gt;
&lt;br /&gt;
General purpose to use this effect comes from requirements to menu item groups.&lt;br /&gt;
&lt;br /&gt;
Effect allows to draw 3d cube with properties&lt;br /&gt;
 - border width ( in fixed32_t units from 0 to 1 )&lt;br /&gt;
 - border color ( in rgb565 format )&lt;br /&gt;
 - clip rect    ( rectangle in the buffer to draw cube)&lt;br /&gt;
 - buffer       ( start address of custom buffer to draw )&lt;br /&gt;
 - pitch        ( pitch of the buffer - used to calculate address in memory for next 'line' in buffer  address(x,y) = startAddress + x + y * pitch&lt;br /&gt;
 - textures     ( array of pointer to custom textures to draw )&lt;br /&gt;
 - texturesIds[24]  ( index of texture must be show on cube face, each face contains 4 cells ( 0 top-left, 1 top-right, 2 bottom-left, 3 bottom-right)  &lt;br /&gt;
                      index = faceId * 4 + cellIndex  &lt;br /&gt;
                     for example we need set 1st texture to 3rd face and top-right cell = 3 * 4 + 1 = 13  :&lt;br /&gt;
                           texuresIds[13] = 1; &lt;br /&gt;
                           texuresIds[13] = 0; zero will mean that there must be empty cell&lt;br /&gt;
                     )&lt;br /&gt;
&lt;br /&gt;
To find live example of usage look at the function effect_cube3d_render_test(framebuffer_t fb, uint32_t currentTime)&lt;br /&gt;
There implemented animation of two cubes flying around screen center &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
G2D acceleration is implemented as a separate task which handles all communication with G2D accelerator. It has mailbox for requests and it also provides utility functions to fill up this mail box for other tasks. Communication is done in OpenGL style, any other task can ask to prepare layers blending, add some layers to blend and initiate blending process.]]&lt;br /&gt;
Currently result is stored in 3 internal buffers (one for each modules face) and ADD_BITMAP command is modified to access buffers in a primitive way. It is also supposed to render directly into display framebuffer (TBD).&lt;br /&gt;
There is a way to wait until rendering is complete for other tasks.&lt;br /&gt;
Task is implemented as a NFA&lt;br /&gt;
&lt;br /&gt;
[[File:G2D acceleration.png|thumb|right|280px| G2D acceleration paradigm]]&lt;br /&gt;
&lt;br /&gt;
====Graphic primitives====&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, 90, 160, 4, current_angles[face], 255, 0, 0);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wowcube.com/index.php?title=API&amp;diff=47</id>
		<title>API</title>
		<link rel="alternate" type="text/html" href="https://wiki.wowcube.com/index.php?title=API&amp;diff=47"/>
		<updated>2020-08-27T08:09:51Z</updated>

		<summary type="html">&lt;p&gt;PavelZh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|This is a beta version, API changes can be made without warning.}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The main functions of the API are listed here, the features of the work of the environment are described&lt;br /&gt;
&lt;br /&gt;
==WOWCube Paradigms==&lt;br /&gt;
&lt;br /&gt;
WOWCUBE executes 8 copies of the byte-code of the script at the same time, providing functions for the interaction of scripts with each other, drawing functions, functions for accessing resources, and other specific functions. Each copy of the script has access to 3 displays. Resource scripts are packed into a package.&lt;br /&gt;
&lt;br /&gt;
==Firmware API==&lt;br /&gt;
===Common Libraries===&lt;br /&gt;
&lt;br /&gt;
====math_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/math_g2d.h&lt;br /&gt;
 Contains functions to work with fixed point, vectors, matrix, quaternion and colors.&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
====tests_g2d.h====&lt;br /&gt;
 Located at cubios/graphics/tests_g2d.h&lt;br /&gt;
 Contains functions to for debug and testing purposes.&lt;br /&gt;
&lt;br /&gt;
===Effects===&lt;br /&gt;
====Cube 3D====  &lt;br /&gt;
Located at cubios/graphics/effects_cube3d.h &lt;br /&gt;
&lt;br /&gt;
General purpose to use this effect comes from requirements to menu item groups.&lt;br /&gt;
&lt;br /&gt;
Effect allows to draw 3d cube with properties&lt;br /&gt;
 - border width ( in fixed32_t units from 0 to 1 )&lt;br /&gt;
 - border color ( in rgb565 format )&lt;br /&gt;
 - clip rect    ( rectangle in the buffer to draw cube)&lt;br /&gt;
 - buffer       ( start address of custom buffer to draw )&lt;br /&gt;
 - pitch        ( pitch of the buffer - used to calculate address in memory for next 'line' in buffer  address(x,y) = startAddress + x + y * pitch&lt;br /&gt;
 - textures     ( array of pointer to custom textures to draw )&lt;br /&gt;
 - texturesIds[24]  ( index of texture must be show on cube face, each face contains 4 cells ( 0 top-left, 1 top-right, 2 bottom-left, 3 bottom-right)  &lt;br /&gt;
                      index = faceId * 4 + cellIndex  &lt;br /&gt;
                     for example we need set 1st texture to 3rd face and top-right cell = 3 * 4 + 1 = 13  :&lt;br /&gt;
                           texuresIds[13] = 1; &lt;br /&gt;
                           texuresIds[13] = 0; zero will mean that there must be empty cell&lt;br /&gt;
                     )&lt;br /&gt;
&lt;br /&gt;
To find live example of usage look at the function effect_cube3d_render_test(framebuffer_t fb, uint32_t currentTime)&lt;br /&gt;
There implemented animation of two cubes flying around screen center &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Pawn API==&lt;br /&gt;
===Graphic functions===&lt;br /&gt;
&lt;br /&gt;
G2D acceleration is implemented as a separate task which handles all communication with G2D accelerator. It has mailbox for requests and it also provides utility functions to fill up this mail box for other tasks. Communication is done in OpenGL style, any other task can ask to prepare layers blending, add some layers to blend and initiate blending process.]]&lt;br /&gt;
Currently result is stored in 3 internal buffers (one for each modules face) and ADD_BITMAP command is modified to access buffers in a primitive way. It is also supposed to render directly into display framebuffer (TBD).&lt;br /&gt;
There is a way to wait until rendering is complete for other tasks.&lt;br /&gt;
Task is implemented as a NFA&lt;br /&gt;
&lt;br /&gt;
[[File:G2D acceleration.png|thumb|right|280px| G2D acceleration paradigm]]&lt;br /&gt;
&lt;br /&gt;
====Graphic primitives====&lt;br /&gt;
&lt;br /&gt;
====Font drawing functions====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example&lt;br /&gt;
 new text[4] = ['A', 'p', 'p', '\0'];&lt;br /&gt;
 abi_CMD_TEXT(text, 90, 160, 4, current_angles[face], 255, 0, 0);&lt;/div&gt;</summary>
		<author><name>PavelZh</name></author>
		
	</entry>
</feed>