Click to See Complete Forum and Search --> : DirectDraw and DirectInput
Vuen
Sep 9th, 2000, 11:52 PM
Ok. HERES WHAT I NEED. I need the code that will do the following for me: Create a primary surface fullscreen 800x600, and create a backbuffer for that surface. I also need Click and MouseDown/MouseUp events to work with this primary surface.(though they wont be called that ofcourse). I also need the code to blit to the backbuffer, and the code to flip the surfaces. So there you go. If anyone could get me this (and hopefully only this), I would be VERY HAPPY! Thanks.
Warmaster199
Sep 10th, 2000, 01:34 PM
I'm not th greatest with DirectInput, so I can't help you there, however, I can help you with the DirectDraw part. Try it using my I3D Graphics engine(with source) that I made:
http://www.geocities.com/warmaster2000us
Or, use this code, although I do need testers for I3D.
Option Explicit
Public dd As DirectDraw7
Public ddsdFront As DDSURFACEDESC2
Public ddsFront As DirectDrawSurface7
Public ddsdBack As DDSURFACEDESC2
Public ddsBack As DirectDrawSurface7
Public ddCaps As DDSCAPS2
Public ddfxBack As DDBLTFX
Public Sub InitializeDD()
Dim ColorKey As DDCOLORKEY
Dim EmptyRect As RECT
Dim intCount As Integer
On Local Error GoTo ErrorHandler
Set dd = dx.DirectDrawCreate("")
dd.SetCooperativeLevel FORM.hwnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE
dd.SetDisplayMode 800, 600, 24, 0, 0
With ddsdFront
.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX Or DDSCAPS_SYSTEMMEMORY
.lBackBufferCount = 1
End With
Set ddsFront = dd.CreateSurface(ddsdFront)
ddCaps.lCaps = DDSCAPS_BACKBUFFER
Set ddsBack = ddsFront.GetAttachedSurface(ddCaps)
With ddfxBack
.lFill = 0
End With
With ColorKey
.high = TRANSPARENTINDEX
.low = TRANSPARENTINDEX
End With
Exit Sub
ErrorHandler:
If Err.Number = DDERR_NOEXCLUSIVEMODE Then
EndGame
MsgBox "Unable to create Direct Draw object."
End
Else
EndGame
End
End If
End Sub
Note: Change resolution by changing this line:
dd.SetDisplayMode 800, 600, 24, 0, 0
Be sure to change FORM.hWnd to something else in this line:
dd.SetCooperativeLevel FORM.hwnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE
Get I3D, and then you don't have to "hardwire" your resolution in the sample. You just need to run I3DSetup display program to change it. I3D also supports 3D stuff, which you may like to use.
Vuen
Sep 10th, 2000, 06:42 PM
YOU ARE MY GOD!!!
though I have yet to find out if it works or not...
Vuen
Sep 10th, 2000, 08:36 PM
What's transparentindex supposed to be and mean? And do I use the DirectDraw surfaces' methods to blit to and from them and not the api? Ok.
Warmaster199
Sep 11th, 2000, 03:27 PM
Transparent Index is the index of the colors of the items that will be transparent. By the way, the majority of that code came fromthe Spaceshooters example from the DirectX 7 SDK. Try downloading the SDK at http://www.microsoft.com/directx ,but beware... The download is monstrous(125MB, That's 125 MegaBytes). But the SDK contains so much info and documentation, that the download can(and was for me) be worth the wait. It'll also give you info on DirectInput that you needed. Go to my homepage I posted earlier in this thread and get Tank Attack Messenger(TAM for short). It's a messenger for a game I'm making. Although it's not quite done, I brought it to school today and showed it to my tech teacher. He thought it was really amazing how I got DirectPlay to let users(me and my friend) to communicate on two different comps. Even though I'm pretty sure the Computers were linked via Ethernet, I am positive that TAM will run on the Internet, connecting two users that are thousands of kilometers away... Anyways, try out TAM for DirectPlay stuff and for DirectX info, get the MS DX7 SDK.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.