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:
  1. Dim WorldDC As Long
  2. Dim WorldBMP As Long
  3. Dim FormDC As Long
  4. Dim WorldRegions() As Long
  5. Dim num_regions As Long
  6.  
  7. Private Function Initialize()
  8.  
  9. End Function
  10.  
  11. Public Function BeginScene(hdc As Long) As Long
  12. 'Here we will initialize the WorldDC and paint it plain black
  13. Dim hr As Long, vr As Long
  14. Dim wh As Long, ww As Long 'world height and width
  15.  
  16. FormDC = hdc
  17.  
  18. hr = GetDeviceCaps(hdc, HORZRES)
  19. vr = GetDeviceCaps(hdc, VERTRES)
  20.  
  21. 'set them to how they should be
  22. If (hr > 0) Then
  23.     ww = hr * 0.4
  24.     wh = vr * 0.15
  25. End If
  26.  
  27. 'set up our world
  28. WorldDC = CreateCompatibleDC(hdc)
  29. WorldBMP = CreateCompatibleBitmap(hdc, ww, wh)
  30. SelectObject WorldDC, WorldBMP
  31. 'fill it with black
  32. BitBlt WorldDC, 0, 0, ww, wh, 0, 0, 0, vbBlackness
  33.  
  34. End Function
  35.  
  36. Public Function UpdateScene() As Long
  37. 'blit the backbuffer to the screen
  38. BitBlt FormDC, 0, 0, ww, wh, WorldDC, 0, 0, vbSrcCopy
  39. End Function
  40.  
  41. Public Function EndScene() As Long
  42. 'delete the memory users
  43. DeleteDC WorldDC
  44. DeleteObject WorldBMP
  45. End Function
  46.  
  47. Private Function Terminate()
  48. 'Delete the memory users
  49. DeleteDC WorldDC
  50. DeleteObject WorldBMP
  51. 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