예제 #1
0
inline const std::vector<std::string>& FileManager::LoadSaveFile()
{
	std::vector<std::string>::iterator iter;
	saveVector.clear();

	std::ifstream saveFile;
	saveFile.open("save/save.sav");
	//Check if it opened
	if(!saveFile.is_open())
	{
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(), "Error!", "FileManager", "Could not open save file", "ok sok", ALLEGRO_MESSAGEBOX_ERROR);
		return saveVector;
	}
	//Declare variables to read the file
	std::string temp;
	while(getline(saveFile,temp))
	{
		saveVector.push_back(temp);
	}
	saveFile.close();

	
	if(saveFile.is_open())
	{
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(),
			"Error!", "FileManager", "Couldn't close saveFile", "Ok",ALLEGRO_MESSAGEBOX_ERROR);
	}

	return saveVector;
}
예제 #2
0
int main3()
{
	if(!al_init())
	{
		al_show_native_message_box(NULL, NULL, "Error", "Could not initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR); 
		return -1;
	}
	
	al_set_new_display_flags(ALLEGRO_FULLSCREEN);
	// al_set_new_display_flags(ALLEGRO_WINDOWED);
	// al_set_new_display_flags(ALLEGRO_RESIZABLE);
	// al_set_new_display_flags(ALLEGRO_WINDOWED | ALLEGRO_RESIZABLE);
	
	ALLEGRO_DISPLAY *display = al_create_display(800, 600); 

	if(!display)
	{
		al_show_native_message_box(NULL, NULL, "Error", "Could not create Allegro 5 display", NULL, ALLEGRO_MESSAGEBOX_ERROR);
		return -1;
	}

	al_set_window_position(display, 200, 100);
	al_set_window_title(display, "CodingMadeEasy");

	// You generally want to do this after you check to see if the display was created. If the display wasn't created then there's
	// no point in calling this function

	al_rest(10.0);
	al_destroy_display(display);

	return 0;
}
예제 #3
0
void BaseGame::initScreen(ScreenType screenType, string screenTitle)
{
	if(!al_init())
	{
		al_show_native_message_box(NULL, "Error", "Error", "Could not initialize Allegro 5", NULL, 0);
		exit(-1);
	}

	int displayFlags = 0;
	switch(screenType)
	{
	case WINDOW: displayFlags = ALLEGRO_WINDOWED; break;
	case FULLSCREEN: displayFlags = ALLEGRO_FULLSCREEN; break;
	case FULLSCREEN_WINDOWED: displayFlags = ALLEGRO_FULLSCREEN | ALLEGRO_FULLSCREEN_WINDOW; break;
	default: displayFlags = ALLEGRO_WINDOWED;
	}
	al_set_new_display_flags(displayFlags);
	display = al_create_display(windowSize.x, windowSize.y);
	al_set_window_position(display, 0, 0);
	al_set_window_title(display, screenTitle.c_str());

	if(!display)
	{
		al_show_native_message_box(display, "Error", "Error", "Could not create Allegro Window", NULL, 0);
		exit(-1);
	}
}
예제 #4
0
int main()
{
    //This is the display on which you draw everyting
    ALLEGRO_DISPLAY *display;

    //If Allegro fails to initialize show a message box
    if(!al_init())
    al_show_native_message_box(NULL, NULL, NULL, "Could not initialize Allegro 5", NULL, NULL);

    //Define the display
    display = al_create_display(800, 600);

    //If Allegro fails to create a display show a message box
    if(!display)
    al_show_native_message_box(NULL, NULL, NULL, "Could not create Allegro 5 display", NULL, NULL);

    //Show the application window for 5 seconds
    //(if you don't, the application will shut down immediately after you launch it)
    al_rest(5.0f);

    //Deallocate the memory used for the display creation
    al_destroy_display(display);

    return 0;
}
예제 #5
0
int allegro_initialization(int widht, int height)
{
	if(!al_init()) 
	{
		al_show_native_message_box(display, "Error", "Error", "Failed to initialize allegro!", 
                                 NULL, ALLEGRO_MESSAGEBOX_ERROR);
		return -1;
	}
	//else
	//	printf("Allegro initialized\n");

	al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_REQUIRE);
	al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST);

	display = al_create_display(widht, height);
	if(!display) 
	{
		al_show_native_message_box(display, "Error", "Error", "failed to create display!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
		return -1;
	}
	//else
	//	printf("Display created\n");

	event_queue = al_create_event_queue();
	if(!event_queue) 
	{
		al_show_native_message_box(display, "Error", "Error", "failed to create event_queue!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
		al_destroy_display(display);
		return -1;
	}
	//else
	//	printf("Event queue created\n");
	al_flush_event_queue(event_queue);

	al_init_font_addon();
	al_init_ttf_addon();
	font = al_load_ttf_font("C:\\Windows\\Fonts\\cour.ttf", TEXT_SIZE, 0);
	font_scale = al_load_ttf_font("C:\\Windows\\Fonts\\cour.ttf", TEXT_SIZE, 0);
	if(!font || !font_scale)
	{
		al_destroy_event_queue(event_queue);
		al_show_native_message_box(display, "Error", "Error", "Failed to initialize font!", NULL, ALLEGRO_MESSAGEBOX_ERROR);
		al_destroy_display(display);
		return -1;
	}
	//else
	//	printf("Fonts installed\n");

	al_install_keyboard();
	al_register_event_source(event_queue, al_get_display_event_source(display));
	al_register_event_source(event_queue, al_get_keyboard_event_source());
	ALLEGRO_EVENT ev;
 
	al_init_primitives_addon();
	al_clear_to_color(al_map_rgb(0,0,20));
	//al_flip_display();
	return 0;
}
예제 #6
0
//Private
void FileManager::LoadSettings()
{
	std::fstream settingsFile;
	settingsFile.open("settings");

	if(!settingsFile.is_open())
	{
		CreateDefaultSettingsFile();
		settingsFile.open("settings");
		if(!settingsFile.is_open())
		{
			al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(), "Error",	"FileManager", 
				"Couldn't load or create settings file", NULL, ALLEGRO_MESSAGEBOX_ERROR);
			return;
		}
	}

	std::string settings = "";
	std::string temp="";
	unsigned settingPos=0;

	std::getline(settingsFile,settings);
	settingsFile.close();

	for(unsigned i=0; i<settings.size(); i++)
	{
		if(settings[i]!=';' && settings[i]!=',')
		{
			temp+=settings[i];
		}
		else if(settings[i] == ';')
		{
			break;
		}
		else
		{
			if(settingPos==0)
				SoundManager::GetInstance().SetMusicEnabled(atoi(temp.c_str()));
			else if(settingPos==1)
				SoundManager::GetInstance().SetMusicVolume(atof(temp.c_str()));
			else if(settingPos==2)
				SoundManager::GetInstance().SetSoundEnabled(atoi(temp.c_str()));
			else if(settingPos==3)
				SoundManager::GetInstance().SetSoundVolume(atof(temp.c_str()));
			else if(settingPos==4)
				DisplayManager::GetInstance().SetState(atoi(temp.c_str()));
			else if(settingPos==5)
				SetDropFrames(atoi(temp.c_str()));
			else
				al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(), "Error!", 
				"FileManager", "To many settings in file", NULL, ALLEGRO_MESSAGEBOX_ERROR);

			temp="";
			settingPos++;
		}
	}
}
예제 #7
0
bool GameManager::initialize()
{
	if (!al_init())
	{
		al_show_native_message_box(0,0,"ERROR!!","failed to initalize allegro!!",0,0);
		return false;
	}

	//Creating a display
	display = al_create_display(WIDTH,HEIGHT);
	
	if (!display)
	{
		al_show_native_message_box(0, 0, "ERROR!!", "failed to create display!!", 0, 0);
		return false;
	}

	al_set_window_position(display,0,0);

	//Initializing all the addons
	al_install_keyboard();
	al_init_image_addon();
	al_init_primitives_addon();
	al_init_font_addon();
	al_init_ttf_addon();
	
	//Loading different size fonts for our game 
	font[LARGE] = al_load_font("Resources/font.ttf", 60, 0);
	assert(font[LARGE] != 0);  //only one assert is needed 

	font[MEDIUM] = al_load_font("Resources/font.ttf", 48, 0);
	 
	font[SMALL] = al_load_font("Resources/font.ttf", 12, 0);
	
	//Creating event queue
	event_queue = al_create_event_queue();
	
	//Setting timer to 60 frames per second
	timer = al_create_timer(1.0/(float)FPS);
	
	al_register_event_source(event_queue,al_get_keyboard_event_source());
	al_register_event_source(event_queue,al_get_timer_event_source(timer));

	gameDone = false;
	actSwitched = false;

	//Setting current activity to start menu
	currentAct = ACT_STARTMENU;
	
	for (int i = 0; i < 6; i++)
		keys[i] = false;
	
	draw = false;
	
	return true;
}
예제 #8
0
파일: main.c 프로젝트: wjwwood/agame
int main(void) {
  if(!al_init()) {
    al_show_native_message_box(NULL, NULL, NULL,
                               "failed to initialize allegro!", NULL, 0);
    return -1;
  }

  display = al_create_display(640, 640);

  if(!display) {
    al_show_native_message_box(NULL, NULL, NULL,
                               "failed to initialize display!", NULL, 0);
    return -1;
  }

  al_init_font_addon();
  al_init_ttf_addon();
  al_init_primitives_addon();

  ALLEGRO_FONT * font24 = safe_load_font("bin/arial.ttf", 24, 0);
  if (!font24) {return -1;}
  ALLEGRO_FONT * font36 = safe_load_font("bin/arial.ttf", 36, 0);
  if (!font36) {return -1;}
  ALLEGRO_FONT * font18 = safe_load_font("bin/arial.ttf", 18, 0);
  if (!font18) {return -1;}

  al_clear_to_color(al_map_rgb(255, 255, 255));

  agame_msg("This is a message for the player of agame, but it is really "
            "long and needs to be wrapped.", font24);

  // al_draw_text(font24, al_map_rgb(255, 0, 255), 50, 50, 0,
  //              "Hello World, this is 24 point");
  // al_draw_text(font36, al_map_rgb(255, 127, 127), 640 / 2, 480 / 2,
  //              ALLEGRO_ALIGN_CENTRE, "This is Centered and 36 point");
  // al_draw_text(font18, al_map_rgb(15, 240, 18), 620, 350, ALLEGRO_ALIGN_RIGHT,
  //              "This is right aligned and 18 point");

  // al_draw_textf(font18, al_map_rgb(255, 255, 255), screen_w/2, 400,
  //               ALLEGRO_ALIGN_CENTRE,
  //               "TEXT with variable output (textf): Screen width and height "
  //               "= %i / %i" , screen_w, screen_h);

  al_flip_display();

  al_rest(4.0);

  al_destroy_font(font18);
  al_destroy_font(font24);
  al_destroy_font(font36);
  al_destroy_display(display);

  return 0;
}
예제 #9
0
inline const std::vector<std::string>& FileManager::LoadLevelFile(int levelNum)
{
	if(levelNum==currentLevelInLevelVector)
	{
		return levelVector;
	}
	else
		currentLevelInLevelVector = levelNum;
	
	std::vector<std::string>::iterator strIter;
	
	levelVector.clear();

	//open levelfile
	bool endFound=false;
	std::ifstream levelFile;
	levelFile.open(GetFilePath(levelNum));
	if(!levelFile.is_open())
	{
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(),
			"Error!", "FileManager", "Couldn't load levelFile", "Ok",ALLEGRO_MESSAGEBOX_ERROR);
		return levelVector;
	}

	std::string temp;
	//push all lines in a vector
	while(std::getline(levelFile, temp) && !endFound)
	{
		unsigned found = temp.find("//");
		if(found != std::string::npos)
		{
			temp.erase(found);
		}
		if(temp.size() > 0)
			levelVector.push_back(temp);
		if(temp=="END")
			endFound=true;
	}
	levelFile.close();

	if(levelFile.is_open())
	{
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(),
			"Error!", "FileManager", "Couldn't close levelFile", "Ok",ALLEGRO_MESSAGEBOX_ERROR);
	}

	return levelVector;
}
예제 #10
0
void SoundManager::PlayMusic(int num, bool loop)
{
	DestroyMusic();
	if(num==-1)
		return;
	else if(num==0)
		music = al_load_audio_stream("music/menu.ogg", 4, 2048);
	else if(num==1)
		music = al_load_audio_stream("music/level1.ogg", 4, 2048);

	if(music==NULL)
	{
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(),
			"Error!", "SoundManager", "Couldn't load music", "ok sok", ALLEGRO_MESSAGEBOX_ERROR);
		return;
	}

	if(music==NULL)
		return;

	al_set_audio_stream_loop_secs(music, .0f, al_get_audio_stream_length_secs(music));
	if(loop)
		al_set_audio_stream_playmode(music, ALLEGRO_PLAYMODE_LOOP);
	else
		al_set_audio_stream_playmode(music, ALLEGRO_PLAYMODE_ONCE);
	al_attach_audio_stream_to_mixer(music, mixer);
	al_attach_mixer_to_voice(mixer,voice);

}
예제 #11
0
int main ()
{
	/* starting random seed */
	srand ((unsigned int) time(NULL));

	/* starting allegro 5 */
	if (!al_init())
	{
		al_show_native_message_box(NULL, NULL, "Could not initialize Allegro 5", NULL, NULL, NULL);
		return -1;
	}

	/* starting addons */
	al_init_image_addon();
	al_init_primitives_addon();
	al_init_font_addon();
	al_init_ttf_addon();
	al_init_acodec_addon();
	al_install_keyboard();
	al_install_mouse();
	al_install_audio();

	/* calling start menu (windowed) */
	start_game(0);
	
	return 0;
}
예제 #12
0
void allegro_display_init(Jogo* jogo, int largura, int altura){
	jogo->display = al_create_display(largura, altura);
	if(!jogo->display){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar o display.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		exit(1);
	}
}
예제 #13
0
void error(const char *err)
{
    ALLEGRO_DISPLAY *dialogErr;
    dialogErr=al_is_system_installed()?al_get_current_display():NULL;
    al_show_native_message_box(dialogErr,"ERREUR", "Erreur", err,NULL,0);
    exit(EXIT_FAILURE);
}
예제 #14
0
void allegro_timer_init(Jogo* jogo){
	jogo->timer = al_create_timer(1.0/FPS);
	if(!jogo->timer){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar o timer do Allegro.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		exit(1);
	}
}
예제 #15
0
void Map::setBuildingAt(int x, int y, Building* building)
{
	if(x >= 0 && x < width && y >= 0 && y < width)
		tiles[x][y].setBuilding(building);
	else
		al_show_native_message_box(NULL, "Error", "", 
			"building set out of map bounds", NULL, NULL);
}
예제 #16
0
void Map::setTerrainAt(int x, int y, Terrain terrain)
{
	if(x >= 0 && x < width && y >= 0 && y < width)
		tiles[x][y].setTerrain(terrain);
	else
		al_show_native_message_box(NULL, "Error", "", 
			"terrain set out of map bounds", NULL, NULL);
}
예제 #17
0
파일: error.cpp 프로젝트: kotori/alMonopoly
void error(const char *func, int line, ALLEGRO_DISPLAY *display, const char *message)
{
   char text[256];

   sprintf(text, "%s(%d): %s", func, line, message);
   al_show_native_message_box(display, "Error", NULL, text,
                              NULL, ALLEGRO_MESSAGEBOX_ERROR);
}
예제 #18
0
void Map::setUnitAt(int x, int y, Unit* unit)
{
	if(x >= 0 && x < width && y >= 0 && y < width)
		tiles[x][y].setUnit(unit);
	else
		al_show_native_message_box(NULL, "Error", "", 
			"unit set out of map bounds", NULL, NULL);
}
예제 #19
0
void cria_tanque(Jogo* jogo){
	jogo->tanque = inicializa_tanque(LARGURA_INICIAL/2, ALTURA_INICIAL/8 * 7);
	if(!jogo->tanque){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar imagem do tanque.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		destroi_jogo(jogo);
		exit(1);
	}
}
예제 #20
0
void cria_sound_manager(Jogo* jogo){
	jogo->sound_mng = inicializa_sound_manager();
	if(!jogo->sound_mng){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar o sound manager.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		destroi_jogo(jogo);
		exit(1);
	}
}
예제 #21
0
void allegro_font_init(Jogo* jogo){
	al_init_font_addon();
	al_init_ttf_addon();
	jogo->fonte = al_load_ttf_font("imagens/space_invaders.ttf", 25, 0);
	if(!jogo->fonte){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar a fonte.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		exit(1);
	}
}
예제 #22
0
void allegro_keyboard_init(Jogo* jogo){
	if(!al_install_keyboard()){
		al_show_native_message_box(jogo->display, "Erro", "Erro", "Falha ao iniciar o teclado.", "OK", ALLEGRO_MESSAGEBOX_ERROR);
		exit(1);
	}

	for(int i=0; i<N_KEYS;	 i++)
		jogo->key[i] = false;
}
예제 #23
0
void Animation :: TESTE()
{
  char aux[100];
  for(frames_aux = frames_ini;frames_aux != NULL;frames_aux = frames_aux->prox)
  {
    itoa(frames_aux->ID, aux, 10);
    al_show_native_message_box(NULL, "IDs das animacoes", "teste", aux, NULL, 0);
  }
}
예제 #24
0
inline void FileManager::CreateObject(const std::string &ID,float x,float y)
{
	if(ID=="-1")
		return;//If temp == -1 the rest doesn't have to be checked, since most is -1 it is at the top
	else if(ID == "00")
		GameObjectManager::GetInstance().CreateObject(0,x,y);
	else if(ID == "01")
		GameObjectManager::GetInstance().CreateObject(1,x,y);
	else if(ID == "02")
		GameObjectManager::GetInstance().CreateObject(2,x,y);
	else if(ID == "03")
		GameObjectManager::GetInstance().CreateObject(3,x,y);
	else if(ID == "04")
		GameObjectManager::GetInstance().CreateObject(4,x,y);
	else if(ID == "05")
		GameObjectManager::GetInstance().CreateObject(5,x,y);
	else if(ID == "06")
		GameObjectManager::GetInstance().CreateObject(6,x,y);
	else if(ID == "07")
		GameObjectManager::GetInstance().CreateObject(7,x,y);
	else if(ID == "08")
		GameObjectManager::GetInstance().CreateObject(8,x,y);
	else if(ID == "09")
		GameObjectManager::GetInstance().CreateObject(9,x,y);
	else if(ID == "10")
		GameObjectManager::GetInstance().CreateObject(10,x,y);
	else if(ID == "11")
		GameObjectManager::GetInstance().CreateObject(11,x,y);
	else if(ID == "12")
		GameObjectManager::GetInstance().CreateObject(12,x,y);
	else if(ID == "13")
		GameObjectManager::GetInstance().CreateObject(13,x,y);
	else if(ID == "14")
		GameObjectManager::GetInstance().CreateObject(14,x,y);
	else if(ID == "15")
		GameObjectManager::GetInstance().CreateObject(15,x,y);
	else if(ID == "16")
		GameObjectManager::GetInstance().CreateObject(16,x,y);
	else if(ID == "17")
		GameObjectManager::GetInstance().CreateObject(17,x,y);
	else if(ID == "18")
		GameObjectManager::GetInstance().CreateObject(18,x,y);
	else if(ID == "96")
		GameObjectManager::GetInstance().CreateObject(96,x,y);
	else if(ID == "97")
		GameObjectManager::GetInstance().CreateObject(97,x,y);
	else if(ID == "98")
		GameObjectManager::GetInstance().CreateObject(98,x,y);
	else if(ID == "99")
		GameObjectManager::GetInstance().CreateObject(99,x,y);
	else //Give error message if object ID is unknown
	{
		std::string error = "Unknown object ID: " + ID;
		al_show_native_message_box(DisplayManager::GetInstance().GetDisplay(), "Error!", "FileManager", error.c_str() , "OkSok", 0);
	}
}
예제 #25
0
int main(int argc, char **argv){

       ALLEGRO_DISPLAY *display = NULL;
       ALLEGRO_BITMAP  *image   = NULL;

       if(!al_init()) {
          al_show_native_message_box(display, "Error", "Error", "Failed to initialize allegro!",
                                     NULL, ALLEGRO_MESSAGEBOX_ERROR);
          return 0;
       }
       if(!al_init_image_addon()) {
          al_show_native_message_box(display, "Error", "Error", "Failed to initialize al_init_image_addon!",
                                     NULL, ALLEGRO_MESSAGEBOX_ERROR);
          return 0;
       }
       display = al_create_display(800,600);

       if(!display) {
          al_show_native_message_box(display, "Error", "Error", "Failed to initialize display!",
                                     NULL, ALLEGRO_MESSAGEBOX_ERROR);
          return 0;
       }
       image = al_load_bitmap("image.png");

       if(!image) {
          al_show_native_message_box(display, "Error", "Error", "Failed to load image!",
                                     NULL, ALLEGRO_MESSAGEBOX_ERROR);
          al_destroy_display(display);
          return 0;
       }

       al_draw_bitmap(image,200,200,0);

       al_flip_display();

       al_rest(2);

       al_destroy_display(display);

       al_destroy_bitmap(image);

       return 0;
}
예제 #26
0
파일: utils.cpp 프로젝트: ahyangyi/Apomaku2
void Utils::error (char const *format, ...)
{
    char str[1024];
    va_list args;
    va_start(args, format);
    vsnprintf(str, sizeof str, format, args);
    va_end(args);

    al_show_native_message_box("Error", "We meet an error!", str, NULL, 0);
}
예제 #27
0
void load_menu_fonts() {
    menu_title_font = al_load_ttf_font("data/fonts/dc_s.ttf", 80, 0);
    menu_option_font = al_load_ttf_font("data/fonts/AnyTakers-Regular.ttf", 75, 0);
    menu_credits_font = al_load_ttf_font("data/fonts/Shehroz khalid.ttf", 20, 0);
    if (!menu_title_font || !menu_option_font || !menu_credits_font) {
        al_show_native_message_box(display.view, "Error", "Error", "Could not load font.", NULL,
                                   ALLEGRO_MESSAGEBOX_ERROR);
        return;
    }
}
예제 #28
0
파일: hashGame.c 프로젝트: rerthal/mc102
int main(void)
{
    int hash[HASH_DIMENSION][HASH_DIMENSION];
    int playerRound, x;

    int line, column;

    ALLEGRO_DISPLAY *display;
    ALLEGRO_EVENT_QUEUE *eventQueue;

    for(line = 0; line < HASH_DIMENSION; line++)
        for(column = 0; column < HASH_DIMENSION; column++)
            hash[line][column] = -1;

    if (!AllegroStart()) return -1;
    if (!ImageStart()) return -1;
    if (!MouseStart()) return -1;
    if (!DisplayStart(&display)) return -1;
    if (!EventQueueStart(&eventQueue)) return -1;

    al_register_event_source(eventQueue, al_get_display_event_source(display));
    al_register_event_source(eventQueue, al_get_mouse_event_source());
    al_set_target_bitmap(al_get_backbuffer(display));

    playerRound = rand() % 2;

    RenderHash(hash);

    while ( !GameOver(hash) )
    {
        if ( playerRound == COMPUTER )playerRound = PlayComputer(hash);
        else playerRound = PlayPlayer(hash, &eventQueue, &display);

        RenderHash(hash);
    }

    if (IsWinner(hash, COMPUTER)) al_show_native_message_box(display,"Computador Venceu", "", "Computador Venceu", "Ok",1);
    else if (IsWinner(hash, PLAYER)) al_show_native_message_box(display,"Você Venceu", "", "Você Venceu", "Ok",1);
    else al_show_native_message_box(display,"Deu Velha", "", "Deu Velha", "Ok",1);

    return 0;
}
예제 #29
0
파일: common.cpp 프로젝트: karadoc/slow
void ErrorExit(char const *format, ...)
{
	char str[1024];
	va_list args;
	va_start(args, format);
	vsnprintf(str, sizeof(str), format, args);
	va_end(args);

	al_show_native_message_box("Error", "something went wrong", str, NULL, 0);
	exit(1);
}
예제 #30
0
파일: main.c 프로젝트: wjwwood/agame
ALLEGRO_FONT * safe_load_font(char const * filename, int size, int flags) {
  ALLEGRO_FONT * font = al_load_font(filename, size, flags);
  if (!font) {
    char msg[256];
    sprintf(msg, "failed to load font: %s", filename);
    al_show_native_message_box(NULL, "error", "failed to load font",
                               msg, NULL,
                               ALLEGRO_MESSAGEBOX_ERROR);
  }
  return font;
}