From: Henrik S. <hb...@ks...> - 2002-07-28 16:32:46
|
On Tue, 23 Jul 2002, Eric Botcazou wrote: > > I found the problem with v4.0.1 and switching from windowed to fullscreen. > > Windowed to fullscreen or the other way around ? > Windowed to fullscreen > > If my desktop is 32 bit and I do set less with set_color_depth() in my > > application switching will fail. It does only work if both are equal. > > Did you change the color depth (i.e call set_color_depth more than once) ? > It fails with only one set_color_depth() > > Can you fix ? > > I'll try. > Thanks Henrik Here is one small program I use to reproduce : ------------------------------------------------- #include <stdlib.h> #include <allegro.h> static int fullscreen,restore; BITMAP *ScreenBuf; void switch_callback(void) { restore = TRUE; } void RestoreScreen(void) { scare_mouse(); acquire_screen(); blit(ScreenBuf,screen,0,0,0,0,800,600); release_screen(); unscare_mouse(); } void ToggleGFXMode(void) { if ( fullscreen == TRUE ) { set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0); fullscreen = FALSE; } else { set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0); fullscreen = TRUE; } set_display_switch_mode(SWITCH_PAUSE); set_display_switch_callback(SWITCH_IN,switch_callback); show_mouse(NULL); RestoreScreen(); show_mouse(screen); } int main(void) { int input; allegro_init(); install_keyboard(); install_timer(); install_mouse(); // if desktop is 32 bit and color depth is set to 16 // switch fails !!!! //set_color_depth(32); set_color_depth(16); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,600,0,0)) return -1; set_display_switch_mode(SWITCH_PAUSE); set_display_switch_callback(SWITCH_IN,switch_callback); fullscreen = FALSE; ScreenBuf = create_bitmap(800,600); rectfill(ScreenBuf,0,0,800-1,600-1,makecol(255,0,0)); show_mouse(screen); while (TRUE) { if ( keypressed() ) { input = readkey(); if (input == KEY_W << 8 ) ToggleGFXMode(); else if (input >> 8 == KEY_ESC ) break; } } return 0; } END_OF_MAIN() |