예제 #1
0
파일: tile.cpp 프로젝트: elgis/cpp-game
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);
		}
	}
}
예제 #2
0
파일: TileGraphic.cpp 프로젝트: Joe4/mms
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);
}
예제 #3
0
//----------------------------------------------------- show / hide.
void ofxQuadWarp::draw() {
    if(bShow == false) {
        return;
    }
    
    drawQuadOutline();
    drawCorners();
    drawHighlightedCorner();
    drawSelectedCorner();
}
예제 #4
0
파일: cloth.cpp 프로젝트: vhwu/physic-tests
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);
}
예제 #5
0
파일: main.c 프로젝트: scoopr/ngi
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

    
}
예제 #6
0
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
}
예제 #7
0
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);
}