Browse Source

Add visual switching to sources editor with key 4

master
Krisjanis Rijnieks 11 years ago
parent
commit
5ab0168cbb
  1. 6
      example/src/ofApp.cpp
  2. 3
      src/ofxGuiMode.h
  3. 5
      src/ofxSourcesEditor.cpp
  4. 4
      src/ofxSourcesEditor.h
  5. 7
      src/ofxSurfaceManagerGui.cpp
  6. 2
      src/ofxSurfaceManagerGui.h

6
example/src/ofApp.cpp

@ -46,8 +46,9 @@ void ofApp::draw()
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 << " 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 << "Hit <i> to hide this message.";
ofDrawBitmapStringHighlight(ss.str(), 10, 20, ofColor(0,0,0,100), ofColor(255,255,255,200));
@ -62,6 +63,7 @@ void ofApp::keyPressed(int key)
case '1': gui.setMode(ofxGuiMode::NONE); break;
case '2': gui.setMode(ofxGuiMode::TEXTURE_MAPPING); break;
case '3': gui.setMode(ofxGuiMode::PROJECTION_MAPPING); break;
case '4': gui.setMode(ofxGuiMode::SOURCE_SELECTION); break;
case 'i': bShowInfo = !bShowInfo; break;
case 'r': addRandomSurface(); break;
default: break;

3
src/ofxGuiMode.h

@ -6,7 +6,8 @@ struct ofxGuiMode
enum {
NONE,
TEXTURE_MAPPING,
PROJECTION_MAPPING
PROJECTION_MAPPING,
SOURCE_SELECTION
};
};

5
src/ofxSourcesEditor.cpp

@ -8,4 +8,9 @@ ofxSourcesEditor::ofxSourcesEditor()
ofxSourcesEditor::~ofxSourcesEditor()
{
}
void ofxSourcesEditor::draw()
{
ofDrawBitmapString("Sources Editor", ofPoint(10, 20));
}

4
src/ofxSourcesEditor.h

@ -1,12 +1,16 @@
#ifndef H_OFX_SOURCES_EDITOR
#define H_OFX_SOURCES_EDITOR
#include "ofGraphics.h"
class ofxSourcesEditor
{
public:
ofxSourcesEditor();
~ofxSourcesEditor();
void draw();
private:
};

7
src/ofxSurfaceManagerGui.cpp

@ -67,6 +67,8 @@ void ofxSurfaceManagerGui::draw()
// draw projection mapping editing gui
projectionEditor.draw();
} else if ( guiMode == ofxGuiMode::SOURCE_SELECTION ) {
sourcesEditor.draw();
}
}
@ -126,6 +128,8 @@ void ofxSurfaceManagerGui::mousePressed(ofMouseEventArgs &args)
projectionEditor.clearJoints();
surfaceManager->deselectSurface();
}
} else if ( guiMode == ofxGuiMode::SOURCE_SELECTION ) {
}
}
@ -162,7 +166,8 @@ void ofxSurfaceManagerGui::setMode(int newGuiMode)
{
if (newGuiMode != ofxGuiMode::NONE &&
newGuiMode != ofxGuiMode::TEXTURE_MAPPING &&
newGuiMode != ofxGuiMode::PROJECTION_MAPPING) {
newGuiMode != ofxGuiMode::PROJECTION_MAPPING &&
newGuiMode != ofxGuiMode::SOURCE_SELECTION) {
throw std::runtime_error("Trying to set invalid mode.");
}

2
src/ofxSurfaceManagerGui.h

@ -8,6 +8,7 @@
#include "ofxSurfaceManager.h"
#include "ofxTextureEditor.h"
#include "ofxProjectionEditor.h"
#include "ofxSourcesEditor.h"
#include "ofxGuiMode.h"
class ofxSurfaceManagerGui
@ -34,6 +35,7 @@ private:
ofxSurfaceManager* surfaceManager;
ofxTextureEditor textureEditor;
ofxProjectionEditor projectionEditor;
ofxSourcesEditor sourcesEditor;
int guiMode;
bool bDrag;
ofVec2f clickPosition;

Loading…
Cancel
Save