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; }
void draw_matrix(matrix_t *m, char *name, char *dirname){ allegro_init(); set_color_depth( 16 ); BITMAP * obrazek1 = NULL; obrazek1 = create_bitmap( m->cn*10, m->rn*10 ); if( !obrazek1 ) { set_gfx_mode( GFX_TEXT, 0, 0, 0, 0 ); allegro_message( "nie mogę załadować obrazka 1 !" ); allegro_exit(); } clear_to_color( obrazek1, makecol( 255, 255, 255 ) ); int i,j; for (i = 0; i < m->rn; i++) for (j = 0; j < m->cn ; j++) if(m->e[i*m->cn+j]==1) rectfill( obrazek1, j*10, i*10, (j*10)+10,(i*10)+10,makecol( 0, 0, 0 ) ); chdir(dirname); save_bitmap(name, obrazek1, default_palette); chdir(PARENT_DIRECTORY); destroy_bitmap( obrazek1 ); allegro_exit(); }
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; }
void RGBHistogram::display() { #ifdef ALLEGRO int winwid=640,winhei=480; set_color_depth(24); allegrosetup(winwid,winhei); PALETTE pal; generate_332_palette(pal); set_palette(pal); float rot=pi/4,elev=pi/8,rotspeed=pi/64; int smallize=largest(); PPsetup(winwid,winhei,3); BITMAP *b=create_bitmap(winwid,winhei); do { clear(b); Matrix m1=Matrix(); m1.makerotation(V3d(0,1,0),rot); Matrix m2=Matrix(); m2.makerotation(V3d(1,0,0),elev); for (int i=0;i<quant;i++) { for (int j=0;j<quant;j++) { for (int k=0;k<quant;k++) { V3d c=V3d(i,j,k); c=c/c.getlongestside(); c=c*(float)rgb[i][j][k]/smallize*255; // c=c*255; c.chop(0,255); if (c.getlongestside()>64) { V3d v=2*(V3d(i,j,k)/quant-V3d(.5,.5,.5)); // v=V3d::rotate(v,V3d(0,1,0),rot); // v=V3d::rotate(v,V3d(1,0,0),elev); v=m1*v; v=m2*v; V3d u=v+V3d(.02,0,0); int x,y,rx,dx; PPgetscrpos(v,&x,&y); PPgetscrpos(u,&rx,&dx); dx=rx-x; circle(b,x,y,dx,makecol(c.x,c.y,c.z)); } } } } blit(b,screen,0,0,0,0,winwid,winhei); if (key[KEY_LEFT]) rot-=rotspeed; if (key[KEY_RIGHT]) rot+=rotspeed; if (key[KEY_UP]) elev-=rotspeed; if (key[KEY_DOWN]) elev+=rotspeed; if (key[KEY_Z]) smallize=smallize*1.2; if (key[KEY_X]) smallize=smallize/1.2; } while (!key[KEY_ESC]); #endif }
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 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 }
SCREEN::SCREEN(int width, int height, bool windowed, bool db, bool videobuf_tiles) : w(width), h(height), doublebuffer(db) { if (!doublebuffer) { // page flipping // set graphics mode set_color_depth(32); if (set_gfx_mode((windowed ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN), width, height, width, height * 2) != 0) { // get video memory now (smart drivers) printf("warning: set_gfx_mode(): %s\n", allegro_error); if (set_gfx_mode((windowed ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN), width, height, 0, 0) != 0) { // just open screen now and hope we can get the video memory later (DirectX) printf("warning: set_gfx_mode(%dx%d): %s\n", width, height, allegro_error); panic("failed to open screen with requested resolution"); } } // get video memory video_page[0] = create_video_bitmap(width, height); video_page[1] = create_video_bitmap(width, height); if (videobuf_tiles) video_page[2] = create_video_bitmap(width + 2 * WORLD_RENDER_BORDER_SIZE, height + 2 * WORLD_RENDER_BORDER_SIZE); else video_page[2] = NULL; // error if (!video_page[0] || !video_page[1]) panic("unable to acquire sufficient video memory for requested resolution"); if (!video_page[2] && videobuf_tiles) printf("unable to acquire video memory for tile background; using a memory bitmap instead"); // set current screen video_page_offscreen = 0; offscreen = video_page[video_page_offscreen]; // flip page flip_page(); } else { // double buffering set_color_depth(32); if (set_gfx_mode((windowed ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN), width, height, 0, 0) != 0) { // double buffering printf("warning: set_gfx_mode(%dx%d): %s\n", width, height, allegro_error); panic("failed to open screen with requested resolution"); } video_page[0] = create_bitmap(width, height); video_page[1] = NULL; video_page[2] = NULL; offscreen = video_page[0]; } gui_set_screen(offscreen); // for the allegro gui routines }
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; }
void __fastcall TMainCaptureForm::FormCreate(TObject *Sender) { CaptureWorkerForm = new TCaptureWorkerForm(this); CaptureWorkerForm1 = new TCaptureWorkerForm(this); CaptureWorkerForm2 = new TCaptureWorkerForm(this); CaptureWorkerForm3 = new TCaptureWorkerForm(this); MainCaptureForm->Caption = UnicodeString("CES Video Stream, version ") + getVersion(); //There has to be some option other than silent failure and dialog box, but I haven't found it yet. // _control87(MCW_EM, MCW_EM); //Turn off FPU generated floating point exceptions. Threads still fail however. _control87( 0x1372, 0x137F ); //turns on dialog exceptions, but not in TThread. Exceptions in TThread cause the thread to die. pBmpRec=new Graphics::TBitmap; pBmpRec-> LoadFromFile("Rec.bmp"); pBmpRecGr=new Graphics::TBitmap; pBmpRecGr-> LoadFromFile("Rec-gr.bmp"); pBmpPau=new Graphics::TBitmap; pBmpPau->LoadFromFile("Pau.bmp"); pBmpPauGr=new Graphics::TBitmap; pBmpPauGr->LoadFromFile("Pau-gr.bmp"); //set default output folder to c:\Users\currentUser\Desktop\capture // char pathC[MAX_PATH]; // SHGetSpecialFolderPath(NULL, pathC, CSIDL_DESKTOP, 1); // edOutput->Text = UnicodeString(pathC) + "\\capture"; frameThread = NULL; frameThread1 = NULL; frameThread2 = NULL; frameThread3 = NULL; hMutex = CreateMutex(0,false,0); hMutex1 = CreateMutex(0,false,0); hMutex2 = CreateMutex(0,false,0); hMutex3 = CreateMutex(0,false,0); BitBtnStop->Enabled = false; FrameDivisorEditChange(this); SpatialDivisorEditChange(this); allegro_init(); set_gdi_color_format(); set_color_depth(CDEPTH); nFrames=0; SetToVideoMode(); // let's refresh the controls according to the TVideoGrabber's states AssignListToComboBox (cbVideoInputDevice, CaptureWorkerForm->VideoGrabber->VideoDevices, CaptureWorkerForm->VideoGrabber->VideoDevice); AssignListToComboBox (cbVideoInputDevice1, CaptureWorkerForm1->VideoGrabber->VideoDevices, CaptureWorkerForm1->VideoGrabber->VideoDevice); AssignListToComboBox (cbVideoInputDevice2, CaptureWorkerForm2->VideoGrabber->VideoDevices, CaptureWorkerForm2->VideoGrabber->VideoDevice); AssignListToComboBox (cbVideoInputDevice3, CaptureWorkerForm3->VideoGrabber->VideoDevices, CaptureWorkerForm3->VideoGrabber->VideoDevice); }
Game::Game() :mPauseButtonPressed(false), mLevel(NULL) { allegro_init(); install_keyboard(); install_mouse(); set_window_title("Dr. Madness Or: How Fluffy Love Learned to Stop " "Worrying and Love The Bomb"); int driver = GFX_AUTODETECT_FULLSCREEN; set_color_depth(32); if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) { set_color_depth(24); if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) { set_color_depth(16); if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) { set_color_depth(15); if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) { throw DBSH07_EXCEPTION("Unable to set graphics mode."); } } } } install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL); initTimer(); mScreenBuffer = create_bitmap(640, 480); mBuffer = create_bitmap(320, 240); mSplashScreen = new SplashScreen(); mEnding = new Ending(); initGui(); initMusic(); setState(SPLASHSCREEN); }
int main(void) { BITMAP *bmp; allegro_init(); install_keyboard(); jpgalleg_init(); set_color_depth(32); if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0)) { set_color_depth(16); if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0)) { set_color_depth(15); if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0)) { allegro_message("Unable to init truecolor 640x480 gfx mode: %s", allegro_error); return -1; } } } clear(screen); bmp = load_bitmap("cat.tga", NULL); if (!bmp) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error loading cat.tga\n"); return -1; } blit(bmp, screen, 0, 0, 0, 0, bmp->w, bmp->h); readkey(); if (save_jpg("savedcat.jpg", bmp, NULL)) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error saving savedcat.jpg (error code %d)\n", jpgalleg_error); return -1; } destroy_bitmap(bmp); return 0; }
int main( void ) { int depth; /* represents color depth */ /* 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 ); depth = desktop_color_depth(); /* find out what color depth is on our computer */ if (depth == 0) depth = 32; set_color_depth( depth ); /* set the color depth to depth used by our computer */ set_gfx_mode( GFX_AUTODETECT_WINDOWED, 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 the ball its initial x-coordinate */ ball_y = SCREEN_H / 2; /* give the 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 ); /* 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 */
/** * Initialises the Allegro application. This function creates the global * Gui object that can be populated by various examples. */ void init() { // We simply initialise Allegro as we would do with any Allegro application. allegro_init(); int bpp = desktop_color_depth(); if (bpp == 0) { bpp = 16; } set_color_depth(bpp); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0)) { if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0)) { throw FCN_EXCEPTION("Unable to set graphics mode"); } } screenBuffer = create_bitmap(SCREEN_W, SCREEN_H); if (screenBuffer == NULL) { throw FCN_EXCEPTION("Unable to create a screen buffer"); } install_keyboard(); install_mouse(); install_timer(); // Now it's time to initialise the Guichan Allegro back end. imageLoader = new fcn::AllegroImageLoader(); // The ImageLoader Guichan should use needs to be passed to the Image object // using a static function. fcn::Image::setImageLoader(imageLoader); graphics = new fcn::AllegroGraphics(); // Set the target for the graphics object to be the doublebuffer // for the screen. Drawing to the screen directly is not a good // idea, as it will produce flicker, unless you use page flipping. graphics->setTarget(screenBuffer); input = new fcn::AllegroInput(); // Now we create the Gui object to be used with this Allegro application. globals::gui = new fcn::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 Allegro implementations of these objects hence making Guichan // able to utilise Allegro. globals::gui->setGraphics(graphics); globals::gui->setInput(input); }
void S9xTextMode () { if (!in_text_mode) { set_color_depth (8); remove_keyboard (); remove_mouse (); set_gfx_mode (GFX_TEXT, 0, 0, 0, 0); in_text_mode = TRUE; } }
void Game::privChangeResolution( bool aWindowed ) { myWindowed = aWindowed; int driver; if (myWindowed) { driver = GFX_AUTODETECT_WINDOWED; myResolutionWidth = 640; myResolutionHeight = 480; } else { driver = GFX_AUTODETECT_FULLSCREEN; if (myWideScreen) { myResolutionWidth = 1280; myResolutionHeight = 720; } else { myResolutionWidth = 640; myResolutionHeight = 480; } } set_color_depth(32); if (set_gfx_mode(driver, myResolutionWidth, myResolutionHeight, 0, 0) < 0) { set_color_depth(24); if (set_gfx_mode(driver, myResolutionWidth, myResolutionHeight, 0, 0) < 0) { set_color_depth(16); if (set_gfx_mode(driver, myResolutionWidth, myResolutionHeight, 0, 0) < 0) { set_color_depth(15); if (set_gfx_mode(driver, myResolutionWidth, myResolutionHeight, 0, 0) < 0) { throw std::string("Unable to set graphics mode."); } } } } }
int main(int argc, char *argv[]) { BITMAP *Image; PALETTE Pal; ILuint Id; if (argc != 2) { printf("Please specify a filename.\n"); return 1; } ilInit(); ilGenImages(1, &Id); ilBindImage(Id); ilLoadImage(argv[1]); // if (ilGetInteger(IL_IMAGE_FORMAT) == GL_BGR || // ilGetInteger(IL_IMAGE_FORMAT) == GL_BGRA) ilSwapColours(); Image = (BITMAP*)ilutConvertToAlleg(Pal); allegro_init(); install_keyboard(); if (ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL) == 8) { set_color_depth(8); set_palette(Pal); } else set_color_depth(32); set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); blit(Image, screen, 0, 0, (SCREEN_W - Image->w) / 2, (SCREEN_H - Image->h) / 2, Image->w, Image->h); destroy_bitmap(Image); readkey(); return 0; }
/* _set_gfx_mode_safe: * Special wrapper used when the card parameter of set_gfx_mode() * is GFX_SAFE. In this case the function tries to query the * system driver for a "safe" resolution+driver it knows it will * work, and set it. If the system driver cannot get a "safe" * resolution+driver, it will try the given parameters. */ static int _set_gfx_mode_safe(int card, int w, int h, int v_w, int v_h) { char buf[ALLEGRO_ERROR_SIZE], tmp1[64]; struct GFX_MODE mode; int ret, driver; ASSERT(card == GFX_SAFE); ASSERT(system_driver); TRACE(PREFIX_I "Trying to set a safe graphics mode.\n"); if (system_driver->get_gfx_safe_mode) { ustrzcpy(buf, sizeof(buf), allegro_error); /* retrieve the safe graphics mode */ system_driver->get_gfx_safe_mode(&driver, &mode); TRACE(PREFIX_I "The system driver suggests %dx%dx%d\n", mode.width, mode.height, mode.bpp); /* try using the specified resolution but current depth */ if (_set_gfx_mode(driver, w, h, 0, 0, TRUE) == 0) return 0; ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, buf); /* finally use the safe settings */ set_color_depth(mode.bpp); if (_set_gfx_mode(driver, mode.width, mode.height, 0, 0, TRUE) == 0) return 0; ASSERT(FALSE); /* the safe graphics mode must always work */ } else { TRACE(PREFIX_W "The system driver was unable to get a safe mode, " "I'll try with the specified parameters...\n"); /* no safe graphics mode, try hard-coded autodetected modes with * custom settings */ _safe_gfx_mode_change = 1; ret = _set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0, TRUE); _safe_gfx_mode_change = 0; if (ret == 0) return 0; } /* failing to set GFX_SAFE is a fatal error */ TRACE(PREFIX_E "Bad bad, not even GFX_SAFE works?\n"); _set_gfx_mode(GFX_TEXT, 0, 0, 0, 0, TRUE); allegro_message(uconvert_ascii("%s\n", tmp1), get_config_text("Fatal error: unable to set GFX_SAFE")); return -1; }
int main(int argc, char *argv[]) { ////////////////////////////////////////////////////////////////////////// allegro_init(); // Initialize Allegro install_keyboard(); set_close_button_callback(quit_function); FreeImage_Initialise(TRUE); create_cycles_table(); Configuration cfg; cfg.Process(argc, argv); if (cfg.continue_processing) { quiet=true; rasta.Resume(); rasta.cfg.continue_processing=true; quiet=false; } else rasta.SetConfig(cfg); screen_color_depth = desktop_color_depth(); get_desktop_resolution(&desktop_width,&desktop_height); set_color_depth(screen_color_depth); if (!rasta.cfg.preprocess_only) { if (desktop_width>=320*3) set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320*3,480,0,0); else set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480,0,0); // Change our graphics mode to 640x480 set_display_switch_mode(SWITCH_BACKGROUND); set_close_button_callback(close_button_procedure); set_window_title(rasta.cfg.command_line.c_str()); } else quiet=true; rasta.LoadAtariPalette(); rasta.LoadInputBitmap(); if (rasta.ProcessInit()) { rasta.FindBestSolution(); rasta.SaveBestSolution(); } return 0; // Exit with no errors }
int main(int argc, char **argv) { allegro_init(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, SCRW, SCRH, 0, 0); install_keyboard(); install_mouse(); install_timer(); LOCK_VARIABLE(timer); LOCK_FUNCTION(timerupdate); install_int_ex(timerupdate, BPS_TO_TIMER(TIMER_BPS)); srand((unsigned)time(NULL)); set_window_title("Skat"); LOCK_FUNCTION(close_handler); set_close_button_callback(close_handler); cards = load_bitmap("images/cards.tga", NULL); game.p[0] = &human; game.p[1] = &cpu1; game.p[2] = &cpu2; human.choose_card = human_choose_card; cpu1.choose_card = cpu_choose_card; cpu2.choose_card = cpu_choose_card; human.choose_game = human_choose_game; cpu1.choose_game = cpu_choose_game; cpu2.choose_game = cpu_choose_game; human.reizen = human_reizen; cpu1.reizen = cpu_reizen; cpu2.reizen = cpu_reizen; human.schieben = human_schieben; cpu1.schieben = cpu_schieben; cpu2.schieben = cpu_schieben; human.kontra = human_kontra; cpu1.kontra = cpu_kontra; cpu2.kontra = cpu_kontra; human.name = "Stefan"; cpu1.name = "Robert"; cpu2.name = "Thomas"; human.rtext = cpu1.rtext = cpu2.rtext = NULL; human.total_points = 0; cpu1.total_points = 0; cpu2.total_points = 0; enable_hardware_cursor(); show_mouse(screen); buffered_do_dialog(main_dlg, -1); destroy_bitmap(cards); }
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, 1440, 900, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1);} install_timer(); install_keyboard(); install_mouse(); }
void init() { allegro_init(); install_mouse(); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); buffer = create_bitmap(SCREEN_W, SCREEN_H); srand(time(NULL)); }
int main() { // programı ilklendir allegro_init(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0); install_keyboard(); while(!key[KEY_ESC]) { } allegro_exit(); }
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, 960, 600, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } install_keyboard(); }
BITMAP *initiate_im(matrix_t *matrix){ allegro_init(); set_color_depth( 8 ); BITMAP * pic1 = NULL; pic1 = create_bitmap( 50*matrix->cn, 50*matrix->rn); if( !pic1 ) { set_gfx_mode( GFX_TEXT, 0, 0, 0, 0 ); allegro_message( "nie mogę załadować obrazka 1 !" ); allegro_exit(); return NULL; } return pic1; }
int main(int argc, char **argv) { bool fullScreen; int windowW, windowH; srand(time(0)); allegro_init(); install_keyboard(); install_mouse(); install_timer(); install_joystick(JOY_TYPE_AUTODETECT); set_color_depth(32); CheckMIDIs(); set_config_file("trog.cfg"); CfgLoad(); set_gfx_mode(cfgFull ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, std::atoi(cfgW), std::atoi(cfgH), 0, 0); install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, 0); set_window_title("The Revenge of Gregorius"); set_display_switch_mode(SWITCH_BACKGROUND); set_display_switch_callback(SWITCH_OUT, &SwitchOut); LoadSoundVolumes("sounds.cfg"); game.Init(); bool notQuit = true; while(notQuit) { int ret = MainMenu(); switch(ret) { case 0: game.zoomMode = cfgZoom; game.Start(-1); break; case 1: DoConfiguration(); break; case 2: notQuit = false; break; } } return 0; }
int main( void ) { BITMAP *bmp; /* pointer to the bitmap */ allegro_init(); /* initialize Allegro */ install_keyboard(); /* allow Allegro to recieve keyboard input */ set_color_depth( 16 ); /* set the color depth to 16-bit */ set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0 ); /* set graphics mode */ bmp = load_bitmap( "picture.bmp", NULL ); /* load the bitmap file */ blit( bmp, screen, 0, 0, 0, 0, bmp->w, bmp->h ); /* draw the bitmap */ readkey(); /* wait for a keypress */ destroy_bitmap( bmp ); /* free the memory allocated to bmp */ return 0; } /* end function main */
void allegro_video_init() { int c; set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); video_blit_memtoscreen = allegro_blit_memtoscreen; video_blit_memtoscreen_8 = allegro_blit_memtoscreen_8; for (c = 0; c < 256; c++) pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2); buffer32_vscale = create_bitmap(2048, 2048); }
void announceWinner() { //announces the winner if( turn == 1){ textout_ex( screen, font, "X Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); }else { textout_ex( screen, font, "Y Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); } void checkWin() { //checks for a winner } void drawXO() { //draws in the X and O } void moveBox() { //takes input } int main() { //now we actually build it allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); xSprite = load_bitmap("x.bmp", NULL); oSprite = load_bitmap("o.bmp", NULL); setupBoard(); while(!key[KEY_ESC]){ moveBox(); } destroy_bitmap(xSprite); destroy_bitmap(oSprite); return 0; }
// Procédure d'ouverture du mode graphique Allegro void initAllegro() { set_uformat(U_ASCII); allegro_init(); // Souris allegro install_mouse(); install_keyboard(); install_timer(); set_color_depth(32); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED,1000,550,0,0)!=0) { set_color_depth(24); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED,1000,550,0,0)!=0) { allegro_message("probleme ouverture mode graphique"); allegro_exit(); exit(EXIT_FAILURE); } } // Souris allegro show_mouse(screen); //initialisation du temps de prise de saisie set_keyboard_rate(300,100); }