2014-01-06 02:40:24 +00:00
|
|
|
#include "testApp.h"
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
// TODO
|
|
|
|
|
// ====
|
2014-01-16 05:03:08 +00:00
|
|
|
// - optimise - don't calculate graph point values evey frame
|
|
|
|
|
// - investigate backward graph animation (use alternating colours)
|
2014-01-17 01:11:16 +00:00
|
|
|
// - OSC - send values each frame
|
2014-01-16 05:03:08 +00:00
|
|
|
// - Colour range - tween between 2-3 points
|
2014-01-12 20:08:05 +00:00
|
|
|
//
|
2014-01-06 02:40:24 +00:00
|
|
|
//--------------------------------------------------------------
|
2014-01-12 20:08:05 +00:00
|
|
|
void testApp::setup()
|
|
|
|
|
{
|
|
|
|
|
ofSetFrameRate(30);
|
|
|
|
|
ofSetLogLevel(OF_LOG_SILENT);
|
|
|
|
|
ofSetWindowPosition(0, 100);
|
|
|
|
|
ofEnableSmoothing();
|
|
|
|
|
ofSeedRandom(ofRandom(23243));
|
|
|
|
|
ofSetFullscreen(true);
|
|
|
|
|
ofSetVerticalSync(true);
|
|
|
|
|
|
|
|
|
|
dataManager.setup();
|
|
|
|
|
scene.setup();
|
|
|
|
|
gui.setup();
|
2014-01-16 05:03:08 +00:00
|
|
|
scene.graphManager.updateInfoText();
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
isPaused = false;
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
void testApp::update()
|
|
|
|
|
{
|
|
|
|
|
if (isPaused) return;
|
|
|
|
|
|
|
|
|
|
dataManager.update();
|
|
|
|
|
scene.update();
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
void testApp::draw()
|
|
|
|
|
{
|
|
|
|
|
dataManager.draw();
|
|
|
|
|
scene.draw();
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
void testApp::mousePressed(int x, int y, int button)
|
|
|
|
|
{
|
|
|
|
|
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
void testApp::keyPressed(int key)
|
|
|
|
|
{
|
|
|
|
|
if (key == 'p')
|
|
|
|
|
isPaused = !isPaused;
|
|
|
|
|
else if (key == 'f')
|
|
|
|
|
ofToggleFullscreen();
|
|
|
|
|
else if (key == 'c')
|
|
|
|
|
scene.clearGraphData();
|
2014-01-16 05:03:08 +00:00
|
|
|
else if (key == 't')
|
|
|
|
|
scene.graphManager.updateInfoText();
|
|
|
|
|
else if (key == 'o')
|
|
|
|
|
scene.graphManager.outputData();
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
scene.keyPressed(key);
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-12 20:08:05 +00:00
|
|
|
|
|
|
|
|
void testApp::windowResized(int w, int h)
|
|
|
|
|
{
|
2014-01-14 15:12:43 +00:00
|
|
|
scene.setViewport();
|
2014-01-06 02:40:24 +00:00
|
|
|
}
|