|
|
|
|
? - .
DirectX 9c C++
MSVS 2005 . |
|
|
|
|
|
.
. |
|
|
|
|
|
:
-
Microsoft Visual Studio 2005 ;
-
DirectX SDK Aug 2008 ;
-
,
- -/- -
X-translator, Lingvo - . |
|
|
|
|
|
. |
|
|
|
|
|
. |
|
|
|
|
|
MSVS (Microsoft
Visual Studio), DirectX SDK.
DX SDK
DirectX , DX-
. |
|
|
|
|
|
|
|
|
|
|
|
:
-
MSVS;
-
;
-
; |
|
|
|
|
|
MSVS
File > Open > Project Solution
DirectX SDK -
C:\DXSDK_Aug2008\Samples
, DirectX
SDK , ,
DX SDK ! |
|
|
|
|
|
-
C:\DXSDK_Aug2008\Samples\C++\Direct3D\Tutorials\Tut01_CreateDevice |
|
|
|
|
|
|
|
|
|
|
|
Solution Explorer CreateDevice.cpp,
cpp . |
|
|
|
|
|
wWinMain |
|
|
|
|
|
 |
|
|
|
|
|
, ,
|
|
|
|
|
|
- |
|
|
|
|
|
INT
WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
// Register the window class
WNDCLASSEX wc =
{
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
L"D3D Tutorial", NULL
};
RegisterClassEx( &wc );
// Create the application's window
HWND hWnd = CreateWindow( L"D3D Tutorial", L"D3D Tutorial
01: CreateDevice",
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
NULL, NULL, wc.hInstance, NULL );
// Initialize Direct3D
if( SUCCEEDED( InitD3D( hWnd ) ) )
{
// Show the window
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
// Enter the message loop
MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
UnregisterClass(
L"D3D Tutorial", wc.hInstance );
return 0;
} |
|
|
|
|
|
wWinMain -
, Win -
Windows Main - .
w , WideChar,
. . . |
|
|
|
|
|
- wWinMain. |
|
|
|
|
|
, ,
- wWinMain. |
|
|
|
|
|
- ,
! |
|
|
|
|
|
?
//
Register the window class -
WNDCLASSEX wc =
{
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
L"D3D Tutorial", NULL
};
RegisterClassEx( &wc ); |
|
|
|
|
|
,
//
.
,
,
CPU
. |
|
|
|
|
|
wc WNDCLASSEX
,
-
|
|
|
|
|
|
WNDCLASSEX
wc;
SecureZeroMemory(&wc, sizeof(wc));
wc.cbSize = sizeof( WNDCLASSEX );
wc.style = CS_CLASSDC;
wc.lpfnWndProc = MsgProc;
wc.cbClsExtra = 0L;
wc.cbWndExtra = 0L;
wc.hInstance = GetModuleHandle( NULL );
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszClassName = L"D3D Tutorial";
wc.lpszMenuName = NULL;
|
|
|
|
|
|
wc WNDCLASSEX
SecureZeroMemory
-
.
-
- sizeof
MsgProc
wc.hInstance
GetModuleHandle
wc.lpszClassName
= L"D3D Tutorial";
- .
0, NULL. |
|
|
|
|
|
0
, NULL - -. |
|
|
|
|
|
RegisterClassEx
- . |
|
|
|
|
|
CreateWindow
- |
|
|
|
|
|
if(
SUCCEEDED( InitD3D( hWnd ) ) )
- -
ShowWindow(
hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
- , . |
|
|
|
|
|
//
Enter the message loop
MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
,
GetMessage FALSE
-
UnregisterClass(
L"D3D Tutorial", wc.hInstance );
return 0; -
,
0 |
|
|
|
|
|
[] |
|
|
|
|
|
|
|
|
|
|