From 4235b68bcf53e9c12dff1baf4ed2530fd2d6f523 Mon Sep 17 00:00:00 2001
From: Krisjanis Rijnieks <krisjanis.rijnieks@gmail.com>
Date: Sat, 10 May 2014 16:31:20 +0200
Subject: [PATCH] Add info message to example

---
 example/src/ofApp.cpp | 16 ++++++++++++++++
 example/src/ofApp.h   |  1 +
 src/ofxSurfaceGui.cpp | 17 +++++++++++++++++
 3 files changed, 34 insertions(+)

diff --git a/example/src/ofApp.cpp b/example/src/ofApp.cpp
index b7304b5..3f16b66 100644
--- a/example/src/ofApp.cpp
+++ b/example/src/ofApp.cpp
@@ -9,6 +9,8 @@ void ofApp::setup()
                           &image.getTextureReference());
     
     gui.setup(triangleSurface);
+    
+    bShowInfo = true;
 }
 
 void ofApp::update()
@@ -52,6 +54,19 @@ void ofApp::draw()
     }
     
     gui.draw();
+    
+    if ( bShowInfo ) {
+        // Draw instructions
+        stringstream ss;
+        ss << "There are 3 modes:\n\n";
+        ss << " 1. Presentation mode\n";
+        ss << " 2. Texture mapping mode\n";
+        ss << " 3. Projection mapping mode\n\n";
+        ss << "You can switch between the modes by using <1>, <2> and <3> keys on the keyboard.\n\n";
+        ss << "Hit <i> to hide this message.";
+        
+        ofDrawBitmapStringHighlight(ss.str(), 10, 20, ofColor(0,0,0,100), ofColor(255,255,255,200));
+    }
 }
 
 void ofApp::keyPressed(int key)
@@ -62,6 +77,7 @@ void ofApp::keyPressed(int key)
         case '1': gui.setMode(ofxSurfaceGui::NONE); break;
         case '2': gui.setMode(ofxSurfaceGui::TEXTURE_MAPPING); break;
         case '3': gui.setMode(ofxSurfaceGui::PROJECTION_MAPPING); break;
+        case 'i': bShowInfo = !bShowInfo; break;
         default: break;
     }
 }
diff --git a/example/src/ofApp.h b/example/src/ofApp.h
index f8707fe..06cc87c 100644
--- a/example/src/ofApp.h
+++ b/example/src/ofApp.h
@@ -22,6 +22,7 @@ public:
     ofImage image;
     
     ofxSurfaceGui gui;
+    bool bShowInfo;
 };
 
 #endif
\ No newline at end of file
diff --git a/src/ofxSurfaceGui.cpp b/src/ofxSurfaceGui.cpp
index eea1e60..b3b881d 100644
--- a/src/ofxSurfaceGui.cpp
+++ b/src/ofxSurfaceGui.cpp
@@ -42,10 +42,27 @@ void ofxSurfaceGui::draw()
     if (mode == NONE) return;
     
     if (mode == PROJECTION_MAPPING) {
+        ofPolyline line;
+        for ( int i=0; i<projectionMappingJoints.size(); i++ ) {
+            line.addVertex( ofPoint(projectionMappingJoints[i].position.x,
+                                    projectionMappingJoints[i].position.y) );
+        }
+        line.close();
+        line.draw();
+        
         for ( int i=0; i<projectionMappingJoints.size(); i++ ) {
             projectionMappingJoints[i].draw();
         }
+        
     } else if (mode == TEXTURE_MAPPING) {
+        ofPolyline line;
+        for ( int i=0; i<textureMappingJoints.size(); i++ ) {
+            line.addVertex( ofPoint(textureMappingJoints[i].position.x,
+                                    textureMappingJoints[i].position.y) );
+        }
+        line.close();
+        line.draw();
+        
         for ( int i=0; i<textureMappingJoints.size(); i++ ) {
             textureMappingJoints[i].draw();
         }