static int init_vidmode () { int i; RGB p; install_keyboard(); install_timer(); /*install_mouse();*/ LOCK_VARIABLE (clock_ticks); LOCK_FUNCTION (tick_increment); install_int_ex (tick_increment, BPS_TO_TIMER (TICK_SECONDS)); screen_buffer = create_bitmap (GFX_WIDTH, GFX_HEIGHT); clear(screen_buffer); clock_count = 0; clock_ticks = 0; set_gfx_mode(GFX_VGA, GFX_WIDTH, GFX_HEIGHT, 0, 0); for(i = 0; i < 32; i++) { p.r = palette[(i*3)+0]; p.g = palette[(i*3)+1]; p.b = palette[(i*3)+2]; set_color(i, &p); } return err_OK; }
int main(){ declarevalues(); allegro_init(); install_keyboard(); install_mouse(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, Screen.getwidth(), Screen.getheight(), 0, 0); buffer = create_bitmap(Screen.getwidth(), Screen.getheight()); Loadproperties(); while (!key[KEY_ESC]) // Here is the game loop. { declarearray(); create_world(); circlefill(buffer, mouse_x, mouse_y, 5, makecol(255, 0, 0)); textprintf_ex(buffer, font, 10, 10, makecol(255, 100, 200), -1, "%s", testchar.testname.c_str() ); blit(buffer, screen, 0, 0, 0, 0, Screen.getwidth(), Screen.getheight()); clear_bitmap(buffer); } return 0; }
int main(int argc, char *argv[]) { BITMAP *buffer; allegro_init(); install_keyboard(); if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set gfx mode\n%s\n", allegro_error); return 1; } buffer = create_bitmap(SCREEN_W, SCREEN_H); while (!key[KEY_ESC]) { blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); } destroy_bitmap(buffer); return 0; }
const char *VideoDriver_Allegro::Start(const char * const *parm) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) { DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error); return "Failed to set up Allegro"; } _allegro_instance_count++; install_timer(); install_mouse(); install_keyboard(); #if defined _DEBUG /* Allegro replaces SEGV/ABRT signals meaning that the debugger will never * be triggered, so rereplace the signals and make the debugger userful. */ signal(SIGABRT, NULL); signal(SIGSEGV, NULL); #endif #if defined(DOS) /* Force DOS builds to ALWAYS use full screen as * it can't do windowed. */ _fullscreen = true; #endif GetVideoModes(); if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) { return "Failed to set up Allegro video"; } MarkWholeScreenDirty(); set_close_button_callback(HandleExitGameRequest); return NULL; }
void init(){ allegro_init(); set_color_depth(32); set_alpha_blender(); set_gfx_mode(GFX_AUTODETECT_WINDOWED,SCREEN_LENG_X,SCREEN_LENG_Y,0,0); install_keyboard(); install_mouse(); BUFFER=create_bitmap(SCREEN_LENG_X,SCREEN_LENG_Y); PLAYER_SPRITE_ALIVE=load_tga("img/Player.tga",NULL); PLAYER_SPRITE_DEAD=load_tga("img/Explosion.tga",NULL); BLOCK_SPRITE=load_tga("img/Block.tga",NULL); GREEN_SPIKE_SPRITE=load_tga("img/Green_Spike.tga",NULL); RED_SPIKE_SPRITE=load_tga("img/Red_Spike.tga",NULL); GATE_SPRITE=load_tga("img/Gate.tga",NULL); KEY_SPRITE=load_tga("img/Key.tga",NULL); CHECK_POINT_SPRITE_VACANT=load_tga("img/Check_Point_Vacant.tga",NULL); CHECK_POINT_SPRITE_OCCUPIED=load_tga("img/Check_Point_Occupied.tga",NULL); EXIT_SPRITE=load_tga("img/Exit.tga",NULL); CURSOR_SPRITE=load_tga("img/Cursor.tga",NULL); blue=new Color(0,0,255); red=new Color(255,0,0); green=new Color(0,255,0); yellow=new Color(255,255,0); orange=new Color(255,100,0); purple=new Color(155,0,155); black=new Color(0,0,0); white=new Color(255,255,255); m_pressed=false; m_released=false; }
static void run_demo (void) { set_color_depth (16); if (set_gfx_mode(GFX_OPENGL, width, height, 0, 0) < 0) { allegro_message ("Error setting OpenGL graphics mode:\n%s\nAllegro GL error : %s\n", allegro_error, allegro_gl_error); return; } install_keyboard(); LOCK_FUNCTION(secs_timer); LOCK_VARIABLE(secs); glClearColor (0, 0, 0, 0); glShadeModel (GL_FLAT); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glPolygonMode (GL_BACK, GL_POINTS); glEnable (GL_DEPTH_TEST); glCullFace (GL_BACK); glEnable (GL_CULL_FACE); install_int (secs_timer, 1000); do { keyboard(); rest(2); } while (!key[KEY_ESC]); remove_int (secs_timer); remove_keyboard(); }
int main() { int ok; allegro_init(); install_timer(); do { set_color_depth(8); if (set_gfx_mode (GFX_AUTODETECT, 640, 480, 0, 0) < 0) { allegro_message ("Error setting plain graphics mode:\n%s\n", allegro_error); return -1; } install_allegro_gl(); install_keyboard(); install_mouse(); ok = setup(); remove_keyboard(); remove_mouse(); if (ok) run_demo(); remove_allegro_gl(); } while (ok); return 0; }
int main(int argc, char **argv) { int i,stillhappy; int events; allegro_init (); install_keyboard (); install_timer (); set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0); set_pallete (desktop_palette); buffer = create_bitmap (scrwid, scrhei); clear (buffer); p.x=-0.9; p.y=0; q.x=0.9; q.y=0; srand(874984); frame=0; for (i=0; i<numps; i++) { randpart(&particle[i]); } while(!key[KEY_ESC]) { plotparts(); // blit (buffer, screen, 0, 0, 0, 0, scrwid, scrhei); moveparts(); // if (mymod(frame,32)==0) // plotfield(); frame=frame+speed; } }
int main() { allegro_init(); install_mouse(); install_keyboard(); set_color_depth(16); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); buffer = create_bitmap( 640, 480); show_mouse(buffer); while(!key[KEY_ESC]) { shape_menu(); get_mouse_info(); circle_fill(); if(cursor_x<=110&&cursor_y<=40) { circle_empty(); } else if(cursor_x<=110&&cursor_y>=60||cursor_y<=120) { circle_fill(); } } return 0; }
int main() { allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT,640,480,0,0); ball=load_bitmap("ball.bmp",NULL); buffer=create_bitmap(SCREEN_W,SCREEN_H); ball_x=SCREEN_W/2; ball_y=SCREEN_H/2; srand(time(NULL)); direction= rand()%4; while(!key[KEY_ESC]) { moveball(); clear_to_color(screen,makecol(256,256,256)); blit(ball,buffer,0,0,ball_x,ball_y,ball->w,ball->h); blit(buffer,screen,0,0,0,0,buffer->w,buffer->h); clear_bitmap(buffer); } destroy_bitmap(ball); destroy_bitmap(buffer); return(0); }
void kmain(kernel_boot_info_t info) { if(info.magic_number != MULTIBOOT_BOOTLOADER_MAGIC) { printk("Invalid Boot Image!"); return; } else { printk("Boot Successfull!"); } terminal_initialize(); // Disable Interrupts disable_interrupts(); install_gdt(); install_idt(); // Enable Interrupts enable_interrupts(); install_mm(&info); install_paging(&info); install_keyboard(); install_pit(); initialize_initrd(&info); list_mount_points(); while(1); }
void init() { allegro_init(); set_color_depth(32); if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 240, 0, 0)) { allegro_message("%s.", allegro_error); exit(1); } init_engine(SCREEN_W, SCREEN_H); point_at_color_buffer(&buffer); set_clipping_rect(10, 10, buffer->w - 11, buffer->h - 11); setup_projection(90.0, -1.333, 1.333, -1.0, 1.0, 0.0, 200.0); set_znear(1.0); init_clipper(); set_rasterizer_function(tex_sides); set_world_clip_func(2, wclip_to_rend_int, 0, 0, 0, 0); set_scr_clip_func(4, rend_int_to_tri, 0, 0, 0, 0); install_keyboard(); install_mouse(); srand(time(NULL)); texture = load_bitmap("data/babe_skin.bmp", NULL); }
void init_keyboard(void){ key_done=0; key_debug=0; install_keyboard(); new_int=1; NeedsPoll = keyboard_needs_poll(); }
int main (void) { int i; allegro_init (); install_keyboard (); install_mouse (); install_timer (); if (set_gfx_mode (GFX_XWINDOWS, 640, 480, 0, 0) < 0) { allegro_message ("Can not set graphics mode\n%s", allegro_error); return 0; } black = makecol (0, 0, 0); white = makecol (255, 255, 255); red = makecol (255, 0, 0); yellow = makecol (255, 255, 0); /* Clear key mappings. */ for (i = 0; i < 256; i++) keycode_to_scancode[i] = -1; /* Hook X-windows keyboard callback. */ _xwin_keyboard_callback = get_raw_keycode; show_main_dialog (); return 0; }
int main( void ) { /* first, set up Allegro and the graphics mode */ allegro_init(); /* initialize Allegro */ install_keyboard(); /* install the keyboard for Allegro to use */ 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 */ buffer = create_bitmap( SCREEN_W, SCREEN_H ); /* create buffer */ ball_x = SCREEN_W / 2; /* give the ball its initial x-coordinate */ ball_y = SCREEN_H / 2; /* give the ball its initial y-coordinate */ 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 */ /* 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( buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h ); clear_bitmap( buffer ); } /* end while */ destroy_bitmap( ball ); /* destroy the ball bitmap */ destroy_bitmap( buffer ); /* destroy the buffer bitmap */ return 0; } /* end function main */
void main() { char radius[50]; srand(time(NULL)); allegro_init(); install_keyboard(); set_color_depth(32); set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); line(screen, 320 , 0, 320, 480, makecol(255,255,0 )); line(screen, 0 , 240, 640, 240, makecol(255,255,0 )); circle (screen, 320,240,300, makecol(0,0,255)); circle (screen, 320,240,200, makecol(0,0,255)); circle (screen, 320,240,100, makecol(0,0,255)); textout_ex(screen, font, "Probabilistic Machine by Tuyama",50,10, makecol(255,0,0), -1); while( !key[KEY_ESC]){ moveCircle(); raddius = sqrt((double)((x-320)*(x-320)+(y-240)*(y-240))); textout_ex(screen, font, "radius: ", 30, 30, makecol(255,0,0), -1); if (t%100==0) { rectfill(screen, 90, 25, 150, 40, makecol(0, 0, 0)); textout_ex(screen, font, itoa(raddius, radius, 10), 100, 30, makecol(255,0,0), -1); } t+=1; } }
int main() { /* initialize */ if (allegro_init() != 0) { return 1; } install_keyboard(); install_mouse(); install_timer(); if (set_gfx_mode(GFX_AUTODETECT, 340, 380, 0, 0) != 0) { if (set_gfx_mode(GFX_SAFE, 340, 380, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set any graphic mode\n%s\n", allegro_error); return 1; } } set_palette(default_palette); /* run the dialog */ do_dialog(color_builder, -1); return 0; }
int main(int argc, char *argv[]) { allegro_init(); if (argc < 2) { allegro_message("Usage: %s files ...\n", argv[0]); return 1; } install_timer(); install_keyboard(); if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) < 0) { allegro_message("Error setting video mode.\n"); return 1; } clear_to_color(screen, makecol(255, 255, 255)); /* to achieve the max possible volume */ set_volume_per_voice(0); if (install_sound(DIGI_AUTODETECT, MIDI_NONE, 0) < 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error installing sound.\n"); return 1; } do_example(argc-1, argv+1); allegro_exit(); return 0; }
/* init: init's the element lists and allegro, returns 0 upon success * and non-zero otherwise */ int init(void) { /* init allegro */ if (allegro_init() != 0) { printf("failed to initialize..."); return 1; } set_color_depth(GFX_DEPTH); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, EDITOR_WIN_W, EDITOR_WIN_H, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Failed to init a gfxmode."); return 1; } set_window_title("GUNPOWDER MapEditor"); install_keyboard(); install_mouse(); show_mouse(screen); vscreen = create_bitmap(EDITOR_WIN_W, EDITOR_WIN_H); if (!vscreen) { close_program = 1; } /* init our lists */ load_tiles(); load_sprites(); return 0; }
//Main function int main(){ //Allegro init allegro_init(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1280, 960, 0, 0); set_window_title("Chuckie Egg"); srand(time(NULL)); //Installations install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,0); install_timer(); install_keyboard(); install_mouse(); //Close button LOCK_FUNCTION(close_button_handler); set_close_button_callback(close_button_handler); //Show menu ce_menu *menu = new ce_menu(); menu->setupMenu(); menu->showMenu(); delete menu; allegro_exit(); return 1; }
int main() { int i, wid, col, offset = 10, w = 800, h = 600; allegro_init(); set_gfx_mode(GFX_AUTODETECT_WINDOWED, w, h, 0, 0); install_timer(); install_keyboard(); for (col = 0, i = 0, wid = 0; i < 256; i++, col++) { if ((offset * col) >= screen->h) { wid += 150; col = 0; } textprintf_ex(screen, font, wid, offset * col, i, -1, "This is color %d.", i); } readkey(); allegro_exit(); return 0; }
int main(int argc, char *argv[]) { allegro_init(); install_allegro_gl(); install_keyboard(); install_mouse(); try { Juego::Inicializar() ; Juego *juego = new Juego(); juego->BuclePrincipal(); delete juego ; Juego::Cerrar(); } catch ( Excepcion &ex ) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("%s\n", ex.GetMensajeDeError().c_str()); } catch ( exception &ex ) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("%s\n", ex.what() ); } }
int main(void) { allegro_init(); install_timer(); install_keyboard(); rgb_map = malloc(sizeof(RGB_MAP)); create_rgb_table(rgb_map, desktop_palette, NULL); set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0); buffer = create_bitmap(SCREEN_W, SCREEN_H); set_projection_viewport(0, 0, SCREEN_W, SCREEN_H); init_shape(); while (!key[KEY_ESC]) { move_shape(); translate_shape(); vsync(); draw(); } destroy_bitmap(buffer); free(rgb_map); allegro_exit(); return 0; }
int cControls::Init() { install_keyboard(); install_joystick(JOY_TYPE_AUTODETECT); install_mouse(); return 0; }
void configAll(){ allegro_init(); install_timer(); install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,"OK"); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,1000,800,0,0); formation(); }
void init() { allegro_init(); set_gfx_mode(GFX_AUTODETECT_WINDOWED, XWIN, YWIN, 0, 0); clear_to_color(screen, BGC); install_keyboard(); install_mouse(); srand(time(NULL)); }
void textgfx_init() { #ifdef UNIX strcpy(_xwin.application_name, "vitetris"); strcpy(_xwin.application_class, "Vitetris"); #endif if (install_allegro(SYSTEM_AUTODETECT, &errno, NULL) != 0) exit(1); #ifdef UNIX sigaction(SIGINT, NULL, &allegro_sigint_handler); signal(SIGINT, sigint_handler); #endif load_pc8x16_font(); set_window_title(VITETRIS_VER); set_close_button_callback(close_btn); #ifndef UNIX /* Seems to cause seg fault later quite randomly on Linux */ int depth = desktop_color_depth(); if (depth != 0) set_color_depth(depth); #endif virt_screen = set_screen(getopt_int("", "fullscreen")); lang |= LATIN1; if (!font8x16) { font8x16 = font; textgfx_flags |= ASCII; } setattr_normal(); #if WIN32 && !ALLEGRO_USE_CONSOLE if (exists("stdout.tmp")) { FILE *fp; freopen("stdout2.tmp", "w", stdout); fp = fopen("stdout.tmp", "r"); if (fp) { char line[80]; int i; for (i=0; i < 25 && fgets(line, 80, fp); i++) { setcurs(0, i); i += printline(line); } fclose(fp); if (i) { refreshscreen(); if (!strncmp(line, "Press ", 6)) { install_keyboard(); clear_keybuf(); readkey(); remove_keyboard(); } } } freopen("stdout.tmp", "w", stdout); delete_file("stdout2.tmp"); } #endif }
void inicio(){ allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0); im_tortuga = load_bitmap("tortuga.bmp", NULL); // carga la imagen buffer = create_bitmap(800,600); buffer2 = create_bitmap(800,600); }
int main() { allegro_init(); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, width, height, 0, 0); bialy=makecol(200,200,200); czarny=makecol(0,0,0);//ustawienie kodow kolorow BITMAP *buffer = create_bitmap(width, height); clear_to_color(buffer, bialy); x=width/2; y=height/2;//ustawienie mrowki w centrum direction=0;//mrowka zwrocona poczatkowo w gore while (!keypressed()) { if(getpixel(buffer,x,y)==bialy)//jesli mrowka znajduje sie na polu bialym { //allegro_message("BIALY"); direction = (direction+3)%4;//obrot w lewo rectfill(buffer,x-0.5*a,y-0.5*a,x+0.5*a,y+0.5*a,czarny);//zamalowanie pola na czarno } else{ direction = (direction+5)%4;//obrot w prawo rectfill(buffer,x-0.5*a,y-0.5*a,x+0.5*a,y+0.5*a,bialy);//zamalowanie pola na bialo } x += a*moves[direction][0]; y += a*moves[direction][1];//przesuniecie mrowki w zadanym kierunku strcpy(napis,"X: "); strcat(napis,itoa(x,str,10)); strcat(napis," Y: "); strcat(napis,itoa(y,str,10)); strcat(napis," D: "); strcat(napis,itoa(direction,str,10)); textout_centre_ex(buffer, font, napis, SCREEN_W / 2, 0, makecol(255, 0, 0), makecol(0, 0, 0)); if(x<0.5*a || y<0.5*a || x>width-0.5*a || y>height-0.5*a)break; //ochrona przed wyjsciem mrowki poza ramy ekranu blit(buffer, screen, 0, 0, 0, 0, 640, 700);//wklejenie bufora na ekran rest(10);//odczekanie pomiêdzy kolejnym ruchem } readkey(); destroy_bitmap(buffer); return 0; }
int main() { int koseler[8]; 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, "Cokgen cizme 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ç koseler[0] = 10 + rand() / (RAND_MAX / (SCREEN_W - 20)); koseler[1] = 10 + rand() / (RAND_MAX / (SCREEN_H - 20)); koseler[2] = koseler[0] + rand() / (RAND_MAX / 30) + 50; koseler[3] = koseler[1] + rand() / (RAND_MAX / 30) + 50; koseler[4] = koseler[2] + rand() / (RAND_MAX / 30) - 100; koseler[5] = koseler[3] + rand() / (RAND_MAX / 30) + 50; koseler[6] = koseler[4] + rand() / (RAND_MAX / 30); koseler[7] = koseler[5] + rand() / (RAND_MAX / 30) - 100; // 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); // çokgen çiz polygon(screen, 4, koseler, renk); rest(50); } // programı sonlandır allegro_exit(); }