Ejemplo n.º 1
0
void MainGui::draw (gcn::Graphics *graphics){
	if(!visible) return;
	if(!img){
		std::stringstream imgPath(std::string(""));
		imgPath << ConfigData::GetPath("gui") << "GUIV3.png";
		img = gcn::Image::load(imgPath.str());
	}
	graphics->drawImage(img,0,0);
	drawMiniMap(graphics);
	drawChildren(graphics);
}
Ejemplo n.º 2
0
Archivo: cgii.c Proyecto: chamun/CGII
void
draw(void)
{
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    /* 3D */
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_COLOR_MATERIAL);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective( 60, 1, 0.05, WORLD_SIDE * 2 * 2.4142);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    illumination();

    gluLookAt(compass[P].x, PLAYER_HEIGHT, compass[P].y,
              compass[W].x, PLAYER_HEIGHT, compass[W].y,
              0, 1, 0);

    drawEnv();
    drawCoins();
    drawFixeds();

    glDisable(GL_COLOR_MATERIAL);
    glDisable(GL_LIGHT0);
    glDisable(GL_LIGHTING);
    glDisable(GL_DEPTH_TEST);

    /* 2D */

    /* Isso aqui só precisa ser chamado uma vez, e quando a janela muda de
     * tamanho */
    glViewport(0, 0, WINDOW_SIZE, WINDOW_SIZE);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0, WINDOW_SIZE, WINDOW_SIZE, 0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    if(playing) {
        drawScoreBoard(20,20);
        if(map)
            drawMiniMap(3.5f * MAP_SIZE, 3.5f * MAP_SIZE);
    } else
        drawEnd();

    glutSwapBuffers();
}
Ejemplo n.º 3
0
void ABETHUD::DrawHUD()
{
	Super::DrawHUD();

	drawMiniMap();
	// find center of the Canvas
	const FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);

	// offset by half the texture's dimensions so that the center of the texture aligns with the center of the Canvas
	const FVector2D CrosshairDrawPosition( (Center.X - (CrosshairTex->GetSurfaceWidth() * 0.5)),
										   (Center.Y - (CrosshairTex->GetSurfaceHeight() * 0.5f)) );

	// draw the crosshair
	FCanvasTileItem TileItem( CrosshairDrawPosition, CrosshairTex->Resource, FLinearColor::White);
	TileItem.BlendMode = SE_BLEND_Translucent;
	Canvas->DrawItem( TileItem );
}
Ejemplo n.º 4
0
void Model::drawMap() {
	
	app->Clear(sf::Color(100,100,100));
	
	unsigned int height = app->GetHeight();
	unsigned int IMAGE_SIZE = gamerImg.GetWidth();
	
   double h = 50;					//height/2-FIELD_SIZE*IMAGE_SIZE/2;
   double w = 50;					//app->GetWidth()/2-FIELD_SIZE*IMAGE_SIZE/3*2;
	
	pair<int,int> pos = getPlayerPosition();
	int i_now = pos.first/FIELD_SIZE*FIELD_SIZE;
	int j_now = pos.second/FIELD_SIZE*FIELD_SIZE;
	int max_value_i = i_now+FIELD_SIZE;
	int max_value_j = j_now+FIELD_SIZE;
	
	if (max_value_i > MAP_SIZE)
		max_value_i = MAP_SIZE;
	if (max_value_j > MAP_SIZE)
		max_value_j = MAP_SIZE;
	
	app->Draw(sf::Shape::Rectangle(w-2, h-2, w+(max_value_j-j_now)*IMAGE_SIZE+2, h+(max_value_i-i_now)*IMAGE_SIZE+2, sf::Color(200,200,149)));
	
	app->Draw(sf::Shape::Rectangle(w, h, w+(max_value_j-j_now)*IMAGE_SIZE, h+(max_value_i-i_now)*IMAGE_SIZE, sf::Color(50,50,50)));
	
	drawMiniMap();										//Draws mini map in front of the rectangles above
	
	for (int i=i_now;i<max_value_i;++i) {
		for (int j=j_now;j<max_value_j;++j) {
			if (getState(i,j) == GAME_EMPTY_CELL)
				continue;
			if (getState(i,j) == GAME_WALL) {
				boxSpr.SetPosition(w+(j%FIELD_SIZE)*IMAGE_SIZE,h+(i%FIELD_SIZE)*IMAGE_SIZE);
				app->Draw(boxSpr);
			}
			else if (getState(i,j) == GAME_PLAYER) {
			
				double rot = players.begin()->get()->rotation;
				
				gamerSpr.SetCenter(gamerImg.GetWidth()/2,gamerImg.GetHeight()/2);		
				gamerSpr.SetRotation(rot);
				gamerSpr.SetPosition(w+(j%FIELD_SIZE+0.5)*IMAGE_SIZE,h+(i%FIELD_SIZE+0.5)*IMAGE_SIZE);

				app->Draw(gamerSpr);			
			}			
			else if (getState(i,j) == GAME_ENEMY) {
				for(vector<PlayerPtr>::iterator it = players.begin()+1; it!=players.end(); ++it) {
					if (it->get()->getX() == i && it->get()->getY() == j) {
						double rot = it->get()->rotation;
						
						computerSpr.SetCenter(gamerImg.GetWidth()/2,gamerImg.GetHeight()/2);		
						computerSpr.SetRotation(rot);
						computerSpr.SetPosition(w+(j%FIELD_SIZE+0.5)*IMAGE_SIZE,h+(i%FIELD_SIZE+0.5)*IMAGE_SIZE);
				
						break;
					}
				}
				app->Draw(computerSpr);
			}
		}
	}
	app->Display();
}