D3D10 Vsync on (640x480), R8G8B8A8_UNORM_SRGB (MS1, Q0) HARDWARE: NVIDIA GeForce GT 220 |
前田稔(Maeda Minoru)の超初心者のプログラム入門
#include "DXUT.h" #include "SDKmisc.h" ID3DX10Font* g_pFont = NULL; // Font for drawing text ID3DX10Sprite* g_pSprite = NULL; // Sprite for batching text drawing CDXUTTextHelper* g_pTxtHelper = NULL; void RenderText(); |
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ) { HRESULT hr; V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, //V_RETURN( D3DX10CreateFont( pd3dDevice, 24, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &g_pFont ) ); V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite ) ); g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont, g_pSprite, 15 ); //g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont, g_pSprite, 24 ); return S_OK; } |
void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ) { // Clear render target and the depth stencil float ClearColor[4] = { 0.176f, 0.196f, 0.667f, 0.0f }; pd3dDevice->ClearRenderTargetView( DXUTGetD3D10RenderTargetView(), ClearColor ); pd3dDevice->ClearDepthStencilView( DXUTGetD3D10DepthStencilView(), D3D10_CLEAR_DEPTH, 1.0, 0 ); RenderText(); } |
void RenderText() { g_pTxtHelper->Begin(); g_pTxtHelper->SetInsertionPos( 0, 10 ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) ); g_pTxtHelper->SetInsertionPos( 0, 60 ); g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 0.0f, 1.0f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); g_pTxtHelper->End(); } |
void CALLBACK OnD3D10DestroyDevice( void* pUserContext ) { SAFE_DELETE( g_pTxtHelper ); SAFE_RELEASE( g_pFont ); SAFE_RELEASE( g_pSprite ); } |
D3D10 Vsync on (640x480), R8G8B8A8_UNORM_SRGB (MS1, Q0) HARDWARE: NVIDIA GeForce GT 220 |