• Advertisement

Archived

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

Can't get bmp on screen

This topic is 5992 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

For some reason I cannot get any bitmap up on the screen. Obviously I am doing something wrong, and I suspect it might have to do with the fact that I do not know how to make a template of .bmp''s, as described in the book "Tricks..." which I am using as a reference. For any of you would-be-helpers would like the code I will post it (could you also maybe tell me how to get that special code box that some of you use?). Here is the code taken from the initialization phase : /*{ THIS CODE USES "BOB''S" AS mR. LAMOTHE REFERS TO THEM}*/ //Init phase////////////////////////////////////////////////// // load the ship Load_Bitmap_File (&bitmap8bit, "ship.bmp"); Create_BOB (&ship, 336, 596, 256, 96, 2, BOB_ATTR_SINGLE_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY); Set_Anim_Speed_BOB (&ship, 1); for (int index = 0; index < 2; index++) Load_Frame_BOB (&ship, &bitmap8bit, 0, 0, 0, BITMAP_EXTRACT_MODE_ABS); Unload_Bitmap_File (&bitmap8bit); // set position Set_Pos_BOB (&ship, 336, 596); And here is a snippet of the main game loop pertaining to the BOB/Bitmap: 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; } Move_BOB (&ship); Animate_BOB (&ship); Draw_BOB (&ship, lpddsback); ship.xv = 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 ////////////////////////////////////////////////////////// Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Please, can someone help me? I am beggining to become very frustrated. ANY help is highly regarded.

Share this post


Link to post
Share on other sites
Yeah, I remember how it was the first time I was using LaMothe''s BOB engine...it was a pain to get right, but the feeling when it worked was great!
From the code you displayed, it SEEMS to be okay, but there may be a problem in the code that wasnt posted. If you want to email me a bit of your code, I''ll take a look on my end and should be able to help you out.

jonathan_morris@hotmail.com

Share this post


Link to post
Share on other sites
One thing I did notice (although this may not neccessarily BE the problem)...I saw that you were creating a BOB with 2 frames, loading the 2 frames, and then using AnimateBob() to run the animation. Yet, your BOB attributes are BOB_ATTR_SINGLE_FRAME | BOB_ATTR_VISIBLE...I think you want BOB_ATTR_MULTI_ANIM or something along those multi-frame attributes, since it will only assume 1 frame is there, and AnimateBob() won''t really do much.
Also when you run your LoadFrameBob() loop, it''s actually only loading the same on twice.

Then again, this may have been deliberate. I dunno. It was just a thought off of what I saw.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks alot fuge I emailed you the entire (crappy) source, and also included the .BMP, in case there was something wrong with it. I tried to make a template manually, but I failed

Share this post


Link to post
Share on other sites

  • Advertisement