gaMouseX()

Syntax

gaMouseX()

Example

posY = 0
velY = 0
 
function update()
 // creating here a velocity range from 0 to 100 (pixels x frame)
 velY = (gaMouseY()/OUTPUT_H) * 100
 // updating the Y position
 posY += velY
 
 if posY > OUTPUT_H then
 posY = 0
 end
end
 
function draw()
 gaBackground(0.0,1.0)
 
 ofSetColor(255)
 ofCircle(gaMouseX(),posY,167)
 
 ofNoFill()
 ofSetColor(255,0,0)
 ofCircle(gaMouseX(),gaMouseY(),20)
 
 ofSetColor(255)
 info = string.format("X:%d - Y: %d - Velocity: %d",gaMouseX(),gaMouseY(),velY)
 ofDrawBitmapString(tostring(info),gaMouseX()+30,gaMouseY())
end

Description

This function is a common mouse input detection returning the X position over the GAmuza output window.

Returns

«Int, The numeric value of the last X position of the mouse over the GAmuza output window.