Results 1 to 5 of 5

Thread: DirectDraw and DirectInput

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    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.
    Vuen

  2. #2
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    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.
    Code:
    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.
    Designer/Programmer of the Comtech Operating System(CTOS)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    YOU ARE MY GOD!!!
    though I have yet to find out if it works or not...
    Vuen

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    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.
    Vuen

  5. #5
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    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.
    Designer/Programmer of the Comtech Operating System(CTOS)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width