int main() { setup_array(); output_file(); calc(); show_values(); }
int main(int argc, char **argv){ int in_sample_rate, out_sample_rate, ch ,i, in_ch_layout_index, out_ch_layout_index, osr, flush_count; uint64_t in_ch_layout, out_ch_layout; enum AVSampleFormat in_sample_fmt, out_sample_fmt; int sample_rates[]={8000,11025,16000,22050,32000}; uint8_t array_in[SAMPLES*8*8]; uint8_t array_mid[SAMPLES*8*8*3]; uint8_t array_out[SAMPLES*8*8+100]; uint8_t *ain[SWR_CH_MAX]; uint8_t *aout[SWR_CH_MAX]; uint8_t *amid[SWR_CH_MAX]; struct SwrContext * forw_ctx= NULL; struct SwrContext *backw_ctx= NULL; in_sample_rate=16000; for(osr=0; osr<5; osr++){ out_sample_rate= sample_rates[osr]; for(in_sample_fmt= AV_SAMPLE_FMT_U8; in_sample_fmt<=AV_SAMPLE_FMT_DBL; in_sample_fmt++){ for(out_sample_fmt= AV_SAMPLE_FMT_U8; out_sample_fmt<=AV_SAMPLE_FMT_DBL; out_sample_fmt++){ for(in_ch_layout_index=0; layouts[in_ch_layout_index]; in_ch_layout_index++){ in_ch_layout= layouts[in_ch_layout_index]; int in_ch_count= av_get_channel_layout_nb_channels(in_ch_layout); for(out_ch_layout_index=0; layouts[out_ch_layout_index]; out_ch_layout_index++){ int out_count, mid_count; out_ch_layout= layouts[out_ch_layout_index]; int out_ch_count= av_get_channel_layout_nb_channels(out_ch_layout); fprintf(stderr, "ch %d->%d, rate:%5d->%5d, fmt:%s->%s", in_ch_count, out_ch_count, in_sample_rate, out_sample_rate, av_get_sample_fmt_name(in_sample_fmt), av_get_sample_fmt_name(out_sample_fmt)); forw_ctx = swr_alloc_set_opts(forw_ctx, out_ch_layout, av_get_alt_sample_fmt(out_sample_fmt, 1), out_sample_rate, in_ch_layout, av_get_alt_sample_fmt( in_sample_fmt, 1), in_sample_rate, 0, 0); backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout, in_sample_fmt, in_sample_rate, out_ch_layout, av_get_alt_sample_fmt(out_sample_fmt, 1), out_sample_rate, 0, 0); if(swr_init( forw_ctx) < 0) fprintf(stderr, "swr_init(->) failed\n"); if(swr_init(backw_ctx) < 0) fprintf(stderr, "swr_init(<-) failed\n"); if(!forw_ctx) fprintf(stderr, "Failed to init forw_cts\n"); if(!backw_ctx) fprintf(stderr, "Failed to init backw_ctx\n"); //FIXME test planar setup_array(ain , array_in , av_get_alt_sample_fmt( in_sample_fmt, 1), SAMPLES); setup_array(amid, array_mid, av_get_alt_sample_fmt(out_sample_fmt, 1), 3*SAMPLES); setup_array(aout, array_out, in_sample_fmt , SAMPLES); for(ch=0; ch<in_ch_count; ch++){ for(i=0; i<SAMPLES; i++) set(ain, ch, i, in_ch_count, av_get_alt_sample_fmt(in_sample_fmt, 1), sin(i*i*3/SAMPLES)); } mid_count= swr_convert(forw_ctx, amid, 3*SAMPLES, ain, SAMPLES); out_count= swr_convert(backw_ctx,aout, SAMPLES, amid, mid_count); for(ch=0; ch<in_ch_count; ch++){ double sse, x, maxdiff=0; double sum_a= 0; double sum_b= 0; double sum_aa= 0; double sum_bb= 0; double sum_ab= 0; for(i=0; i<out_count; i++){ double a= get(ain , ch, i, in_ch_count, av_get_alt_sample_fmt(in_sample_fmt, 1)); double b= get(aout, ch, i, in_ch_count, in_sample_fmt); sum_a += a; sum_b += b; sum_aa+= a*a; sum_bb+= b*b; sum_ab+= a*b; maxdiff= FFMAX(maxdiff, FFABS(a-b)); } x = sum_ab/sum_bb; sse= sum_aa + sum_bb*x*x - 2*x*sum_ab; fprintf(stderr, "[%f %f %f] len:%5d\n", sqrt(sse/out_count), x, maxdiff, out_count); } flush_count=swr_convert(backw_ctx,aout, SAMPLES, 0, 0); if(flush_count){ for(ch=0; ch<in_ch_count; ch++){ double sse, x, maxdiff=0; double sum_a= 0; double sum_b= 0; double sum_aa= 0; double sum_bb= 0; double sum_ab= 0; for(i=0; i<flush_count; i++){ double a= get(ain , ch, i+out_count, in_ch_count, av_get_alt_sample_fmt(in_sample_fmt, 1)); double b= get(aout, ch, i, in_ch_count, in_sample_fmt); sum_a += a; sum_b += b; sum_aa+= a*a; sum_bb+= b*b; sum_ab+= a*b; maxdiff= FFMAX(maxdiff, FFABS(a-b)); } x = sum_ab/sum_bb; sse= sum_aa + sum_bb*x*x - 2*x*sum_ab; fprintf(stderr, "[%f %f %f] len:%5d\n", sqrt(sse/flush_count), x, maxdiff, flush_count); } } fprintf(stderr, "\n"); } } } } } return 0; }
int main(int argc, char **argv){ int in_sample_rate, out_sample_rate, ch ,i, flush_count; uint64_t in_ch_layout, out_ch_layout; enum AVSampleFormat in_sample_fmt, out_sample_fmt; uint8_t array_in[SAMPLES*8*8]; uint8_t array_mid[SAMPLES*8*8*3]; uint8_t array_out[SAMPLES*8*8+100]; uint8_t *ain[SWR_CH_MAX]; uint8_t *aout[SWR_CH_MAX]; uint8_t *amid[SWR_CH_MAX]; int flush_i=0; int mode; int num_tests = 10000; uint32_t seed = 0; uint32_t rand_seed = 0; int remaining_tests[FF_ARRAY_ELEMS(rates) * FF_ARRAY_ELEMS(layouts) * FF_ARRAY_ELEMS(formats) * FF_ARRAY_ELEMS(layouts) * FF_ARRAY_ELEMS(formats)]; int max_tests = FF_ARRAY_ELEMS(remaining_tests); int test; int specific_test= -1; struct SwrContext * forw_ctx= NULL; struct SwrContext *backw_ctx= NULL; if (argc > 1) { if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { av_log(NULL, AV_LOG_INFO, "Usage: swresample-test [<num_tests>[ <test>]] \n" "num_tests Default is %d\n", num_tests); return 0; } num_tests = strtol(argv[1], NULL, 0); if(num_tests < 0) { num_tests = -num_tests; rand_seed = time(0); } if(num_tests<= 0 || num_tests>max_tests) num_tests = max_tests; if(argc > 2) { specific_test = strtol(argv[1], NULL, 0); } } for(i=0; i<max_tests; i++) remaining_tests[i] = i; for(test=0; test<num_tests; test++){ unsigned r; uint_rand(seed); r = (seed * (uint64_t)(max_tests - test)) >>32; FFSWAP(int, remaining_tests[r], remaining_tests[max_tests - test - 1]); } qsort(remaining_tests + max_tests - num_tests, num_tests, sizeof(remaining_tests[0]), (void*)cmp); in_sample_rate=16000; for(test=0; test<num_tests; test++){ char in_layout_string[256]; char out_layout_string[256]; unsigned vector= remaining_tests[max_tests - test - 1]; int in_ch_count; int out_count, mid_count, out_ch_count; in_ch_layout = layouts[vector % FF_ARRAY_ELEMS(layouts)]; vector /= FF_ARRAY_ELEMS(layouts); out_ch_layout = layouts[vector % FF_ARRAY_ELEMS(layouts)]; vector /= FF_ARRAY_ELEMS(layouts); in_sample_fmt = formats[vector % FF_ARRAY_ELEMS(formats)]; vector /= FF_ARRAY_ELEMS(formats); out_sample_fmt = formats[vector % FF_ARRAY_ELEMS(formats)]; vector /= FF_ARRAY_ELEMS(formats); out_sample_rate = rates [vector % FF_ARRAY_ELEMS(rates )]; vector /= FF_ARRAY_ELEMS(rates); av_assert0(!vector); if(specific_test == 0){ if(out_sample_rate != in_sample_rate || in_ch_layout != out_ch_layout) continue; } in_ch_count= av_get_channel_layout_nb_channels(in_ch_layout); out_ch_count= av_get_channel_layout_nb_channels(out_ch_layout); av_get_channel_layout_string( in_layout_string, sizeof( in_layout_string), in_ch_count, in_ch_layout); av_get_channel_layout_string(out_layout_string, sizeof(out_layout_string), out_ch_count, out_ch_layout); fprintf(stderr, "TEST: %s->%s, rate:%5d->%5d, fmt:%s->%s\n", in_layout_string, out_layout_string, in_sample_rate, out_sample_rate, av_get_sample_fmt_name(in_sample_fmt), av_get_sample_fmt_name(out_sample_fmt)); forw_ctx = swr_alloc_set_opts(forw_ctx, out_ch_layout, out_sample_fmt, out_sample_rate, in_ch_layout, in_sample_fmt, in_sample_rate, 0, 0); backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout, in_sample_fmt, in_sample_rate, out_ch_layout, out_sample_fmt, out_sample_rate, 0, 0); if(!forw_ctx) { fprintf(stderr, "Failed to init forw_cts\n"); return 1; } if(!backw_ctx) { fprintf(stderr, "Failed to init backw_ctx\n"); return 1; } if (uint_rand(rand_seed) % 3 == 0) av_opt_set_int(forw_ctx, "ich", 0, 0); if (uint_rand(rand_seed) % 3 == 0) av_opt_set_int(forw_ctx, "och", 0, 0); if(swr_init( forw_ctx) < 0) fprintf(stderr, "swr_init(->) failed\n"); if(swr_init(backw_ctx) < 0) fprintf(stderr, "swr_init(<-) failed\n"); //FIXME test planar setup_array(ain , array_in , in_sample_fmt, SAMPLES); setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES); setup_array(aout, array_out, in_sample_fmt , SAMPLES); #if 0 for(ch=0; ch<in_ch_count; ch++){ for(i=0; i<SAMPLES; i++) set(ain, ch, i, in_ch_count, in_sample_fmt, sin(i*i*3/SAMPLES)); } #else audiogen(ain, in_sample_fmt, in_ch_count, SAMPLES/6+1, SAMPLES); #endif mode = uint_rand(rand_seed) % 3; if(mode==0 /*|| out_sample_rate == in_sample_rate*/) { mid_count= swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, SAMPLES); } else if(mode==1){ mid_count= swr_convert(forw_ctx, amid, 0, (const uint8_t **)ain, SAMPLES); mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0); } else { int tmp_count; mid_count= swr_convert(forw_ctx, amid, 0, (const uint8_t **)ain, 1); av_assert0(mid_count==0); shift(ain, 1, in_ch_count, in_sample_fmt); mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0); shift(amid, mid_count, out_ch_count, out_sample_fmt); tmp_count = mid_count; mid_count+=swr_convert(forw_ctx, amid, 2, (const uint8_t **)ain, 2); shift(amid, mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count; shift(ain, 2, in_ch_count, in_sample_fmt); mid_count+=swr_convert(forw_ctx, amid, 1, (const uint8_t **)ain, SAMPLES-3); shift(amid, mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count; shift(ain, -3, in_ch_count, in_sample_fmt); mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, (const uint8_t **)ain, 0); shift(amid, -tmp_count, out_ch_count, out_sample_fmt); } out_count= swr_convert(backw_ctx,aout, SAMPLES, (const uint8_t **)amid, mid_count); for(ch=0; ch<in_ch_count; ch++){ double sse, maxdiff=0; double sum_a= 0; double sum_b= 0; double sum_aa= 0; double sum_bb= 0; double sum_ab= 0; for(i=0; i<out_count; i++){ double a= get(ain , ch, i, in_ch_count, in_sample_fmt); double b= get(aout, ch, i, in_ch_count, in_sample_fmt); sum_a += a; sum_b += b; sum_aa+= a*a; sum_bb+= b*b; sum_ab+= a*b; maxdiff= FFMAX(maxdiff, FFABS(a-b)); } sse= sum_aa + sum_bb - 2*sum_ab; if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error fprintf(stderr, "[e:%f c:%f max:%f] len:%5d\n", out_count ? sqrt(sse/out_count) : 0, sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, out_count); } flush_i++; flush_i%=21; flush_count = swr_convert(backw_ctx,aout, flush_i, 0, 0); shift(aout, flush_i, in_ch_count, in_sample_fmt); flush_count+= swr_convert(backw_ctx,aout, SAMPLES-flush_i, 0, 0); shift(aout, -flush_i, in_ch_count, in_sample_fmt); if(flush_count){ for(ch=0; ch<in_ch_count; ch++){ double sse, maxdiff=0; double sum_a= 0; double sum_b= 0; double sum_aa= 0; double sum_bb= 0; double sum_ab= 0; for(i=0; i<flush_count; i++){ double a= get(ain , ch, i+out_count, in_ch_count, in_sample_fmt); double b= get(aout, ch, i, in_ch_count, in_sample_fmt); sum_a += a; sum_b += b; sum_aa+= a*a; sum_bb+= b*b; sum_ab+= a*b; maxdiff= FFMAX(maxdiff, FFABS(a-b)); } sse= sum_aa + sum_bb - 2*sum_ab; if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error fprintf(stderr, "[e:%f c:%f max:%f] len:%5d F:%3d\n", sqrt(sse/flush_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, flush_count, flush_i); } } fprintf(stderr, "\n"); } return 0; }
int main(int argc, char const *argv[]) { int n_hordas = 0; //Numero de hordas chamadas bool nova_horda = true; //Chama nova horda bool torre_mouse = false; //Se a torre está no mouse bool info_torre = false; //Chama a funçao de informaçoes da torre bool compra_torre = false; //Exibe as informaçoes da torre a ser comprada bool upgrade_torre; //Guarda os upgrades da torre] int tower_posx = 0; //Posiçao x de determinada torre int tower_posy = 0; //Posiçao y de determinada torre int torre_ID; //Identifica as torres int t = 0; //Contagem das torres int t_1, t_2; //Contagem para disparo int r; //Variável para colunas int l; //Variável para linhas bool render = false; //Renderizaçao int resposta = 0; //Resposta se os monstros estão todos mortos int gamestate = 0; //Gamestates //Setup inicial Sistema sistema; Monstro monstro[tipos_monstros][n_monstros]; Tipo tipo_torre; Tipo tipo1; Tipo tipo2; Tipo upgrade1_torre1; Torre torre[100]; //Declaracao vairaveis allegro ALLEGRO_DISPLAY *janela = NULL; //Vari�vel para a janela ALLEGRO_EVENT_QUEUE *fila_eventos = NULL; // '' para eventos ALLEGRO_BITMAP *imagem = NULL; // '' para imagem ALLEGRO_TIMER *timer = NULL; // '' para o tempo (fps) ALLEGRO_FONT *fonte = NULL; // '' para fonte ALLEGRO_BITMAP *trilha = NULL; ALLEGRO_BITMAP *fundao = NULL; ALLEGRO_BITMAP *spawn = NULL; ALLEGRO_BITMAP *the_end = NULL; ALLEGRO_BITMAP *monstro2 = NULL; ALLEGRO_BITMAP *torre1 = NULL; ALLEGRO_FONT *fonte40 = NULL; //Inicializa o allegro, mouse e add-ons al_init(); al_install_mouse(); al_init_primitives_addon(); al_init_image_addon(); al_init_font_addon(); al_init_ttf_addon(); //Setup inicial do sistema, monstros e torres init_horda(monstro, n_monstros, n_hordas, tipos_monstros); init_system(sistema); setup_torre1(tipo1); setup_torre2(tipo2); upgrade1_tower1(upgrade1_torre1); //Atribui atributos às variáveis allegro janela = al_create_display(LARGURA_TELA, ALTURA_TELA); fila_eventos = al_create_event_queue(); imagem = al_load_bitmap("virus.jpg"); trilha = al_load_bitmap("fundoc.jpg"); fundao = al_load_bitmap("fundod.jpg"); spawn = al_load_bitmap("spawn.jpg"); the_end = al_load_bitmap("the end.jpg"); monstro2 = al_load_bitmap("virus2.jpg"); torre1 = al_load_bitmap("halter.png"); timer = al_create_timer(1.0 / fps); fonte = al_load_font("arial.ttf", 12, 0); fonte40 = al_load_font("arial.ttf", 40, 0); //Inicializa o mouse e tempo al_set_system_mouse_cursor(janela, ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT); al_start_timer(timer); al_install_keyboard(); init_fail(janela, fonte, fila_eventos, imagem, timer, trilha); //Fun�ao de teste de inicializaçao do allegro //Regista os eventos da janela, mouse e timer na vari�vel de eventos (fila_eventos) al_register_event_source(fila_eventos, al_get_display_event_source(janela)); al_register_event_source(fila_eventos, al_get_mouse_event_source()); al_register_event_source(fila_eventos, al_get_keyboard_event_source()); al_register_event_source(fila_eventos, al_get_timer_event_source(timer)); al_clear_to_color(al_map_rgb(235, 235, 235)); //Limpa a tela al_flip_display(); //Atualiza a tela //Loop principal while (!GameOver) { ALLEGRO_EVENT evento; //Variavel para eventos al_wait_for_event(fila_eventos, &evento); //Espera por eventos if (evento.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { GameOver = true; } switch(gamestate) { case 0: //Menu inicial { if(evento.type == ALLEGRO_EVENT_TIMER) { render = true; } if(evento.type == ALLEGRO_EVENT_KEY_DOWN) { switch(evento.keyboard.keycode) { case ALLEGRO_KEY_ENTER: gamestate = 1; break; case ALLEGRO_KEY_BACKSPACE: gamestate = 2; break; } } break; } case 1: //Jogo { if(evento.type == ALLEGRO_EVENT_TIMER) { if(info_torre) { if (torre[torre_ID].upgrade == 0 && sistema.money >= 60) { mapa[25][30] = 12; } } if(!info_torre) { mapa[25][30] = 0; } for(int j = 0; j < t; j++) //Loop para o disparo das torres { if(torre[j].n == 1) { if(t_1 >= fps*(torre[j].fire_rate)) { fire_tiro(torre, monstro, t, n_monstros, tipos_monstros); //Dispara tiros t_1 = 0; } } if(torre[j].n == 2) { if(t_2 >= fps*(torre[j].fire_rate)) { fire_tiro(torre, monstro, t, n_monstros, tipos_monstros); //Dispara tiros t_2 = 0; } } } update_horda(monstro, sistema, mapa, n_monstros, tipos_monstros); update_tiro(torre, monstro, t, n_monstros, tipos_monstros); colisao_horda(torre, monstro, t, n_monstros, sistema, &resposta, tipos_monstros); t_1++; t_2++; render = true; if(sistema.lives <= 0) gamestate = 2; } else if(evento.type == ALLEGRO_EVENT_MOUSE_AXES) { pos_x = evento.mouse.x; //Armazena a posiçao x do mouse pos_y = evento.mouse.y; //Armazena a posiçao y do mouse r = pos_x/l_celula; // Atribui uma celula de coluna l = pos_y/a_celula; // Atribui uma celula de linha } else if(evento.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { switch (mapa[l][r]) { case 10: info_torre = false; compra_torre = true; tipo_torre = tipo1; if(sistema.money >= tipo_torre.price && evento.mouse.button & 1) torre_mouse = true; break; case 20: info_torre = false; compra_torre = true; tipo_torre = tipo2; if(sistema.money >= tipo_torre.price && evento.mouse.button & 1) torre_mouse = true; break; case 11: torre_ID = find_tower_ID(torre, t, r, l); info_torre = true; break; case 12: torre_ID = find_tower_ID(torre, t, r, l); info_torre = true; break; case 21: torre_ID = find_tower_ID(torre, t, r, l); info_torre = true; break; default: info_torre = false; } if(torre_mouse && (mapa[l][r] == 0 || mapa[l][r] == 5) && evento.mouse.button & 1) //Posicionamento da torre enquanto ela estiver no mouse { setup_tower(torre, tipo_torre, t, r, l); sistema.money -= tipo_torre.price; //Pagamento da torre torre_mouse = false; compra_torre = false; t++; } if(torre_mouse && evento.mouse.button & 2) //Cancela compra { torre_mouse = false; compra_torre = false; } if(compra_torre && mapa[l][r] != 10 && mapa[l][r] != 20) //Termina a exibiçao da torre a ser comprada { compra_torre = false; } if(info_torre && mapa[l][r] == 12 ) { sistema.money -= 60; torre_ID = find_tower_ID(torre, t, r, l); upgrade_tower(torre, upgrade1_torre1, torre_ID); //upgrade_torre = true; } } else if(evento.type == ALLEGRO_EVENT_KEY_DOWN) { printf("resposta = %d\n", resposta); if(resposta == 1 || n_hordas == 0) { switch(evento.keyboard.keycode) { case ALLEGRO_KEY_SPACE: //Inicializa uma nova horda start_horda(monstro, n_monstros, n_hordas, tipos_monstros); n_hordas++; break; } } } } break; case 2: //Fim de jogo { if(evento.type == ALLEGRO_EVENT_TIMER) { render = true; } if(evento.type == ALLEGRO_EVENT_KEY_DOWN) { switch(evento.keyboard.keycode) { case ALLEGRO_KEY_R: init_system(sistema); init_horda(monstro, n_monstros, n_hordas, tipos_monstros); restart_tower(torre, t); n_hordas = 0; setup_array(mapa); gamestate = 1; break; case ALLEGRO_KEY_ESCAPE: GameOver = true; break; } } break; } } if(render && al_is_event_queue_empty(fila_eventos)) { render = false; if(gamestate == 0) { al_clear_to_color(al_map_rgb(255,255,255)); al_draw_textf(fonte, al_map_rgb(0, 0, 255), LARGURA_TELA/2, (ALTURA_TELA/2) - 20, 0, "Pressione ENTER para Jogar"); al_draw_textf(fonte, al_map_rgb(0, 0, 0), LARGURA_TELA/2, (ALTURA_TELA/2) + 20, 0, "Pressione BACKSPACE para Sair"); } if(gamestate == 1) { al_clear_to_color(al_map_rgb(61, 10, 10)); draw_background(mapa, fonte, trilha, fundao, spawn, the_end); //Desenha o plano de fundo draw_towers(mapa, sistema, fonte, the_end, torre1); //Desenha as torres al_draw_textf(fonte, al_map_rgb(255, 255, 255), 900, 15, ALLEGRO_ALIGN_LEFT, "Vidas do sistema %i", sistema.lives); al_draw_textf(fonte, al_map_rgb(255, 255, 255), 900, 35, ALLEGRO_ALIGN_LEFT, "Bitcoins %.2f", sistema.money); al_draw_textf(fonte, al_map_rgb(255, 255, 255), 100, 15, ALLEGRO_ALIGN_LEFT, "Monstros mortos: %i Wave: %i", sistema.score, n_hordas); /* Mouse debug al_draw_textf(fonte, al_map_rgb(0, 0, 0), pos_x, pos_y, ALLEGRO_ALIGN_LEFT, "l:%i r:%i", l, r); al_draw_textf(fonte, al_map_rgb(0, 0, 0), pos_x, pos_y + 15, ALLEGRO_ALIGN_CENTRE, "mapa[l][r]: %i", mapa[l][r]); */ draw_horda(monstro, n_monstros, imagem, tipos_monstros, monstro2); //Desenha os montros if(torre_mouse) { draw_mouse_tower(r, l, tipo_torre); //Desenha a torre somente enquanto ela estiver no mouse } if(info_torre) { show_tower_information(torre, torre_ID, fonte); //info torres if (mapa[25][30] == 12) { al_draw_filled_circle(25 * l_celula + (l_celula/2), 30 * a_celula + (a_celula/2), l_celula/2, al_map_rgb(40, 150, 10)); } } if(compra_torre) { buy_tower(tipo_torre, fonte); //Exibe as informaçoes da torre a ser comprada } draw_tiro(torre, t); //Desenha os tiros } if(gamestate == 2) { al_clear_to_color(al_map_rgb(255,255,255)); al_draw_textf(fonte40, al_map_rgb(255, 0, 0), LARGURA_TELA/2, (ALTURA_TELA/2) - 100, 0, "Game Over"); al_draw_textf(fonte, al_map_rgb(0, 0, 0), LARGURA_TELA/2, (ALTURA_TELA/2) - 20, 0, "Pressione R para Jogar Novamente"); al_draw_textf(fonte, al_map_rgb(0, 0, 0), LARGURA_TELA/2, (ALTURA_TELA/2) + 20, 0, "Pressione ESC para Sair"); } al_flip_display(); } } destroy_al(janela, fonte, fila_eventos, imagem, timer); //Destroi as vari�veis allegro return 0; }