Jump to content

  • Log In with Google      Sign In   
  • Create Account

Now I can't load a background.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Sheep   Members   -  Reputation: 152

Like
Likes
Like

Posted 24 August 2001 - 06:22 AM

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

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS