also ich weiß nicht, entweder ich bin zu dumm oder ich krieg langsam nen schaden.
ich erstelle ein neues projekt, und schreibe das gerüst wie folgt:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#include <TriBase.h>
#include "..\\Buch\\3D Spieleprogrammierung\\Beispiele\\Allgemeines\\InitWindow.h"
#include "..\\Buch\\3D Spieleprogrammierung\\Beispiele\\Allgemeines\\Direct3DEnum.h"
#include "..\\Buch\\3D Spieleprogrammierung\\Beispiele\\Allgemeines\\InitDirect3D.h"
tbResult InitApplication();
tbResult ExitApplication();
tbResult Render(float fNumSecsPassed);
tbResult Move(float fNumSecsPassed);
float g_fTime = 0.0f;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
tbResult Result;
Result = InitApplication();
if (Result == TB_ERROR)
{
MessageBox(NULL,"Fehler beim Initialisieren der Anwendung!","Fehler",MB_OK | MB_ICONERROR);
return 1;
}
else if (Result == TB_CANCELED)
{
return 0;
}
tbDoMessageLoop(Move,Render);
ExitApplication();
return 0;
}
tbResult InitApplication()
{
if(tbInit())
{
MessageBox(NULL,"Fehler beim Initialisieren der Engine!","Fehler",MB_OK | MB_ICONERROR);
}
SDirect3DParameters Direct3DParameters;
tbResult Result;
Result = GetDirect3DParameters(&Direct3DParameters);
if (Result == TB_ERROR)
{
MessageBox(NULL,"Fehler beim abfragen der Direct3D Parameter!","Fehler",MB_OK | MB_ICONERROR);
return TB_ERROR;
}
else if (Result == TB_CANCELED)
{
tbExit();
return TB_CANCELED;
}
if (InitWindow(Direct3DParameters.VideoMode.Width,Direct3DParameters.VideoMode.Height,
"Testumgebung",NULL))
{
MessageBox(NULL,"Fehler beim erstellen des Fensters!","Fehler",MB_OK | MB_ICONERROR);
tbExit();
return TB_ERROR;
}
if (InitDirect3D(&Direct3DParameters,g_hWindow))
{
MessageBox(NULL,"Fehler beim Initialisieren von Direct3D!","Fehler",MB_OK | MB_ICONERROR);
ExitWindow();
tbExit();
return TB_ERROR;
}
return TB_OK;
}
tbResult ExitApplication()
{
ExitWindow();
ExitDirect3D();
tbExit();
return TB_OK;
}
tbResult Move(float fNumSecsPassed)
{
g_fTime += fNumSecsPassed;
return TB_OK;
}
tbResult Render(float fNumSecsPassed)
{
return TB_OK;
}
|
dem projekt sind die dateien:
- Direct3DEnum.cpp
- InitDirect3D.cpp
- InitWindow.cpp
hinzugefügt.
dem linker wurden die libs:
- TriBaseD.lib
- D3D9.lib
- DXErr.lib
hinzugefügt.
und was passiert? nichts! die funktion GetDirect3DParameters liefert automatisch TB_CANCELED zurück, dabei wurde das fenster für die auswahl noch nichtmal geöffnet. alle beispiele von der cd die ich selbst kompiliere etc. funktionieren einwandfrei.
ich hab das da oben 4 mal durch den debugger laufen lassen und konnt den fehler nicht finden, da ich doch tatsächlich der meinung bin da ist keiner :o .
also bitte sagt mir wo der fehler ist, sonst zweifle ich echt an meinem verstand! :crying: