You are on page 1of 23

Beginning Game

Programing With DirectX


DirectX l g ?
Game Dos
S pht trin ca windows v card mn hnh
Vic giao tip vi nhiu loi card mn hnh dn n kh khn trong lp trnh
ha
Cn mt tng giao tip chung vi mi loi card mn hnh
S ra i ca DirectX
DirectX l g ? (cont.)
DirectX Module :
DirectX Graphics
Direct Input
Direct Show
DirectX Audio
Direct Play
Direct Setup
DirectX l g ? (Cont.)
Create DirectX Device
Create DirectX Device (Cont.)
Create DirectX Device (Cont.)
IDIRECT3D9 interface c dng ly thng tin ca Adapter ( graphic card )
Mt s cc API thng dng
UNIT GetAdapterCount()
HRESULT GetAdapterDisplayMode( UINT adapter , D3DDISPLAYMODE* pMode )

DirectX Device overview

DirectX Device overview(Cont.)
Frame buffer ( aka Back buffer )
Refresh rate
DirectX Device overview(Cont.)
Front buffer
Swap chains
Fullscreen mode problem
Windowed mode problem
Create DirectX Device (Cont.)
What are those variables ?
UNIT Adapter
D3DDEVTYPE type

D3DDEVTYPE
D3DDEVTYPE_HAL
D3DDEVTYPE_REF
D3DDEVTYPE_SW
What are those variables ? (Cont.)
HWND hFocusWindow
DWORD BehaviourFlags
D3DCREATE_HARDWARE_VERTEXPROCESSING
D3DCREATE_MIXED_VERTEXPROCESSING
D3DCREATE_SOFTWARE_VERTEXPROCESSING
PRESENTATION PARAMETERS
PRESENTATION PARAMETERS(Cont.)
What are those variables ?
UNIT BackBufferWidth , BackBufferHeight
D3DFORMAT BackBufferFormat
Mt s format ca backbuffer
What are those variables ? (Cont.)
UINT BackBufferCount ( 0 4 )
MULTISAMPLETYPE , MULTISAMPLEQUALITY ( Doesnt use yet )
D3DSWAPEFFECT SwapEffect
D3DSWAPEFFECT_FLIP
D3DSWAPEFFECT_COPY
D3DSWAPEFFECT_DISCARD ( Use it if confuse @_@ )
HWND hwnd
BOOL windowed


BOOL EnableAutoDepthStencil
D3DFMT AutoDepthStencilFormat
DWORD Flag
D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
D3DPRESENT_DISCARD_DEPTHSTENCIL ( not use much )
UINT FullScreen_RefreshRateInHz
Use D3DPRESENT_RATE_DEFAULT
UINT PresentationInterval
Google for more information
D3DPRESENT_INTERVAL_DEFAULT for good purpose

Demo code

Externals Topics
GAME LOOP

You might also like