跳轉到內容

SpringRTS/Callins 中的 Lua - MouseRelease()

來自華夏公益教科書

MouseRelease()

[編輯 | 編輯原始碼]

您需要在 MousePress() 中返回 true 才能將 MouseMove/MouseRelease 指向您的部件。

返回值

[編輯 | 編輯原始碼]

x, y, button
其中 x 是游標在 x 軸上的位置,y 是游標在 y 軸上的位置。位置相對於螢幕,而不是 3D 世界

使用示例

[編輯 | 編輯原始碼]
function widget:MousePress(x, y, button)
  echo("Mouse pressed")
  return true -- Pay attention to this. Without returning true the next function won't do anything
end

function widget:MouseRelease(x, y, button)
  echo("Mouse released")
end



華夏公益教科書