Exemplo n.º 1
0
int w_Cursor_getType(lua_State *L)
{
	Cursor *cursor = luax_checkcursor(L, 1);

	Cursor::CursorType ctype = cursor->getType();
	const char *typestr = nullptr;

	if (ctype == Cursor::CURSORTYPE_IMAGE)
		mouse::Cursor::getConstant(ctype, typestr);
	else if (ctype == Cursor::CURSORTYPE_SYSTEM)
	{
		Cursor::SystemCursor systype = cursor->getSystemType();
		mouse::Cursor::getConstant(systype, typestr);
	}

	if (!typestr)
		return luaL_error(L, "Unknown cursor type.");

	lua_pushstring(L, typestr);
	return 1;
}