the bitmap doesn't show up

Started by
3 comments, last by _Sigma 19 years, 3 months ago
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]
Advertisement
Try looking at this http://www.gamedev.net/reference/articles/article608.asp.
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?
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.
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.

This topic is closed to new replies.

Advertisement