Difference between revisions of "love.mousepressed (Tiếng Việt)"

(Created page with "Hàm callback, được kích hoạt khi một nút chuột bị nhấn. == Hàm == === Tóm tắt === <source lang="lua"> love.mousepressed( x, y, button ) </source> === Đối ...")
 
(No difference)

Latest revision as of 08:39, 17 September 2012

Hàm callback, được kích hoạt khi một nút chuột bị nhấn.

Hàm

Tóm tắt

love.mousepressed( x, y, button )

Đối số

number x
Vị trí x của chuột.
number y
Vị trí y của chuột.
MouseConstant button
Nút chuột bị nhấn.

Kết quả trả lại

(Không)

Ví dụ

Hãy đặt một chuỗi ("Text") vào nơi người dùng nhấn nút trái chuột.

function love.load()
   printx = 0
   printy = 0
end
function love.draw()
   love.graphics.print("Text", printx, printy)
end
function love.mousepressed(x, y, button)
   if button == "l" then
      printx = x
      printy = y
   end
end

Xem thêm


Ngôn ngữ khác