//gable roof void gableRoof(int x) { int i = x - 10; int iCp = i; int j = 5; while(i <= x) { printf(" "); if(i==iCp) { drawSpace(j); drawDashes(i); i = i + 2; printf("\n"); } else if(i==x) { drawSpace(j); drawEquals(i); i = i + 2; printf("\n"); } else { drawSpace(j); drawSlash(i); i = i + 2; printf("\n"); } j--; } }
void LvlScene::setSectionResizer(bool enabled, bool accept) { if((enabled)&&(pResizer==NULL)) { MainWinConnect::pMainWin->on_actionSelect_triggered(); //Reset mode int x = LvlData->sections[LvlData->CurSection].size_left; int y = LvlData->sections[LvlData->CurSection].size_top; int w = LvlData->sections[LvlData->CurSection].size_right; int h = LvlData->sections[LvlData->CurSection].size_bottom; pResizer = new ItemResizer( QSize((long)fabs(x-w), (long)fabs(y-h)), Qt::green, 32 ); this->addItem(pResizer); pResizer->setPos(x, y); pResizer->type=0; pResizer->_minSize = QSizeF(800, 600); this->setFocus(Qt::ActiveWindowFocusReason); //DrawMode=true; SwitchEditingMode(MODE_Resizing); MainWinConnect::pMainWin->resizeToolbarVisible(true); } else { if(pResizer!=NULL) { if(accept) { #ifdef _DEBUG_ WriteToLog(QtDebugMsg, QString("SECTION RESIZE -> to %1 x %2").arg(pResizer->_width).arg(pResizer->_height)); #endif long l = pResizer->pos().x(); long t = pResizer->pos().y(); long r = l+pResizer->_width; long b = t+pResizer->_height; long oldL = LvlData->sections[LvlData->CurSection].size_left; long oldR = LvlData->sections[LvlData->CurSection].size_right; long oldT = LvlData->sections[LvlData->CurSection].size_top; long oldB = LvlData->sections[LvlData->CurSection].size_bottom; LvlData->sections[LvlData->CurSection].size_left = l; LvlData->sections[LvlData->CurSection].size_right = r; LvlData->sections[LvlData->CurSection].size_top = t; LvlData->sections[LvlData->CurSection].size_bottom = b; addResizeSectionHistory(LvlData->CurSection, oldL, oldT, oldR, oldB, l, t, r, b); ChangeSectionBG(LvlData->sections[LvlData->CurSection].background); drawSpace(); LvlData->modified = true; } delete pResizer; pResizer = NULL; MainWinConnect::pMainWin->on_actionSelect_triggered(); MainWinConnect::pMainWin->resizeToolbarVisible(false); //resetResizingSection=true; } DrawMode=false; } }
void display() { GLfloat lightPos[4] = {sun.x, sun.y, sun.z, 1}; glLightfv(GL_LIGHT0, GL_POSITION, lightPos); moveSpace(&space, camera.eye.x, camera.eye.y, camera.eye.z); drawSpace(&space); drawShip(&ship); drawSun(&sun); }
void wyChipmunk::draw() { // if no draw flag is set, call wyNode::draw and it // will decide forward drawing to java layer or not if(m_noDraw) { wyNode::draw(); return; } drawSpace(m_space, &m_options); }
void kSpaceSaver::slotTimeout() { //printf("%d %d \n",(int)warpinterval, MAXWARP); if(warpinterval != MAXWARP){ if(nitro == 0) counter -= speed +1; if(counter <= 0){ nitro = 1; counter = (int) warpinterval *WARPFACTOR; } } else nitro = 0; drawSpace( mDrawable ); }
///////////////////////////////////////////////////////////////////////////// // DrawGLScene // desc: handles drawing of scene // void CHOpenGLView::DrawGLScene(void) { // clear screen and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); m_B111208.checkMouseMove(); // camera view configuration m_B111208.setLookAt(); // draw drawSpace(); Invalidate(FALSE); // swap buffer SwapBuffers(m_hDC); }
void GameView::drawBoard(int* board, int WIDTH, int HEIGHT){ int n,m, p; cout << " "; for (p=0;p<HEIGHT;p++) { cout << " " << lettersFromInt(p) << " "; } cout << "\n"; for (n=0;n<HEIGHT;n++) { cout << n << " "; for (m=0;m<WIDTH;m++) { drawSpace(board[n*WIDTH+m]); } cout << "\n"; } cout << "\n"; }
static void display(void) { glClear(GL_COLOR_BUFFER_BIT); drawSpace(space, currDemo->drawOptions ? currDemo->drawOptions : &options); drawInstructions(); drawInfo(); drawString(-300, -210, messageString); glutSwapBuffers(); ticks++; cpVect newPoint = cpvlerp(mousePoint_last, mousePoint, 0.25f); mouseBody->p = newPoint; mouseBody->v = cpvmult(cpvsub(newPoint, mousePoint_last), 60.0f); mousePoint_last = newPoint; currDemo->updateFunc(ticks); }
void display(void) { static unsigned n; static double t0; double t1, elapsedTime; float fps; char cfps[256]; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eye_x, eye_y, eye_z, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glRotatef(rotate_y_angle, 0.0, 1.0, 0.0); glRotatef(rotate_x_angle, 1.0, 0.0, 0.0); glRotatef(rotate_z_angle, 0.0, 0.0, 1.0); drawSpace(); drawJulia(dm); n++; t1 = currentSeconds(); elapsedTime = t1 - t0; if (elapsedTime > FPS_TIME_WINDOW) { fps = (float) n / elapsedTime; n = 0; t0 = t1; sprintf(cfps, "Julia Fractal GL (%d x %d): %3.1f fps", WIDTH, HEIGHT, fps); printf("%s\n", cfps); glutSetWindowTitle(cfps); } glutPostRedisplay(); glutSwapBuffers(); }
//pitched roof void pitchedRoof(int roofWidth) { if(roofWidth%2==0) //pitched roof for even numbers { int i = roofWidth/2; int space = 2; while(i>0) { printf(" "); if(i == roofWidth/2) { drawSpace(i); printf("/\\ \n"); } else { drawSpace(i); printf("/--"); drawSpace(space); printf("--\\ \n"); space = space + 6; } i = i - 3; } } else //pitched roof for odd numbers { int i = roofWidth/2 + 1; int space = 3; while(i>0) { printf(" "); if(i== roofWidth/2 + 1) { drawSpace(i); printf("* \n"); i--; drawSpace(i+2); printf("/ \\ \n"); } else if(i == roofWidth/2) { printf("I: %i \n", i); drawSpace(i); printf("/\\ \n"); } else { drawSpace(i); printf("/--"); drawSpace(space); printf("--\\ \n"); space = space + 6; } i = i - 3; } } printf(" "); drawEquals(roofWidth); printf("\n"); }
//Drawing ground floor or the base floor void groundFloor(int winSpacing, int windowWidth, int windowHeight, int winPerFloor) { int roofWidth = (winPerFloor*windowWidth) + (winPerFloor+1)*winSpacing + 2; int doorSpacing = (windowWidth + winSpacing) - 5; int winHeightCp = windowHeight; int i; for(i=1; i<=8; i++) { printf(" "); if(i==1) { drawPipes(roofWidth); printf("\n"); } else if(i==8) { drawDashes(roofWidth); printf("\n"); } else if(i==2) { int counter = winPerFloor - 1; printf("|"); drawSpace(winSpacing+windowWidth+winSpacing); while (counter>0) { drawDashes(windowWidth); drawSpace(winSpacing); counter--; } printf("|\n"); winHeightCp--; } else if(winHeightCp>0) { if(winHeightCp == (windowHeight -1)) { int counter = winPerFloor - 1; printf("|"); drawSpace(winSpacing); drawDashes(5); drawSpace(winSpacing + windowWidth - 5); while (counter>0) { drawPipes(windowWidth); drawSpace(winSpacing); counter--; } } else if(winHeightCp == 1) { int counter = winPerFloor - 1; printf("|"); drawSpace(winSpacing); drawPipes(5); drawSpace(winSpacing + windowWidth - 5); while (counter>0) { drawDashes(windowWidth); drawSpace(winSpacing); counter--; } } else { int counter = winPerFloor - 1; printf("|"); drawSpace(winSpacing); drawPipes(5); drawSpace(winSpacing + windowWidth - 5); while (counter>0) { drawPipes(windowWidth); drawSpace(winSpacing); counter--; } } printf("|\n"); winHeightCp--; } else { printf("|"); drawSpace(winSpacing); drawPipes(5); drawSpace(roofWidth - (winSpacing+5) - 2); printf("|\n"); } } }
//Drawing floor void floors(int winSpacing, int winWidth, int windowHeight, int numOfWin) { int roofWidth = (winWidth*numOfWin)+ ((numOfWin+1)*winSpacing) + 2; int i; int windowHeightCopy = windowHeight; for(i = 1; i<=8; i++) { printf(" "); if(i==1) { drawPipes(roofWidth); printf("\n"); } else if(i==8) { drawDashes(roofWidth); } else if(windowHeightCopy>0) { if(windowHeightCopy == windowHeight || windowHeightCopy==1) { int counter = (numOfWin*2) + 1; int counterCp = counter; printf("|"); while(counter>0) { if(counter==1 || counter==counterCp) { drawSpace(winSpacing); } else if(counter%2==0) { drawDashes(winWidth); } else { drawSpace(winSpacing); } counter--; } printf("| \n"); } else { int counter = (numOfWin*2) + 1; int counterCp = counter; printf("|"); while(counter>0) { if(counter==1 || counter==counterCp) { drawSpace(winSpacing); } else if(counter%2==0) { drawPipes(winWidth); } else { drawSpace(winSpacing); } counter--; } printf("| \n"); } windowHeightCopy--; } else { drawPipes(roofWidth); printf("\n"); } } printf("\n"); }
void ChipmunkTestLayer::draw() { drawSpace(space, currDemo->drawOptions ? currDemo->drawOptions : &options); }
int main(int argc, char **argv) { Fl_Window window(10, 10, 950, 700, "PaintBot"); FillBackground fillBackground(window.w(), window.h()); FillBoxBackground fillBoxBackground(31, 31, 888, 486); Fl_Box drawSpace(30, 30, 890, 488, ""); drawSpace.box(FL_DOWN_FRAME); Fl_Box controlPanel(30, 548, 890, 122, ""); controlPanel.box(FL_DOWN_BOX); Drawing d(1,1,4,5); CreateBase base(450,470, 50,30); arms = new Lines(); CreateCircles joint1Circ(); //CreateCircle joint2Circ(BX+arms->lines[1]->x1, BY-arms->lines[1]->y1); //CreateCircle joint3Circ(BX+arms->lines[2]->x1, BY-arms->lines[2]->y1); Fl_Box joint1_txt(215, 550, 30, 15, "Joint 1"); Fl_Button j1_cc(150, 570, 60, 30, "-"); Fl_Button j1_cl(250, 570, 60, 30, "+"); j1_cc.callback(j1_cc_callback, NULL); j1_cl.callback(j1_cl_callback, NULL); Fl_Box joint2_txt(460, 550, 30, 15, "Joint 2"); Fl_Button j2_cc(395, 570, 60, 30, "-"); Fl_Button j2_cl(495, 570, 60, 30, "+"); j2_cc.callback(j2_cc_callback, NULL); j2_cl.callback(j2_cl_callback, NULL); Fl_Box joint3_txt(705, 550, 30, 15, "Joint 3"); Fl_Button j3_cc(640, 570, 60, 30, "-"); Fl_Button j3_cl(740, 570, 60, 30, "+"); j3_cc.callback(j3_cc_callback, NULL); j3_cl.callback(j3_cl_callback, NULL); Fl_Button paint(445, 610, 60, 30, "Paint"); paint.callback(paint_callback, NULL); joint1_txt.show(); joint2_txt.show(); joint3_txt.show(); j1_cc.show(); j1_cl.show(); j2_cc.show(); j2_cl.show(); j3_cc.show(); j3_cl.show(); paint.show(); window.show(); return Fl::run(); }
//just for debug purposes void ofxDuration::draw(float x, float y, float width, float height){ if(!isSetup){ return; } ofPushStyle(); ofEnableAlphaBlending(); ofSetLineWidth(1); map<string, ofxDurationTrack>::iterator trackit; int numTracks = tracks.size(); float heightPerTrack = height / numTracks; for (int trackIdx = 0; trackIdx < trackNames.size(); trackIdx++) { ofPushStyle(); ofxDurationTrack& track = tracks[trackNames[trackIdx]]; ofRectangle drawSpace(x, y+(heightPerTrack*trackIdx), width, heightPerTrack); //fade out indicator over 2 seconds float fadeValue = ofMap(track.lastUpdatedTime, ofGetElapsedTimef(), ofGetElapsedTimef()-2, 150, 0, true); if(track.type == "Bangs"){ ofFill(); ofSetColor(blueColor, fadeValue); ofRect(drawSpace); } else if(track.type == "Curves" || track.type == "LFO"){ ofSetColor(redColor); float height = ofMap(track.value, track.range.min, track.range.max, drawSpace.getMaxY(), drawSpace.getMinY()); ofLine(drawSpace.getMinX(), height, drawSpace.getMaxX(), height); } else if(track.type == "Colors"){ ofFill(); ofSetColor(track.color); ofRect(drawSpace); } else if(track.type == "Switches"){ if(track.on){ ofFill(); ofSetColor(blueColor, 150); ofRect(drawSpace); } } else if(track.type == "Flags"){ ofFill(); ofSetColor(blueColor, fadeValue); ofRect(drawSpace); ofSetColor(255); if(font.isLoaded()){ font.drawString(track.flag, drawSpace.x + 10, drawSpace.y + (font.getLineHeight()+3)*2); } else{ ofDrawBitmapString(track.flag, drawSpace.x + 10, drawSpace.y + 30); } } else if(track.type == "Audio"){ float binWidth = drawSpace.width / track.fft.size(); ofFill(); for(int i = 0; i < track.fft.size(); i++){ float height = drawSpace.height * track.fft[i]/track.maxBinReceived; float y = drawSpace.y + drawSpace.height - height; ofSetColor(blueColor, 120); ofRect(i*binWidth, y, binWidth, height); ofSetColor(redColor); ofLine(i*binWidth,y,i*binWidth+binWidth,y); } } //draw border ofNoFill(); ofSetColor(redColor); ofRect(drawSpace); //draw label if(track.type == "Colors"){ ofSetColor(track.color.getInverted()); } else{ ofSetColor(255); } if(font.isLoaded()){ font.drawString(track.name, drawSpace.x + 10, drawSpace.y + font.getLineHeight()+3); } else{ ofDrawBitmapString(track.name, drawSpace.x + 10, drawSpace.y + 15); } } ofSetColor(255); if(font.isLoaded()){ font.drawString("listening on port " + ofToString(port), x + 10, y+height-5); } else{ ofDrawBitmapString("listening on port " + ofToString(port), x + 10, y+height-5); } ofPopStyle(); }