gaKey()

Syntax

gaKey()

Example

r = 0

function draw()
    gaBackground(0.0,1.0)
    ofSetColor(r)
    ofCircle(OUTPUT_W/2,OUTPUT_H/2,200)
end

function keyReleased()
    if gaKey() == string.byte(‘g’) then
        r = ofRandom(0,255)
    end
end

Description

The system function gaKey() always returns the value of the most recent key on the keyboard that was used (either pressed or released).

Returns

«Byte, the ascii value of the most recent key on the keyboard that was used (either pressed or released).