Quick draw() test with keyPressed() event

Hi all,

I want to quickly test the draw() results in the key event, however, unlike Processing, I need to set a global variable and draw it when I press some key. It’s tedius for quick draw test compared to Processing allowing quickly draw() in the keyPressed event. Do you have any idea of smarter/shorter code than the one below?

testApp.h

class testApp : public ofBaseApp{
public:
float someVariable;
}

testApp.cpp

void testApp::update(){
updateBox(someVariable);
}

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

void testApp::keyPressed(int key){
switch (key) {
case ‘1’:
someVariable++;
break;
}