Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/04/2011, 16:46
santi_93
 
Fecha de Ingreso: junio-2010
Mensajes: 18
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: PROBLEMA CON ALLEGRO y C++

#include <allegro.h>

int main (){

allegro_init ();
install_mouse ();
install_keyboard ();
set_color_depth (16);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
set_window_title ("Game");
BITMAP *Buffer = create_bitmap (640, 480);
BITMAP *BackgroundImage = load_bitmap ("photo.bmp", NULL);

bool santi = false;

int x, y;
x = 0;
y = 400;

while (!santi) {

if (key[KEY_UP])
y -= 5;
if (key[KEY_DOWN])
y += 5;
if (key[KEY_LEFT])
x -= 5;
if (key[KEY_RIGHT])
x += 5;

blit (BackgroundImage, Buffer, 0, 0, 0, 0, 640, 480);
rectfill(Buffer, x, y, x+10, y+10, makecol (255, 0, 0));
blit (Buffer, screen, 0, 0, 0, 0, 640, 480);
rest (60);
clear_bitmap (Buffer);

if (key[KEY_ESC])
santi = true;

}

return 0;
}
END_OF_MAIN()

El codigo es algo asi, nose como hacer para subirlo con el coso fachero ese del comentario de arriba pero bueno, para que masomenos entiendan. Muchas gracias