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

Function LuaGetScreenPosition

engine/gui/src/gui_script.cpp:4488–4498  ·  view source on GitHub ↗

gets the node screen position * Returns the screen position of the supplied node. This function returns the * calculated transformed position of the node, taking into account any parent node * transforms. * * @name gui.get_screen_position * @param node [type:node] node to get the screen position from * @return position [type:vector3] node screen position */

Source from the content-addressed store, hash-verified

4486 * @return position [type:vector3] node screen position
4487 */
4488 int LuaGetScreenPosition(lua_State* L)
4489 {
4490 DM_LUA_STACK_CHECK(L, 1);
4491 InternalNode* n = LuaCheckNodeInternal(L, 1, 0);
4492 Scene* scene = GuiScriptInstance_Check(L);
4493 Matrix4 node_transform;
4494 CalculateNodeTransform(scene, n, CalculateNodeTransformFlags(), node_transform);
4495 Vector3 node_screen_pos = node_transform.getCol3().getXYZ();
4496 dmScript::PushVector3(L, node_screen_pos);
4497 return 1;
4498 }
4499
4500 /*# sets screen position to the node
4501 *

Callers

nothing calls this directly

Calls 7

LuaCheckNodeInternalFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
PushVector3Function · 0.85
CalculateNodeTransformFunction · 0.70
getXYZMethod · 0.45
getCol3Method · 0.45

Tested by

no test coverage detected