当前位置: 首页>>代码示例>>C++>>正文


C++ set_gfx_mode函数代码示例

本文整理汇总了C++中set_gfx_mode函数的典型用法代码示例。如果您正苦于以下问题:C++ set_gfx_mode函数的具体用法?C++ set_gfx_mode怎么用?C++ set_gfx_mode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_gfx_mode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_gfx_mode

//returns a pointer to FONT (char *aFilename) and shows
//error message on failure
FONT *makeFont(char *aFilename)
{
	FONT *fontPointer;
	if (!(fontPointer = load_font(aFilename, palette, NULL)))
	{
      set_gfx_mode(GFX_TEXT, 1024,768,0,0);
		allegro_message("Error! Could not find the file \"%s\"!", aFilename);
		exit(1);
	}
	return(fontPointer);
}
开发者ID:ChrisCooper,项目名称:Flight-Path,代码行数:13,代码来源:Initializations.cpp

示例2: tui_init

void tui_init(void)
{
    set_gfx_mode(GFX_TEXT, 80, 25, 0, 0);

    /* FIXME: this should be made more flexible, to handle other screen modes
       automatically. */
    _set_screen_lines(25);

    gettextinfo(&text_mode_info);
    /* _setcursortype(_NOCURSOR); */
}
开发者ID:martinpiper,项目名称:VICE,代码行数:11,代码来源:tui_backend.c

示例3: main

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 */
开发者ID:rjgodia30,项目名称:bcit-courses,代码行数:54,代码来源:fig15_12.c

示例4: set_color_depth

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.");
				}
			}
		}
	}
}
开发者ID:olofn,项目名称:db_public,代码行数:41,代码来源:Game.cpp

示例5: memverify_str

void memverify_str(void *pointer, char *str)
{
 if(!pointer)
 {
  set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
  if(str)
   allegro_message("The program that you are running has run out of memory, and cannot continue. %s ", str);
  else 
   allegro_message("The program that you are running has run out of memory, and cannot continue.");
  exit(EXIT_FAILURE);
 }
}
开发者ID:rofl0r,项目名称:GfxRip,代码行数:12,代码来源:bgui.c

示例6: allegro_init

//contrutor
int ControleGrafico::IniciaAllegro()
{
    //inicia o allegro
    allegro_init();
    //..o teclado
	install_keyboard();
	 // .. 16 bits de cores
    set_color_depth(16); 

   // (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 800, 600, 0, 0) != 0)
   //.. se criar a janela do jogo no tamanho de 640x480
   if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) != 0)
   {  //.. sei la set alguma coisa
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      //fala pro usuario que deu merda ..
      allegro_message("Nao foi possivel selecionar modo grafico algum.\n%s\n", allegro_error);
      return 0;
   }

   return 1;
}
开发者ID:gabrielpsilva,项目名称:Allegro-Tank-Game,代码行数:22,代码来源:ControleGrafico.cpp

示例7: get_desktop_resolution

// Construct state
init::init(){
  // Get graphics resolution
  int width;
  int height;
  get_desktop_resolution( &width, &height);

  // Set graphics mode
  set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 640, 0, 0);

  // Title
  set_window_title( "Minesweeper - A.D.S. Games");
}
开发者ID:ADSgames,项目名称:MineSweeper,代码行数:13,代码来源:init.cpp

示例8: shutdown_gfx

/* shutdown_gfx:
 *  Used by allegro_exit() to return the system to text mode.
 */
static void shutdown_gfx(void)
{
   if (gfx_driver)
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);

   if (system_driver->restore_console_state)
      system_driver->restore_console_state();

   _remove_exit_func(shutdown_gfx);

   gfx_virgin = TRUE;
}
开发者ID:Skiles,项目名称:aseprite,代码行数:15,代码来源:graphics.c

示例9: initialize

int initialize(){
    allegro_init();
    install_timer();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode(MODE,WIDTH,HEIGHT,0,0);
    srand(time(NULL));
    buffer=create_bitmap(SCREEN_W,SCREEN_H);
    clear(buffer);
    if(install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,"")!=0){
        allegro_message("Error initializing sound system");
        return 0;
    }
    welcome=load_bitmap("welcome.bmp",NULL);
     instruction1=load_bitmap("instruction1.bmp",NULL);
     instruction2=load_bitmap("instruction2.bmp",NULL);
      instruction3=load_bitmap("instruction3.bmp",NULL);
       gameoverscreen=load_bitmap("gameover.bmp",NULL);
       if(!welcome || !instruction2 || ! instruction3 || !instruction1 || ! gameoverscreen){
        set_gfx_mode(GFX_TEXT,0,0,0,0);
        allegro_message("WELCOME BMPS MISSING");
        return 0;
       }
    //level1=load_sample("stage1.wav");
    /*if(!level1){
        allegro_message("No sound file");
        return 0;
    }*/
        if(MapLoad("level1.fmp")){
        set_gfx_mode(GFX_TEXT,0,0,0,0);
        allegro_message("Can't find level1.fmp");
        return 0;
    }
    LOCK_FUNCTION(timer1);
    LOCK_VARIABLE(ticks);
    LOCK_VARIABLE(framerate);
    LOCK_VARIABLE(counter);
    install_int(timer1,100);
    return 1;
}
开发者ID:devkotasabin,项目名称:Horizontal-Scrolling-Shooting-Game,代码行数:40,代码来源:contra.cpp

示例10: change_resolution

int change_resolution(int fullscreen, int ResIndex)
{
    int screen_mode;
    if(!IsInstalled)
    {
        return install(fullscreen,800,480,32); //Security mesure
    }

    KillTextures();
    allegro_gl_set(AGL_COLOR_DEPTH, Resolutions->mode[ResIndex].bpp);
    if(fullscreen)
        screen_mode=GFX_OPENGL_FULLSCREEN;
    else
        screen_mode=GFX_OPENGL_WINDOWED;

    if (set_gfx_mode(screen_mode, Resolutions->mode[ResIndex].width,Resolutions->mode[ResIndex].height, 0, 0))
    {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("Unable to set graphic mode\n%s\n", allegro_error);
        return 1;
    }

    SetOpenGL2D();
    RefreshGLTextures();
    AspectRatio=(float)SCREEN_W/(float)SCREEN_H;
    Fullscreen=fullscreen;
    Width=Resolutions->mode[ResIndex].width;
    Height=Resolutions->mode[ResIndex].height;
    depth=Resolutions->mode[ResIndex].bpp;
    ResolutionIndex=ResIndex;
    set_config_file("Resources/Setting.cfg");
    set_config_int("graphics","Fullscreen",Fullscreen);
    set_config_int("graphics","Width",Width);
    set_config_int("graphics","Height",Height);
    set_config_int("graphics","depth",depth);
    set_config_int("graphics","ResolutionIndex",ResIndex);
    flush_config_file();
    LoadSavegame();
    return 0;
}
开发者ID:iBicha,项目名称:esprit-2013-1a3-sharp-vision-sharp-fighter,代码行数:40,代码来源:Install.c

示例11: main

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);
}
开发者ID:ThomasWitte,项目名称:sskat,代码行数:52,代码来源:skat.c

示例12: main

int main(void)
{
   if (allegro_init() != 0)
      return 1;
   install_keyboard();
   set_color_depth(32);
   if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0) != 0) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Unable to set a 640x480x32 windowed mode\n%s\n", allegro_error);
      return 1;
   }

   memread_test();

   stdio_read_test();

   stdio_seek_test();

   stdio_write_test();

   return 0;
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:22,代码来源:expackf.c

示例13: main

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();
}
开发者ID:erdemoncel,项目名称:allegro,代码行数:13,代码来源:uzaykapisi.c

示例14: main

int main(int argc, char *argv[])
{
    BITMAP *buffer;

    allegro_init();
    install_keyboard();
    install_timer();
    int buttons = install_mouse();

    set_color_depth(32);
    if (set_gfx_mode(GFX_AUTODETECT, 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;
    }


    uclock_t start;
    buffer = create_bitmap(SCREEN_W, SCREEN_H);


    zelda::image::Image *img = new zelda::image::Image;
    img->load_pcx("./pics/test3.pcx");

    while (!key[KEY_ESC]) {

        blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
        blit(img->get_bmp(), screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);

        start = uclock();
        while (uclock() < start + UCLOCKS_PER_SEC / 1500)
            ;
        //usleep(50000);

    }

    destroy_bitmap(buffer);
    return 0;
}
开发者ID:v-zor,项目名称:games.for.dosbox,代码行数:39,代码来源:MAIN.CPP

示例15: init

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();
}
开发者ID:junian,项目名称:HilbertCurveGenerator,代码行数:13,代码来源:hilbert.cpp


注:本文中的set_gfx_mode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。