File: priklad3.cpp | Size: 767 bytes | Download file | Back to directory listing | BWPOW's homepage
#include <allegro.h>
#include <cstdio>
 
#define RES_W 800
#define RES_H 600
 
int main(void)
{
    if(allegro_init()!=0){
        fputs("Inicializacia allegra zlyhala!\n",stderr);
        return 1;
    }
 
    int depth=0;
    if((depth=desktop_color_depth())==0){
        depth=32;
    }
    if(depth<16){
        fputs("Je potrebna aspon 16-bitova farebna hlbka!\n",stderr);
        return 2;
    }
 
    set_color_depth(depth);
    if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,RES_W,RES_H,0,0)!=0){
        if(set_gfx_mode(GFX_AUTODETECT,RES_W,RES_H,0,0)!=0){
            fputs("Nepodarilo sa inicializovat graficky rezim!\n",stderr);
            return 3;
        }
    }
 
    set_gfx_mode(GFX_TEXT,0,0,0,0);
    allegro_exit();
    return 0;
}
END_OF_MAIN()