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

Function LuaScreenToLocal

engine/gui/src/gui_script.cpp:4527–4536  ·  view source on GitHub ↗

convert screen position to the local node position * * Convert the screen position to the local position of supplied node * * @name gui.screen_to_local * @param node [type:node] node used for getting local transformation matrix * @param screen_position [type:vector3] screen position * @return local_position [type:vector3] local position */

Source from the content-addressed store, hash-verified

4525 * @return local_position [type:vector3] local position
4526 */
4527 int LuaScreenToLocal(lua_State* L)
4528 {
4529 DM_LUA_STACK_CHECK(L, 1);
4530 Scene* scene = GuiScriptInstance_Check(L);
4531 InternalNode* node = LuaCheckNodeInternal(L, 1, 0);
4532 Point3 screen_position = GetPositionFromArgumentIndex(L, 2);
4533 Point3 local_position = ScreenToLocalPosition(scene, GetNodeHandle(node), screen_position);
4534 dmScript::PushVector3(L, Vector3(local_position));
4535 return 1;
4536 }
4537
4538 /*# gets the normalized cursor of the animation on a node with flipbook animation
4539 * This is only useful nodes with flipbook animations. Gets the normalized cursor of the flipbook animation on a node.

Callers

nothing calls this directly

Calls 7

GuiScriptInstance_CheckFunction · 0.85
LuaCheckNodeInternalFunction · 0.85
PushVector3Function · 0.85
ScreenToLocalPositionFunction · 0.70
GetNodeHandleFunction · 0.70
Vector3Class · 0.50

Tested by

no test coverage detected