MCPcopy Create free account
hub / github.com/defold/defold / LuaGetFlipbookCursor

Function LuaGetFlipbookCursor

engine/gui/src/gui_script.cpp:4545–4562  ·  view source on GitHub ↗

gets the normalized cursor of the animation on a node with flipbook animation * This is only useful nodes with flipbook animations. Gets the normalized cursor of the flipbook animation on a node. * * @name gui.get_flipbook_cursor * @param node [type:node] node to get the cursor for (node) * @return cursor [type:number] cursor value */

Source from the content-addressed store, hash-verified

4543 * @return cursor [type:number] cursor value
4544 */
4545 static int LuaGetFlipbookCursor(lua_State* L)
4546 {
4547 DM_LUA_STACK_CHECK(L, 1);
4548
4549 Scene* scene = GuiScriptInstance_Check(L);
4550 HNode node;
4551 LuaCheckNodeInternal(L, 1, &node);
4552
4553 if (dmGui::GetNodeIsBone(scene, node))
4554 {
4555 return DM_LUA_ERROR("cannot get cursor for bone");
4556 }
4557
4558 float cursor = dmGui::GetNodeFlipbookCursor(scene, node);
4559 lua_pushnumber(L, cursor);
4560
4561 return 1;
4562 }
4563
4564 /*# sets the normalized cursor of the animation on a node with flipbook animation
4565 * This is only useful nodes with flipbook animations. The cursor is normalized.

Callers

nothing calls this directly

Calls 5

GuiScriptInstance_CheckFunction · 0.85
LuaCheckNodeInternalFunction · 0.85
lua_pushnumberFunction · 0.85
GetNodeIsBoneFunction · 0.70
GetNodeFlipbookCursorFunction · 0.70

Tested by

no test coverage detected