sets the x-anchor of a node * The x-anchor specifies how the node is moved when the game is run in a different resolution. * * @name gui.set_xanchor * @param node [type:node] node to set x-anchor for * @param anchor [type:constant] anchor constant * * - `gui.ANCHOR_NONE` * - `gui.ANCHOR_LEFT` * - `gui.ANCHOR_RIGHT` */
| 2907 | * - `gui.ANCHOR_RIGHT` |
| 2908 | */ |
| 2909 | static int LuaSetXAnchor(lua_State* L) |
| 2910 | { |
| 2911 | int top = lua_gettop(L); |
| 2912 | (void) top; |
| 2913 | |
| 2914 | HNode hnode; |
| 2915 | InternalNode* n = LuaCheckNodeInternal(L, 1, &hnode); |
| 2916 | (void) n; |
| 2917 | |
| 2918 | int anchor = luaL_checkint(L, 2); |
| 2919 | if (anchor != XANCHOR_NONE && anchor != XANCHOR_LEFT && anchor != XANCHOR_RIGHT) |
| 2920 | { |
| 2921 | luaL_error(L, "Invalid x-anchor: %d", anchor); |
| 2922 | } |
| 2923 | |
| 2924 | Scene* scene = GuiScriptInstance_Check(L); |
| 2925 | |
| 2926 | SetNodeXAnchor(scene, hnode, (XAnchor) anchor); |
| 2927 | |
| 2928 | assert(top == lua_gettop(L)); |
| 2929 | return 0; |
| 2930 | } |
| 2931 | |
| 2932 | /*# gets the y-anchor of a node |
| 2933 | * The y-anchor specifies how the node is moved when the game is run in a different resolution. |
nothing calls this directly
no test coverage detected