void Game_sys::InitializeAllegro() { allegro_init(); // INITIALIZE ALLEGRO install_keyboard(); install_sound( DIGI_AUTODETECT, MIDI_AUTODETECT, 0 ); set_color_depth(32); set_gfx_mode( GFX_AUTODETECT_WINDOWED, screenwidth, screenheight, 0, 0 ); // SET THE GRAPHICS MODE buffer = create_bitmap( screenwidth, screenheight ); // CREATE THE BUFFER set_window_title( "Bubble Rebel" ); // SET THE WINDOW TITLE }
/*************************** Helpus*/ void helpus(void){ #ifndef __LIBRETRO__ allegro_init(); install_timer(); #endif printf("here helpus\n"); init_display(); printf("here after init disp\n"); init_system(); #ifdef ALLEGRO_WINDOWS FreeConsole(); #endif help(); exit(EXIT_SUCCESS); }
void init() { allegro_init(); set_color_depth(32); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0)) { allegro_message("%s.", allegro_error); exit(1); } install_keyboard(); install_mouse(); buffer = create_bitmap(SCREEN_W, SCREEN_H); }
int main(int argc, char *argv[]) { allegro_init(); // Initialize Allegro install_keyboard(); // Initialize keyboard routines install_mouse(); install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL); set_color_depth(16); // Set the color depth set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1024,768,0,0); // Change our graphics mode to 1024x768 mouse = load_bitmap("Mouse.bmp", NULL); //showCopyrights(); toMenu(); //startGame(); return 0; }
void init() { allegro_init(); /* Initializes this library */ tspec_init(); set_gfx_mode(GFX_AUTODETECT_WINDOWED, XWIN, YWIN, 0, 0); clear_to_color(screen, BGC); install_keyboard(); install_mouse(); srand(time(NULL)); /* semaphore to write on the screen */ pmux_create_pi(&mxa); }
/* Função principal, que faz as chamadas das demais funções. */ int main(){ allegro_init(); install_keyboard(); install_mouse(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 560, 400, 0, 0); show_mouse(screen); casasInva(); preecherCasas(); jogada(); displayUser_1(); msgVencedor(); return 0; }
void init() { allegro_init(); set_color_depth(32); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 512, 512, 0, 0)) { allegro_message("Error: %s.", allegro_error); exit(1); } install_keyboard(); install_mouse(); generate_envmap(); }
int main( void ) { /* first, set up Allegro and the graphics mode */ allegro_init(); /* initialize Allegro */ install_keyboard(); /* install the keyboard for Allegro to use */ install_sound( DIGI_AUTODETECT, MIDI_AUTODETECT, NULL ); set_color_depth( 16 ); /* set the color depth to 16-bit */ set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0 ); /* set graphics mode */ ball = load_bitmap( "ball.bmp", NULL ); /* load the ball bitmap */ bar = load_bitmap( "bar.bmp", NULL); /* load the bar bitmap */ buffer = create_bitmap(SCREEN_W, SCREEN_H);/* create buffer */ boing = load_sample( "boing.wav" ); /* load the sound file */ pongFont = load_font( "pongfont.pcx", NULL, NULL ); /* load the font */ ball_x = SCREEN_W / 2; /* give ball its initial x-coordinate */ ball_y = SCREEN_H / 2; /* give ball its initial y-coordinate */ barL_y = SCREEN_H / 2; /* give left paddle its initial y-coordinate */ barR_y = SCREEN_H / 2; /* give right paddle its initial y-coordinate */ scoreL = 0; /* set left player’s score to 0 */ scoreR = 0; /* set right player’s score to 0 */ srand( time( NULL ) ); /* seed the random function ... */ direction = rand() % 4; /* and then make a random initial direction */ while ( !key[KEY_ESC] )/* until the escape key is pressed ... */ { moveBall(); /* move the ball */ respondToKeyboard(); /* respond to keyboard input */ /* now, perform double buffering */ clear_to_color( buffer, makecol( 255, 255, 255 ) ); blit( ball, buffer, 0, 0, ball_x, ball_y, ball->w, ball->h ); blit( bar, buffer, 0, 0, 0, barL_y, bar->w, bar->h ); blit( bar, buffer, 0, 0, 620, barR_y, bar->w, bar->h ); line( buffer, 0, 30, 640, 30, makecol( 0, 0, 0 ) ); /* draw text onto the buffer */ textprintf_ex( buffer, pongFont, 75, 0, makecol( 0, 0, 0 ), -1, "Left Player Score: %d", scoreL ); textprintf_ex( buffer, pongFont, 400, 0, makecol( 0, 0, 0 ), -1, "Right Player Score: %d", scoreR ); blit( buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h ); clear_bitmap( buffer ); } /* end while */ destroy_bitmap( ball ); /* destroy the ball bitmap */ destroy_bitmap( bar ); /* destroy the bar bitmap */ destroy_bitmap( buffer ); /* destroy the buffer bitmap */ destroy_sample( boing ); /* destroy the boing sound file */ destroy_font( pongFont ); /* destroy the font */ return 0; } /* end function main */
int main(int argc, char **argv) { int max_val = 50; char desc[255]; data_bits bits; baud_bits baud; stop_bits stop; parity_bits parity; flow_control_type fc; #ifdef ALLEGRO_H allegro_init(); install_keyboard(); install_timer(); set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); #endif dzcomm_init(); parse_command_line(argc, argv); // Will exit in this if command line requires it for (fc=DZ_MIN_CONTROL; fc<=DZ_MAX_CONTROL; fc++) { comm_port_set_flow_control(port1, fc); if (port2 != NULL) comm_port_set_flow_control(port2, fc); for (parity=DZ_MIN_PARITY; parity<=DZ_MAX_PARITY; parity++) { comm_port_set_parity(port1, parity); if (port2 != NULL) comm_port_set_parity(port2, parity); for (bits=DZ_MIN_DATA; bits<=DZ_MAX_DATA; bits++) { comm_port_set_data_bits(port1, bits); if (port2 != NULL) comm_port_set_data_bits(port2, bits); for (baud=DZ_MIN_BAUD; baud<=DZ_MAX_BAUD; baud++) { comm_port_set_baud_rate(port1, baud); if (port2 != NULL) comm_port_set_baud_rate(port2, baud); max_val = 1 << num_data_bits[bits]; for (stop=DZ_MIN_STOP; stop<=DZ_MAX_STOP; stop++) { comm_port_set_stop_bits(port1, stop); if (port2 != NULL) comm_port_set_stop_bits(port2, stop); sprintf(desc, "(%s parity, %s control. bits:%d baud:%6d stop:%d):", parity_desc[parity], flow_control_desc[fc], num_data_bits[bits], baud_from_baud_bits[baud], num_stop_bits[stop]); if (main_loop(desc, max_val) == -1) exit(0); } } } } } return 0; }
//Allegro init fun! void techInit(){ allegro_init(); // all Allegro programs need this set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, WIDTH, HEIGHT, 0, 0); srand((unsigned)time(0)); screenBuffer = create_bitmap(WIDTH, HEIGHT); install_keyboard(); install_mouse(); LOCK_VARIABLE(speed_counter); LOCK_FUNCTION(increment_speed_counter); install_int_ex(increment_speed_counter,BPS_TO_TIMER(120)); /* add other initializations here*/ }
void init() { allegro_init(); set_color_depth(16); if(set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0)) { allegro_message("Error: %s.", allegro_error); exit(1); } install_keyboard(); buffer = create_bitmap(SCREEN_W, SCREEN_H); init_trig_tables(); }
void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_timer(); install_keyboard(); /* add other initializations here */ }
int main() { allegro_init(); install_keyboard(); if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) { if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) { allegro_message("Error setting graphics mode\n%s\n", allegro_error); return 1; } } PALETTE palette; }
void Init_video(char* argv[]) { allegro_init(); install_timer(); install_keyboard(); install_joystick(JOY_TYPE_AUTODETECT); request_refresh_rate(FPS_VIDEO); set_color_depth(32); /*set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 320, 240, 0, 0);*/ set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 240, 0, 0); set_window_title(game_name); clear_to_color(screen, makecol(0, 0, 0)); LOCK_VARIABLE(ticks); LOCK_FUNCTION(ticker); install_int_ex(ticker, BPS_TO_TIMER(FPS_VIDEO)); }
int main() { int x, y1, y2; int kirmizi, yesil, mavi, renk; // Allegro'yu ilklendir allegro_init(); // klavyeyi ilklendir install_keyboard(); // rastgele sayı üretecini ilklendir srand(time(NULL)); // ekran kipini ayarla int donen = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (donen != 0) { allegro_message(allegro_error); return; } // ekran çözünürlüğünü göster textprintf(screen, font, 0, 0, 15, "Dikey cizgi programı - %dx%d - Cikmak icin ESC tusuna basiniz", SCREEN_W, SCREEN_H); // çıkış tusuna basılana kadar devam et while (!key[KEY_ESC]) { // rastgele bir nokta seç x = 10 + rand() / (RAND_MAX / (SCREEN_W - 19)); y1 = 10 + rand() / (RAND_MAX / (SCREEN_H - 19)); y2 = 10 + rand() / (RAND_MAX / (SCREEN_H - 19)); // rastgele bir renk seç kirmizi = rand() / (RAND_MAX / 255 + 1); yesil = rand() / (RAND_MAX / 255 + 1); mavi = rand() / (RAND_MAX / 255 + 1); renk = makecol(kirmizi, yesil, mavi); // dikey çizgi çiz vline(screen, x, y1, y2, renk); } // programı sonlandır allegro_exit(); }
int main() { int x, y, yaricapx, yaricapy; int kirmizi, yesil, mavi, renk; // herşeyi ilklendir allegro_init(); install_keyboard(); install_timer(); srand(time(NULL)); // ekran kipini 640x480 olarak ayarla int donen = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (donen != 0) { allegro_message(allegro_error); return; } // ekran çözünürlüğünü göster textprintf(screen, font, 0, 0, 15, "Elips programı - %dx%d - Cikmak icin ESC tusuna basiniz", SCREEN_W, SCREEN_H); // çıkış tusuna basılana kadar devam et while (!key[KEY_ESC]) { // rastgele bir nokta seç x = 30 + rand() / (RAND_MAX / (SCREEN_W - 60)); y = 30 + rand() / (RAND_MAX / (SCREEN_H - 60)); yaricapx = rand() / (RAND_MAX / 30 + 1); yaricapy = rand() / (RAND_MAX / 30 + 1); // rastgele bir renk seç kirmizi = rand() / (RAND_MAX / 255 + 1); yesil = rand() / (RAND_MAX / 255 + 1); mavi = rand() / (RAND_MAX / 255 + 1); renk = makecol(kirmizi, yesil, mavi); // elipsi çiz ellipse(screen, x, y, yaricapx, yaricapy, renk); rest(25); } // programı sonlandır allegro_exit(); }
int main( void ) { /* first, set up Allegro and the graphics mode */ allegro_init(); /* initialize Allegro */ install_keyboard(); /* install the keyboard for Allegro to use */ install_sound( DIGI_AUTODETECT, MIDI_AUTODETECT, NULL ); install_timer(); /* install the timer handler */ set_color_depth( 16 ); /* set the color depth to 16-bit */ set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0 ); /* set graphics mode */ buffer = create_bitmap(SCREEN_W, SCREEN_H);/* create buffer */ pongData = load_datafile( "pongdatafile.dat" ); /* load the datafile */ ball_x = SCREEN_W / 2; /* give ball its initial x-coordinate */ ball_y = SCREEN_H / 2; /* give ball its initial y-coordinate */ barL_y = SCREEN_H / 2; /* give left paddle its initial y-coordinate */ barR_y = SCREEN_H / 2; /* give right paddle its initial y-coordinate */ scoreL = 0; /* set left player’s score to 0 */ scoreR = 0; /* set right player’s score to 0 */ srand( time( NULL ) ); /* seed the random function ... */ direction = rand() % 4; /* and then make a random initial direction */ /* add timer that calls moveBall every 5 milliseconds */ install_int( moveBall, 5 ); /* add timer that calls respondToKeyboard every 10 milliseconds */ install_int( respondToKeyboard, 10 ); while ( !key[KEY_ESC] ) /* until the escape key is pressed ... */ { /* now, perform double buffering */ clear_to_color( buffer, makecol( 255, 255, 255 ) ); blit( pongData[BALL].dat, buffer, 0, 0, ball_x, ball_y, 40, 40 ); blit( pongData[BAR].dat, buffer, 0, 0, 0, barL_y, 20, 100 ); blit( pongData[BAR].dat, buffer, 0, 0, 620, barR_y, 20, 100 ); line( buffer, 0, 30, 640, 30, makecol( 0, 0, 0 ) ); /* draw text onto the buffer */ textprintf_ex( buffer, pongData[PONGFONT].dat, 75, 0, makecol( 0, 0, 0 ), -1, "Left Player Score: %d", scoreL ); textprintf_ex( buffer, pongData[PONGFONT].dat, 400, 0, makecol( 0, 0, 0 ), -1, "Right Player Score: %d", scoreR ); blit( buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h ); clear_bitmap( buffer ); } /* end while */ remove_int( moveBall ); /* remove moveBall timer */ remove_int( respondToKeyboard ); /* remove respondToKeyboard timer */ destroy_bitmap( buffer ); /* destroy the buffer bitmap */ unload_datafile( pongData ); /* unload the datafile */ return 0; } /* end function main */
int main(int argc, char **argv) { srand((unsigned)time(NULL)); allegro_init(); install_keyboard(); install_timer(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0); BITMAP *orig_screen = screen; screen = create_bitmap(SCREEN_W, SCREEN_H); LOCK_VARIABLE(timer); LOCK_FUNCTION(timer_increment); install_int_ex(timer_increment, BPS_TO_TIMER(60)); int need_redraw = 1; Game game; init_game(&game); while(!game.end) { for(; timer > 0; --timer) { need_redraw = 1; get_input(&game); update_game(&game); if(timer > 4) { timer = 0; break; } } if(need_redraw) { clear_to_color(screen, makecol(0,0,0)); draw_game(&game, screen); blit(screen, orig_screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); } else sched_yield(); } delete_list(game.asteroids); delete_list(game.shot); delete_list(game.particles); return 0; }
/** * Initialises the OpenGL and Allegro application. This function creates the global * Gui object that can be populated by various examples. */ void init() { // We simply initialise OpenGL and Allegro as we would do with any OpenGL // and Allegro application. allegro_init(); install_allegro_gl(); allegro_gl_clear_settings(); allegro_gl_set (AGL_COLOR_DEPTH, 32); allegro_gl_set (AGL_Z_DEPTH, 24); allegro_gl_set (AGL_FULLSCREEN, TRUE); allegro_gl_set (AGL_DOUBLEBUFFER, 1); allegro_gl_set (AGL_SUGGEST, AGL_COLOR_DEPTH | AGL_Z_DEPTH | AGL_DOUBLEBUFFER); set_gfx_mode(GFX_OPENGL_WINDOWED, 640, 480, 0, 0); install_keyboard(); install_mouse(); install_timer(); glViewport(0, 0, 640, 480); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Now it's time to initialise the Guichan OpenGL back end // and the Guichan Allegro back end. imageLoader = new gcn::OpenGLAllegroImageLoader(); // The ImageLoader Guichan should use needs to be passed to the Image object // using a static function. gcn::Image::setImageLoader(imageLoader); graphics = new gcn::OpenGLGraphics(); // We need to tell the OpenGL Graphics object how big the screen is. graphics->setTargetPlane(640, 480); input = new gcn::AllegroInput(); // Now we create the Gui object to be used with this OpenGL // and Allegro application. globals::gui = new gcn::Gui(); // The Gui object needs a Graphics to be able to draw itself and an Input // object to be able to check for user input. In this case we provide the // Gui object with OpenGL and Allegro implementations of these objects hence // making Guichan able to utilise OpenGL and Allegro. globals::gui->setGraphics(graphics); globals::gui->setInput(input); }
/*--------------------------------------------------------------*/ void init() { allegro_init(); set_gfx_mode(GFX_AUTODETECT_WINDOWED, XWIN, YWIN, 0, 0); clear_to_color(screen, BGC); install_keyboard(); srand(time(NULL)); rect(screen, XMIN - L - 1, BASE - 1, XMAX + L + 1, TOP + BASE + L + 1, 14); textout_centre_ex(screen, font, "SPACE to create a fly", XWIN / 2, YWIN / 2, 14, 0); textout_centre_ex(screen, font, "ESC exit", XWIN / 2, YWIN / 2 + 30, 14, 0); pmux_create_pi(&mxa); pmux_create_pi(&mxv); ptask_init(SCHED_FIFO, GLOBAL, PRIO_INHERITANCE); }
int main () { allegro_init(); install_allegro_gl(); allegro_gl_clear_settings(); allegro_gl_set (AGL_COLOR_DEPTH, 32); allegro_gl_set (AGL_Z_DEPTH, 24); allegro_gl_set (AGL_FULLSCREEN, TRUE); allegro_gl_set (AGL_DOUBLEBUFFER, 1); allegro_gl_set (AGL_SUGGEST, AGL_COLOR_DEPTH | AGL_Z_DEPTH | AGL_DOUBLEBUFFER | AGL_FULLSCREEN); if (set_gfx_mode(GFX_OPENGL, 640, 480, 0, 0) < 0) { allegro_message ("Error setting OpenGL graphics mode:\n%s\n" "Allegro GL error : %s\n", allegro_error, allegro_gl_error); return -1; } install_keyboard(); install_timer(); LOCK_FUNCTION(secs_timer); LOCK_VARIABLE(secs); glShadeModel (GL_FLAT); glEnable (GL_DEPTH_TEST); glCullFace (GL_BACK); glEnable (GL_CULL_FACE); install_int (secs_timer, 1000); do { keyboard(); } while (!key[KEY_ESC]); set_gfx_mode (GFX_TEXT, 0, 0, 0, 0); allegro_message("Frames: %i, Seconds: %i, FPS: %f\n", frames, secs, (float)frames / (float)secs); return 0; }
void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); res = set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1280, 720, 0, 0); //WINDOWSED / FULLSCREEN if (res != 0) { allegro_message(allegro_error); exit(-1); } install_timer(); install_keyboard(); install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL); /* add other initializations here */ }
void TMainCaptureForm::SetToVideoMode() { Caption = "Four Channel Video stream: video camera"; MainCaptureForm->Caption = UnicodeString("Video Stream, version ") + getVersion(); allegro_init(); set_gdi_color_format(); set_color_depth(CDEPTH); bmpCanvas = create_bitmap_ex(CDEPTH,tPanel->Width,tPanel->Height); bmpCanvas1 = create_bitmap_ex(CDEPTH,tPanel1->Width,tPanel1->Height); bmpCanvas2 = create_bitmap_ex(CDEPTH,tPanel2->Width,tPanel2->Height); bmpCanvas3 = create_bitmap_ex(CDEPTH,tPanel3->Width,tPanel3->Height); clear_bitmap(bmpCanvas); clear_bitmap(bmpCanvas1); clear_bitmap(bmpCanvas2); clear_bitmap(bmpCanvas3); }
int main( int argc, char **argv ) { Game *the_game; allegro_init(); install_keyboard(); install_timer(); if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, argv[0]) != 0) { return 1; } if ( argc > 1 ) the_game = new Game( argv[1] ); else the_game = new Game( "dat" ); the_game->run(); delete the_game; return 0; } END_OF_MAIN();
+=j!=I&&i!=J&&i!=I&&j!=J&&*c(I,J)&&q(p(i),p(j),p(I),p(J));return f;}main(){int i ,I,j,J,f,F,a,b,s=-1,X,Y,H,h;BITMAP*B;SAMPLE*S;allegro_init();*c(0,1)=*c(0,2)=*c( 0,3)=1;set_gfx_mode(GFX_AUTODETECT_WINDOWED,w,w,0,0);install_sound(DIGI_DIRECTX( 0),MIDI_NONE,0);B=create_bitmap(w,w);install_keyboard();install_mouse();*c(2,3)= *c(1,2)=*c(1,3)=1;text_mode(-1);S=create_sample(8,0,9999,9999);for(i=0;i<9999;i ++){((unsigned char*)S->data)[i]=(((i+(fixsin(i<<13)>>13))%100+(i)%152)*i)/9000; }for(l=4;l<99;l++){play_sample(S,255,55,1600,0);play_sample(S,255,200,1604,0); for(i=0;i<l;i++){x[i]=((fixcos((i<<24)/l)*w/3)>>16)+w/2;y[i]=((fixsin((i<<24)/l) *w/3)>>16)+w/2;}do{F=0;key[KEY_ESC]?exit(0):0;clear_to_color(B,15);for(i=0;i<l;i ++){for(j=0;j<l;j++){f=0;if(*c(j,i)){f=M(i,j);for(a=-1;a<2;a++)for(b=-1;b<2;b++) line(B,a+p(i)+b,a+p(j)+b,f?12:10);}F|=f;}}for(i=0;i<l;i++){circlefill(B,p(i),8,0 );circlefill(B,p(i),6,s==i?7:8);s=mouse_b?s:-1;if(mouse_b&&s<0&&_(mouse_x-x[i],- 7,7)&&_(mouse_y-y[i],-7,7))s=i;}if(s>=0){x[s]=mouse_x;y[s]=mouse_y;}textprintf(B ,font,10,10,0,"Level %d",l-3);draw_sprite(B,mouse_sprite,mouse_x,mouse_y);blit(B ,screen,0,0,0,0,w,w);}while(F||mouse_b);H=0;for(j=0;j<2000;j++){h=0;x[l]=rand()% w*2-w/2;y[l]=rand()%w*2-w/2;for(i=0;i<l;i++){h+=M(i,l)==0;}if(h>H){H=h;X=x[l];Y= y[l];}}x[l]=X;y[l]=Y;for(i=0;i<l;i++){*c(i,l)=M(i,l)==0;*c(rand()%l,rand()%l)=0; }}}END_OF_MAIN();///////////////////////////////////////////////////////////////
void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT, NULL); install_sound_input(DIGI_AUTODETECT,MIDI_NONE); install_timer(); install_keyboard(); install_mouse(); /* add other initializations here */ }
/* Este metodo inicializa todos los componentes de allegro para la ejecucion del programa, la pantalla, la ventanta, el mouse y el teclado. */ void init() { int depth, res; allegro_init(); depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); //detecta drivers de video automaticamente res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_timer(); install_keyboard(); install_mouse(); show_mouse(screen); }
/** * arquivo de exemplo de funções de sprite * * @author: Cantídio Oliveira Fontes * @since: 13/06/2008 * @final: 14/06/2008 */ void init() { int depth; if (allegro_init() != 0) exit(1); install_timer(); install_keyboard(); key[KEY_ENTER]=0; install_mouse(); depth = desktop_color_depth(); if (depth == 0) depth = 16; set_color_depth(depth); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 240, 0, 0)) { if (set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0)) exit(1); } }
void init_at_startup(void) { allegro_init(); install_keyboard(); install_timer(); three_finger_flag = 0; key_led_flag = 0; // LOCK_FUNCTION (framecount); LOCK_FUNCTION (tickover); LOCK_VARIABLE (ticked); // LOCK_VARIABLE (tick_counter); // LOCK_VARIABLE (frames_per_second); // LOCK_VARIABLE (framecounter); LOCK_VARIABLE (turns_per_second); LOCK_VARIABLE (turncounter); // LOCK_VARIABLE (inputs_per_second); // LOCK_VARIABLE (inputcounter); // install_int (framecount, 1000); install_int (tickover, 30); set_color_depth(8); init_config(); if (set_gfx_mode((options.windowed == 1) ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set 640x480 mode\n%s\n", allegro_error); exit(1); } init_palette(); init_display(); init_menus_once_only(); init_sound(); // must come after init_menus_once_only, as that's where // options.sound_enabled is set. }
int main(void) { /* declare three 32 bit (16.16) fixed point variables */ fixed x, y, z; if (allegro_init() != 0) return 1; /* convert integers to fixed point like this */ x = itofix(10); /* convert floating point to fixed point like this */ y = ftofix(3.14); /* fixed point variables can be assigned, added, subtracted, negated, * and compared just like integers, eg: */ z = x + y; allegro_message("%f + %f = %f\n", fixtof(x), fixtof(y), fixtof(z)); /* you can't add integers or floating point to fixed point, though: * z = x + 3; * would give the wrong result. */ /* fixed point variables can be multiplied or divided by integers or * floating point numbers, eg: */ z = y * 2; allegro_message("%f * 2 = %f\n", fixtof(y), fixtof(z)); /* you can't multiply or divide two fixed point numbers, though: * z = x * y; * would give the wrong result. Use fixmul() and fixdiv() instead, eg: */ z = fixmul(x, y); allegro_message("%f * %f = %f\n", fixtof(x), fixtof(y), fixtof(z)); /* fixed point trig and square root are also available, eg: */ z = fixsqrt(x); allegro_message("fixsqrt(%f) = %f\n", fixtof(x), fixtof(z)); return 0; }