readkey. Zdrojak mi skompiluje bez problemov. Ak vynecham prikaz blit(obr, screen, 0, 0, 200, 200, obr->w, obr->h); program bezi normalne. Pozeral som manual na www.allegro.cc a syntax by mala byt v poriadku. Tak kde robim chybu?
Vypis zdrojoveho kodu:
#include "allegro.h"
int main(void)
{
BITMAP *obr;
if (allegro_init() != 0) return 1;
install_keyboard();
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0) != 0) {
if (set_gfx_mode(GFX_SAFE, 1024, 768, 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(desktop_palette);
clear_to_color(screen, makecol(255, 255, 255));
acquire_screen();
textout_centre_ex(screen, font, "Moj prvy obrazok", SCREEN_W/2, SCREEN_H/2, makecol(255,0,0), -1);
obr = load_bitmap("obrazok.pcx", NULL);
blit(obr, screen, 0, 0, 200, 200, obr->w, obr->h);
release_screen();
readkey();
destroy_bitmap(obr);
return 0;
}
END_OF_MAIN()
Allegro - blit
Pre pridávanie komentárov sa musíte prihlásiť.
#include "allegro.h" int main(void) { BITMAP *obr; PALETTE desktop_palette; if (allegro_init() != 0) return 1; install_keyboard(); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0) != 0) { if (set_gfx_mode(GFX_SAFE, 1024, 768, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to set any graphic moden%sn", allegro_error); return 1; } } obr = load_bitmap("obrazok.pcx", desktop_palette); set_palette(desktop_palette); clear_to_color(screen, makecol(255, 255, 255)); blit(obr, screen, 0, 0, (SCREEN_W - obr->w)/2, (SCREEN_H - obr->h)/2, obr->w, obr->h); textout_centre_ex(screen, font, "Moj prvy obrazok", SCREEN_W/2, SCREEN_H*2/3, makecol(255,0,0), -1); destroy_bitmap(obr); readkey(); return 0; } END_OF_MAIN()
No a potom mal som to spustit v konzole./pokus
P.S. Existuje sposob ako to spustit kliknutim v KDE a nie v konzole?