32 GpD3D = Direct3DCreate9(D3D_SDK_VERSION);
34 DEBUG_INFO(
"jbxwl::Dx9CreateInterface: ERROR: グラフィックデバイスの取得に失敗しました\n");
40 DEBUG_INFO(
"jbxwl::Dx9CreateInterface: ERROR: インプットデバイスの取得に失敗しました\n");
50 DEBUG_INFO(
"jbxwl::Dx9CreateInterface(): ERROR: マウスデバイスの取得に失敗しました\n");
61 DEBUG_INFO(
"jbxwl::Dx9CreateInterface(): ERROR: キーボードデバイスの取得に失敗しました\n");
95 LPDIRECT3DDEVICE9 d3dDevice=NULL;
98 hr = gpD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, d3dParam, &d3dDevice);
100 hr = gpD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, d3dParam, &d3dDevice);
102 hr = gpD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, d3dParam, &d3dDevice);
103 if (FAILED(hr))
return (LPDIRECT3DDEVICE9)NULL;
116 LPDIRECTINPUTDEVICE8 gpdmouse=NULL;
118 HRESULT hr = gpDInput->CreateDevice(GUID_SysMouse, &gpdmouse, NULL);
119 if (FAILED(hr) || gpdmouse==NULL)
return NULL;
121 hr = gpdmouse->SetDataFormat(&c_dfDIMouse);
122 if (FAILED(hr))
return NULL;
124 hr = gpdmouse->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
125 if (FAILED(hr))
return NULL;
140 hr = gpdmouse->Acquire();
141 if (FAILED(hr))
return NULL;
153 LPDIRECTINPUTDEVICE8 gpdkeyboard=NULL;
155 HRESULT hr = gpDInput->CreateDevice(GUID_SysKeyboard, &gpdkeyboard, NULL);
156 if (FAILED(hr))
return NULL;
158 hr = gpdkeyboard->SetDataFormat(&c_dfDIKeyboard);
159 if (FAILED(hr))
return NULL;
161 hr = gpdkeyboard->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
162 if (FAILED(hr))
return NULL;
163 else return gpdkeyboard;
180 HRESULT hr = gpD3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, pgpBackBuffer);
181 if (FAILED(hr))
return pt;
202 if (cmnHead.kind==HEADER_NONE)
return FALSE;
203 int chk = cmnHead.kind & 0x00ff;
221 HRESULT hr = gpD3DDevice->CreateOffscreenPlainSurface(cmnHead.xsize, cmnHead.ysize, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, pgpSurface, NULL);
222 if (FAILED(hr))
return FALSE;
224 hr = D3DXLoadSurfaceFromFileInMemory(*pgpSurface, NULL, NULL, cmnHead.grptr, cmnHead.lsize, NULL, D3DX_FILTER_NONE, 0, (D3DXIMAGE_INFO*)cmnHead.buf);
225 if (FAILED(hr))
return FALSE;
238 HRESULT hr = gpD3DDevice->CreateOffscreenPlainSurface(cmnHead.xsize, cmnHead.ysize, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, pgpSurface, NULL);
239 if (FAILED(hr))
return FALSE;
244 rect.right = cmnHead.xsize - 1;
245 rect.bottom = cmnHead.ysize - 1;
246 hr = D3DXLoadSurfaceFromMemory(*pgpSurface, NULL, NULL, cmnHead.grptr, D3DFMT_L8, cmnHead.xsize, NULL, &rect, D3DX_FILTER_NONE, 0);
248 if (FAILED(hr))
return FALSE;
267 if (cmnHead.kind==HEADER_NONE)
return FALSE;
268 int chk = cmnHead.kind & 0x00ff;
283 HRESULT hr = D3DXCreateTextureFromFileInMemoryEx(
284 gpD3DDevice, cmnHead.grptr, cmnHead.lsize, 0, 0, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
285 D3DX_FILTER_LINEAR, D3DX_FILTER_LINEAR, 0, NULL, NULL, pgpTexture);
286 if (FAILED(hr))
return FALSE;
300 LPDIRECT3DSURFACE9 surface;
302 hr = D3DXCreateTexture(gpD3DDevice, cmnHead.xsize, cmnHead.ysize, 0, D3DUSAGE_RENDERTARGET, D3DFMT_L8, D3DPOOL_DEFAULT, pgpTexture);
303 if (FAILED(hr))
return FALSE;
305 hr = (*pgpTexture)->GetSurfaceLevel(0, &surface);
306 if (FAILED(hr))
return FALSE;
310 rect.right = cmnHead.xsize - 1;
311 rect.bottom = cmnHead.ysize - 1;
312 hr = D3DXLoadSurfaceFromMemory(surface, NULL, NULL, cmnHead.grptr, D3DFMT_L8, cmnHead.xsize, NULL, &rect, D3DX_FILTER_LINEAR, 0);
315 if (FAILED(hr))
return FALSE;
344 for (i=0; i<iter; i++) {
346 if (FAILED(hr))
return hr;
348 hr = gpD3DDevice->DrawPrimitive(ptype, i*unit*
DXMAXPRIMITIVE, imod);
352 hr = gpD3DDevice->DrawPrimitive(ptype, 0, bsize);
363 D3DSURFACE_DESC desc;
366 (*lpsf)->GetDesc(&desc);
#define DIRECTINPUT_VERSION
LPDIRECTINPUTDEVICE8 GpDMouse
BOOL Dx9SurfaceFromByteMemory(LPDIRECT3DDEVICE9, LPDIRECT3DSURFACE9 *, CmnHead)
BOOL Dx9TextureFromMemoryFile(LPDIRECT3DDEVICE9, LPDIRECT3DTEXTURE9 *, CmnHead)
LPDIRECTINPUTDEVICE8 GpDKeyBoard
POINT Dx9GetSurfaceSize(LPDIRECT3DSURFACE9 *lpsf)
LPDIRECTINPUTDEVICE8 Dx9CreateKeyBoard(LPDIRECTINPUT8, HWND)
HRESULT Dx9DrawPrimitive(LPDIRECT3DDEVICE9, D3DPRIMITIVETYPE, UINT, UINT)
BOOL Dx9CreateInterface(CWinApp *wapp)
LPDIRECT3DDEVICE9 Dx9CreateGraphic(LPDIRECT3D9, D3DPRESENT_PARAMETERS *, HWND)
BOOL Dx9SurfaceFromMemoryFile(LPDIRECT3DDEVICE9, LPDIRECT3DSURFACE9 *, CmnHead)
POINT Dx9GetBackBuffer(LPDIRECT3DDEVICE9, LPDIRECT3DSURFACE9 *)
LPDIRECTINPUTDEVICE8 Dx9CreateMouse(LPDIRECTINPUT8, HWND)
BOOL Dx9SurfaceFromMemory(LPDIRECT3DDEVICE9, LPDIRECT3DSURFACE9 *, CmnHead)
BOOL Dx9TextureFromMemory(LPDIRECT3DDEVICE9, LPDIRECT3DTEXTURE9 *, CmnHead)
void Dx9ReleaseInterface()
BOOL Dx9DividePrimitiveMode
BOOL Dx9TextureFromByteMemory(LPDIRECT3DDEVICE9, LPDIRECT3DTEXTURE9 *, CmnHead)