Was heißt der Parameter in der fertigen Funktion ?



  • Also ich habe jetzt diese Funktion (dank gamedev.net)

    IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap)
    {
        HBITMAP hbm;
        BITMAP bm;
        IDirectDrawSurface *pdds;
    
        // LoadImage has some added functionality in Windows 95 that allows
        // you to load a bitmap from a file on disk.
        hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, 0, 0,
        LR_LOADFROMFILE|LR_CREATEDIBSECTION);
    
        if (hbm == NULL)
            return NULL;
    
        GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
    
       /*
        * create a DirectDrawSurface for this bitmap
        * source to function CreateOffScreenSurface() follows immediately
        */
    
        pdds = CreateOffScreenSurface(pdd, bm.bmWidth, bm.bmHeight);
        if (pdds) {
            DDCopyBitmap(pdds, hbm, bm.bmWidth, bm.bmHeight);
        }
    
        DeleteObject(hbm);
    
        return pdds;
    }
    

    was muss bei den Parametern bei "IDirectDraw *pdd" rein , das versteh ich ihrgendwie nicht .



  • Dein DirectDraw-Objekt!



  • danke , das klappt jetzt und hier :

    HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int dx, int dy)
    {
        HDC hdcImage;
        HDC hdc;
        HRESULT hr;
        HBITMAP hbmOld;
    
        //
        // select bitmap into a memoryDC so we can use it.
        //
        hdcImage = CreateCompatibleDC(NULL);
        hbmOld = (HBITMAP)SelectObject(hdcImage, hbm);
    
        if ((hr = pdds->GetDC(&hdc)) == DD_OK)
        {
            BitBlt(hdc, 0, 0, dx, dy, hdcImage, 0, 0, SRCCOPY);
            pdds->ReleaseDC(hdc);
        }
    
        SelectObject(hdcImage, hbmOld);
        DeleteDC(hdcImage);
    
        return hr;
    }
    

    fehlt mir HBITMAP hbm , was muss da rein (es ist nicht der Pfad\name so viel versteh ich selber)?



  • Tja, c&p ist schon evil, stimmt's? 😉



  • Du benötigst ein Objekt der Klasse HBITMAP. Ich glaube mir den Funktionen LoadImage und LoadBitmap kannste dir so ein Objekt erzeugen.



  • @TGGC ich habs auch schon mal selber geschreiben nur da isser drann rausgeflogen (so 3 Postings her) und jetzt hab ich es mit c&p versucht . Und hoffe das das läuft (irgendwann) . Aber danke an Creon ich gucke mal ob ichs hinbekomme .



  • habs jetzt hinbekommen


Anmelden zum Antworten