Permalink
Browse files

added arrow-key nudging from scott vanderbeck, changed vs2010 libs to…

… compile in release
  • Loading branch information...
1 parent c7915ca commit 5088bd240888f5ada78641faa7244d7edce3a002 @kylemcdonald kylemcdonald committed Jul 9, 2012
Showing with 26 additions and 2 deletions.
  1. +1 −1 mapamok/mapamok.vcxproj
  2. +1 −0 mapamok/src/main.cpp
  3. +24 −1 mapamok/src/testApp.cpp
View
@@ -92,7 +92,7 @@
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- <AdditionalDependencies>%(AdditionalDependencies);opencv_calib3d231d.lib;opencv_contrib231d.lib;opencv_core231d.lib;opencv_features2d231d.lib;opencv_flann231d.lib;opencv_gpu231d.lib;opencv_haartraining_engined.lib;opencv_highgui231d.lib;opencv_imgproc231d.lib;opencv_legacy231d.lib;opencv_ml231d.lib;opencv_objdetect231d.lib;opencv_video231d.lib;zlibd.lib;assimp.lib</AdditionalDependencies>
+ <AdditionalDependencies>%(AdditionalDependencies);opencv_calib3d231.lib;opencv_contrib231.lib;opencv_core231.lib;opencv_features2d231.lib;opencv_flann231.lib;opencv_gpu231.lib;opencv_haartraining_engine.lib;opencv_highgui231.lib;opencv_imgproc231.lib;opencv_legacy231.lib;opencv_ml231.lib;opencv_objdetect231.lib;opencv_video231.lib;zlib.lib;assimp.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);..\..\..\addons\ofxOpenCv\libs\opencv\lib\vs2010;..\..\..\addons\ofxAssimpModelLoader\libs\assimp\lib\vs2010</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
View
@@ -6,6 +6,7 @@ int main() {
#ifdef TARGET_OSX
window.setGlutDisplayString("rgba double samples>=8 depth");
#endif
+
ofSetupOpenGL(&window, 1024, 768, OF_FULLSCREEN);
ofRunApp(new testApp());
}
View
@@ -40,8 +40,10 @@ void testApp::update() {
light.setPosition(getf("lightX"), getf("lightY"), getf("lightZ"));
if(getb("selectionMode")) {
+ cam.enableMouseInput();
} else {
updateRenderMode();
+ cam.disableMouseInput();
}
}
@@ -87,6 +89,21 @@ void testApp::draw() {
}
void testApp::keyPressed(int key) {
+ if(key == OF_KEY_LEFT || key == OF_KEY_UP || key == OF_KEY_RIGHT|| key == OF_KEY_DOWN){
+ int choice = geti("selectionChoice");
+ setb("arrowing", true);
+ if(choice > 0){
+ Point2f& cur = imagePoints[choice];
+ switch(key) {
+ case OF_KEY_LEFT: cur.x -= 1; break;
+ case OF_KEY_RIGHT: cur.x += 1; break;
+ case OF_KEY_UP: cur.y -= 1; break;
+ case OF_KEY_DOWN: cur.y += 1; break;
+ }
+ }
+ } else {
+ setb("arrowing",false);
+ }
if(key == OF_KEY_BACKSPACE) { // delete selected
if(getb("selected")) {
setb("selected", false);
@@ -321,6 +338,7 @@ void testApp::setupControlPanel() {
panel.addSlider("hoverChoice", 0, 0, objectPoints.size(), true);
panel.addToggle("selected", false);
panel.addToggle("dragging", false);
+ panel.addToggle("arrowing", false);
panel.addSlider("selectionChoice", 0, 0, objectPoints.size(), true);
panel.addSlider("slowLerpRate", .001, 0, .01);
panel.addSlider("fastLerpRate", 1, 0, 1);
@@ -492,7 +510,12 @@ void testApp::drawRenderMode() {
drawLabeledPoint(choice, toOf(cur), yellowPrint, ofColor::white, ofColor::black);
ofSetColor(ofColor::black);
ofRect(toOf(cur), 1, 1);
- } else {
+ } else if(getb("arrowing")) {
+ Point2f& cur = imagePoints[choice];
+ drawLabeledPoint(choice, toOf(cur), yellowPrint, ofColor::white, ofColor::black);
+ ofSetColor(ofColor::black);
+ ofRect(toOf(cur), 1, 1);
+ } else {
// check to see if anything is selected
// draw hover magenta
float distance;

0 comments on commit 5088bd2

Please sign in to comment.