Chojrak_ Temat założony przez niniejszego użytkownika |
[Allegro] Blad przy wyswietlaniu mapy bitowej? » 2009-03-31 15:41:35 Witam, zaczelem sie bawic allegro i chcialem, aby wyswietlilo mape bitowa i teraz wazne, jesli kod wyglada tak:
[CODE src="C++" zawin]#include <allegro.h>
void init(); void deinit();
BITMAP *Buffer, *Grass;
int main() { init();
Buffer = create_bitmap(800, 600); Grass = load_bitmap("Grass.bmp", default_palette);
while ( !key[KEY_ESC]) { clear_to_color(Buffer, makecol(255, 255, 255)); blit(Buffer, screen, 0, 0, 0, 0, Buffer->w, Buffer->h); }
deinit(); return 0; } END_OF_MAIN();
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, 800, 600, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); }
install_timer(); install_keyboard(); install_mouse(); }
void deinit() { clear_keybuf(); } [/code]
To skompilowana binarka sie odpala normalnie, ale kiedy juz wyglada tak: [CODE src="C++" zawin] #include <allegro.h>
void init(); void deinit();
BITMAP *Buffer, *Grass;
int main() { init();
Buffer = create_bitmap(800, 600); Grass = load_bitmap("Grass.bmp", default_palette);
while ( !key[KEY_ESC]) { clear_to_color(Buffer, makecol(255, 255, 255)); blit(Buffer, screen, 0, 0, 0, 0, Buffer->w, Buffer->h); blit(Grass, screen, 0, 0, 778, 0, Grass->w, Grass->h); }
deinit(); return 0; } END_OF_MAIN();
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, 800, 600, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); }
install_timer(); install_keyboard(); install_mouse(); }
void deinit() { clear_keybuf(); } [/code]
Czyli kiedy wyswietli obrazek, to wyskakuje mi blad aplikacji. (Raportowanie bledow Windows (R).) |