diff --git a/of/Active Tripod/Active_Tripod.vcxproj b/of/Active Tripod/Active_Tripod.vcxproj index aa3f58d..acb7cbf 100644 --- a/of/Active Tripod/Active_Tripod.vcxproj +++ b/of/Active Tripod/Active_Tripod.vcxproj @@ -58,15 +58,15 @@ MultiThreadedDebugDLL Level3 EditAndContinue - %(AdditionalIncludeDirectories);src;src\data;src\gui;src\visual;src\visual\graph;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\;..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers;..\..\..\addons\ofxSpacebrew\src;..\..\..\addons\ofxUI\src;..\..\..\addons\ofxXmlSettings\libs;..\..\..\addons\ofxXmlSettings\src + %(AdditionalIncludeDirectories);src;src\data;src\gui;src\visual;src\visual\graph;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\;..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers;..\..\..\addons\ofxSpacebrew\src;..\..\..\addons\ofxUI\src;..\..\..\addons\ofxXmlSettings\libs;..\..\..\addons\ofxXmlSettings\src;..\..\..\addons\ofxFTGL\src;..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL;..\..\..\addons\ofxFTGL\libs\FTGL\include;..\..\..\addons\ofxFTGL\libs\FTGL CompileAsCpp true Console false - %(AdditionalDependencies);websockets_static.lib;ZLIB.lib - %(AdditionalLibraryDirectories);..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\lib\win32\Release + %(AdditionalDependencies);websockets_static.lib;ZLIB.lib;ftgl_static.lib + %(AdditionalLibraryDirectories);..\..\..\addons\ofxFTGL\libs\FTGL\lib\vs2012;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\lib\win32\Release @@ -75,7 +75,7 @@ %(PreprocessorDefinitions) MultiThreadedDLL Level3 - %(AdditionalIncludeDirectories);src;src\data;src\gui;src\visual;src\visual\graph;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\;..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers;..\..\..\addons\ofxSpacebrew\src;..\..\..\addons\ofxUI\src;..\..\..\addons\ofxXmlSettings\libs;..\..\..\addons\ofxXmlSettings\src + %(AdditionalIncludeDirectories);src;src\data;src\gui;src\visual;src\visual\graph;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp;..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\;..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets;..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\src;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers;..\..\..\addons\ofxSpacebrew\src;..\..\..\addons\ofxUI\src;..\..\..\addons\ofxXmlSettings\libs;..\..\..\addons\ofxXmlSettings\src;..\..\..\addons\ofxFTGL\src;..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL;..\..\..\addons\ofxFTGL\libs\FTGL\include;..\..\..\addons\ofxFTGL\libs\FTGL CompileAsCpp @@ -85,11 +85,13 @@ true true false - %(AdditionalDependencies);websockets_static.lib;ZLIB.lib - %(AdditionalLibraryDirectories);..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\lib\win32\Release + %(AdditionalDependencies);websockets_static.lib;ZLIB.lib;ftgl_static.lib + %(AdditionalLibraryDirectories);..\..\..\addons\ofxFTGL\libs\FTGL\lib\vs2012;..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\lib\win32\Release + + @@ -112,6 +114,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/of/Active Tripod/Active_Tripod.vcxproj.filters b/of/Active Tripod/Active_Tripod.vcxproj.filters index 0dca948..1eeaee0 100644 --- a/of/Active Tripod/Active_Tripod.vcxproj.filters +++ b/of/Active Tripod/Active_Tripod.vcxproj.filters @@ -67,6 +67,12 @@ src\data + + addons\ofxFTGL\src + + + addons\ofxFTGL\src + @@ -114,6 +120,24 @@ {93208e3d-c398-4400-8666-06931df26fe1} + + {dd615fe5-22cf-4bb9-bf59-f34ad36495c0} + + + {c9f5eae9-5ed3-4d24-a1c9-476fbad9949e} + + + {a3c99ccb-c276-4148-a49d-dd4bf17a53fc} + + + {2d8bfa80-59ad-45f3-9d0b-7fcec05fb366} + + + {2cc0c40f-3510-4cf0-9591-327e59f16c45} + + + {c8f02691-0523-43c1-b471-e9e043b64209} + @@ -269,6 +293,81 @@ src\data + + addons\ofxFTGL\src + + + addons\ofxFTGL\src + + + addons\ofxFTGL\src + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + + + addons\ofxFTGL\libs\FTGL\include\FTGL + diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index aca4731..058ef0a 100644 Binary files a/of/Active Tripod/bin/Active_Tripod.lib and b/of/Active Tripod/bin/Active_Tripod.lib differ diff --git a/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml new file mode 100644 index 0000000..7c9a46e --- /dev/null +++ b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml @@ -0,0 +1,50 @@ + + 4 + X Margin + 90.460525513 + + + 4 + Y Margin + 87.171058655 + + + 4 + Y Margin Bottom Offset + 92.763160706 + + + 4 + Line Length + 380.098693848 + + + 4 + Line Spacing + 0.986842155 + + + 4 + Text Size + 27.763158798 + + + 4 + Red + 255.000000000 + + + 4 + Green + 255.000000000 + + + 4 + Blue + 255.000000000 + + + 4 + Alpha + 222.286193848 + diff --git a/of/Active Tripod/bin/data/fonts/Helvetica.dfont b/of/Active Tripod/bin/data/fonts/Helvetica.dfont new file mode 100644 index 0000000..2bd070c Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Helvetica.dfont differ diff --git a/of/Active Tripod/bin/data/fonts/cour.ttf b/of/Active Tripod/bin/data/fonts/cour.ttf new file mode 100644 index 0000000..ebb3361 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/cour.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/courbd.ttf b/of/Active Tripod/bin/data/fonts/courbd.ttf new file mode 100644 index 0000000..a4f26b4 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/courbd.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/courbi.ttf b/of/Active Tripod/bin/data/fonts/courbi.ttf new file mode 100644 index 0000000..fa12206 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/courbi.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/couri.ttf b/of/Active Tripod/bin/data/fonts/couri.ttf new file mode 100644 index 0000000..c0df001 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/couri.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/georgia.ttf b/of/Active Tripod/bin/data/fonts/georgia.ttf new file mode 100644 index 0000000..317b851 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/georgia.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/georgiab.ttf b/of/Active Tripod/bin/data/fonts/georgiab.ttf new file mode 100644 index 0000000..75fa68f Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/georgiab.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/georgiai.ttf b/of/Active Tripod/bin/data/fonts/georgiai.ttf new file mode 100644 index 0000000..3ee04e5 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/georgiai.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/georgiaz.ttf b/of/Active Tripod/bin/data/fonts/georgiaz.ttf new file mode 100644 index 0000000..1697bc5 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/georgiaz.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf b/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf new file mode 100644 index 0000000..d8d2e2e Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/verdana.ttf b/of/Active Tripod/bin/data/fonts/verdana.ttf new file mode 100644 index 0000000..49fe2fb Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/verdana.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/verdanab.ttf b/of/Active Tripod/bin/data/fonts/verdanab.ttf new file mode 100644 index 0000000..344db20 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/verdanab.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/verdanai.ttf b/of/Active Tripod/bin/data/fonts/verdanai.ttf new file mode 100644 index 0000000..132b655 Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/verdanai.ttf differ diff --git a/of/Active Tripod/bin/data/fonts/verdanaz.ttf b/of/Active Tripod/bin/data/fonts/verdanaz.ttf new file mode 100644 index 0000000..c1724bb Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/verdanaz.ttf differ diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp index 201bb4d..900261a 100644 --- a/of/Active Tripod/src/gui/GUI.cpp +++ b/of/Active Tripod/src/gui/GUI.cpp @@ -21,6 +21,7 @@ void GUI::setup() addBarGraphDesignGUI(); addGraphSimulationGUI(); addBackgroundGUI(); + addHUDTextGUI(); addVariousGUI(); setGUIColour(); @@ -106,7 +107,7 @@ void GUI::addBackgroundGUI() gui->addSlider("Blue", 0, 2, &app->scene.blue, length, dim); gui->addSlider("Alpha", 0, 2, &app->scene.alpha, length, dim); gui->addSpacer(length, 1); - gui->addLabel("HUD SETTINGS"); + gui->addLabel("HUD BACKGROUND SETTINGS"); gui->addSlider("Red .", 0, 255, &app->scene.hudColour[0], length, dim); gui->addSlider("Green .", 0, 255, &app->scene.hudColour[1], length, dim); gui->addSlider("Blue .", 0, 255, &app->scene.hudColour[2], length, dim); @@ -120,6 +121,28 @@ void GUI::addBackgroundGUI() } +void GUI::addHUDTextGUI() +{ + string title = "HUD TEXT"; + ofxUICanvas* gui = getNewGUI(title); + + gui->addSlider("X Margin", 0, 500, &app->scene.xMargin, length, dim); + gui->addSlider("Y Margin", 0, 500, &app->scene.yMargin, length, dim); + gui->addSlider("Y Margin Bottom Offset", 0, 300, &app->scene.yMarginBottomOffset, length, dim); + gui->addSlider("Line Length", 50, 500, &app->scene.lineLength, length, dim); + gui->addSlider("Line Spacing", 0, 10, &app->scene.lineSpacing, length, dim); + gui->addSlider("Text Size", 10, 100, &app->scene.textSize, length, dim); + gui->addSpacer(length, 1); + gui->addSlider("Red", 0, 255, &app->scene.textColour[0], length, dim); + gui->addSlider("Green", 0, 255, &app->scene.textColour[1], length, dim); + gui->addSlider("Blue", 0, 255, &app->scene.textColour[2], length, dim); + gui->addSlider("Alpha", 0, 255, &app->scene.textColour[3], length, dim); + + ofAddListener(gui->newGUIEvent, this, &GUI::variousGUIEvent); + finaliseCanvas(gui, true); +} + + void GUI::addVariousGUI() { string title = "VARIOUS"; diff --git a/of/Active Tripod/src/gui/GUI.h b/of/Active Tripod/src/gui/GUI.h index 5248fba..47bf035 100644 --- a/of/Active Tripod/src/gui/GUI.h +++ b/of/Active Tripod/src/gui/GUI.h @@ -24,6 +24,7 @@ public: void addBarGraphDesignGUI(); void addGraphSimulationGUI(); void addBackgroundGUI(); + void addHUDTextGUI(); void addVariousGUI(); void variousGUIEvent(ofxUIEventArgs &e); diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp index 0c5bc28..a22f8d9 100644 --- a/of/Active Tripod/src/testApp.cpp +++ b/of/Active Tripod/src/testApp.cpp @@ -32,6 +32,7 @@ void testApp::setup() ofSetWindowPosition(0, 100); ofEnableSmoothing(); ofSeedRandom(ofRandom(23243)); + ofSetFullscreen(true); dataManager.setup(); scene.setup(); @@ -70,6 +71,8 @@ void testApp::keyPressed(int key) isPaused = !isPaused; else if (key == 'f') ofToggleFullscreen(); + + scene.keyPressed(key); } diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index 17d4da3..52d50e9 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -14,12 +14,26 @@ void Scene::setup() bgImg.loadImage("images/tanks.jpg"); rgbShader.load("shaders/RGBShader"); barGraph.setup(); + + + text.loadFont("fonts/mplus-1c-regular.ttf", 8); + //text.setLineLength(ofGetWidth() - margin * 2); + + + xMargin = 500; + yMargin = 400; + lineLength = 200; } void Scene::update() { barGraph.update(); + + text.setLineLength(lineLength); + text.setLineSpacing(lineSpacing); + text.setSize(textSize); + } @@ -27,7 +41,8 @@ void Scene::draw() { drawVideo(); barGraph.draw(); - drawHUD(); + drawHUDBG(); + drawHUDCopy(); } void Scene::drawVideo() @@ -47,7 +62,7 @@ void Scene::drawVideo() rgbShader.end(); } -void Scene::drawHUD() +void Scene::drawHUDBG() { ofPushStyle(); ofSetColor(hudColour[0], hudColour[1], hudColour[2], hudColour[3]); @@ -71,4 +86,57 @@ void Scene::drawHUD() ofPopStyle(); ofFill(); +} + + +void Scene::drawHUDCopy() +{ + string tlStr = "TOP LEFT\nThis is some text\nthis is some more text\na little more"; + drawTextBox(tlStr, "TOP LEFT"); + string trStr = "TOP RIGHT\nThis is some text\nthis is some more text\na little more\none more line"; + drawTextBox(trStr, "TOP RIGHT"); + string blStr = "BOTTOM LEFT\nThis is some text\nthis is some more text"; + drawTextBox(blStr, "BOTTOM LEFT"); + string brStr = "BOTTOM RIGHT\nThis is some text\nthis is some more text\na little more"; + drawTextBox(brStr, "BOTTOM RIGHT"); +} + + +void Scene::drawTextBox(string copy, string align) +{ + ofPushStyle(); + ofSetColor(textColour[0], textColour[1], textColour[2], textColour[3]); + ofPushMatrix(); + if (align == "TOP LEFT") + { + ofTranslate(xMargin, yMargin); + text.setAlignment(FTGL_ALIGN_LEFT); + } + else if (align == "TOP RIGHT") + { + text.setAlignment(FTGL_ALIGN_RIGHT); + ofTranslate(ofGetWidth() - xMargin - lineLength, yMargin); + } + else if (align == "BOTTOM LEFT") + { + ofTranslate(xMargin, ofGetHeight() - yMargin - yMarginBottomOffset); + text.setAlignment(FTGL_ALIGN_LEFT); + } + if (align == "BOTTOM RIGHT") + { + text.setAlignment(FTGL_ALIGN_RIGHT); + ofTranslate(ofGetWidth() - xMargin - lineLength, ofGetHeight() - yMargin - yMarginBottomOffset); + } + + text.drawString(copy, 0, 0); + + ofPopMatrix(); + ofPopStyle(); +} + + + +void Scene::keyPressed(int key) +{ + } \ No newline at end of file diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h index 1b31b52..e324e43 100644 --- a/of/Active Tripod/src/visual/Scene.h +++ b/of/Active Tripod/src/visual/Scene.h @@ -10,6 +10,7 @@ #include "ofMain.h" #include "BarGraph.h" +#include "ofxFTGL.h" class testApp; @@ -20,16 +21,39 @@ public: void update(); void draw(); void drawVideo(); - void drawHUD(); + void drawHUDBG(); + void drawHUDCopy(); + void drawTextBox(string copy, string align); + void keyPressed(int key); BarGraph barGraph; ofShader rgbShader; ofImage bgImg; + ofxFTGLSimpleLayout text; + + + + // video image vars + float brightness; + float contrast; + float saturation; + float red; + float green; + float blue; + float alpha; - float brightness, contrast, saturation, red, green, blue, alpha; - + // HUD background vars float hudColour[4]; float circlePointSize; float radiusW; float radiusH; + + // text vars + float xMargin; + float yMargin; + float yMarginBottomOffset; + float lineLength; + float lineSpacing; + float textSize; + float textColour[4]; }; \ No newline at end of file