• Advertisement

Archived

This topic is now archived and is closed to further replies.

Now I can't load a background.

This topic is 5993 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement