Results 1 to 2 of 2
  1. #1
    undergroundhack's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Posts
    130
    Reputation
    10
    Thanks
    100
    My Mood
    Amazed

    Post 50% Background Transparancy

    function

    code:
    Code:
    void DrawBox(IDirect3DDevice8 *pD3Ddev, int x, int y, int w, int h, D3DCOLOR col)
    {
        struct QuadVertex {
            float x,y,z,rhw;
            DWORD dwColor;
        };
        IDirect3DVertexBuffer8 *pVertexBuffer = NULL;
        QuadVertex qV[4];
        BYTE *pVertexData = NULL;
    
        if (pD3Ddev->CreateVertexBuffer((4*sizeof(QuadVertex)),(D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC),(D3DFVF_XYZRHW|D3DFVF_DIFFUSE),D3DPOOL_DEFAULT,&pVertexBuffer)<0) return;
    
        pD3Ddev->SetRenderState(D3DRS_ZENABLE , FALSE);
        pD3Ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
        pD3Ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
    
        pVertexBuffer->Lock(0,0,&pVertexData,D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD);
        if(pVertexData)
        {
            qV[0].dwColor = qV[1].dwColor = qV[2].dwColor = qV[3].dwColor = col;
            qV[0].z   = qV[1].z   = qV[2].z   = qV[3].z   = 0.0f;
            qV[0].rhw = qV[1].rhw = qV[2].rhw = qV[3].rhw = 0.0f;
    
            qV[0].x = (float)x;
            qV[0].y = (float)(y + h);
            qV[1].x = (float)x;
            qV[1].y = (float)y;
            qV[2].x = (float)(x + w);
            qV[2].y = (float)(y + h);
            qV[3].x = (float)(x + w);
            qV[3].y = (float)y;
    
            memcpy(pVertexData,qV,sizeof(QuadVertex)*4);
            pVertexBuffer->Unlock();
            pVertexData = NULL;
    
            pD3Ddev->SetStreamSource(0,pVertexBuffer, sizeof(QuadVertex));
            pD3Ddev->SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE );
            pD3Ddev->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
        }
        if    (pVertexBuffer) {
            pVertexBuffer->Release();
            pVertexBuffer=NULL;
        }
        pD3Ddev->SetRenderState(D3DRS_LIGHTING, true);
    }
    Put it in the globals.

    how to use

    code:

    Code:
    DrawBox(m_pD3Ddev,10,5,130,130,0x60000000);
    Just change the coordinates.Thats how I used it in mine.



    What this does ?

    Creates a black box 50% Transparant.

    Thank me for posting
    [IMG]https://i665.photobucke*****m/albums/vv17/undergroundhack/avatar_2961.gif[/IMG]
    goal list!
    get 10 kill streak on ca [X]
    get 100 kill streak on ca [X]
    get 30 post [X]
    get 80 post [X]
    get 100 post [X]
    get 400 post []
    make a small ca cham [X]
    get mpgh mod []

    respect list!
    dave84311
    [MPGH]obama

    press thanks!

  2. #2
    copterkill's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    4
    Please! What is m_pD3Ddev?? I have this error :
    ===>undeclared identifier<===

    Help me please!
    Thanks

Similar Threads

  1. Can someone make the background transparent?
    By J in forum Help & Requests
    Replies: 2
    Last Post: 08-21-2010, 04:54 PM
  2. Make Background Transparent
    By paintlax21 in forum CrossFire Mods & Rez Modding
    Replies: 1
    Last Post: 06-04-2010, 08:54 PM
  3. How to make background transparent??
    By headsup in forum Showroom
    Replies: 2
    Last Post: 02-24-2010, 07:32 PM
  4. Transparent Backgrounds
    By hunter3002 in forum Programming Tutorial Requests
    Replies: 3
    Last Post: 04-21-2009, 04:51 PM
  5. [Help]Transparent Background for Crosshairs...
    By Jumpshot in forum Visual Basic Programming
    Replies: 12
    Last Post: 01-30-2008, 09:57 AM

Tags for this Thread