Browse Source

Use the new `Info` class instead of inline code

master
Krisjanis Rijnieks 10 years ago
parent
commit
2aa24ad581
  1. 2
      src/Application/Application.cpp
  2. 30
      src/ofxPiMapper.cpp
  3. 13
      src/ofxPiMapper.h

2
src/Application/Application.cpp

@ -68,7 +68,7 @@ void Application::onKeyPressed(ofKeyEventArgs & args){
break;
case 'i':
_ofxPiMapper->toggleInfo();
_ofxPiMapper->getInfo()->toggle();
break;
case 's':

30
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 <t> to add new triangle surface\n";
ss << "Press <q> to add new quad surface\n";
ss << "Press <s> to save the composition\n";
ss << "Press <f> to toggle fullscreen\n";
ss << "Press <i> 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;
}

13
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;
};
Loading…
Cancel
Save