ok, some of these may sound n00bish, I am new to directX, so here goes:
after I have started the fullscreen mode, created the primary and backbuffer surfaces, how would I display buttons on the screen? do they need to be defined as their own surfaces, or just as RECTs? would I need to create a flipping chain just for these buttons? or is there a way I could just leave the primary surfaces up there? (and is it recommended I do so?)
Thanks in advance.
Last edited by outcast24817; May 18th, 2005 at 11:36 PM.
DDraw does not come as a part of DX8, but in DX 9 it is back......but DDraw is the same in both versions, but how to make a GUI is pretty different....
If I remember irght in my old days, there was no simple way to use Win GUI in DX7. And DX7 had no classes on it's own for drawing a GUI. I remember seein Arbiter (was it him) that made his own chatt app in a game of his where he made the textbox ++ him self from scratch.
And that is probably the easiest way to do it.
And old friend of ours here on the forum (long time no see M) wrote a couple of tutorials on the topic. You can find them here:
But then again, if you are using C++, then you could just have used DX9 and used the GUI classes there to save you some trouble. So thats why I am guessing you are using VB.
yea, i am using VB, and the last time i updated directx that was the newest one
I looked at those pages, and they dont really show me what i need to know. I have looked at other code, and tried to duplicate it for my own uses, but it doesnt work. I am not trying to make my own window and such, i have a fullscreen game i am trying to make and JUST need to blt pictures to the screen. lol.
Well if you are just trying to Blt pictures to the screen, then do it as you do with all the other pictures you have on the screen. (Hopefully, ifyou have any)
So just load them the normal way to a surface, and Blt them as usual.
well, thats just it, i am a little confused about the theory, say i wanted to make my button go to the screen, would i load the bmp of the button into a surface, and then blt the surface to the backbuffer? or somehow load it into a RECT and then blt that to the backbuffer or what?
I am a bit confused about your term rect here. If you are talking about the RECT struct then that is not a conatiner for a picture. It stores information about the size of something (like a picture), if you mean something else, please elaborate.
But what you should do is to load it to the surface, as you said, and then Blt it to the backbuffer, before you flip it to the screen.Thats correct.
ah... I think i see why i cant get anything on the screen.
So i would load a picture to the surface, then i would create a RECT that has the dimensions of the picture, and then blt it onto the backbuffer, then flip the backbuffer. correct?
Yeah, that is exactly the way to go. The reason why you have the RECT there, is so you can choose to only Blt a small part of the picture, like for a helth bar, or if you have batched more then one picture into one surface, you can choose what picture from the surface you want to Blt.
If you have the DX SDK installed, you probably have the docs installed too. If not, it is higly recomended that you install it. It says there what all the parameters is.
But if I remeber right, it is the X coordiante and the Y coordinate where you want to draw the sprite.
And you can see that the rect for BltFast is the source rect. So you can't stretch and other things, but you can leave out a part of the source image if you want that.
I already have the SDK, but it doesnt help much, most of it is for c++, and the managed languages section has some stuff, but under the directdraw section it has this
Note: This documentation is preliminary and is subject to change.
Warning: Microsoft® DirectDraw® has been deprecated. Deprecated components of Microsoft DirectX® 9.0 for Managed Code are considered obsolete. While these components are still supported in this release of DirectX 9.0 for Managed Code, they may be removed in the future. When writing new applications, you should avoid using these deprecated components. When modifying existing applications, you are strongly encouraged to remove any dependency on these components.
The DirectDraw application programming interface (API) is the component of DirectX that enables you to directly manipulate display memory, the hardware blitter, hardware overlay support, and flipping surface support. For more information, see the Microsoft.DirectX.DirectDraw managed code reference documentation.
So i go to the microsoft.directX.directdraw managed code refrerence documentation, and all of it gives me the same "deprecated" message.
furthermore, i have attempted to load surfaces from files, and it doesnt want to work for me, the pictures are bmps. and I get an error on this part of the code:
retval = dd.CreateSurfaceFromFile(path, ddsdf)
retval is an integer, dd is my directdraw object, path is a string that is the path to the bmp, and ddsdf is a DDSURFACEDESC2 (with it's height set at 49, and its width set at 200) (the size of my picture) and some other things for ddsdf: ddsdf.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
ddsdf.DDSCAPS.lCaps = DDSCAPS_OFFSCREENPLAIN And DDSCAPS_VIDEOMEMORY
so when i run it I get an error that says: method or data member not found. and it highlights .CreateSurfaceFromFile
I am beginning to think direct3D would be easier to work with... it isn't "deprecated"
i decided to start from scratch. I actually got something to happen this time, i can display the picture "startgame1" on the screen, the only thing is, when i start it I get that picture, and the rest of the background is a flickering mass of pixels that at one point could have been part of the last image my computer displayed before starting my app.
Then i go back into developement and i get an automation error on the backbuffer.flip line
I have included the code. could someone please take a look and tell me what I am doing wrong???
1) A means of exiting the game. For testing I just put your terminate sub into the Form_Click event
2) A seperate sub to initialize your offscreen surfaces, so if you've lost them you can call the sub to re-load them.
You don't need to do this for the Primary or attached backbuffer, that's why i seperated it from your Init DX code.