Skip to content

Instantly share code, notes, and snippets.

@soundkitchen
Created June 1, 2010 03:15
Show Gist options
  • Save soundkitchen/420520 to your computer and use it in GitHub Desktop.
Save soundkitchen/420520 to your computer and use it in GitHub Desktop.
#include "testApp.h"
void testApp::setup()
{
updateHandler = drawHandler = &testApp::empty;
}
void testApp::update()
{
(this->*updateHandler)();
}
void testApp::draw()
{
(this->*drawHandler)();
}
void testApp::mousePressed(int x, int y, int button)
{
updateHandler = &testApp::updateSomething;
drawHandler = &testApp::drawSomething;
}
void testApp::mouseReleased(int x, int y, int button)
{
updateHandler = drawHandler = &testApp::empty;
}
void testApp::updateSomething()
{
// (snip)
}
void testApp::drawSomething()
{
// (snip)
}
void testApp::empty()
{
// do nothing.
}
#include "ofMain.h"
class testApp:public ofBaseApp
{
// (snip)
private:
void updateSomething();
void drawSomething();
void empty();
void (testApp::*updateHandler)();
void (testApp::*drawHandler)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment