Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

How to run update() and draw() in keyPressed() event

$
0
0

@hyro wrote:

Hi all,

I have used Processing and recently moved into ofx.
I am wondering is it possible to call update() and draw() function in the KeyPressed event, such as the code below.

void testApp::update(){
someUpdateFunction();
}

void testApp::draw(){
someDrawFunction();
}

void testApp::keyPressed(int key) {
switch (key) {
case '1':
draw();
update();
break;
}

Thanks!

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles