Programación Específica > Allegro
Problema Con Load_bitmap()
(1/1)
DarthCarl:
En mi compilador (DevC++), al utilizar este código me muestra una pantalla solo negra, sin la imagen que yo he puesto (C:\Fondo.bmp)
--- Código: Text ---#include <allegro.h> int main() { allegro_init(); install_mouse(); install_keyboard(); install_timer(); int type=JOY_TYPE_AUTODETECT; install_joystick(type); char *title="Ascyer"; int *rw,*rh; BITMAP *bitmap; const char* filename="C:\Fondo.bmp"; RGB* pal; while (!key[KEY_ESC]) { set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0); bitmap=load_bmp(filename, pal); } allegro_exit(); return 0;}END_OF_MAIN()
¿Que hago mal para que no cargue el Bitmap?
De paso, pido un manual de Allegro, pero que explique bien las funciones y en español
Salu2 y gracias
ibito:
En ningun momento estas dibujando el bitmap, solo lo estas cargando...
ademas, en cada ciclo estas haciendo un cambio de resolucion.
Prueba poniendo el set_gfx_mode y bitmap=load_bitmap arriba del while, y dentro del while pon un draw_bitmap
:comp:
CarloX:
Pruea esto:
--- Código: Text ---#include <allegro.h> BITMAP *bitmap;BITMAP *bufferint x=0,y=0; int main() { allegro_init(); install_mouse(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0); install_timer(); buffer = create_bitmap(800, 600); bitmap=load_bmp(nombredelaimagen, NULL); while (!key[KEY_ESC]) { draw_sprite(screen, bitmap, x, y); } allegro_exit(); return 0;}END_OF_MAIN()
Navegación
Ir a la versión completa