|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
Join Date: May 2002
Location: Mtl,CAN
Posts: 16
|
Im stuck...
Developping your first game in VB is hell ![]() I use 2 picture boxes, one for the backbuffer where I draw everything and one for the game screen where I do the final blit. The problem is that when I hide the backbuffer (either visible=false or putting it somewhere very far...), it hides the screen too! This doesn't happen if I set autoredraw to true, but Im doing a backbuffer to avoid this since its slow as hell. What can I do to hide the backbuffer and be able to see the screen? |
|
|
|
|
|
#2 |
|
Member (14 bit)
|
Hi,
so you have a real backbuffer (I mean, not just an offscreen surface, but a complex surface) ? If so, then the backbuffer is always hidden, and the primary surface is visible. You display the backbuffer by flipping it (method is "flip"). The pointers of primary surface and backbuffer will be exchanged, thus the backbuffer will become the primary surface (primary will become offscreen) and be displayed on the screen. RJ
__________________
All's right with the world when your PC is working right.
|
|
|
|
|
|
#3 |
|
Member (5 bit)
Join Date: May 2002
Location: Mtl,CAN
Posts: 16
|
This sounds interesting but Im not understandinganything How can I implement this RJ???
|
|
|
|
|
|
#4 |
|
Member (14 bit)
|
Can't exactly tell you coz I've never used VB.
The APIs are the same, though, only the syntax is different. What do you mean with "implement" ? Do you mean how to create the complex surface ? Well, some tutorials from where I've learned DirectDraw programming showed the examples in VB. This one explained it for DirectX 7: Dim ddScreen As DirectDrawSurface7 Dim ddsdScreen As DDSURFACEDESC2 ddsdScreen.lFlags = DDSD_CAPS Or _ DDSD_BACKBUFFERCOUNT ddsdScreen.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or _ DDSCAPS_COMPLEX Or _ DDSCAPS_FLIP ddsdScreen.lBackbufferCount = 1 Set ddScreen = DirectDraw.CreateSurface(ddsdScreen) And then the backbuffer: Dim ddBackbuffer As DirectDrawSurface7 Dim ddsdBackbuffer As DDSURFACEDESC2 Dim caps As DDSCAPS2 caps.lCaps = DDSCAPS_BACKBUFFER Set ddBackbuffer = ddScreen.GetAttachedSurface(caps) ddBackbuffer.GetSurfaceDesc ddsdBackbuffer Should be similar to how you did it, right ? I guess the only differences are the DDSCAPS_COMPLEX, DDSCAPS_FLIP flags to create the complex surface. BTW, you're using DirectX, right ? I forgot to ask this, coz Backbuffer suddenly reminded me of my past days as a programmer and the last I did was programming for DirectX (in DirectDraw there is a primary surface and a backbuffer). If you're not programming a DirectX game then sorry I got you wrong ![]() RJ |
|
|
|
|
|
#5 |
|
Member (5 bit)
Join Date: May 2002
Location: Mtl,CAN
Posts: 16
|
hehe NP, thanks for the advice RJ, but its too advanced for me,
I haven't looked at DirectX yet, I only know some basic APIs for using in VB! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|