Ejemplo n.º 1
0
void MonopolyGame::drawTextCen(ALLEGRO_COLOR col, int x, int y, const char *msg, ...) {

	char buffer[256];
	va_list ap;

	va_start( ap, msg );
	vsprintf( buffer, msg, ap );
	va_end( ap );

	// First print the shadow, which is slightly off-centered.
	int offset = 2;
	al_draw_text(
		m_fontCollection[0],
		al_map_rgb( 0, 0, 0 ),
		x + offset,
		y + offset,
		ALLEGRO_ALIGN_CENTRE,
		buffer );

	// Finally we print the foreground text.
	al_draw_text(
		m_fontCollection[0],
		col,
		x,
		y,
		ALLEGRO_ALIGN_CENTRE,
		buffer );
}
Ejemplo n.º 2
0
void score::paint(ALLEGRO_FONT *font)
{
	char temp[10];
	_itoa_s(points, temp, 10);
	al_draw_text(font, al_map_rgb(255, 255, 255), 700, 80, 0, "SCORE: ");
	al_draw_text(font, al_map_rgb(255, 255, 255), 835, 80, 0, temp);
}
Ejemplo n.º 3
0
bool abrirJogo(int x, int y,int *fps,int *tempo,ALLEGRO_FONT *font,ALLEGRO_FONT *font2,ALLEGRO_COLOR font_color){
  char seg[100];
  
  if(x >=40 && x<=200 && y <=460 && y>=360){
              *fps = *fps+1;
              sprintf(seg, "%d", *tempo); 
              al_draw_text(font2, font_color, 120, 200, 0,seg);
              

              if(*fps >= 3){
                *tempo=*tempo-1;
                if(*tempo == 0){
                  
                 return true;
                }
                *fps = 0;
              }
          return false;

              
          }else if(*fps !=0 && *tempo != 5){

            *fps = 0;*tempo = 5;
          }
              al_draw_text(font, font_color, 120, 200, 0,"Escolha um elemento para iniciar!");
        
          return false;
}
Ejemplo n.º 4
0
void Gra::komunikat(){
	int kto=czyja_wygrana();
	obraz.zmientlo();
	if (kto==0)
		return;

	if (kto==3){
		al_draw_bitmap(obraz.tlo,0,0,0);
		al_draw_text(obraz.font_menu_glowne,al_map_rgb(160,0,0),0.5*800,0.25*600,ALLEGRO_ALIGN_CENTRE,"REMIS");
		
		al_draw_bitmap(obraz.Image2,0.35*800,0.5*600,0);
		al_draw_bitmap(obraz.Image,0.65*800,0.5*600,0);
		al_flip_display();
		al_rest(4);
	}

	if (kto==2){
		al_draw_bitmap(obraz.tlo,0,0,0);
		al_draw_text(obraz.font_menu_glowne,al_map_rgb(63,49,255),0.5*800,0.25*600,ALLEGRO_ALIGN_CENTRE,"WYGRANA!");
		
		al_draw_bitmap(obraz.Image2,0.5*800,0.5*600,0);
		al_flip_display();
		al_rest(4);
	}

	if (kto==1){
		al_draw_bitmap(obraz.tlo,0,0,0);
		al_draw_text(obraz.font_menu_glowne,al_map_rgb(181,230,29),0.5*800,0.25*600,ALLEGRO_ALIGN_CENTRE,"WYGRANA!");
		al_draw_bitmap(obraz.Image,0.5*800,0.5*600,0);
		al_flip_display();
		al_rest(4);
	}

}
Ejemplo n.º 5
0
   static void draw(float x, float y)
   {
      float w = 300;
      float line_height = 25;
      float pad = 20;
      float h = Profiler::get_instance()->timer.size()*line_height + pad*2;
      PROFILE_TIMER_TIME_T duration = 0.0;
      int i=0;
      char time[32];

      al_draw_filled_rounded_rectangle(x, y, x+w, y+h, 8, 8, bg_color);

      //if (!font) return;

      std::vector<profile_timer_class *>::iterator it = Profiler::get_instance()->timer.begin();
      for ( ; it != get_instance()->timer.end(); ++it)
      {
         duration = (*it)->stop_time - (*it)->start_time;
         al_draw_filled_rectangle(x, y+pad+line_height*i+15, x+duration*10000, y+pad+line_height*i+20, al_color_name("orange"));
         al_draw_text(font, font_color, x+pad, y+pad+line_height*i, 0, (*it)->name);
         sprintf(time, "%f", duration*100);
         al_draw_text(font, font_color, x+pad+200, y+pad+line_height*i, 0, time);
         i++;
      }
      al_draw_line(x+ALLEGRO_BPS_TO_SECS(60)*10000, y, x+ALLEGRO_BPS_TO_SECS(60)*10000, y+h, limit_bar_color, 1.0);
      al_draw_line(x+ALLEGRO_BPS_TO_SECS(72)*10000, y, x+ALLEGRO_BPS_TO_SECS(72)*10000, y+h, limit_bar_color, 1.0);
   }
Ejemplo n.º 6
0
void ChooseMap<al_b,al_f>::showSection(InputManager<ALLEGRO_EVENT,ALLEGRO_KEYBOARD_STATE> &input,Maps<al_b> &m,Player<al_b> &p,bool st){
	m.showBackground();

	al_draw_text(this->_font30, al_map_rgb(0,0,0), 335, 130, 0, "Escoge un mapa");
	for(int i = 0;i < 3;i++){
		m.loadMap(3,i);
		for(int y = 0; y<m.getHeight();y++){
			for(int x = 0;x<m.getWidth();x++){
		//al_draw_filled_rectangle(80+(250*i)+(12*x), 200+(12*y), 80+(250*i)+((12*x) +12), 200+((12*y )+12), al_map_rgb(255,255,255));

				switch(m.getPositionMap(x,y)){
					case 'p': al_draw_scaled_bitmap(this->_block, 145, 171, 58, 58, 80+(250*i)+(12*x), 200+(12*y), 12, 12, 0);  break;
					case 'j':
					case 'g':
					case 'e': al_draw_filled_rectangle(80+(250*i)+(12*x), 200+(12*y), 80+(250*i)+((12*x) +12), 200+((12*y )+12), al_map_rgb(255,255,255)); break;
					case 'c': al_draw_scaled_bitmap(this->_block, 258, 20, 58, 58, 80+(250*i)+(12*x), 200+(12*y), 12, 12, 0); 	 break;
					case 'd': al_draw_scaled_bitmap(this->_block, 37, 20, 58, 58, 80+(250*i)+(12*x), 200+(12*y), 12, 12, 0); 	 break;
					case 's': al_draw_filled_rectangle(80+(250*i)+(12*x), 200+(12*y), 80+(250*i)+((12*x) +12), 200+((12*y )+12), al_map_rgb(236,236,236)); break;
				}
			}
		}
	}
	m.setLevel(input.getX(0));
	
	al_draw_rectangle(80+(250*input.getX(0)), 200, 320+(250*input.getX(0)), 370, al_map_rgb(140,40,40),5);	
	al_draw_filled_rectangle(360, 385, 540, 430, al_map_rgb(20,20,20));
	al_draw_text(this->_font20, al_map_rgb(255,255,255), 395, 390, 0, "Seleccionar");
}
Ejemplo n.º 7
0
void menu::draw() {
	int elem_num = size;
	if (size > 5)
		elem_num = 5;
	else
		offset = 0;

	al_clear_to_color(COLOR_BLACK);
	al_draw_rectangle(MAP_SIZE / 2 - 60, 120, MAP_SIZE / 2 + 60, 240, al_map_rgb(0, 255, 00), 10);
	al_draw_filled_rectangle(MAP_SIZE / 2, 175, MAP_SIZE / 2 + 108, 185, COLOR_WHITE);
	char buffer[100];
	

	for (int i = 0; i < elem_num; ++i) {
		if (entries[i+offset].type == MENU_OPTION) {
			sprintf_s(buffer, 100, "%s: %.1f", entries[i+offset].name.c_str(), *entries[i+offset].value);
			al_draw_text(menu_font, (i+offset == active) ? al_map_rgb(255, 0, 0) : COLOR_WHITE, MAP_SIZE / 2, MAP_SIZE / 2 + 60 * i, ALLEGRO_ALIGN_CENTER, buffer);
		}
		else if (entries[i + offset].type == MENU_ENUM) {
			sprintf_s(buffer, 100, "%s: %s", entries[i + offset].name.c_str(), entries[i + offset].opt[*(entries[i + offset].set)].c_str());
			al_draw_text(menu_font, (i + offset == active) ? al_map_rgb(255, 0, 0) : COLOR_WHITE, MAP_SIZE / 2, MAP_SIZE / 2 + 60 * i, ALLEGRO_ALIGN_CENTER, buffer);
		}
		else {
			al_draw_text(menu_font, (i + offset == active) ? al_map_rgb(255, 0, 0) : COLOR_WHITE, MAP_SIZE / 2, MAP_SIZE / 2 + 60 * i, ALLEGRO_ALIGN_CENTER, this->entries[i + offset].name.c_str());
		}
	}
	al_flip_display();
}
Ejemplo n.º 8
0
void CDisplay::Draw()
{
	// convert the variables into strings to be drawn to the screen
	char* tempScore = ltoa(score, new char[sizeof(long) * 8 + 1], 10);

	char* tempLines = itoa(lines, new char[sizeof(int) * 8 + 1], 10);
	char* tempLevel = itoa(level, new char[sizeof(int) * 8 + 1], 10);
	
	al_draw_text(font, al_map_rgb(32,32,32), 78, 206, ALLEGRO_ALIGN_LEFT, tempScore);
	al_draw_text(font, al_map_rgb(32,32,32), 78, 224, ALLEGRO_ALIGN_LEFT, tempLines);
	al_draw_text(font, al_map_rgb(32,32,32), 78, 262, ALLEGRO_ALIGN_LEFT, tempLevel);

	// draw the next block
	for(int i = 0; i < 4; i++) {
		for(int j = 0; j < 4; j++) {
			if(nextBlock->GetDef()[i][j] != 0) {
				DrawBlock(nextBlock->GetDef()[i][j], 
						((j + nextBlock->GetX()) * 32) + 30, 
						((i + nextBlock->GetY()) * 32) + 30);
			}
		}
	}

	for(int i = 0; i < numHighScores; i++) {
		al_draw_text(font, al_map_rgb(0, 0, 0), 26, 360 + (24 * i), 0, itoa(i + 1, new char[2], 10));
		al_draw_text(font, al_map_rgb(0, 0, 0), 44, 360 + (24 * i), 0, highScores[i]);
	}
}
Ejemplo n.º 9
0
void Draw::menu(int menu, int selection, int WIDTH, int HEIGHT, int FPS, int Volume, float Pan){
	al_draw_scaled_bitmap(menubg, 0, 0, this->menubgW, this->menubgH, 0, 0, this->WIDTH, this->HEIGHT, NULL);

	string text1 = "";
	string text2 = "";
	string text3 = "";

	switch(menu){
		case(1):{
			text1 = "Play game";
			text2 = "Settings";
			text3 = "Quit";
			break;
		}
		case(2):{
			text1 = "Graphics";
			text2 = "Audio";
			text3 = "Back";
			break;
		}
		case(3):{
			text1 = "Resolution: " + to_string(WIDTH) + "X" + to_string(HEIGHT);
			text2 = "FPS: " + to_string(FPS);
			text3 = "Back";
			break;
		}
		case(4):{
			text1 = "Volume: " + to_string(Volume);
			text2 = "Pan: " + round(Pan);
			text3 = "Back";
			break;
		}
	}

	const char* text1C = text1.c_str();
	const char* text2C = text2.c_str();
	const char* text3C = text3.c_str();

	al_draw_text(font18, al_map_rgb(255, 0, 0), this->WIDTH/2, this->HEIGHT/8*3, ALLEGRO_ALIGN_CENTER, text1C);
	al_draw_text(font18, al_map_rgb(255, 0, 0), this->WIDTH/2, this->HEIGHT/8*4, ALLEGRO_ALIGN_CENTER, text2C);
	al_draw_text(font18, al_map_rgb(255, 0, 0), this->WIDTH/2, this->HEIGHT/8*5, ALLEGRO_ALIGN_CENTER, text3C);

	switch(selection){
		case(1):{
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 + (al_get_text_width(font18,text1C)/2), this->HEIGHT/8*3 -14, 40, 50, NULL);
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 - (al_get_text_width(font18,text1C)/2) - (playerWidth()/2.7), this->HEIGHT/8*3 -14, 40, 50, ALLEGRO_FLIP_HORIZONTAL);
			break;
		}
		case(2):{
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 + (al_get_text_width(font18,text2C)/2), this->HEIGHT/8*4 -14, 40, 50, NULL);
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 - (al_get_text_width(font18,text2C)/2) - (playerWidth()/2.7), this->HEIGHT/8*4 -14, 40, 50, ALLEGRO_FLIP_HORIZONTAL);
			break;
		}
		case(3):{
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 + (al_get_text_width(font18,text3C)/2), this->HEIGHT/8*5 -14, 40, 50, NULL);
			al_draw_scaled_bitmap(msel, 0, 0, this->selectorW, this->selectorH, this->WIDTH/2 - (al_get_text_width(font18,text3C)/2) - (playerWidth()/2.7), this->HEIGHT/8*5 -14, 40, 50, ALLEGRO_FLIP_HORIZONTAL);
			break;
		}
	}
}
Ejemplo n.º 10
0
void record_draw(const record *r) {
  uint32_t i;
  char score_buffer[128];
  // title
  al_draw_text(r->font, r->display_color,
               r->center.x - r->area.w / 2,
               r->center.y,
               ALLEGRO_ALIGN_LEFT, RECORD_NAME_TITLE);

  al_draw_text(r->font, r->display_color,
               r->center.x + r->area.w / 2,
               r->center.y,
               ALLEGRO_ALIGN_RIGHT, RECORD_SCORE_TITLE);

  const uint32_t max = r->entry_count > RECORD_MAX_DISPLAY_COUNT ?
        RECORD_MAX_DISPLAY_COUNT : r->entry_count;
  for (i = 0 ; i < max ; i ++) {
    memset(score_buffer, '\0', 128);
    snprintf(score_buffer, 128, "%d", r->entries[i].score);

    al_draw_text(r->font, r->display_color,
                r->center.x - r->area.w / 2,
                r->center.y + (i + 1) * RECORD_ENTRY_PADDING,
                ALLEGRO_ALIGN_LEFT, r->entries[i].name);

    al_draw_text(r->font, r->display_color,
                r->center.x + r->area.w / 2,
                r->center.y + (i + 1) * RECORD_ENTRY_PADDING,
                ALLEGRO_ALIGN_RIGHT, score_buffer);
  }
}
Ejemplo n.º 11
0
void csd_render_message_queue(CSD_MESSAGE_QUEUE * qp, ALLEGRO_FONT * fp, float x, float y, int smooth)
{
	int w;
	
	if(qp->messages > 0)
	{
		switch(qp->message[0].type)
		{
			case CSD_MESSAGE_SCROLL:
			{
				if(smooth)
				{
					al_draw_text(fp, t3f_color_white, x + (float)qp->message[0].pos, y, 0, qp->message[0].text);
				}
				else
				{
					w = al_get_text_width(fp, "A");
					al_draw_text(fp, t3f_color_white, x + (float)(qp->message[0].pos / w) * w, y, 0, qp->message[0].text);
				}
				break;
			}
			case CSD_MESSAGE_FLASH:
			{
				if(qp->message[0].pos % 60 < 30)
				{
					al_draw_text(fp, t3f_color_white, x, y, 0, qp->message[0].text);
				}
				break;
			}
		}
	}
}
Ejemplo n.º 12
0
void IntroDoctor::Render()
{
	al_clear_to_color( al_map_rgb( 0, 0, 0 ) );

	int qrtWidth = (FRAMEWORK->Display_GetWidth() / 2);
	int imgHeight = (graphic->GetFrame( 0 )->Height + textHeight);
	int yOffset = (FRAMEWORK->Display_GetHeight() - imgHeight) / 2;

	graphic->DrawSprite( 0, qrtWidth - (graphic->GetFrame( 0 )->Width / 2), yOffset, 1.0f, 1.0f, 0 );

	int curSec = viewTime / FRAMES_PER_SECOND;
	switch( curSec )
	{
		case 1:
		case 2:
			al_draw_text( textFont, al_map_rgb( 255, 0, 0 ), FRAMEWORK->Display_GetWidth() / 2, FRAMEWORK->Display_GetHeight() - yOffset - textHeight, ALLEGRO_ALIGN_CENTRE, "Finally..." );
			break;
		case 3:
		case 4:
			al_draw_text( textFont, al_map_rgb( 255, 0, 0 ), FRAMEWORK->Display_GetWidth() / 2, FRAMEWORK->Display_GetHeight() - yOffset - textHeight, ALLEGRO_ALIGN_CENTRE, "After all this time" );
			break;
		case 5:
		case 6:
			al_draw_text( textFont, al_map_rgb( 255, 0, 0 ), FRAMEWORK->Display_GetWidth() / 2, FRAMEWORK->Display_GetHeight() - yOffset - textHeight, ALLEGRO_ALIGN_CENTRE, "I have created..." );
			break;
	}

}
void GameClass::DrawPauseMenu () const {
  ALLEGRO_COLOR fontColor = cBlack;

  al_draw_filled_rectangle(0, 0, cWindowWidth, cWindowHeight, cWhite);
  al_draw_text(hugeFont, fontColor, cWindowWidth/2, 40, ALLEGRO_ALIGN_CENTRE,
      cPause[language].c_str());

  std::stringstream aux[8];
  for (int i = 0; i < 4; i++)
    aux[i] << cPauseInformation[language][i];
  aux[4] << hero->GetLives();
  aux[5] << hero->GetJumpUpgrades();
  aux[6] << hero->GetSpeedUpgrades();
  aux[7] << hero->GetLifeUpgrades();


  float xdif = 500, ydif = 50;
  float x = cWindowWidth/2 + 10, y = 250 + 100*pauseOption,
        xf = cWindowWidth/2 + xdif, yf = y + ydif;

  al_draw_rectangle(25, 225, 600, 475, cBlack, 0);

  for (int i = 0; i < 4; i++)
    al_draw_text(bigFont, fontColor, 50, 250 + 50*i,
        ALLEGRO_ALIGN_LEFT, aux[i].str().c_str());
  for (int i = 0; i < 4; i++)
    al_draw_text(bigFont, fontColor, 550, 250 + 50*i,
        ALLEGRO_ALIGN_LEFT, aux[i+4].str().c_str());

  for (int i = 0; i < 3; i++)
    al_draw_text(bigFont, fontColor, cWindowWidth/2 + 50, 250 + 100*i,
        ALLEGRO_ALIGN_LEFT, cPauseMenuOptionsText[language][i].c_str());

  al_draw_rectangle(x, y, xf, yf, cBlack,0);
}
Ejemplo n.º 14
0
char * input(void)
{
    int count=0;
    int i=0;
    char name[15]="";
    al_set_target_bitmap(background);
    al_clear_to_color(al_map_rgb(0,0,0));
    al_draw_text(font,al_map_rgb(100,100,100), 640/2+2, 480/4+2,ALLEGRO_ALIGN_CENTRE, "You Got Highscore Enter your name:");
    al_draw_text(font,al_map_rgb(255,255,255), 640/2, 480/4,ALLEGRO_ALIGN_CENTRE, "You Got Highscore Enter your name:");

    al_register_event_source(event_queue, al_get_keyboard_event_source());
    al_set_target_bitmap(al_get_backbuffer(display));

    while(1)
    {
        ALLEGRO_EVENT ev;
        al_wait_for_event(event_queue,&ev);
        al_clear_to_color(al_map_rgb(0,0,0));
        al_draw_bitmap(background,0,0,0);
        al_draw_text(font,al_map_rgb(255,255,255), 640/2, 480,ALLEGRO_ALIGN_CENTRE, name);;
        al_flip_display();

        if(ev.type==ALLEGRO_EVENT_KEY_DOWN)
        {

            if(ev.keyboard.keycode==ALLEGRO_KEY_ENTER)
            {
                al_play_sample(enter, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL);
                break;
            }

            if(ev.keyboard.keycode==ALLEGRO_KEY_BACKSPACE && i>0)
            {
                al_play_sample(_type, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL);
                i--;
                name[i]=' ';
                name[i+1]='\0';
            }

            if(ev.keyboard.keycode>=ALLEGRO_KEY_A && ev.keyboard.keycode<=ALLEGRO_KEY_Z)
            {
                al_play_sample(_type, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL);
                for(count=0; count<26; count++)
                {
                    if(ev.keyboard.keycode==ALLEGRO_KEY_A+count)
                    {
                        name[i]='A'+count;
                        name[i+1]='\0';
                        i++;
                    }
                }
            }
        }// End of key detection
    } // End of while loop

    level_running=false;
    game_running=false;

    return(name);
}
Ejemplo n.º 15
0
void draw_config(game *g) {
    ALLEGRO_TRANSFORM trans;
    al_identity_transform(&trans);
    al_use_transform(&trans);
    
    int x, y;
    x = (g->Size->x - 150) / 2;
    y = 0;
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, "CONFIGURATION");
    
    if(get_config("display_width") == NULL) return;
    
    x = 100;
    y = 100;
    char msg[22];
    sprintf(msg, "DISPLAY WIDTH: %d", atoi(get_config("display_width")));
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, msg);
    
    x = 100;
    y = 125;
    sprintf(msg, "DISPLAY HEIGHT: %d", atoi(get_config("display_height")));
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, msg);
    
    al_draw_circle(80, 110 + config_pos * 25, 3.0, SHOOT_COLOR, 1.5);    
}
Ejemplo n.º 16
0
void RenderTarget::drawText(const ALLEGRO_FONT *font, const ISString &text, float x, float y, const ALLEGRO_COLOR &color, int flags) {
	setAsCurrent();
	convertCoords(x, y);
	if ((flags & Center) == Center) {
		al_draw_text(font, color, x, y - al_get_font_ascent(font) * 0.5f, ALLEGRO_ALIGN_CENTRE, text.getUtf8Encoded().c_str());
		return;
	}
	if ((flags & VCenter) == VCenter) {
		y -= al_get_font_ascent(font) * 0.5f;
	}
	else if ((flags & Bottom) == Bottom) {
		y -= al_get_font_ascent(font);
	}
	if ((flags & HCenter) == HCenter) {
		al_draw_text(
			font,
			color,
			x,
			y,
			ALLEGRO_ALIGN_CENTRE,
			text.getUtf8Encoded().c_str()
		);
		return;
	}
	if ((flags & Right) == Right) {
		al_draw_text(font, color, x, y, ALLEGRO_ALIGN_RIGHT, text.getUtf8Encoded().c_str());
		return;
	}
	al_draw_text(font, color, x, y, 0, text.getUtf8Encoded().c_str());
}
Ejemplo n.º 17
0
void LoadGame(Heroi *Heroi)
{
	FILE *Load;
	Load = fopen("SaveLoadGame/SaveLoadGame.bin", "r");

	al_clear_to_color(al_map_rgb(0, 0, 0));
	if (!Load)
	{
		al_draw_text(Fonte, al_map_rgb(255, 255, 255), (LARGURA_TELA / 2 - al_get_font_ascent(Fonte)), (ALTURA_TELA / 2 - al_get_font_ascent(Fonte)), ALLEGRO_ALIGN_CENTRE, "Nenhum Save Game Encontrado...");
		al_flip_display();
		al_rest(3.0);
	}
	else
	{
		al_draw_text(Fonte, al_map_rgb(255, 255, 255), (LARGURA_TELA / 2 - al_get_font_ascent(Fonte)), (ALTURA_TELA / 2 - al_get_font_ascent(Fonte)), ALLEGRO_ALIGN_CENTRE, "Carregando Jogo...");
		al_flip_display();
		al_rest(3.0);
	}

	fscanf(Load, "%d", &IDMapa);
	fscanf(Load, "%d", &Heroi->x);
	fscanf(Load, "%d", &Heroi->y);
	fscanf(Load, "%d", &Heroi->LinhaAnimacao);
	fscanf(Load, "%d", &Heroi->ColunaAnimacao);
	fscanf(Load, "%d", &Heroi->Life);
	fscanf(Load, "%d", &Heroi->MaxLife);
	fscanf(Load, "%d", &Heroi->Mana);
	fscanf(Load, "%d", &Heroi->MaxMana);
	fscanf(Load, "%d", &Heroi->QtdVida);
	fscanf(Load, "%d", &Heroi->QtdMana);

	fclose(Load);
}
Ejemplo n.º 18
0
void LoseScreen::render()
{
	m_game->m_camera2.bind();
	al_clear_to_color(al_map_rgb(0,0,0));
	al_draw_text(m_game->m_font, al_map_rgb(255, 255, 255), 10, 10, 0, "YOU LOST");
	al_draw_text(m_game->m_font, al_map_rgb(255, 255, 255), 10, 20, 0, (std::string("Floor ") + std::to_string(m_game->m_floor)).c_str());
	al_draw_text(m_game->m_font, al_map_rgb(255, 255, 255), 10, 30, 0, (std::string("Level ") + std::to_string(m_game->m_player->m_level)).c_str());
}
Ejemplo n.º 19
0
void DescriptionBox::Draw(std::string title, std::string description){
	ALLEGRO_COLOR color = al_color_name("white");
	if (title == "Game Over") {
		color = al_color_name("red");
	}
    al_draw_rounded_rectangle(10, ScreenHeight - 190, ScreenWidth - 10, ScreenHeight - 10, 7, 7, al_color_name("white"), 5);
    //std::cout << title << " " << description << std::endl;
    al_draw_text(font, color, 20, ScreenHeight - 190, ALLEGRO_ALIGN_LEFT, title.c_str());
    al_draw_text(font, al_color_name("white"), 20, ScreenHeight - 160, ALLEGRO_ALIGN_LEFT, description.c_str());
}
void GameClass::DrawCredits () const {
  ALLEGRO_COLOR fontColor = cWhite;

  al_draw_text(bigFont, fontColor, cWindowWidth/2, 10, ALLEGRO_ALIGN_CENTRE,
      cCredits[language].c_str());

  for (size_t i = 0; i < cCreditsLines; i++)
    al_draw_text(normalFont, fontColor, 100, 50 + i*47, ALLEGRO_ALIGN_LEFT,
        cCreditsText[language][i].c_str());
}
Ejemplo n.º 21
0
void GameLobby::draw()
{
	al_draw_text(font36, al_map_rgb(100,0,100), 25,25,0, "Press Space to start the Game");
	al_draw_text(font36, al_map_rgb(100,0,100), 25,60,0, "This is the GAME LOBBY.");
	//draw player names
	std::vector<Player*> players = map->getPlayers();
	al_draw_textf(font36, al_map_rgb(255,255,255), 1920/2, 1080/2-35, ALLEGRO_ALIGN_CENTRE, "%i Player(s)", players.size());
	for(unsigned int i=0; i<players.size(); i++)
		al_draw_text(font36, al_map_rgb(255,255,255), 1920/2, 1080/2 + (35*i), ALLEGRO_ALIGN_CENTRE, (char*)(players.at(i)->getName().c_str()));
}
Ejemplo n.º 22
0
	void primary_timer_func() override
	{
		//al_clear_to_color(color::orange);
		std::string output_message = "Last Message: ";
		output_message += last_message.c_str();
		al_draw_text(af::fonts["DroidSans.ttf 30"], color::white, 200, 300, ALLEGRO_FLAGS_EMPTY, last_message.c_str());
		
		al_draw_text(af::fonts["DroidSans.ttf 30"], color::darkblue, 500, 100, ALLEGRO_ALIGN_CENTER, "Press SPACEBAR to toggle connect/disconnect from server.");
		al_draw_text(af::fonts["DroidSans.ttf 30"], color::darkblue, 500, 150, ALLEGRO_ALIGN_CENTER, (nwk->is_connected()) ? "status: CONNECTED" : "status: not connected");
	}
Ejemplo n.º 23
0
void StartMenu::draw(){
	al_draw_bitmap(background, 0, 0, 0);
	al_draw_rectangle(mouseX-5, mouseY-5, mouseX+5, mouseY+5, al_map_rgb(255,0,0), 5);	//testing purposes
	al_draw_text(font36, al_map_rgb(100,0,100), 25,25,0, "Press Space to make game Lobby");
	al_draw_textf(font36, al_map_rgb(100,0,100), 25,60,0, "This is the START MENU.");
	
	int tempY = windowHeight/2 - (fontHeight * 2);
	if(selected == START_GAME_HOST)
		al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Host game");
	else 
		al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Host game");
	tempY += fontHeight;
	
	if(selected == START_GAME_CLIENT)
		al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Connect to game");
	else 
		al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Connect to game");
	tempY += fontHeight;
	
	if(selected == HELP)
		al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Help");
	else 
		al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Help");
	tempY += fontHeight;
	
	if(selected == EXIT)
		al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Exit");
	else 
		al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Exit");
}
Ejemplo n.º 24
0
void About(struct Game *game, struct MenuResources* data) {
	ALLEGRO_TRANSFORM trans;
	al_identity_transform(&trans);
	al_use_transform(&trans);

	if (!game->_priv.font_bsod) {
		game->_priv.font_bsod = al_create_builtin_font();
	}

	al_set_target_backbuffer(game->display);
	al_clear_to_color(al_map_rgb(0,0,170));

	char *header = "TICKLE MONSTER";

	al_draw_filled_rectangle(al_get_display_width(game->display)/2 - al_get_text_width(game->_priv.font_bsod, header)/2 - 4, (int)(al_get_display_height(game->display) * 0.32), 4 + al_get_display_width(game->display)/2 + al_get_text_width(game->_priv.font_bsod, header)/2, (int)(al_get_display_height(game->display) * 0.32) + al_get_font_line_height(game->_priv.font_bsod), al_map_rgb(170,170,170));

	al_draw_text(game->_priv.font_bsod, al_map_rgb(0, 0, 170), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32), ALLEGRO_ALIGN_CENTRE, header);

	char *header2 = "A fatal exception 0xD3RP has occured at 0028:M00F11NZ in GST SD(01) +";

	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32+2*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, header2);
	al_draw_textf(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(al_get_display_height(game->display) * 0.32+3*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "%p and system just doesn't know what went wrong.", (void*)game);

	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32+5*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, 	"About screen not implemented!");
	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32+6*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, 	"See http://dosowisko.net/ticklemonster/");
	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32+7*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, 	"Made for Ludum Dare 33 by Sebastian Krzyszkowiak");

	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(al_get_display_height(game->display) * 0.32+9*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to terminate this error.");
	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(al_get_display_height(game->display) * 0.32+10*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Press any key to destroy all muffins in the world.");
	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2 - al_get_text_width(game->_priv.font_bsod, header2)/2, (int)(al_get_display_height(game->display) * 0.32+11*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_LEFT, "* Just kidding, please press any key anyway.");

	al_draw_text(game->_priv.font_bsod, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, (int)(al_get_display_height(game->display) * 0.32+13*al_get_font_line_height(game->_priv.font_bsod)*1.25), ALLEGRO_ALIGN_CENTRE, "Press any key to continue _");

	al_use_transform(&game->projection);
}
void GameClass::DrawGameEnd () const {
  ALLEGRO_COLOR fontColor = cWhite;

  for (size_t i = 0; i < cGameEndLines; i++)
    al_draw_text(normalFont, fontColor, cWindowWidth/2, 70 + i*45,
        ALLEGRO_ALIGN_CENTRE, cGameEndText[language][i].c_str());
  al_draw_text(bigFont, fontColor, cWindowWidth/2, 500,
      ALLEGRO_ALIGN_CENTRE, cThanks[language].c_str());
  al_draw_text(normalFont, fontColor, cWindowWidth - 20, cWindowHeight - 30,
      ALLEGRO_ALIGN_RIGHT, cPressAnyKey[language].c_str());
}
Ejemplo n.º 26
0
void Textbox::draw()
{
    al_draw_filled_rectangle(AREA, al_map_rgba(255,255,255,1));

    [=]{ // Lambda rysująca text
        int length = (text == "" ? default_text : text).size();
        float x = area.x() + font_size;
        const float y = area.y() + font_size;
        for (int i = 0; i < text.size(); ++i) {
            if (x + al_get_text_width(font(font_size), (text == "" ? default_text : text).substr(0, i+1).c_str()) >= area.x2()) {
                length = i;
                break;
            }
        }
        string text_to_draw = (text == "" ? default_text : text).substr(0, length);
        if (text == "") {
            al_draw_text(font(font_size), Color(200,200,200), x, y, ALLEGRO_ALIGN_LEFT, text_to_draw.c_str());
            return;
        }
        pair<int,int> s;
        s.first = range(selection.first, 0, length);
        s.second = range(selection.second, 0, length);
        string t = text_to_draw.substr(0, s.first);
        al_draw_text(font(font_size), Color::black(), x, y, ALLEGRO_ALIGN_LEFT, t.c_str());
        x += al_get_text_width(font(font_size), t.c_str());
        t = text_to_draw.substr(s.first, s.second - s.first);
        al_draw_filled_rectangle(x, y, x+al_get_text_width(font(font_size), t.c_str()), y+font_size, color);
        al_draw_text(font(font_size), color.ifDark() ? Color::white() : Color::black(), x, y, ALLEGRO_ALIGN_LEFT, t.c_str());
        x += al_get_text_width(font(font_size), t.c_str());
        t = text_to_draw.substr(s.second);
        al_draw_text(font(font_size), Color::black(), x, y, ALLEGRO_ALIGN_LEFT, t.c_str());
    }();

    //al_draw_rectangle(area.x1()+font_size/2, area.y1()+font_size/2, area.x2()-font_size/2, area.y2()-font_size/2, Color::white(), font_size);
    al_draw_filled_rectangle(area.x2()-font_size, area.y1(), area.x2(), area.y2(), Color::white());

    al_draw_rectangle(AREA, Color::black(), 1);

    if (cs.getInvaded() || cs.getIsPressed() || active) {

        int x = 7;
        for (float i = 0; i < x; ++i) {
            al_draw_rectangle(area.x1()+i, area.y1()+i, area.x2()-i, area.y2()-i, Color(0, 0, 0, 255-255*((i*2)/x)), 1);
        }

        if (active) {

            al_draw_rectangle(AREA, color, 3);
            if (show_cursor) {
                al_draw_line(cursor_x(), area.y() + font_size, cursor_x(), area.y() + font_size*2, Color::black(), font_size/10);
            }
        }
    }
}
Ejemplo n.º 27
0
void available_levels(al_defs *al) {

  bool quit=false;
  level_list *list = get_level_list();
  level_list_mem *p = list->first;
  level* l = NULL;

  while(!quit) {
    al_clear_to_color(al_map_rgb(0,0,0));
    al_draw_text(al->logo_font,al_map_rgb(255,255,255),al->width/2,
        20,ALLEGRO_ALIGN_CENTRE,"sokoban");
    al_draw_text(al->menu_font,al_map_rgb(255,255,255), al->width/2, 
        160, ALLEGRO_ALIGN_CENTRE,"Select your level:");

    al_draw_textf(al->menu_font, al_map_rgb(255,0,0), al->width/2, 
        al->height/2, ALLEGRO_ALIGN_CENTRE, "%s", p->name);

    al_draw_text(al->hint_font, al_map_rgb(120, 120, 120), 10,
        al->height-30, ALLEGRO_ALIGN_LEFT, 
        "Use arrows to navigate, ENTER to choose, Esc to return to the main screen");
    al_flip_display();

    ALLEGRO_EVENT ev;
    al_wait_for_event(al->queue, &ev);
    if(ev.type == ALLEGRO_EVENT_KEY_DOWN) {
      //printf("EVENT KEYCODE: %d\n",ev.keyboard.keycode);
      switch(ev.keyboard.keycode) {
        case ALLEGRO_KEY_ESCAPE:
          quit=true;
          break;

        case ALLEGRO_KEY_ENTER: 
          do {
            if(l!=NULL) free_level(l);
            l = read_level(p->name);
            if(l==NULL) break;
          }while(play_level(al, l, p->name));
          free_level(l);
          l=NULL;
          break;

        case ALLEGRO_KEY_LEFT:
          p=p->prev;
          break;

        case ALLEGRO_KEY_RIGHT:
          p=p->next;
          break;
      }
    }
  }
}
Ejemplo n.º 28
0
			void entityErrorBox::render(float oX,float oY) {
				al_draw_tinted_bitmap(errorBG,al_map_rgba_f(1*alpha,1*alpha,1*alpha,alpha),x-204,y,0);
				al_draw_text(errorFont,al_map_rgba(101*alpha,5*alpha,5*alpha,alpha*255),x-204+9,y+2,0,"Error!");
				al_draw_text(errorFont,al_map_rgba(101*alpha,5*alpha,5*alpha,alpha*255),x,y+24,ALLEGRO_ALIGN_CENTRE,errorText.c_str());
				ALLEGRO_MOUSE_STATE mS;
				al_get_mouse_state(&mS);
					if (gameEngine::globalFunctions::pointInRegion(mS.x,mS.y,x-204+384,y+8,x-204+384+16,y+8+16)) { //Hovering over the x button
						al_draw_text(errorFont,al_map_rgba(101*alpha,5*alpha,5*alpha,alpha*255),x-204+384,y+2,0,"X");
					}else { //Not hovering
						al_draw_text(errorFont,al_map_rgba(108*alpha,10*alpha,10*alpha,alpha*255),x-204+384,y+2,0,"X");
					}
				
			}
Ejemplo n.º 29
0
void MenuScreen::render()
{

	m_game->m_camera2.bind();

	al_clear_to_color(al_map_rgb(63,63,116));
	al_set_target_bitmap(al_get_backbuffer(m_game->display()));

	al_draw_text(m_game->m_fontBig, al_map_rgb(203, 219, 252), 15, 11, 0, "Pheee");
	al_draw_text(m_game->m_fontBig, al_map_rgb(203, 219, 252), 15, 31, 0, "Strew");
	al_draw_text(m_game->m_fontBig, al_map_rgb(203, 219, 252), 15, 51, 0, "Quest");

}
Ejemplo n.º 30
0
void RoomDesignerPanel::RenderOverlay()
{
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 16, ALLEGRO_ALIGN_LEFT, "INS: New" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 25, ALLEGRO_ALIGN_LEFT, "DEL: Delete" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 34, ALLEGRO_ALIGN_LEFT, "C: Copy" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 43, ALLEGRO_ALIGN_LEFT, "[: Prev" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 52, ALLEGRO_ALIGN_LEFT, "]: Next" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 61, ALLEGRO_ALIGN_LEFT, "H/V: Flip" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 70, ALLEGRO_ALIGN_LEFT, "A/Z: BkgY" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 79, ALLEGRO_ALIGN_LEFT, "S: Sort" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 88, ALLEGRO_ALIGN_LEFT, "G: Graphic" );
	al_draw_text( textfont, Palette::ColourPalette[8], 140, 97, ALLEGRO_ALIGN_LEFT, "P: Palette" );
}