D3DXCreateFont funzt nicht



  • Hey!

    Was kann man schon falsch machen? D3DXCreateFont() failed.

    ID3DXFont* d3dFont = NULL;
    
    D3DXCreateFont(d3dDev, 40, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &d3dFont);
    

    Ich verstehe es nicht.

    MfG

    Edit:
    D3DBLABLA_INVALIDCALL gibt die Funktion zurück...



  • Aus DirectX-Documentation:

    Syntax:

    HRESULT D3DXCreateFont(
    LPDIRECT3DDEVICE9 pDevice,
    HFONT hFont,
    LPD3DXFONT *ppFont
    );

    Parameters:
    pDevice
    [in] Pointer to an IDirect3DDevice9 interface, the device to be associated with the font object.
    hFont
    [in] Handle to the font object.
    ppFont
    [out] Returns a pointer to an ID3DXFont interface, representing the created font object.
    Return Value

    If the function succeeds, the return value is D3D_OK.

    If the function fails, the return value can be one of the following values.

    D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value.
    E_OUTOFMEMORY Microsoft® Direct3D® could not allocate sufficient memory to complete the call.

    Function Information

    Header d3dx9core.h
    Import library d3dx9.lib
    Minimum operating systems Windows 98



  • Das stimmt so nicht mehr, früher wurde ID3DXFont über ein HFONT bzw. Windows-Font erstellt, aber jetzt kann man das direkt mit D3DXCreateFont machen (und spart dabei nen paar Parameter aus der LOGFONT Struktur).
    Start das ganze mal mitm Debugger, dann steht im Debugger-Fenster normal ne ausführlichere Erklärung was genau ungültig ist.



  • Na toll, ich dachte zuerst wird der Konstruktor und DANN der Konstruktor der Teilobjekte einer Klasse aufgerufen. Grr, nun jetzt ist mir so einiges klar...


Anmelden zum Antworten