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
|
MapEditorMainWindow.CreateMainWindow (g_hInstance, 1000, 700, "MainWindow",WS_OVERLAPPEDWINDOW|WS_VISIBLE); //Hier erstelle ich mein Fenster. Die Funktion dazu habe ich selber geschrieben
ShowWindow(MapEditorMainWindow.GetHandle(), SW_MAXIMIZE); //Das Fenster wird auf volle größe gebracht
if (MapEditorMainWindow.GetHandle() == NULL) // Fehler abfragen
{
return (1);
}
HWND hTest;
hTest = CreateWindow ("STATIC",NULL,
WS_VISIBLE | WS_CHILD,
0, 0, 600, 400,
MapEditorMainWindow.GetHandle(), (HMENU)5, g_hInstance, NULL); //So nun erstelle ich ein Child. Ein Static mit der Größe 600x400.
//-----------------------------------------------------------------------------------------------------------
//nun zu Initalisierung von Direct3D
HRESULT hResult;
D3DFORMAT format=D3DFMT_R5G6B5;
g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if(!g_pD3D) return 1;
// Präsentationsstruktur ausfüllen
ZeroMemory(&PresentParams, sizeof(D3DPRESENT_PARAMETERS));
PresentParams.BackBufferWidth = 600;
PresentParams.BackBufferHeight = 400;
PresentParams.BackBufferFormat = format;
PresentParams.BackBufferCount = 1;
PresentParams.MultiSampleType = D3DMULTISAMPLE_NONE;
PresentParams.MultiSampleQuality = 0;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow = hTest;
PresentParams.Windowed = true;
PresentParams.EnableAutoDepthStencil = FALSE;
PresentParams.Flags = 0;
PresentParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
PresentParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
if(FAILED (hResult=g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hTest, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &PresentParams, &g_pD3DDevice))) //Hier gebe ich an, dass auf hTest gerendert werden soll.
{
return 1;
}
|