MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "12": {
                "pageid": 12,
                "ns": 0,
                "title": "API",
                "revisions": [
                    {
                        "user": "Raccoon pirate",
                        "timestamp": "2022-02-11T06:50:12Z",
                        "slots": {
                            "main": {
                                "contentmodel": "wikitext",
                                "contentformat": "text/x-wiki",
                                "*": "{{notice|This is a beta version, API changes can be made without warning.}}\n\n=Introduction=\n\nThe main functions of the API are listed here, the features of the work of the environment are described\n\n==WOWCube Paradigms==\n\nWOWCube 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.\n\n==Pawn API==\n===Graphic functions===\n\n====Graphics 2D acceleration (G2D)====\nWOWCube 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:\n[[File:Cascade.png|center|G2D cascading scheme]]\nResult 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.\nBasic coordinate principle:\n[[File:G2d_coordinates.png|center|G2D coordinates sceme]]\nCoordinates are limited from -2048 to 2047. Maximum layers size is 240x240.\n\n=====abi_CMD_G2D_BEGIN_BITMAP=====\nSyntax:\n abi_CMD_G2D_BEGIN_BITMAP(const resID, const width, const height, const bool:replace)\nDescription:\n: 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.\nArguments:\n: ''resID''\n:: 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.\n: ''width'' \n:: Width of the resulting resource. G2D engine can keep resource of 240px width maximum.\n: ''height'' \n:: Height of the resulting resource. G2D engine can keep resource of 240px height maximum.\n: ''replace'' \n:: If true, then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.\n\n=====abi_CMD_G2D_BEGIN_DISPLAY=====\nSyntax:\n abi_CMD_G2D_BEGIN_DISPLAY(const display, const bool:replace)\nDescription:\n: 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.\nArguments:\n: ''display''\n:: ID of the display which framebuffer will be used for blending. Each module have 3 displays with ID starting from 0.\n: ''replace'' \n:: If true then an existing image will be replaced completely, otherwise it will be overwritten by reusing itself as a background layer.\n\n=====abi_CMD_G2D_ADD_SPRITE=====\nSyntax:\n abi_CMD_G2D_ADD_SPRITE(const resID, const bool:g2d, const x, const y, const alpha, const color, const rotation, const mirror)\nDescription:\n: Specifies game resource which will be used as a layer for blending.\nArguments:\n: ''resID''\n:: ID of the resource to be uses as a layer.\n: ''g2d''\n:: Indicates if an internal G2D resource is specified or not.\n: ''x'', ''y''\n:: Coordinates of the bitmap center to place on the layer.\n: ''alpha''\n:: Layer transparency in range between 0x00 and 0xFF, where 0x00 is a fully transparent layer.\n: ''color''\n:: Layer's source key - a color in ARGB8888 format to be avoided.\n: ''rotation''\n:: 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.\n: ''mirror''\n:: Mirroring variant. Possible values are self-explained: MIRROR_BLANK, MIRROR_X, MIRROR_Y, MIRROR_XY.\n\n=====abi_CMD_G2D_ADD_RECTANGLE=====\nSyntax:\n abi_CMD_G2D_ADD_RECTANGLE(const x, const y, const width, const height, const color)\nDescription:\n: 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.\nArguments:\n: ''x'', ''y''\n:: Coordinates of top left rectangle corner.\n: ''width''\n:: Rectangle width.\n: ''height''\n:: Rectangle height.\n: ''color''\n:: Rectangle color in ARGB8888 format.\n\n=====abi_CMD_G2D_END=====\nSyntax:\n abi_CMD_G2D_END()\nDescription:\n: 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.\n\n=====Examples=====\n1. 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:\n ...\n abi_CMD_G2D_BEGIN_BITMAP(face, 240, 240, true);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);\n abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);\n abi_CMD_G2D_END();\n ...\n abi_CMD_BITMAP(face, 120, 120, 0, MIRROR_BLANK, true);\n ...\n abi_CMD_REDRAW(face);\n ...\n2. Render directly into display framebuffer #face. This will produce same result on display as example #1, but the generated image is not saved:\n ...\n abi_CMD_G2D_BEGIN_DISPLAY(face, true);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize0, 120 - animationSquareSize0, animationSquareSize0 * 2, animationSquareSize0 * 2, 0xdfff0000);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize1, 120 - animationSquareSize1, animationSquareSize1 * 2, animationSquareSize1 * 2, 0xdfffff00);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize2, 120 - animationSquareSize2, animationSquareSize2 * 2, animationSquareSize2 * 2, 0xdfff00ff);\n abi_CMD_G2D_ADD_RECTANGLE(120 - animationSquareSize3, 120 - animationSquareSize3, animationSquareSize3 * 2, animationSquareSize3 * 2, 0xdf00ffff);\n abi_CMD_G2D_ADD_SPRITE(resID, false, 120, 120, animationAlpha, 0x00000000, animationAngle, MIRROR_BLANK);\n abi_CMD_G2D_END();\n ...\n\n====Font drawing functions====\n=====abi_CMD_TEXT=====\nAPI:\n  abi_CMD_TEXT(const text[], const fontResID, const x, const y, const scale, const angle, const r, const g, const b)\nDescription:\n: Intended to render a system font or a custom font from resources with specified coordinates, scale and rotation at an arbitrary angle.\nArguments:\n: ''text''\n:: Array of chars.\n: ''fontResID''\n:: Custom font resource identifier. Provide ''-1'' to use system font resource.\n: ''x'', ''y''\n:: Coordinates of top left rectangle corner.\n: ''scale'', ''angle''\n:: Percentage scale and clockwise rotation angle in degrees. Max size of font is 200x200 px. (scale = 100%)\n: ''r'', ''g'', ''b''\n:: Font color in RGB format.\n\nExample:\n new text[4] = ['A', 'p', 'p', '\\0'];\n abi_CMD_TEXT(text, RES_ID_FONT, 90, 160, 16, current_angles[face], 255, 0, 0);\n\n====TEXTURE drawing functions====\n=====abi_CMD_DYNAMIC_TEXTURE=====\n\nAPI:\n\n abi_CMD_DYNAMIC_TEXTURE(const effectId = 1, const time = any value, const args[] = {0x04030201, 0x08070605, 0x00000A09}, const argsCount = 3, const bool:g2d = false)\n\nDescription:\n: Render a texture with chosen algorithm and parameters.\nArguments:\n: ''effectId''\n:: Define algorithm to render texture. \n:: Available values : G2D_DYNAMIC_TEXTURE_MOSAIC \n\n: ''time ''\n:: Current time value. Use any fixed value to static texture or set current time value in milliseconds to make texture alive.\n: ''args'', ''argsCount''\n:: Byte stream of algorithm settings it's aligned to 4 bytes, because of pawn supports only 32-bit values.\n:: 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\n\n: ''g2d''\n:: false - Use pawn default buffer to draw texture.\n:: true - Use g2d buffer to draw texture - not supported now.\n\n'''G2D_DYNAMIC_TEXTURE_MOSAIC''' alogrithm description\n\n:So in effect named 'mosaic' we have settings of 10 parameters each one 1 byte\n\n:Noise factors :\n::factor x : values from 0 to 10\n::factor y : values from 0 to 10\n::factor xy : values from 0 to 10\n:Time factors :\n::factor x : values from 0 to 10\n::factor y : values from 0 to 10\n::factor xy : values from 0 to 10\n:Color factors :\n::r : values from 0 to 10\n::g : values from 0 to 10\n::b : values from 0 to 10\n:Zoom factor :\n::zoom  values from 0 to 10\n\nFor 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\n0x04030201, 0x08070605, 0x00000A09\n\nExample:\n mosaic_effect_settings = { 0x04030201, 0x08070605, 0x00000A09  };\n mosaic_effect_settings_length = 3;\n abi_CMD_DYNAMIC_TEXTURE(G2D_DYNAMIC_TEXTURE_MOSAIC , currentTime, mosaic_effect_settings, mosaic_effect_settings_length);\n\n===Motion sensors===\n====abi_MTD_GetFaceAccel(X/Y/Z)====\nSyntax:\n  abi_MTD_GetFaceAccelX(const faceN)\n  abi_MTD_GetFaceAccelY(const faceN)\n  abi_MTD_GetFaceAccelZ(const faceN)\nDescription:\n: Get the value of acceleration along the requested axis.\nArguments\n: ''faceN''\n:: Number of the module face for which requested axis is belong.\n\n====abi_MTD_GetFaceGyro(X/Y/Z)====\nSyntax:\n  abi_MTD_GetFaceGyroX(const faceN)\n  abi_MTD_GetFaceGyroY(const faceN)\n  abi_MTD_GetFaceGyroZ(const faceN)\nDescription:\n: Get the gyro value around the requested axis.\nArguments\n: ''faceN''\n:: Number of the module face for which requested axis is belong.\n\n====abi_MTD_GetTapFace====\nSyntax:\n  abi_MTD_GetTapFace()\nDescription:\n: Get the face ID which was tapped. ID is not a face number which is used for drawing in abi_CMD_G2D_BEGIN_DISPLAY or abi_CMD_REDRAW, but that number can be calculated by subtracting by one from ID value. See possible values below.\nReturn values:\n: ''MTD_TAP_DIRECTION_NONE = 0''\n:: Indicates that the module wan not tapped.\n: ''MTD_TAP_DIRECTION_X = 1''\n: ''MTD_TAP_DIRECTION_Y = 2''\n: ''MTD_TAP_DIRECTION_Z = 3''\n:: Indicated direction of tap.\n\n====abi_MTD_IsTapOpposite====\nSyntax:\n  abi_MTD_IsTapOpposite()\nDescription:\n: Get the flag if the tap was detected in opposite direction.\n\n====abi_MTD_GetTapsCount====\nSyntax:\n  abi_MTD_GetTapsCount()\nDescription:\n: Get the count of subsequent taps. Tap is treated as a subsequent if it was detected within predefined interval (350ms). Count will be zero until sequence is finished, i.e. next tap is not detected within interval.\n\n====abi_checkShake====\nSyntax:\n  abi_checkShake()\nDescription:\n: Checks if the number of shakes of the cube was more than a certain threshold then exits the script \n\n\n====Examples====\n1. Flash the face on which tap was detected. Print an ID of that face. Color of the flash depends on taps count: red - one tap, green - two taps and blue - three.\n new delay = 0;\n new color = 0x000000; \n ONTICK() {\n   if (!color) {\n     switch (abi_MTD_GetTapsCount()) {\n     case 1:\n       color = 0xff0000;\n     case 2:\n       color = 0x00ff00;\n     case 3:\n       color = 0x0000ff;\n     }\n   }\n   if (delay % 25 == 0) {\n     for (new i = 0; i < FACES_MAX; i++) {\n       if (i == (abi_MTD_GetTapFace() - 1)) {\n         abi_CMD_FILL_2(color);\n         color = 0x000000;\n         switch (abi_MTD_GetTapFace()) {\n         case 1:\n           abi_CMD_TEXT(['1', '\\0'], -1, 120, 120, 14, 0, 0xff, 0xff, 0xff);\n         case 2:\n           abi_CMD_TEXT(['2', '\\0'], -1, 120, 120, 14, 0, 0xff, 0xff, 0xff);\n         case 3:\n           abi_CMD_TEXT(['3', '\\0'], -1, 120, 120, 14, 0, 0xff, 0xff, 0xff);\n         }\n       } else {\n         abi_CMD_FILL(0, 0, 0);\n       }\n       abi_CMD_REDRAW(i);\n     }\n   }\n   delay++;\n }\n2. Exit from script\n ONTICK() {\n    if (abi_cubeN == 0) {\n        abi_checkShake();\n    }\n    // Script logic\n }\n\n===Save/load functions===\n\n====abi_CMD_SAVE_STATE====\nSyntax:\n  bool:abi_CMD_SAVE_STATE(const data[], size = sizeof(data))\nDescription:\n: Save maximum 256 bytes of data to wowcube flash memory.\nArguments\n: ''data''\n:: Game data to save.\n: ''size''\n:: Size of game data.\nReturn values:\n: ''return false''\n:: If size is bigger then 256 bytes.\n\n====abi_CMD_LOAD_STATE====\nSyntax:\n  abi_CMD_LOAD_STATE()\nDescription:\n: Sends a command requesting the platform to load script data. The response from the platform is not instantaneous and takes several milliseconds.\n\n====Examples====\n1. Load data at the start.\n // This function is called when a response is received from the platform\n ON_LOAD_GAME_DATA (const pkt[]) {\n    // Deserialize pkt\n    currentLevelNumber = pkt[1]; // Starting with 1 cause 0 pkt element holding command ID\n    score = pkt[2];\n    moves = pkt[3];\n    ...\n    record = pkt[GAME_SAVE_SIZE];\n }\n ON_INIT () {\n    abi_CMD_LOAD_STATE ();\n }\n\n2. Save the data after the end of the level.\n SaveGameState () {\n    new saveData [GAME_SAVE_SIZE];\n    // Assign all necessary data\n    saveData[0] = currentLevelNumber;\n    saveData[1] = score;\n    saveData[2] = moves;\n    ...\n    saveData[GAME_SAVE_SIZE - 1] = record;\n    \n    abi_CMD_SAVE_STATE (saveData);\n }\n ON_CHECK_ROTATE () {\n    if (isLevelFinished) {\n        SaveGameState();\n    }\n }\n\n===Time functions===\n====abi_GetTime====\nSyntax:\n  abi_GetTime()\nDescription:\n: Get current time in milliseconds.\n\n====Examples====\n new previousTime = 0;\n new currentTime = 0;\n new deltaTime = 0;\n ON_INIT() {\n    previousTime = abi_GetTime();\n }\n ONTICK() {\n     currentTime = abi_GetTime();\n     deltaTime = currentTime - previousTime;\n     previousTime = currentTime;\n }\n\n\n===Topology functions===\n====get cube/face====\nSyntax:\n  abi_topCubeN(const _cubeN, const _faceN)\n  abi_topFaceN(const _cubeN, const _faceN)\n  abi_rightCubeN(const _cubeN, const _faceN)\n  abi_rightFaceN(const _cubeN, const _faceN)\n  abi_bottomCubeN(const _cubeN, const _faceN)\n  abi_bottomFaceN(const _cubeN, const _faceN)\n  abi_leftCubeN(const _cubeN, const _faceN)\n  abi_leftFaceN(const _cubeN, const _faceN)\nDescription:\n: Returns the cube / screen located at the top / bottom / left / right of the specified in parameters.\n\n====Examples====\nFind diagonal face and cube\n new diagonalCube = CUBES_MAX;\n new diagonalFace = FACES_MAX;\n new topCube = abi_topCubeN(cube, face);\n new topFace = abi_topFaceN(cube, face);\n if (topCube < CUBES_MAX) {\n     diagonalCube = abi_topCubeN(topCube, topFace);\n     if (diagonalCube < CUBES_MAX) {\n         diagonalFace = abi_topFaceN(topCube, topFace);\n     }\n }\n\n\n===Sound functions===\n====abi_CMD_PLAYSND====\nSyntax:\n  abi_CMD_PLAYSND(const id, const volume)\nDescription:\n: Play chosen sound with a given volume.\nArguments\n: ''id''\n:: Sound serial number in the application package.\n: ''volume''\n:: The sound volume.\n\n\n===Messages===\n====abi_CMD_NET_TX====\nSyntax:\n  abi_CMD_NET_TX(const line_tx, const TTL, const data[])\nDescription:\n: Send data through given UART line with given TTL.\nArguments\n: ''line_tx''\n:: UART line for sending a message. Each module has 3 UART lines.\n: ''TTL''\n:: Message time to live. How many modules message will pass through before stopping. For example, set TTL to 0 message will transfer only to the neighbor module. Set TTL to 1 message will transfer to a neighbor of neighbor. Maximum TTL is 2.\n: ''data''\n:: Data array to send. Maximum can be sent 20 bytes. The first 4 bytes are message general information that automatically adds before sending. The maximum useful data that can be sent are 16 bytes. Taking into account net command name 15 bytes.\n\n====Examples====\nWe want to receive data only from 0 module\n\n // define net command\n #define NEW_TEST_NET_COMMAND P2P_CMD_BASE_SCRIPT_1 + 1\n \n // create message to send\n Send_Test_Message() {\n    new data[4];\n    data[0] = NEW_TEST_NET_COMMAND | (abi_cubeN << 8);\n    data[1] = add_game_data;\n    // using bitwise operations send more data\n    data[2] = add_script_data_1 | (add_script_data_2 << 8) | (add_script_data_3 << 16) | (add_script_data_4 << 24);\n    data[3] = add_game_data_1 | (add_game_data_2 << 16);\n    \n    // send message through UART\n    abi_CMD_NET_TX(0, NET_BROADCAST_TTL_MAX, data);\n    abi_CMD_NET_TX(1, NET_BROADCAST_TTL_MAX, data);\n    abi_CMD_NET_TX(2, NET_BROADCAST_TTL_MAX, data);\n }\n \n // process the received message\n ON_CMD_NET_RX (const pkt[]) {\n    // get 4 byte from incoming packet to get net command because first 4 bytes are general info\n    switch (abi_ByteN(pkt, 4)) {\n        case NEW_TEST_NET_COMMAND: {\n            if (abi_ByteN(pkt, 5) == 0) {\n                game_data = pkt[2];\n                script_data_1 = abi_ByteN(pkt, 12);\n                script_data_2 = abi_ByteN(pkt, 13);\n                script_data_3 = abi_ByteN(pkt, 14);\n                script_data_4 = abi_ByteN(pkt, 15);\n                game_data_1 = pkt[4] & 0xFFFF;\n                game_data_2 = (pkt[4] >> 16) & 0xFFFF;\n            }\n        }\n    }\n }\n\n===Physics functions===\n====PHYSICS_CIRCLE_DATA====\nSyntax:\n  #define PHYSICS_CIRCLE_DATA .posX, .posY, .simplePosX, .simplePosY, .spdX, .spdY, .mass, .radius, .CoR, .cube, .face, .cubeT, .faceT\nDescription:\n: PAWN symbolic subscript which represent stucture.\nFields\n: ''posX''\n:: Circle position on X axis (fixed point)\n: ''posY''\n:: Circle position on Y axis (fixed point)\n: ''simplePosX''\n:: Circle position on X axis\n: ''simplePosY''\n:: Circle position on Y axis\n: ''spdX''\n:: Circle X speed\n: ''spdY''\n:: Circle Y speed\n: ''mass''\n:: Circle mass (fixed point)\n: ''radius''\n:: Circle radius\n: ''CoR''\n:: Coefficient of restitution (fixed point)\n: ''cube''\n:: Module owner of this circle\n: ''face''\n:: Face owner of this circle\n: ''cubeT''\n:: Cube transfer, last module owner. Can be used for resending messages\n: ''faceT''\n:: Face transfer, last face owner. Can be used for resending messages\n\n====Physics_Circle_Vs_Circle_obj====\nSyntax:\n  Physics_Circle_Vs_Circle_obj(circle1[PHYSICS_CIRCLE_DATA], circle2[PHYSICS_CIRCLE_DATA])\nDescription:\n: Check circle versus circle collision.\nArguments:\n: circle1\n:: First circle object.\n: circle2\n:: Second circle object.\n\n====Physics_Circle_vs_AABB_obj====\nSyntax:\n  Physics_Circle_vs_AABB_obj(circle[PHYSICS_CIRCLE_DATA], rectX, rectY, rectWidth, rectHeight, fakeCircle[PHYSICS_CIRCLE_DATA] = 0)\nDescription:\n: Check circle versus rectangle collision.\nArguments:\n: circle\n:: Circle object.\n: rectX\n:: X coordinate of top left rectangle corner.\n: rectY\n:: Y coordinate of top left rectangle corner.\n: rectWidth\n:: Rectangle width.\n: rectHeight\n:: Rectangle height.\n: fakeCircle\n:: In case of collision returns the collision point.\n\n====Physics_Circle_Vs_LineSegment====\nSyntax:\n  Physics_Circle_Vs_LineSegment(circle[PHYSICS_CIRCLE_DATA], lineSX, lineSY, lineEX, lineEY, fakeCircle[PHYSICS_CIRCLE_DATA] = 0)\nDescription:\n: Check circle versus line segment collision.\nArguments:\n: circle\n:: Circle object.\n: lineSX\n:: Line start X coordinates.\n: lineSY\n:: Line start Y coordinate.\n: lineEX\n:: Line end X coordinate.\n: lineEY\n:: Line end Y coordinate.\n: fakeCircle\n:: In case of collision returns the collision point.\n\n====Physics_Res_CvC_Coll_Massless====\nSyntax:\n  Physics_Res_CvC_Coll_Massless(circle1[PHYSICS_CIRCLE_DATA], circle2[PHYSICS_CIRCLE_DATA])\nDescription:\n: Collision resolves without using object mass.\nArguments:\n: circle1\n:: First circle object.\n: circle2\n:: Second circle object.\n\n====Physics_Res_CvC_Coll_Mass====\nSyntax:\n  Physics_Res_CvC_Coll_Mass(circle1[PHYSICS_CIRCLE_DATA], circle2[PHYSICS_CIRCLE_DATA])\nDescription:\n: Resolves collision using object mass.\nArguments:\n: circle1\n:: First circle object.\n: circle2\n:: Second circle object.\n\n====Physics_DeserializeCircle====\nSyntax:\n  Physics_DeserializeCircle(serializedData_1, serializedData_2, circle[PHYSICS_CIRCLE_DATA])\nDescription:\n: Deserialize circle object.\nArguments:\n: serializedData_1\n:: First part of serialized circle data.\n: serializedData_2\n:: Second part of serialized circle data.\n: circle\n:: Circle object where need to save deserialized data.\n\n====Physics_SerializeCircle====\nSyntax:\n  Physics_SerializeCircle(obj[PHYSICS_CIRCLE_DATA], &serializedData_1, &serializedData_2)\nDescription:\n: Serialize circle object.\nArguments:\n: circle\n:: Circle object to serialize.\n: serializedData_1\n:: Return first part of serialized circle data.\n: serializedData_2\n:: Return second part of serialized circle data.\n\n====Physics_Overlap====\nSyntax:\n  Physics_Overlap(overlap, positionDifference, distance)\nDescription:\n: Returns the distance by which objects overlap.\nArguments:\n: overlap\n:: Half distance between two points.\n: positionDifference\n:: Position difference between two point in one axis. Example - first point position X is 10, second is 6. Then position difference is 10-6=4.\n: distance\n:: Distance between two points.\n\n====Examples====\n1. Create circle object.\n \n new ball_1[PHYSICS_CIRCLE_DATA];\n ball_1.posX = 180 << 8;\n ball_1.posY = 180 << 8;\n ball_1.simplePosX = 200;\n ball_1.simplePosY = 180;\n ball_1.spdX = -155;\n ball_1.spdY = -155;\n ball_1.mass = 5 << 8;\n ball_1.radius = 16;\n ball_1.cube = 0;\n ball_1.face = 0;\n ball_1.CoR = 150;\n\n2. Check collision of two circles and resolve it.\n\n if (Physics_Circle_Vs_Circle_obj(ball_1, ball_2)) {\n    // Resolve collision\n    Physics_Res_CvC_Coll_Massless(ball_1, ball_2);\n }\n\n3. Check collision of circle versus rectangle and resolve it.\n\n new fakeCircle[PHYSICS_CIRCLE_DATA];\n if (Physics_Circle_vs_AABB_obj(ball, rectanglePosX, rectanglePosY, rectangleWidth, rectangleHeight, fakeCircle)) {\n    // Resolve collision    \n    Physics_Res_CvC_Coll_Mass(ball, fakeCircle);\n }\n\n4. Sending and receiving circle object.\n\n // Sending message with ball object\n SendBall (const pktNumber) {\n    new data[4];\n    new serializedData_1, serializedData_2;\n    // Serialize 'ball' data\n    Physics_SerializeCircle(ball, serializedData_1, serializedData_2);\n    // Prepare message\n    data[0] = P2P_CMD_SEND_BALL;\n    data[1] = serializedData_1;\n    data[2] = serializedData_2;\n    data[3] = pktNumber;\n    // Broadcast message\n    abi_CMD_NET_TX(0, NET_BROADCAST_TTL_MAX, data);\n    abi_CMD_NET_TX(1, NET_BROADCAST_TTL_MAX, data);\n    abi_CMD_NET_TX(2, NET_BROADCAST_TTL_MAX, data);\n }\n\n // Receiving message with ball object\n case P2P_CMD_SEND_BALL: {\n    new packetNumberReceived = pkt[4];\n    if ((ballPacketNumber < packetNumberReceived) || ((ballPacketNumber - packetNumberReceived) > (0x7FFFFFFF >> 1))) {\n       ballPacketNumber = packetNumberReceived;\n       Physics_DeserializeCircle(pkt[2], pkt[3], ball);\n    }\n }"
                            }
                        },
                        "comment": "/* Physics_Circle_vs_AABB_obj */"
                    }
                ]
            },
            "1": {
                "pageid": 1,
                "ns": 0,
                "title": "Main Page",
                "revisions": [
                    {
                        "user": "Rbalasho",
                        "timestamp": "2024-01-25T09:25:23Z",
                        "slots": {
                            "main": {
                                "contentmodel": "wikitext",
                                "contentformat": "text/x-wiki",
                                "*": "[[File:Wowcube widgets1.jpg|thumb|right|280px| WOWCube (render) in widgets mode]]\n\n[https://en.wikibooks.org/wiki/History_of_video_games/Platforms/WOWCube WOWCube] is a game console or an electronic puzzle shaped as 2x2 Rubik's Cube, also utilizing the idea of a magnetic puzzle by an American inventor [https://en.wikipedia.org/wiki/Larry_D._Nichols Larry Nichols]. Serving as an example of a tangible user interface, it consists of eight identical elements working as a whole. The surface is covered by 24 screens. \nWOWCube was invented by Savva and Ilya Osipov (Son and Father) on September 10, 2016\n\nIt allows the launching of specially designed games.\n\nIt is a stand-alone digital device that uses a [https://en.wikipedia.org/wiki/Tangible_user_interface Tangible interface] and [https://en.wikipedia.org/wiki/Mixed_reality Mixed Reality] to create an exciting development environment with unusual characteristics in which puzzle-like dynamic games can work.\n\nThe main difference from mechanical puzzles is that you can run and keep many different games on the cube (and not necessarily puzzles as well). When you\u2019re not using it, the WOWCube\u00ae system can go into screensaver mode. With some imagination and creativity, the WOWCube\u00ae system can turn into a multipurpose device (i.e. info-surface). It\u2019s a standalone device and to expand it's personalization capabilities (among others) you can connect it to a smartphone via BT. \n\n\nMain topics:\n* [[FAQ]]\n* [[Development|IDE/SDK/API]]\n* [[Games]]\n\n* [[Community]]\n* [[Culture]]\n\n* [[About|About CubiOs/WOWCube]]\n* [[Technical Description]]\n* [[Troubleshooting guide]]"
                            }
                        },
                        "comment": ""
                    }
                ]
            }
        }
    }
}