int main(int argc, char** argv){ Preview_Window previewWindow(280, 300, "Model Selection"); Model_Window* groundWin = new Model_Window(GROUND, 10, 30, 80, 80); Model_Window* debrisWin = new Model_Window(DEBRIS, 100, 30, 80, 80); Model_Window* grassWin = new Model_Window(GRASS, 190, 30, 80, 80); Model_Window* wallWin = new Model_Window(WALL, 10, 120, 80, 80); Model_Window* objectWin = new Model_Window(OBJECT, 100, 120, 80, 80); Model_Window* fenceWin = new Model_Window(FENCE, 190, 120, 80, 80); Model_Window* windowFrameWin = new Model_Window(WINDOWFRAME, 10, 210, 80, 80); Model_Window* doorWin = new Model_Window(DOOR, 100, 210, 80, 80); Model_Window* doorFrameWin = new Model_Window(DOORFRAME, 190, 210, 80, 80); previewWindow.addWindow(groundWin); previewWindow.addWindow(debrisWin); previewWindow.addWindow(grassWin); previewWindow.addWindow(wallWin); previewWindow.addWindow(objectWin); previewWindow.addWindow(fenceWin); previewWindow.addWindow(windowFrameWin); previewWindow.addWindow(doorWin); previewWindow.addWindow(doorFrameWin); Fl_Window mainWindow(WIDTH, HEIGHT, "Map Editor"); Map_Window mapWin(10, 10, WIDTH-20, HEIGHT-20); mainWindow.show(); previewWindow.show(); return(Fl::run()); }
//-------------------------------------------------------------- void ofApp::draw(){ ofRectangle previewWindow(20, 20, 640, 480); ofRectangle playbackWindow(20+640, 20, 640, 480); // draw the background boxes ofPushStyle(); ofSetColor(0); ofFill(); ofDrawRectangle(previewWindow); ofDrawRectangle(playbackWindow); ofPopStyle(); // draw the preview if available if(vidRecorder->hasPreview()){ ofPushStyle(); ofFill(); ofSetColor(255); // fit it into the preview window, but use the correct aspect ratio ofRectangle videoGrabberRect(0,0,vidGrabber.getWidth(),vidGrabber.getHeight()); videoGrabberRect.scaleTo(previewWindow); vidGrabber.draw(videoGrabberRect); ofPopStyle(); } else{ ofPushStyle(); // x out to show there is no video preview ofSetColor(255); ofSetLineWidth(3); ofDrawLine(20, 20, 640+20, 480+20); ofDrawLine(20+640, 20, 20, 480+20); ofPopStyle(); } // draw the playback video if(recordedVideoPlayback.isLoaded()){ ofPushStyle(); ofFill(); ofSetColor(255); // fit it into the preview window, but use the correct aspect ratio ofRectangle recordedRect(ofRectangle(0,0,recordedVideoPlayback.getWidth(),recordedVideoPlayback.getHeight())); recordedRect.scaleTo(playbackWindow); recordedVideoPlayback.draw(recordedRect); ofPopStyle(); } ofPushStyle(); ofNoFill(); ofSetLineWidth(3); if(vidRecorder->isRecording()){ //make a nice flashy red record color int flashRed = powf(1 - (sin(ofGetElapsedTimef()*10)*.5+.5),2)*255; ofSetColor(255, 255-flashRed, 255-flashRed); } else{ ofSetColor(255,80); } ofDrawRectangle(previewWindow); ofPopStyle(); //draw instructions ofPushStyle(); ofSetColor(255); ofDrawBitmapString("' ' space bar to toggle recording", 680, 540); ofDrawBitmapString("'v' switches video device", 680, 560); ofDrawBitmapString("'a' switches audio device", 680, 580); //draw video device selection ofDrawBitmapString("VIDEO DEVICE", 20, 540); for(int i = 0; i < videoDevices.size(); i++){ if(i == vidRecorder->getVideoDeviceID()){ ofSetColor(255, 100, 100); } else{ ofSetColor(255); } ofDrawBitmapString(videoDevices[i], 20, 560+i*20); } //draw audio device; int startY = 580+20*videoDevices.size(); ofDrawBitmapString("AUDIO DEVICE", 20, startY); startY += 20; for(int i = 0; i < audioDevices.size(); i++){ if(i == vidRecorder->getAudioDeviceID()){ ofSetColor(255, 100, 100); } else{ ofSetColor(255); } ofDrawBitmapString(audioDevices[i], 20, startY+i*20); } ofPopStyle(); }