void Tile::draw() { SDL_Rect rect; rect.x = x * TILE_SIZE; rect.y = y * TILE_SIZE; rect.w = TILE_SIZE; rect.h = TILE_SIZE; Sprite *sprite = m->sprites->getSprite(this->type); float mod = health / (float)getMaxHealth(); if (mod != 1) { if (isBomb()) { sprite->draw(m->ren, &rect, 255, 255 * mod, 255 * mod); } else { sprite->draw(m->ren, &rect); drawDamage(rect, mod); } } else { sprite->draw(m->ren, &rect); } if (this->type != AIRID && !isBomb()) { drawCorners(m->sprites->CORNER, m->sprites->SIDE, AIRID); if (!isStone()) { drawCorners(m->sprites->CORNER_STONE, m->sprites->SIDE_STONE, STONEID); drawCorners(m->sprites->CORNER_STONE, m->sprites->SIDE_STONE, STONE_GOLDID); } } }
void TileGraphic::draw(){ int tileX = m_tile->getX(); int tileY = m_tile->getY(); int tileLength = UNITS_PER_TILE * PIXELS_PER_UNIT; // Lower left corner float c1X = tileLength * tileX; float c1Y = tileLength * tileY; // Upper right corner float c2X = tileLength * (tileX+1); float c2Y = tileLength * (tileY+1); // Update the color to reflect the number of passes if (m_tile->getPasses() > 0){ GLfloat intensity = (float)(.1*m_tile->getPasses()); GLfloat COLOR[3] = {0, intensity, intensity}; m_color = COLOR; } drawRect(c1X, c1Y, c2X, c2Y, m_color); drawCorners(c1X, c1Y, c2X, c2Y); drawWalls(c1X, c1Y, c2X, c2Y); }
//----------------------------------------------------- show / hide. void ofxQuadWarp::draw() { if(bShow == false) { return; } drawQuadOutline(); drawCorners(); drawHighlightedCorner(); drawSelectedCorner(); }
void Cloth::onDraw(Graphic* g) { // Verlet::onDraw(g); g->cull(false); for(Tri* t: _triangles) { // g->setColor(Vector4(t->normal.x*.3,.55+t->normal.y*.2,.67+t->normal.z*.15,1)); // g->setColor(Vector4(t->normal.x*.4,.65+t->normal.y*.3,.77+t->normal.z*.15,1)); // g->setColor(Vector4(t->normal.x*.2+.5,.5+t->normal.y*.2,.47+t->normal.z*.7,1)); g->setColor(Vector4(t->normal.y*.35+.5,.45+t->normal.x*.3,.37+t->normal.z*.7,1));//nice warm color scheme g->drawTriangle(t->vertices,t->normal); } g->cull(true); if(visualize) drawCorners(g); }
void draw(int w, int h) { float cy; float lh = 16*1.2f; float left = lh*2; // int i = 0; layout(w,h); rend->resize(w,h); rend->clear(); draw_pointers(); draw_timeline(); draw_tachometer(); drawCorners(w,h); cy = h-lh*2; rend->text(left, cy, "NGI Probe"); cy-=lh*2; #if 0 for(; i < num_last_events && cy > lh*2; ++i) { int j = (cur_last_event-i-1 + max_last_events)%max_last_events; const char* str = ngi_event_name(last_events[j].type); rend->text(left, cy, "Event %4d: %s", event_serials[j], str); cy-=lh; } #endif }
void BaseElement::draw() { glPushMatrix(); // Translate to the correct location glTranslatef(x, y, z); glPushMatrix(); // Set the rotation of the element glRotatef(rotation, 0, 0, 1); // Set the color of the element glColor4f(color->color.red,color->color.green,color->color.blue, color->color.alpha); glPointSize(1); // Draw the Element drawElement(); // Draw the bounding box corners if selected if(selected || moveable) { drawCorners(); } glPopMatrix(); glFlush(); glPopMatrix(); //DEBUG - bounds /*if(selected || moveable) { glPushMatrix(); bounds->draw(selectedCorner); glPopMatrix(); }*/ //DEBUG - bounds }
void drawCorners(ImgRGB& img_show, const Mat_f& corners, uchar r, uchar g, uchar b, uchar sym) { Mat_i corners_i; matFloat2Int(corners, corners_i); drawCorners(img_show, corners_i, r, g, b, sym); }