//------------------------------------------------------------------------------ void display(void) { glClear (GL_COLOR_BUFFER_BIT); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); GLfloat LightAmbient[] = { 0.4f, 0.4f, 0.4f, 1.0f}; GLfloat LightDiffuse[] = { 0.3f, 0.3f, 0.3f, 1.0f}; GLfloat LightSpecular[] = { 0.4f, 0.4f, 0.4f, 1.0f}; GLfloat LightPosition[] = { 5.0f, 5.0f, 5.0f, 1.0f}; glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); glEnable(GL_LIGHT0); glShadeModel(GL_SMOOTH); draw_spline( CUBIC_SPLINE_CATMULLROM ); draw_spline( CUBIC_SPLINE_B ); draw_actor(); glutSwapBuffers(); }
//------------------------------------------------------------------------------ void display(void) { glClear (GL_COLOR_BUFFER_BIT); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); GLfloat LightAmbient[] = { 0.4f, 0.4f, 0.4f, 1.0f}; GLfloat LightDiffuse[] = { 0.3f, 0.3f, 0.3f, 1.0f}; GLfloat LightSpecular[] = { 0.4f, 0.4f, 0.4f, 1.0f}; GLfloat LightPosition[] = { 5.0f, 5.0f, 5.0f, 1.0f}; //glClearColor(0.0,0.0,0.0,0.0); glClearColor( 0.25, 0.25, 0.25, 0.0 ); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); glEnable(GL_LIGHT0); glShadeModel(GL_SMOOTH); draw_spline( CUBIC_SPLINE_CATMULLROM ); draw_spline( CUBIC_SPLINE_B ); if( DRAW_ACTOR ) draw_actor(); glutSwapBuffers(); if( GENERATE_MOVIE ) { std::string ssplinebasis; switch( SPLINE_BASIS ) { case CATMULL_ROM: ssplinebasis = "crom"; break; case B_SPLINE: default: ssplinebasis = "bspl"; break; } std::string srotfun; switch( ROTFUN ) { case ROTFUN_EULERANGLES: srotfun = "euler"; break; case ROTFUN_QUATERNION: default: srotfun = "quat"; break; } sprintf( filename, "%s_%s_%s_%.04d.tif",filetitle.c_str(), ssplinebasis.c_str(), srotfun.c_str(), frame_id ); printf( "%s\n", filename ); writetiff( filename, "movie", 0, 0, Width, Height, COMPRESSION_NONE ); } }
void update_screen(coord x, coord y) { coord sx, sy, px, py; /* Find the current general section. */ get_current_section_coordinates(d.px, d.py, &sx, &sy); #ifdef UPDATE_PANEL_VIEW coord opsx, opsy; /* Memorize the old panel view. */ opsx = d.psx; opsy = d.psy; /* Adjust the panel view. */ while (sx < d.psx) d.psx--; while (d.psx + 4 < sx) d.psx++; while (sy < d.psy) d.psy--; while (d.psy + 1 < sy) d.psy++; /* Repaint the whole screen map if necessary. */ if (opsx != d.psx || opsy != d.psy) paint_map(); #endif /* Make the immediate surroundings known. */ for (px = x - 1; px <= x + 1; px++) for (py = y - 1; py <= y + 1; py++) know(px, py); /* Check whether the PC is in a room or not. */ get_current_section(d.px, d.py, &sx, &sy); /* Make rooms known. */ if (sx != -1 && sy != -1) know_section(sx, sy); move_dungeon(); draw_dungeon(); draw_monsters(); draw_actor(&d.pa); draw_player_status(); flip(); }
void UcClassCanvas::draw(QPainter & p) { if (! visible()) return; p.setRenderHint(QPainter::Antialiasing, true); QRect r = rect(); QFontMetrics fm(the_canvas()->get_font(UmlNormalFont)); QFontMetrics fim(the_canvas()->get_font(UmlNormalItalicFont)); QColor bckgrnd = p.backgroundColor(); double zoom = the_canvas()->zoom(); FILE * fp = svg(); if (fp != 0) fputs("<g>\n", fp); p.setBackgroundMode((used_color == UmlTransparent) ? ::Qt::TransparentMode : ::Qt::OpaqueMode); QColor co = color(used_color); if (used_view_mode == asClass) { if (used_color != UmlTransparent) { const int shadow = the_canvas()->shadow(); if (shadow != 0) { r.setRight(r.right() - shadow); r.setBottom(r.bottom() - shadow); p.fillRect (r.right(), r.top() + shadow, shadow, r.height() - 1, ::Qt::darkGray); p.fillRect (r.left() + shadow, r.bottom(), r.width() - 1, shadow, ::Qt::darkGray); if (fp != 0) { fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\"" " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n", QColor(::Qt::darkGray).rgb()&0xffffff, r.right(), r.top() + shadow, shadow - 1, r.height() - 1 - 1); fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\"" " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n", QColor(::Qt::darkGray).rgb()&0xffffff, r.left() + shadow, r.bottom(), r.width() - 1 - 1, shadow - 1); } } } p.setBackgroundColor(co); if (used_color != UmlTransparent) { p.fillRect(r, co); if (fp != 0) fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\"" " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n", svg_color(used_color), r.x(), r.y(), r.width() - 1, r.height() - 1); } else if (fp != 0) fprintf(fp, "\t<rect fill=\"none\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\"" " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n", r.x(), r.y(), r.width() - 1, r.height() - 1); p.drawRect(r); } const ClassData * data = ((ClassData *) browser_node->get_data()); const int two = (int) (2 * zoom); int he = fm.height() + two; if (data->get_n_formalparams() != 0) r.setTop(r.top() + fm.height()); switch (used_view_mode) { case asInterface: draw_interface_icon(p, r, used_color, zoom); r.setTop(r.top() + (int) (INTERFACE_SIZE * zoom) + two); break; case asControl: draw_control_icon(p, r, used_color, zoom); r.setTop(r.top() + (int) (CONTROL_HEIGHT * zoom) + two); break; case asBoundary: draw_boundary_icon(p, r, used_color, zoom); r.setTop(r.top() + (int) (BOUNDARY_HEIGHT * zoom) + two); break; case asEntity: draw_entity_icon(p, r, used_color, zoom); r.setTop(r.top() + (int) (ENTITY_SIZE * zoom) + two); break; case asActor: { QRect ra = r; ra.setHeight((int) (ACTOR_SIZE * zoom)); ra.setLeft(ra.left() + (int) ((ra.width() - ACTOR_SIZE * zoom)/2)); ra.setWidth(ra.height()); draw_actor(&p, ra); } r.setTop(r.top() + (int) (ACTOR_SIZE * zoom) + two); break; case Natural: { const QPixmap * px = ProfiledStereotypes::diagramPixmap(data->get_stereotype(), zoom); int lft = (px->width() < width()) ? r.x() + (width() - px->width())/2 : r.x(); p.drawPixmap(lft, r.y(), *px); if (fp != 0) // pixmap not really exported in SVG fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\"" " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n", svg_color(UmlBlack), lft, r.y(), px->width() - 1, px->height() - 1); r.setTop(r.top() + px->height()); } break; default: // class r.setTop(r.top() + two); if (data->get_stereotype()[0]) { p.setFont(the_canvas()->get_font(UmlNormalFont)); p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop, QString("<<") + toUnicode(data->get_short_stereotype()) + ">>"); if (fp != 0) draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop, QString("<<") + toUnicode(data->get_short_stereotype()) + ">>", p.font(), fp); r.setTop(r.top() + he + two); } } p.setBackgroundMode(::Qt::TransparentMode); p.setFont((data->get_is_abstract()) ? the_canvas()->get_font(UmlNormalItalicFont) : the_canvas()->get_font(UmlNormalFont)); p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop, full_name); if (fp != 0) draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop, full_name, p.font(), fp); p.setFont(the_canvas()->get_font(UmlNormalFont)); if (used_view_mode == asClass) { r.setTop(r.top() + he); p.drawLine(r.topLeft(), r.topRight()); if (fp != 0) fprintf(fp, "\t<line stroke=\"black\" stroke-opacity=\"1\"" " x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n", r.left(), r.top(), r.right(), r.top()); r.setTop(r.top() + (int) (8 * zoom)); p.drawLine(r.topLeft(), r.topRight()); if (fp != 0) fprintf(fp, "\t<line stroke=\"black\" stroke-opacity=\"1\"" " x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n", r.left(), r.top(), r.right(), r.top()); } if (fp != 0) fputs("</g>\n", fp); p.setBackgroundColor(bckgrnd); if (selected()) show_mark(p, rect()); }