|
-
Apr 18th, 2005, 06:25 AM
#1
Thread Starter
G&G Moderator
BitBlt Problem
Howdy all,
Somewhere out there, I managed to find a copy of Visual Studio 6. I've now got VB and C++ 6 back. w00t!
Anyway, I'm trying to create a small (albiet crappy) 2D game engine, using BitBlt. Basically what I'm trying to do at the moment, is create a World Object, which will paint the main background, and hold all the different areas of the World (world is made up of regions, moving past a certain trigger will load the next region, kinda like KOTOR on Xbox and PC).
I have a BeginScene function, UpdateScene function and an EndScene Function. BeginScene just makes the usual Backbuffer, and then it fills it with black. The UpdateScene function draws the backbuffer to the World Objects HDC (in this case, the frmWorld form). The EndScene function then deletes the DC and Bitmap from memory.
This is my code..
VB Code:
Dim WorldDC As Long
Dim WorldBMP As Long
Dim FormDC As Long
Dim WorldRegions() As Long
Dim num_regions As Long
Private Function Initialize()
End Function
Public Function BeginScene(hdc As Long) As Long
'Here we will initialize the WorldDC and paint it plain black
Dim hr As Long, vr As Long
Dim wh As Long, ww As Long 'world height and width
FormDC = hdc
hr = GetDeviceCaps(hdc, HORZRES)
vr = GetDeviceCaps(hdc, VERTRES)
'set them to how they should be
If (hr > 0) Then
ww = hr * 0.4
wh = vr * 0.15
End If
'set up our world
WorldDC = CreateCompatibleDC(hdc)
WorldBMP = CreateCompatibleBitmap(hdc, ww, wh)
SelectObject WorldDC, WorldBMP
'fill it with black
BitBlt WorldDC, 0, 0, ww, wh, 0, 0, 0, vbBlackness
End Function
Public Function UpdateScene() As Long
'blit the backbuffer to the screen
BitBlt FormDC, 0, 0, ww, wh, WorldDC, 0, 0, vbSrcCopy
End Function
Public Function EndScene() As Long
'delete the memory users
DeleteDC WorldDC
DeleteObject WorldBMP
End Function
Private Function Terminate()
'Delete the memory users
DeleteDC WorldDC
DeleteObject WorldBMP
End Function
Anyone know why it doesn't blit blackness to the screen? I admit its been well into 7 months since I've typed a line of anything but ASM.
Any help would be appreciated,
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|