Jump to content
  • Advertisement
Sign in to follow this  
Zdman

the bitmap doesn't show up

This topic is 4972 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've got code that executes but I can't seem to make it draw to the screen this is my main code
CDisplay my_dx;

struct sprite
{
	CSurface *lpCD;
	LPDIRECTDRAWSURFACE7 lpDDS;
	int width;
	int height;
	int x;
	int y;
	RECT blit;
};

sprite my_sprite;
LPDIRECTDRAWPALETTE my_palette;

		my_sprite.width = 32;
		my_sprite.height = 32;
		my_sprite.x = 0;
		my_sprite.y = 0;

		my_sprite.blit.left = 0;
		my_sprite.blit.right = 32;
		my_sprite.blit.top = 0;
		my_sprite.blit.bottom = 32;

		if(my_dx.CreateSurfaceFromBitmap(&my_sprite.lpCD, "test.bmp", my_sprite.width, my_sprite.height) == S_OK)
		{
			my_sprite.lpDDS = my_sprite.lpCD->GetDDrawSurface();
		};

		//if(my_dx.CreatePaletteFromBitmap(&my_palette, "test.bmp") == DD_OK)
		//{
		//	if(my_dx.SetPalette(my_palette) == DD_OK)
		//		MessageBox(hwnd, "Success", "Success", MB_OK);
		//};
		
		while (1)
		{
		
			if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
			{
				if (msg.message == WM_QUIT)
					break;
				// Get any accelerator keys
				TranslateMessage(&msg);
				// Do what the message was
				DispatchMessage(&msg);
			} else {
					if(my_dx.Blt(0, 0, my_sprite.lpCD, &my_sprite.blit) != S_OK)
						MessageBox(hwnd, "Error", "Error", MB_OK);

				
			};

		} // end while
	};

I'm using ddutil right now i'm just trying to figure out to get it on the screen, so don't worry about colorkey's just yet. I'll worry about that after I figure out why it won't draw anyways. [Edited by - Coder on January 3, 2005 8:02:54 AM]

Share this post


Link to post
Share on other sites
Advertisement
I have..... I originally tried learning straight from that but couldn't get it to work like I wanted. Then I found out about the ddutil. It's got alot of kool functions and this should be working but it has to do with loading or something. I don't know the problem so I don't know where to look?

Share this post


Link to post
Share on other sites
Thx for the lack of help.. cause it was a very easy and stupid thing I did and ya'll shoulda caught it quick. I forgot to flip the screen. Anyone learning, remember you will not see anything unless you flip the screen lol.

Share this post


Link to post
Share on other sites
Ya, not many people are very helpful when it comes to DirectDraw here :P I'm learning it as well, and have over come the same things as ya. If you need any help, send me a PM, and i'll see if I can help out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!