Need help load .bmp files
Thats ok. I'm learning DirectDraw because thats what my book is on. After I do my shitty 2D project, I'll upgrade to D3D, and learn that. You just have to take it one step at a time! ;) I"ll try some of the other suggestions now. If you could ppost that code Anonymous Poster, i'd be very gratful!
Alright, well I threw a if() around the BLT function (the bitmap one) and its coming back saying that its failed.....
erm..honestly not sure how I would get that. Anyideas how I would find that out? Everytime I put a break into my code, the app crashs. Guess DX doesn't like being broken...;)
Im not so sure, but you can also query for another DirectDraw Interface. Like the interface for version 4 or 6. If you need to know how, Ill tell ya.
If the function returns an HRESULT and you put an if around it, it SHOULD fail since S_OK = 0. So the function call actually is working.
To get the actual code try this:
HRESULT hr = Blt(...);
char buf[16];
sprintf(buf, "%x\n", hr);
MessageBox(NULL, buf, "HRESULT returned from Blt", MB_OK);
That should give you the error code (in hex), je croix.
To get the actual code try this:
HRESULT hr = Blt(...);
char buf[16];
sprintf(buf, "%x\n", hr);
MessageBox(NULL, buf, "HRESULT returned from Blt", MB_OK);
That should give you the error code (in hex), je croix.
Hello
Well I really suggest you take a deep look at the CDX library (http://www.cdxlib.com/), it is a set of well documented and easy to follow DirectX wrapper classes and best of all, comes with FULL SOURCE CODE!. I learned a lot from it.
Hope it helps you.
Oscar
Well I really suggest you take a deep look at the CDX library (http://www.cdxlib.com/), it is a set of well documented and easy to follow DirectX wrapper classes and best of all, comes with FULL SOURCE CODE!. I learned a lot from it.
Hope it helps you.
Oscar
Quote:Original post by ms291052
If the function returns an HRESULT and you put an if around it, it SHOULD fail since S_OK = 0. So the function call actually is working.
To get the actual code try this:
HRESULT hr = Blt(...);
char buf[16];
sprintf(buf, "%x\n", hr);
MessageBox(NULL, buf, "HRESULT returned from Blt", MB_OK);
That should give you the error code (in hex), je croix.
[edit] Got it thx for the code: 80070057 does this help?
I tried using the code from the ddutil.cpp/.h files, and *that* function comes back false. So the bitmap isn't even loading...
HRESULT: 0x80070057 (2147942487)
Name: E_INVALIDARG
Description: An invalid parameter was passed to the returning function
Severity code: Failed
Facility Code: FACILITY_WIN32 (7)
Error Code: 0x0057 (87)
One or more of the parameters you're passing to Blt is wrong.
Name: E_INVALIDARG
Description: An invalid parameter was passed to the returning function
Severity code: Failed
Facility Code: FACILITY_WIN32 (7)
Error Code: 0x0057 (87)
One or more of the parameters you're passing to Blt is wrong.
1) Are you 100% sure the creation and loading of the bitmap from DDback_sprite is being loaded ok (filenames, formats, your loading code, etc ?). Check those error return codes for all DirectDraw and GDI calls!
2) As an experiment try taking DDSCAPS_VIDEOMEMORY out of your MercuryEngine::CreateSurface function.
3) Are you 100% certain that the bitmap being loaded is 800x600 and your surface is being created at that size? If it's smaller, then you could get the errors you've posted.
4) With DirectDraw (and D3D for that matter), it's a really good idea to make your application/engine work in windowed mode. In windowed mode you have easy access to the debugger window so can single step and see watches on variables etc. Get your application working first, then move to fullscreen, then fix any fullscreen issues (lost surfaces etc).
2) As an experiment try taking DDSCAPS_VIDEOMEMORY out of your MercuryEngine::CreateSurface function.
3) Are you 100% certain that the bitmap being loaded is 800x600 and your surface is being created at that size? If it's smaller, then you could get the errors you've posted.
4) With DirectDraw (and D3D for that matter), it's a really good idea to make your application/engine work in windowed mode. In windowed mode you have easy access to the debugger window so can single step and see watches on variables etc. Get your application working first, then move to fullscreen, then fix any fullscreen issues (lost surfaces etc).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement