Title added
This commit is contained in:
@@ -23,12 +23,12 @@ void DataManager::setup()
|
||||
void DataManager::setupSpacebrew()
|
||||
{
|
||||
string host = "54.194.189.129"; // Spacebrew::SPACEBREW_CLOUD; // "localhost";
|
||||
string name = "CRITICAL INFRASTRUCTURE UTILITY BOX";
|
||||
string name = "CRITICAL INFRASTRUCTURE UTILITY BOX DEV";
|
||||
string description = "Description goes here. Not sure why. Let me know if you see this and tell me if you need it";
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
spacebrew.addSubscribe("utility_" + ofToString(i), Spacebrew::TYPE_STRING);
|
||||
spacebrew.addSubscribe("utilitydev_" + ofToString(i), Spacebrew::TYPE_STRING);
|
||||
}
|
||||
spacebrew.connect(host, name, description);
|
||||
|
||||
@@ -133,7 +133,7 @@ void DataManager::onMessage( Spacebrew::Message & m )
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
if (m.name == "utility_" + ofToString(i))
|
||||
if (m.name == "utilitydev_" + ofToString(i))
|
||||
{
|
||||
//isPublisher0DataReceived = true;
|
||||
newData[i] = dataObject;
|
||||
|
||||
@@ -50,6 +50,8 @@ void GUI::addKeyboardShortcutsGUI()
|
||||
gui->addLabel("'c' - CLEAR ALL GRAPH DATA", OFX_UI_FONT_SMALL);
|
||||
gui->addLabel("'t' - REDRAW TEXT FBOS", OFX_UI_FONT_SMALL);
|
||||
gui->addLabel("'o' - OUTPUT GRAPH DATA TO TXT", OFX_UI_FONT_SMALL);
|
||||
gui->addLabel("'1-3' - CHANGE CURRENT CAMERA", OFX_UI_FONT_SMALL);
|
||||
gui->addLabel("'a' - TOGGLE AUTO ROTATE CAM", OFX_UI_FONT_SMALL);
|
||||
|
||||
|
||||
finaliseCanvas(gui, true);
|
||||
@@ -138,11 +140,16 @@ void GUI::addLegendTextGUI()
|
||||
string title = "TITLE AND LEGEND TEXT";
|
||||
ofxUICanvas* gui = getNewGUI(title);
|
||||
|
||||
gui->addLabel("TITLE");
|
||||
gui->addSlider("Scale", 0.1, 2, &app->scene.titleScale, length, dim);
|
||||
|
||||
gui->addLabel("LEGEND");
|
||||
gui->addSlider("Size", 10, 100, &app->scene.legendTextSize, length, dim);
|
||||
gui->addSlider("Spacing", 0, 10, &app->scene.legendTextSpacing, length, dim);
|
||||
gui->addSlider("Line Length", 20, 1000, &app->scene.legendTextLineLength, length, dim);
|
||||
gui->addSlider("X", 0, 500, &app->scene.legendTextPoint.x, length, dim);
|
||||
gui->addSlider("Y", 0, 500, &app->scene.legendTextPoint.y, length, dim);
|
||||
|
||||
|
||||
finaliseCanvas(gui, true);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
// TODO
|
||||
// ====
|
||||
// - optimise - don't calculate graph point values evey frame
|
||||
// - investigate backward graph animation (use alternating colours)
|
||||
// - OSC - send values each frame
|
||||
// - Colour range - tween between 2-3 points
|
||||
// - Add data points to graph as they arrive instead of at fixed points
|
||||
// - Animate new values
|
||||
// - Colour range - tween between 2 points
|
||||
//
|
||||
//--------------------------------------------------------------
|
||||
void testApp::setup()
|
||||
@@ -22,6 +21,7 @@ void testApp::setup()
|
||||
scene.setup();
|
||||
gui.setup();
|
||||
scene.graphManager.updateInfoText();
|
||||
scene.setupTitleFbo();
|
||||
|
||||
isPaused = false;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
void Scene::setup()
|
||||
{
|
||||
text.loadFont("fonts/Roboto-Regular.ttf", 80);
|
||||
thinText.loadFont("fonts/Roboto-Light.ttf", 80);
|
||||
|
||||
graphManager.setup();
|
||||
|
||||
@@ -28,6 +29,41 @@ void Scene::setup()
|
||||
|
||||
setViewport();
|
||||
|
||||
//setupTitleFbo();
|
||||
}
|
||||
|
||||
|
||||
void Scene::setupTitleFbo()
|
||||
{
|
||||
ofFbo::Settings settings;
|
||||
settings.width = 900;
|
||||
settings.height = 180;
|
||||
settings.internalformat = GL_RGBA;
|
||||
titleFbo.allocate(settings);
|
||||
|
||||
targetImage.loadImage("images/TARGET_small_2.png");
|
||||
|
||||
titleFbo.begin();
|
||||
ofClear(0, 0, 0, 0);
|
||||
|
||||
ofPushStyle();
|
||||
ofSetColor(255, 255);
|
||||
thinText.setLineSpacing(legendTextSpacing);
|
||||
thinText.setLineLength(700);
|
||||
thinText.setSize(80);
|
||||
thinText.setAlignment(FTGL_ALIGN_LEFT);
|
||||
ofPushMatrix();
|
||||
ofTranslate(195, -10);
|
||||
ofRotateZ(90);
|
||||
targetImage.draw(20, 20, 165, 165);
|
||||
ofPopMatrix();
|
||||
ofPushMatrix();
|
||||
ofTranslate(200, 80);
|
||||
thinText.drawString("CRITICAL INFRASTRUCTURE", 0, 0);
|
||||
ofPopMatrix();
|
||||
ofPopStyle();
|
||||
|
||||
titleFbo.end();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +110,7 @@ void Scene::draw()
|
||||
graphManager.draw();
|
||||
|
||||
activeCamera->end();
|
||||
|
||||
|
||||
ofPushStyle();
|
||||
ofSetColor(255, 255);
|
||||
text.setLineSpacing(legendTextSpacing);
|
||||
@@ -90,6 +126,16 @@ void Scene::draw()
|
||||
|
||||
text.drawString(str, legendTextPoint.x, legendTextPoint.y);
|
||||
ofPopStyle();
|
||||
|
||||
ofPushStyle();
|
||||
ofSetColor(255);
|
||||
ofPushMatrix();
|
||||
ofTranslate(ofGetWidth() - (titleFbo.getHeight() * titleScale), ofGetHeight());
|
||||
ofRotateZ(-90);
|
||||
ofScale(titleScale, titleScale);
|
||||
titleFbo.draw(0, 0);
|
||||
ofPopMatrix();
|
||||
ofPopStyle();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +161,8 @@ void Scene::keyPressed(int key)
|
||||
activeCamera = &cameras[1];
|
||||
if (key == '3')
|
||||
activeCamera = &cameras[2];
|
||||
if (key == 'a')
|
||||
isCamRotate = !isCamRotate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class Scene
|
||||
{
|
||||
public:
|
||||
void setup();
|
||||
void setupTitleFbo();
|
||||
void update();
|
||||
void draw();
|
||||
void setViewport();
|
||||
@@ -38,8 +39,13 @@ public:
|
||||
ofVec3f lookAtVec;
|
||||
|
||||
ofRectangle viewport;
|
||||
|
||||
|
||||
ofxFTGLSimpleLayout text;
|
||||
ofxFTGLSimpleLayout thinText;
|
||||
ofFbo titleFbo;
|
||||
ofImage targetImage;
|
||||
float titleScale;
|
||||
|
||||
float legendTextSize;
|
||||
float legendTextSpacing;
|
||||
float legendTextLineLength;
|
||||
|
||||
Reference in New Issue
Block a user