heres my code it currently allows you to move a circle around the screen but i want to replace the circle with a bitmap image
#define left 1
#define right 2
#define up 3
#define down 4
#define UpandLeft 5
#define DownandLeft 6
#define UpandRight 7
#define DownandRight 8
#include <stdio.h>
#include <allegro.h>
PALETTE *Pal;
BITMAP *ImageBuffer;
int main(void)
{
BITMAP *dblbuffer;
int x=100;
int y=100;
int lastkeypressed=0;
allegro_init();
install_keyboard();
install_timer(); /* needed for `rest' function */
// set_color_depth(24);
if (set_gfx_mode(GFX_SAFE, 800, 600, 0, 0) < 0)
{
printf("%s\n", allegro_error);
exit(1);
}
clear(screen);
// Pay attention!!! We HAVE to allocate memory for our memory bitmap
dblbuffer = create_bitmap(SCREEN_W, SCREEN_H);
clear(dblbuffer);
ImageBuffer = load_bmp("Eric.bmp", Pal);
while(1)// main loop
{
/////////////////// input
if (key[KEY_LEFT])
{
x--;
lastkeypressed=left;
}
if (key[KEY_RIGHT])
{
x++;
lastkeypressed=right;
}
if (key[KEY_UP])
{
y--;
lastkeypressed=up;
}
if (key[KEY_DOWN])
{
y++;
lastkeypressed=down;
}
if (key[KEY_LEFT] && key[KEY_UP])
{
lastkeypressed=UpandLeft;
}
if (key[KEY_LEFT] && key[KEY_DOWN])
{
lastkeypressed=DownandLeft;
}
if (key[KEY_RIGHT] && key[KEY_UP])
{
lastkeypressed=UpandRight;
}
if (key[KEY_RIGHT] && key[KEY_DOWN])
{
lastkeypressed=DownandRight;
}
//////////////////output
if (lastkeypressed=right)
{
circlefill(dblbuffer, x - 1 , y , 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=left)
{
circlefill(dblbuffer, x + 1 , y , 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=up)
{
circlefill(dblbuffer, x , y + 1, 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=down)
{
circlefill(dblbuffer, x , y - 1, 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=UpandLeft)
{
circlefill(dblbuffer, x + 1 , y + 1, 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=DownandLeft)
{
circlefill(dblbuffer, x + 1 , y - 1, 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=UpandRight)
{
circlefill(dblbuffer, x - 1 , y + 1, 50, makecol(000,000,000)); /* erase from last place */
}
if (lastkeypressed=DownandRight)
{
circlefill(dblbuffer, x - 1 , y - 1, 50, makecol(000,000,000)); /* erase from last place */
}
circlefill(dblbuffer, x , y, 50, makecol(255,255,255)); /* redraw at new place */
vsync();
blit(dblbuffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
if (key[KEY_ESC])//clean up and quit
{
// Now, remember to FREE the memory you previously allocated
destroy_bitmap(dblbuffer);
exit(1);
}
}
return 0;
}
END_OF_MAIN();
heres the warnings i got:41) : warning C4047: 'function' : 'struct RGB *' differs in levels of indirection from 'struct RGB (*)[256]'
and
41) : warning C4024: 'load_bmp' : different types for formal and actual parameter 2
also set color depth seems to make the program windowed is there anyway i can stop that and lastly is anyone have anyrecomendations for improving my code. im using msvc++6.0 windows ME and allegro 4.00