JLI Spieleprogrammierung Foren-Übersicht JLI Spieleprogrammierung

 
 FAQFAQ   SuchenSuchen   MitgliederlisteMitgliederliste   BenutzergruppenBenutzergruppen 
 medals.php?sid=bb4d441ce4fd24c4d54f43fe37f93374Medaillen   RegistrierenRegistrieren   ProfilProfil   Einloggen, um private Nachrichten zu lesenEinloggen, um private Nachrichten zu lesen   LoginLogin 

DirectX Versuche

 
Neues Thema eröffnen   Neue Antwort erstellen    JLI Spieleprogrammierung Foren-Übersicht -> Entwicklung
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen  
Autor Nachricht
mrxcptn
Mini JLI'ler


Alter: 49
Anmeldedatum: 02.06.2008
Beiträge: 12

Medaillen: Keine

BeitragVerfasst am: 03.01.2009, 21:07    Titel: DirectX Versuche Antworten mit Zitat

Hallo an alle.
Ich hab heute mit dem DirectX-Kapitel Kapitel aus meinem Buch angefangen und alles schön sauber abgetippt was im Buch steht(hoffe ich), aber trotzdem kommen da einige Fehlermeldungen beim Kompilieren, komischerweise die meisten von Libraries außerhalb meines Programms, hier der Buildlog:
Code:

-------------- Build: Debug in Test1 ---------------

Compiling: main.cpp
In file included from H:/PlatformSDK/Include/windef.h:176,
                 from H:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20,
                 from H:/PlatformSDK/Include/windows.h:157,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/winnt.h:222: error: expected initializer before "PVOID64"
In file included from H:/PlatformSDK/Include/windef.h:176,
                 from H:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20,
                 from H:/PlatformSDK/Include/windows.h:157,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/winnt.h:666:2: #error Must define a target architecture.
In file included from H:/PlatformSDK/Include/windef.h:176,
                 from H:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20,
                 from H:/PlatformSDK/Include/windows.h:157,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/winnt.h:5940: error: `PVOID64' does not name a type
In file included from H:/PlatformSDK/Include/rpc.h:142,
                 from H:/PlatformSDK/Include/windows.h:188,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/rpcnterr.h:4:1: warning: "/*" within comment
In file included from H:/PlatformSDK/Include/winscard.h:30,
                 from H:/PlatformSDK/Include/windows.h:198,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/wtypes.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:402,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/wtypes.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:403,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/unknwn.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:404,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/objidl.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:404,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/objidl.h:6545: warning: ignoring #pragma warning
H:/PlatformSDK/Include/objidl.h:6561: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:978,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/urlmon.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/msxml.h:274,
                 from H:/PlatformSDK/Include/urlmon.h:278,
                 from H:/PlatformSDK/Include/objbase.h:978,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/oaidl.h:442:1: pasting "/" and "/" does not give a valid preprocessing token
In file included from H:/PlatformSDK/Include/msxml.h:274,
                 from H:/PlatformSDK/Include/urlmon.h:278,
                 from H:/PlatformSDK/Include/objbase.h:978,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/oaidl.h:442: error: expected unqualified-id before '/' token
H:/PlatformSDK/Include/oaidl.h:457:1: pasting "/" and "/" does not give a valid preprocessing token
H:/PlatformSDK/Include/oaidl.h:457: error: expected unqualified-id before '/' token
In file included from H:/PlatformSDK/Include/objbase.h:978,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/urlmon.h:301: warning: ignoring #pragma comment
In file included from H:/PlatformSDK/Include/objbase.h:979,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/propidl.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/objbase.h:979,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/propidl.h:310:1: pasting "/" and "/" does not give a valid preprocessing token
In file included from H:/PlatformSDK/Include/objbase.h:979,
                 from H:/PlatformSDK/Include/ole2.h:69,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/propidl.h:310: error: expected unqualified-id before '/' token
H:/PlatformSDK/Include/propidl.h:1423: warning: ignoring #pragma warning
H:/PlatformSDK/Include/propidl.h:1424: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/oleauto.h:57,
                 from H:/PlatformSDK/Include/ole2.h:70,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/oaidl.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/ole2.h:134,
                 from H:/PlatformSDK/Include/windows.h:207,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/oleidl.h:17: warning: ignoring #pragma warning
In file included from H:/PlatformSDK/Include/windows.h:214,
                 from H:/PlatformSDK/Include/rpc.h:16,
                 from H:/PlatformSDK/Include/objbase.h:32,
                 from H:/DXSDK/Include/d3d9.h:33,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/PlatformSDK/Include/stralign.h: In function `WCHAR* ua_wcscpy(WCHAR*, const WCHAR*)':
H:/PlatformSDK/Include/stralign.h:99: warning: ignoring #pragma warning
H:/PlatformSDK/Include/stralign.h:100: warning: ignoring #pragma warning
H:/PlatformSDK/Include/stralign.h:102: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3d9.h:199,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3d9types.h: At global scope:
H:/DXSDK/Include/d3d9types.h:25: warning: ignoring #pragma warning
H:/DXSDK/Include/d3d9types.h:1789: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:44,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9math.h:19: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:44,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9math.h:1385: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:45,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9core.h:485:1: warning: multi-line comment
In file included from H:/DXSDK/Include/d3dx9mesh.h:15,
                 from H:/DXSDK/Include/d3dx9.h:46,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/dxfile.h:240: error: stray '\26' in program
In file included from H:/DXSDK/Include/d3dx9mesh.h:15,
                 from H:/DXSDK/Include/d3dx9.h:46,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/dxfile.h:240:2: warning: no newline at end of file
In file included from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `BOOL CDirect3D::Init(HWND__*, BOOL)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:57: warning: statement has no effect
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:56: warning: unused variable 'Err'
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `void CDirect3D::DrawTextA(const CHAR*, int, int, D3DCOLOR)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:76: error: no matching function for call to `ID3DXFont::DrawTextA(int, const CHAR*&, int, RECT*, int, D3DCOLOR&)'
H:/DXSDK/Include/d3dx9core.h:138: note: candidates are: virtual INT ID3DXFont::DrawTextA(const CHAR*, INT, tagRECT*, DWORD, D3DCOLOR)
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:77: error: no matching function for call to `ID3DXFont::DrawTextA(int, const CHAR*&, int, RECT*, int, D3DCOLOR&)'
H:/DXSDK/Include/d3dx9core.h:138: note: candidates are: virtual INT ID3DXFont::DrawTextA(const CHAR*, INT, tagRECT*, DWORD, D3DCOLOR)
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `void CDirect3D::CreateFontA()':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: error: `D3DXFONT_DESC' was not declared in this scope
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: error: expected `;' before "FontDesc"
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:105: error: `FontDesc' was not declared in this scope
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: warning: unused variable 'D3DXFONT_DESC'
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:43: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp: In function `HWND__* CreateMainWindow(HINSTANCE__*)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:65: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:66: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:68: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:70: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:76: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:82: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:83: error: expected primary-expression before ',' token
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:85: error: expected primary-expression before ')' token
Process terminated with status 1 (0 minutes, 1 seconds)
24 errors, 26 warnings


Hier die einzelnen Dateien:
CPP:
// Dieses Programm zeigt ein DirectX-Fenster


// Headerdatei
#include "Header1.h"

// Anwendungsfenster erzeugen
HWND CreateMainWindow(HINSTANCE hInstance);

// Callback Funktion zur Nachrichtenbehandlung
LRESULT CALLBACK MessageHandler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);


// Das Fensterhandle
HWND hWnd = 0;

//Das CDirect3D-Objekt
CDirect3D Direct3D;

// Windows main-Funktion
int WINAPI WinMain(HINSTANCE hInstance,      // Handle der Programminstanz
                   HINSTANCE hPrevInstance,  // Handle der letzten Instanz
                   LPSTR lpCmdLine,          // Kommandozeile
                   int nCmdShow)             // Art wie das Fenster angezeigt werden soll
{
    // Fenster erzeugen und Handle speichern
    hWnd = CreateMainWindow(hInstance);

    // Wenn der Rueckgabewert 0 ist, ist ein Fehler aufgetreten
    if(0 == hWnd)
    {
        MessageBox(0, "Fenster konnte nicht erzeugt werden", "Fehler", MB_OK);
        return -1;
    }

    //Hintergrund mit Standardfarbe aus Global.h fuellen
    Direct3D.SetClearColor(BackgroundColor);

   // Struktur, in der Informationen zur Nachricht gespeichert werden
    MSG msg;

    // Diese Schleife laeuft bis die Nachricht WM_QUIT empfangen wird
    while(GetMessage(&msg, NULL, 0, 0))
   {
        // Nachricht an die Callbackfunktion senden
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // Rueckgabewert an Windows
    return 0;
}


HWND CreateMainWindow(HINSTANCE hInstance)
{
    WNDCLASSEX wndClass =
    {
        sizeof(WNDCLASSEX),                                 // Groesse angeben
        CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW,    // Standardstile
        MessageHandler,                                     // Callback-Funktion
        0,                                                  // Zusaetzliche Angaben
        0,                                                  // nicht benoetigt
        hInstance,                                          // Anwendungsinstanz
        LoadIcon(NULL, IDI_WINLOGO),                        // Windows-Logo
        LoadCursor(NULL, IDC_ARROW),                        // Normaler Cursor
        (HBRUSH)GetStockObject(WHITE_BRUSH),                // Weisser Pinsel
        NULL,                                               // kein Menue
        "WindowClass",                                      // Der Name der Klasse
        LoadIcon(NULL, IDI_WINLOGO)                         // Windows Logo
    };


    RegisterClassEx(&wndClass);

    return CreateWindowEx(NULL,                   // Keine erweiterten Stile nutzen
                          "WindowClass",          // Klassenname
                          "Hello DirectX",        // Fenstertitel
                          WS_OVERLAPPEDWINDOW |   // Fenster
                          WS_VISIBLE,             // Eigenschaften
                          100, 100, SCR_WIDTH, SCR_HEIGHT,     // Anfangsposition und Groesse
                          NULL,                   // Handle des Elternfensters
                          NULL,                   // Handle des Menues
                          hInstance,              // Anwendungsinstanz
                          NULL);                  // wird nicht benoetigt
}


// Diese Funktion wird von Windows aufgrufen, wenn eine Nachricht
// fuer Ihr Programm vorliegt
LRESULT CALLBACK MessageHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    // testen, um welche Nachticht es sich handelt
    switch(msg)
    {
        // wenn das Fenster geschlossen wird, eine Nachricht senden,
        // die das Programm beendet
        case WM_DESTROY:
                    PostQuitMessage(0);
                    return 0;
                break;
        case WM_KEYDOWN:
                    switch(wParam)
                    {
                        case VK_ESCAPE:
                                DestroyWindow(hWnd);
                            break;
                    }
                break;
        case WM_PAINT:

                    Direct3D.BeginScene();
                    Direct3D.DrawText("Hallo Direct3D", 100, 100, D3DCOLOR_XRGB(0, 0xFF, 0));
                    Direct3D.EndScene();
                break;



    }

    // Wenn wir uns nicht um die Nachricht gekuemmert haben
    // wird sie an die Standardnachrichtenverarbeitung von Windows
    // geschickt
    return DefWindowProc(hwnd, msg, wParam, lParam);
}

CPP:
#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>
#include "Header2.h"

class CDirect3D
{
    public:

        CDirect3D()
        {
                m_lpD3D       = 0;
                m_lpD3DDevice = 0;
                m_lpD3DFont   = 0;
        }
        virtual ~CDirect3D()
        {
            CleanUp();
        }

        //Initialisieren von Direct3D
        BOOL Init(HWND hWnd, BOOL bWindowed = TRUE)
        {

            //Direct3D-Objekt erstellen
            m_lpD3D = Direct3DCreate9(D3D_SDK_VERSION);

            if(0 == m_lpD3D)
            {
                return FALSE;
            }

            //Parameter fuer den Modus festlegen
            D3DPRESENT_PARAMETERS PParams;
            ZeroMemory(&PParams, sizeof(PParams));

            PParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
            PParams.hDeviceWindow = hWnd;
            PParams.Windowed = bWindowed;

            PParams.BackBufferWidth = SCR_WIDTH;
            PParams.BackBufferHeight = SCR_HEIGHT;
            PParams.BackBufferFormat = D3DFMT_A8R8G8B8;

            HRESULT hr;
            //Geraet anlegen
            if(FAILED(hr = m_lpD3D->CreateDevice(
                                            D3DADAPTER_DEFAULT,
                                            D3DDEVTYPE_HAL,
                                            hWnd,
                                            D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                            &PParams,
                                            &m_lpD3DDevice)))
            {
                //Geraet nicht angelegt
                const char* Err = DXGetErrorDescription9(hr);
                DXTRACE_MSG(Err);
                return FALSE;
            }

            CreateFont();
            return TRUE;
        }

        //Backbufferfarbe festlegen
        void SetClearColor(D3DCOLOR ClearColor)
        {
            m_ClearColor = ClearColor;
        }

        //Text an Position x, y ausgeben
        void DrawText(LPCSTR Text, int x, int y, D3DCOLOR TextColor)
        {
            RECT r = { x, y, 0, 0};
            //TextKoordinaten berechnen
            m_lpD3DFont->DrawText(0, Text, -1, &r, DT_CALCRECT, TextColor);
            m_lpD3DFont->DrawText(0, Text, -1, &r, DT_CENTER, TextColor);
            //Text ausgeben
        }

        void BeginScene(void)
        {
            //Backbuffer mit ClearColor fuellen
            m_lpD3DDevice->Clear(0, 0, D3DCLEAR_TARGET, m_ClearColor, 0, 0);
            //Szene starten
            m_lpD3DDevice->BeginScene();
        }

        void EndScene(void)
        {
            //Szene Beenden und ausgeben
            m_lpD3DDevice->EndScene();
            m_lpD3DDevice->Present(0,0,0,0);
        }


        protected:
        void CreateFont(void)
        {
            //Struktur fuer die Beschreibung des Fonts
            //erstellen und alles mit 0 initialisieren
            D3DXFONT_DESC FontDesc = {0};
            //Den Fontnamen in FaceName von
            //unserem D3DXFONT_DESC Objekt kopieren
            strcpy(FontDesc.FaceName, "Arial");
            //Nach erfolgreichem Aufruf von CreateFont enthaelt
            //m_lpD3DFont einen Zeiger auf ein D3DXFont-objekt
            D3DXCreateFontIndirect(m_lpD3DDevice, &FontDesc, &m_lpD3DFont);
        }
        //Freigeben der Objekte
        void CleanUp(void)
        {
            //Testen ob Objekte angelegt wurden
            //und dann freigeben
            if(0!= m_lpD3DFont)
            {
                m_lpD3DFont->Release(); //Font freigeben
                m_lpD3DFont = 0;
            }

            if(0 != m_lpD3DDevice)
            {
                m_lpD3DDevice->Release();
                m_lpD3DDevice = 0;
            }
            if(0 != m_lpD3D)
            {
                m_lpD3D->Release();
                m_lpD3D = 0;
            }
        }
        D3DCOLOR m_ClearColor;
        LPDIRECT3D9 m_lpD3D;
        LPDIRECT3DDEVICE9 m_lpD3DDevice;
        LPD3DXFONT m_lpD3DFont;
};
CPP:
const int SCR_WIDTH = 800;
const int SCR_HEIGHT = 600;
const D3DCOLOR BackgroundColor = D3DCOLOR_XRGB(0, 0, 0xFF);


Ich verwende CodeBlocks 8.02 mit dem GNU GCC Compiler, beim Download stand "CodeBlocks 8.02 mit MinGW.
Dazu das DirectX9 SDK von der Microsoft Seite und das Microsoft Platform SDK von der Buch-CD (wobei ich es auch schon mit dem Windows SDK von der Microsoft Seite probiert habe, das gleiche Schlamassel).

Hat jemand eine Erklärung dafür?
Ich habe bei den Projekteigenschaften unter Build Options und Linker Settings folgendes hinzugefügt:
d3d9.lib
dxguid.lib
gdi32
user32
kernel32
Wobei ich die oberen 2 Selbst hinzugefügt habe, die unteren 3 sind beim erstellen einer Win32-Anwendung automatisch hinzugefügt worden.
Wenn jemand mir helfen kann, dann bitte ich darum.
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
Jonathan_Klein
Living Legend


Alter: 36
Anmeldedatum: 17.02.2003
Beiträge: 3431
Wohnort: Siegerland
Medaillen: Keine

BeitragVerfasst am: 03.01.2009, 21:18    Titel: Antworten mit Zitat

Ich kann nur mit MinGW ganz Normal Windowsapplikationen kompilieren, ganz ohen Microsoft Plattform SDK.
Probier ob du ein Standard Codeblocks Windows Projekt kompiliert bekommst und schmeiß eventuell das Plattform SDK mal raus.

(Ich weiß nicht, ob das DX SDK vielleicht das Plattform SDK braucht, wenn dann weiß ich glaub ich auch nicht weiter).
_________________
https://jonathank.de/games/
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden Website dieses Benutzers besuchen
mrxcptn
Mini JLI'ler


Alter: 49
Anmeldedatum: 02.06.2008
Beiträge: 12

Medaillen: Keine

BeitragVerfasst am: 03.01.2009, 21:26    Titel: Antworten mit Zitat

Okay, also Microsoft Platform SDK rausgehaun, jetzt geht eine normale Windows Applikation schon Mal, danke soweit.
ich bekomme allerdings immer noch Fehler in den DirectX Libraries:
Code:


-------------- Build: Debug in Test1 ---------------

Compiling: main.cpp
In file included from H:/DXSDK/Include/d3d9.h:199,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:1,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3d9types.h:25: warning: ignoring #pragma warning
H:/DXSDK/Include/d3d9types.h:1789: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:44,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9math.h:19: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:44,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9math.h:1385: warning: ignoring #pragma warning
In file included from H:/DXSDK/Include/d3dx9.h:45,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/d3dx9core.h:485:1: warning: multi-line comment
In file included from H:/DXSDK/Include/d3dx9mesh.h:15,
                 from H:/DXSDK/Include/d3dx9.h:46,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/dxfile.h:240: error: stray '\26' in program
In file included from H:/DXSDK/Include/d3dx9mesh.h:15,
                 from H:/DXSDK/Include/d3dx9.h:46,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:2,
                 from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
H:/DXSDK/Include/dxfile.h:240:2: warning: no newline at end of file
In file included from D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:5:
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `BOOL CDirect3D::Init(HWND__*, BOOL)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:57: warning: statement has no effect
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:56: warning: unused variable 'Err'
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `void CDirect3D::DrawTextA(const CHAR*, int, int, D3DCOLOR)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:76: error: no matching function for call to `ID3DXFont::DrawTextA(int, const CHAR*&, int, RECT*, int, D3DCOLOR&)'
H:/DXSDK/Include/d3dx9core.h:138: note: candidates are: virtual INT ID3DXFont::DrawTextA(const CHAR*, INT, tagRECT*, DWORD, D3DCOLOR)
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:77: error: no matching function for call to `ID3DXFont::DrawTextA(int, const CHAR*&, int, RECT*, int, D3DCOLOR&)'
H:/DXSDK/Include/d3dx9core.h:138: note: candidates are: virtual INT ID3DXFont::DrawTextA(const CHAR*, INT, tagRECT*, DWORD, D3DCOLOR)
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h: In member function `void CDirect3D::CreateFontA()':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: error: `D3DXFONT_DESC' was not declared in this scope
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: error: expected `;' before "FontDesc"
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:105: error: `FontDesc' was not declared in this scope
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\Header1.h:102: warning: unused variable 'D3DXFONT_DESC'
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp: In function `HWND__* CreateMainWindow(HINSTANCE__*)':
D:\Programmieren\C++\Eigene Projekte\Meine Codes\Test1\main.cpp:85: warning: passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 10 warnings
 



Edit:
Hab zur Probe einmal das Beispielprogramm von der CD kompiliert, hier der Buildlog:
Code:

-------------- Build: default in Direct3DClass ---------------

Compiling: Direct3DClass.cpp
In file included from H:/DXSDK/Include/d3dx9mesh.h:15,
                 from H:/DXSDK/Include/d3dx9.h:46,
                 from D:\Programmieren\C++\Beispiele&Probleme\JLI-Dateien\Direct3DClass\Direct3D.h:3,
                 from D:\Programmieren\C++\Beispiele&Probleme\JLI-Dateien\Direct3DClass\Direct3DClass.cpp:3:
H:/DXSDK/Include/dxfile.h:240: error: stray '\26' in program
D:\Programmieren\C++\Beispiele&Probleme\JLI-Dateien\Direct3DClass\Direct3DClass.cpp: In function `HWND__* CreateMainWindow(HINSTANCE__*)':
D:\Programmieren\C++\Beispiele&Probleme\JLI-Dateien\Direct3DClass\Direct3DClass.cpp:89: warning: passing NULL used for non-pointer converting 1 of `HWND__* CreateWindowExA(DWORD, const CHAR*, const CHAR*, DWORD, int, int, int, int, HWND__*, HMENU__*, HINSTANCE__*, void*)'
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 1 warnings


Edit2:
Bei der Gelegenheit stell ich gleich noch eine andere Frage:
Im Beispiel sind die Funktionen in einer extrigen .cpp Datei, ich hab alles in meine .h Datei geschrieben, gibt es da einen Unterschied?
Ich bekomme z.B. in meinem selbstgetippten eine Fehlermeldung für D3DXFONT_DESC FontDesc={0};
und einige wegen der Verwendung von NULL.
Wenn ich 0 verwende gehts, aber im Beispiel macht er keine Probleme wegen NULL oder 0. Kann das daran liegen?

Edit3:
So, ich hab das DirectX SDK von der CD genommen, die Pfade angepasst und einmal ein Beispiel kompiliert.
Buildlog:
Code:
-------------- Build: default in Direct3DClass ---------------

Linking executable: Direct3DClass.exe
H:\Program Files\CodeBlocks\MinGW\bin\ld.exe: cannot find -ldxguid.lib
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
 

Langsam wunderts mich, dass bei mir so viele Fehler kommen, wenns bei anderen einwandfrei funktioniert..


Edit 4:
Ich hab jetzt eine Weile lang gegoogelt wegen meines Problems und scheinbar ist es recht schwer DirectX-Programme mit MinGW zu kompilieren. Ist es den Aufwand wert und soll ich weitersuchen oder soll ich ganz einfach das Microsoft Visual C++ Toolkit als Compiler verwenden?

Edit 5:
So, ich hab das ganze jetzt auf Visual C++ Toolkit 2003 umgestellt, das auch im Buch verwendet wird.
Fürs durcharbeiten vom Buch sollte es reichen und funktionieren.
Allerdings hab ich gleich wieder ein Problem.
Das Beispielprogramm kompiliert er ohne Probleme, aber mein selbstgetipptes nicht, folgender Buildlog:
Code:
-------------- Build: Debug in DirectX9Template ---------------

main.cpp
d:\programmieren\c++\eigene projekte\meine codes\directx9template\main.cpp(115) : warning C4710: function 'void __thiscall CDirect3D::DrawTextA(char const *,int,int,unsigned long)' not inlined
Linking console executable: bin\Debug\DirectX9Template.exe
Output size is 29.50 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 1 warnings

Und beim ausführen des Programms kommt nur ein weißes Fenster und dann sofort Fehlermeldung und Programmabsturz.
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
Beiträge der letzten Zeit anzeigen:   
Neues Thema eröffnen   Neue Antwort erstellen    JLI Spieleprogrammierung Foren-Übersicht -> Entwicklung Alle Zeiten sind GMT
Seite 1 von 1

 
Gehe zu:  
Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.


Powered by phpBB © 2001, 2005 phpBB Group
Deutsche Übersetzung von phpBB.de

Impressum