cant get background up
I have fixed the problem of loading a bitmap up on the screen by drawing a background. But now the background doesn''t draw, but the bitmap does. It simply quits. Any help would be appreciated. Here is the code (I am using the "tricks..." console template.)
// all your initialization code goes here...
// load background image
Load_Bitmap_File(&bitmap8bit, "background.bmp");
Create_Bitmap(&background,0,0,800,600);
Load_Image_Bitmap(&background, &bitmap8bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Set_Palette(bitmap8bit.palette);
Unload_Bitmap_File(&bitmap8bit);
// load the ship
Load_Bitmap_File (&bitmap8bit, "ship.bmp");
Create_BOB (&ship,252,296 , 256, 96, 2, BOB_ATTR_SINGLE_FRAME | BOB_ATTR_VISIBLE | BOB_ATTR_WRAPAROUND, DDSCAPS_SYSTEMMEMORY);
Set_Anim_Speed_BOB (&ship, 1);
Load_Frame_BOB (&ship, &bitmap8bit, 0, 0, 0, BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File (&bitmap8bit);
// set position
Set_Pos_BOB (&ship, 252, 296);
// return success
return(1);
} // end Game_Init
int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!
int index; // looping var
// start the timing clock
Start_Clock();
// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);
// read keyboard and other devices here
DInput_Read_Keyboard();
// game logic here...
if (keyboard_state[DIK_RIGHT])
{
ship.xv = 4;
}
if (keyboard_state[DIK_LEFT])
{
ship.xv = -4;
}
if (keyboard_state [DIK_UP])
{
ship.yv = -4;
}
if (keyboard_state [DIK_DOWN])
{
ship.yv = 4;
}
Move_BOB (&ship);
Draw_BOB (&ship, lpddsback);
ship.xv = 0;
ship.yv = 0;
// flip the surfaces
DDraw_Flip();
// sync to 30ish fps
Wait_Clock(30);
// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE])
{
PostMessage(main_window_handle, WM_DESTROY,0,0);
} // end if
// return success
return(1);
} // end Game_Main
toooooooooo many &signs for me
this doesnt look lik OGL so I guess its direct x. Post it in the direct x forum.

"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement