From 2aa24ad5814325bfc60a26315c16ccd0939f817f Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 3 Jan 2016 15:26:21 +0000 Subject: [PATCH] Use the new `Info` class instead of inline code --- src/Application/Application.cpp | 2 +- src/ofxPiMapper.cpp | 30 ++++++++---------------------- src/ofxPiMapper.h | 13 +++---------- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 88e3048..31710f9 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -68,7 +68,7 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ break; case 'i': - _ofxPiMapper->toggleInfo(); + _ofxPiMapper->getInfo()->toggle(); break; case 's': diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index dd0da47..b9e7b1f 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -3,6 +3,7 @@ ofxPiMapper::ofxPiMapper(){ bShowInfo = false; isSetUp = false; + _info = 0; } void ofxPiMapper::setup(){ @@ -24,36 +25,17 @@ void ofxPiMapper::setup(){ isSetUp = true; ofLogNotice("ofxPiMapper") << "Done setting up"; _application = new ofx::piMapper::Application(this); + _info = new ofx::piMapper::Info(); } void ofxPiMapper::draw(){ if(!isSetUp){ return; } - gui.draw(); - - if(bShowInfo){ - stringstream ss; - ss << "There are 4 modes:\n\n"; - ss << " 1. Presentation mode\n"; - ss << " 2. Texture mapping mode\n"; - ss << " 3. Projection mapping mode\n"; - ss << " 4. Source selection mode\n\n"; - ss << "You can switch between the modes by using <1>, <2>, <3> and <4> " - "keys on the keyboard.\n\n"; - ss << "Press to add new triangle surface\n"; - ss << "Press to add new quad surface\n"; - ss << "Press to save the composition\n"; - ss << "Press to toggle fullscreen\n"; - ss << "Press to hide this message"; - ofDrawBitmapStringHighlight(ss.str(), 10, 20, - ofColor(0, 0, 0, 100), - ofColor(255, 255, 255, 200)); - } - _application->draw(); -} // draw + _info->draw(); +} void ofxPiMapper::registerFboSource(ofx::piMapper::FboSource & fboSource){ mediaServer.addFboSource(fboSource); @@ -85,4 +67,8 @@ ofx::piMapper::MediaServer & ofxPiMapper::getMediaServer(){ ofx::piMapper::SurfaceManager & ofxPiMapper::getSurfaceManager(){ return surfaceManager; +} + +ofx::piMapper::Info * ofxPiMapper::getInfo(){ + return _info; } \ No newline at end of file diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index e640a87..704fc9c 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -9,6 +9,7 @@ #include "CmdManager.h" #include "RmSurfaceCmd.h" #include "Application.h" +#include "Info.h" #define PIMAPPER_DEF_SURFACES_XML_FILE "defaultSurfaces.xml" #define PIMAPPER_USER_SURFACES_XML_FILE "surfaces.xml" @@ -28,15 +29,6 @@ class ofxPiMapper { void draw(); void registerFboSource(ofx::piMapper::FboSource & fboSource); bool loadXmlSettings(string fileName); - void showInfo(){ - bShowInfo = true; - } - void hideInfo(){ - bShowInfo = false; - } - void toggleInfo(){ - bShowInfo = !bShowInfo; - } ofx::piMapper::CmdManager & getCmdManager(); ofx::piMapper::SurfaceManagerGui & getGui(); @@ -44,6 +36,7 @@ class ofxPiMapper { ofx::piMapper::SurfaceManager & getSurfaceManager(); ofx::piMapper::CmdManager cmdManager; ofx::piMapper::SurfaceManager surfaceManager; + ofx::piMapper::Info * getInfo(); private: bool isSetUp; @@ -51,5 +44,5 @@ class ofxPiMapper { ofx::piMapper::MediaServer mediaServer; ofx::piMapper::SurfaceManagerGui gui; ofx::piMapper::Application * _application; - + ofx::piMapper::Info * _info; }; \ No newline at end of file