首页 > 文档 > mousePressed()鼠标按下函数
2017
07-14

mousePressed()鼠标按下函数

1-5.mousePressed()

Name(名称):mousePressed()//可以看做是按下鼠标按钮中断函数

Examples(例子):

// Click within the image to change单击图像中更改

// the value of the rectangle矩形的颜色

int value = 0;

void draw() {

fill(value);

rect(25, 25, 50, 50);

}

void mousePressed() {

if (value == 0) {

value = 255;

} else {

value = 0;

}

}

Description(描述):The mousePressed() function is called once after every time a mouse button is pressed. The mouseButton variable (see the related reference entry) can be used to determine which button has been pressed.

每当按下鼠标按钮时,鼠标按压()函数就会调用一次。mouseButton变量(参见相关参考条目)可用于确定已按哪个按钮。

Mouse and keyboard events only work when a program has draw(). Without draw(), the code is only run once and then stops listening for events.

鼠标和键盘事件只在程序绘制()时才起作用。没有绘制(),代码只运行一次,然后停止监听事件。

Syntax(语法):mousePressed()

mousePressed(event)

Returns(返回值):Void(

Related(相关函数):mouseX
mouseY
pmouseX
pmouseY
mousePressed
mousePressed()
mouseReleased()
mouseClicked()
mouseMoved()
mouseButton
mouseWheel()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。