Browse Source

Add option to set custom info text

master
Krisjanis Rijnieks 8 years ago
parent
commit
5d043d1977
  1. 4
      src/Application/Application.cpp
  2. 1
      src/Application/Application.h
  3. 65
      src/Info/Info.cpp
  4. 2
      src/Info/Info.h
  5. 4
      src/ofxPiMapper.cpp
  6. 1
      src/ofxPiMapper.h

4
src/Application/Application.cpp

@ -215,6 +215,10 @@ void Application::eraseSurface(int i){
new RmSurfaceCmd(getSurfaceManager(), i));
}
void Application::setInfoText(string text){
_info.setText(text);
}
void Application::toggleInfo(){
_info.toggle();
}

1
src/Application/Application.h

@ -57,6 +57,7 @@ class Application : public KeyListener {
void addFboSource(FboSource * fboSource);
void createSurface(SurfaceType type);
void eraseSurface(int i);
void setInfoText(string text);
void toggleInfo();
void saveProject();
bool loadXmlSettings(string fileName);

65
src/Info/Info.cpp

@ -5,41 +5,40 @@ namespace piMapper {
Info::Info(){
_visible = false;
_text = "There are 4 modes:\n\n"
" 1. Presentation mode\n"
" 2. Texture mapping mode\n"
" - Press \"<\" and \">\" to select previous or next vertex\n"
" - Press <SPACE> to play/pause the video\n"
" 3. Projection mapping mode\n"
" - Press <,> and <.> to select previous or next surface\n"
" - Press \"<\" and \">\" to select previous or next vertex\n"
" - Press <t> to add new triangle surface\n"
" - Press <q> to add new quad surface\n"
" - Press <p> to toggle perspective warping while quad surface selected\n"
" - Press <g> to add new grid surface\n"
" - Press <[> and <]> to remove or add columns to selected grid surface\n"
" - Press <{> and <}> to remove or add rows to selected grid surface\n"
" - Press <+> and <-> to scale surface up and down\n"
" - Press <9> and <0> to move selected surface one layer up or down\n"
" - Press <l> to hide/show layer panel\n"
" - Press <BACKSPACE> to delete selection\n"
" - Press <SPACE> to play/pause the video\n"
" - Type <new> to clear composition\n"
" 4. Source selection mode\n\n"
"You can switch between the modes by using <1>, <2>, <3> and <4> "
"keys on the keyboard.\n\n"
"Press <s> to save the composition\n"
"Press <f> to toggle fullscreen\n"
"Press <z> to undo\n"
"Press <i> to hide this message";
}
void Info::draw(){
if(_visible){
stringstream ss;
ss << "There are 4 modes:\n\n";
ss << " 1. Presentation mode\n";
ss << " 2. Texture mapping mode\n";
ss << " - Press \"<\" and \">\" to select previous or next vertex\n";
ss << " - Press <SPACE> to play/pause the video\n";
ss << " 3. Projection mapping mode\n";
ss << " - Press <,> and <.> to select previous or next surface\n";
ss << " - Press \"<\" and \">\" to select previous or next vertex\n";
ss << " - Press <t> to add new triangle surface\n";
ss << " - Press <q> to add new quad surface\n";
ss << " - Press <p> to toggle perspective warping while quad surface selected\n";
ss << " - Press <g> to add new grid surface\n";
ss << " - Press <[> and <]> to remove or add columns to selected grid surface\n";
ss << " - Press <{> and <}> to remove or add rows to selected grid surface\n";
ss << " - Press <+> and <-> to scale surface up and down\n";
ss << " - Press <9> and <0> to move selected surface one layer up or down\n";
ss << " - Press <l> to hide/show layer panel\n";
ss << " - Press <BACKSPACE> to delete selection\n";
ss << " - Press <SPACE> to play/pause the video\n";
ss << " - Type <new> to clear composition\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 <s> to save the composition\n";
ss << "Press <f> to toggle fullscreen\n";
ss << "Press <z> to undo\n";
ss << "Press <i> to hide this message";
ofDrawBitmapStringHighlight(ss.str(), 10, 20,
ofDrawBitmapStringHighlight(_text, 10, 20,
ofColor(0, 0, 0, 100),
ofColor(255, 255, 255, 200));
}
@ -49,5 +48,9 @@ void Info::toggle(){
_visible = !_visible;
}
void Info::setText(string text){
_text = text;
}
} // namespace piMapper
} // namespace ofx

2
src/Info/Info.h

@ -11,9 +11,11 @@ class Info {
void draw();
void toggle();
void setText(string text);
private:
bool _visible;
string _text;
};
} // namespace piMapper

4
src/ofxPiMapper.cpp

@ -154,6 +154,10 @@ unsigned int ofxPiMapper::getNumSurfaces(){
return _application.getSurfaceManager()->getActivePreset()->getSurfaces().size();
}
void ofxPiMapper::setInfoText(string text){
_application.setInfoText(text);
}
void ofxPiMapper::toggleInfo(){
_application.toggleInfo();
}

1
src/ofxPiMapper.h

@ -26,6 +26,7 @@ class ofxPiMapper {
void registerFboSource(ofx::piMapper::FboSource * fboSource);
// Application
void setInfoText(string text);
void toggleInfo();
// Modes

Loading…
Cancel
Save