wip
This commit is contained in:
parent
be143930c8
commit
b2e0a6026b
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ CFLAGS += -Wno-error=unused-function
|
||||
CFLAGS += -Wno-error=unused-variable
|
||||
CFLAGS += -DUNICODE
|
||||
|
||||
LDFLAGS += -Wl,--subsystem,windows -mwindows -mconsole -municode -ld3d9 -ld3dx9 -lwinmm
|
||||
LDFLAGS += -Wl,--subsystem,windows -mwindows -mconsole -municode -ld3d9 -ld3dx9 -lwinmm -ldinput8 -ldxguid
|
||||
|
||||
OPT = -Og
|
||||
|
||||
|
||||
36
main.cpp
36
main.cpp
@ -3,6 +3,7 @@
|
||||
#include <d3dx9.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <dinput.h>
|
||||
|
||||
struct CUSTOMVERTEX
|
||||
{
|
||||
@ -25,6 +26,8 @@ IDirect3DVertexDeclaration9 * g_pVertexDeclaration = NULL;
|
||||
ID3DXConstantTable * g_pConstantTable = NULL;
|
||||
IDirect3DVertexShader9 * g_pVertexShader = NULL;
|
||||
|
||||
IDirectInput8 * g_pDI = NULL;
|
||||
|
||||
HRESULT InitDirect3D(HWND hwnd)
|
||||
{
|
||||
g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
@ -52,6 +55,35 @@ HRESULT InitDirect3D(HWND hwnd)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
BOOL CALLBACK EnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi,
|
||||
LPVOID pvRef)
|
||||
{
|
||||
printf("enum devices callback");
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
HRESULT InitDirectInput(HINSTANCE hInstance)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = DirectInput8Create(hInstance,
|
||||
DIRECTINPUT_VERSION,
|
||||
IID_IDirectInput8,
|
||||
(void **)&g_pDI,
|
||||
NULL);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = g_pDI->EnumDevices(DI8DEVCLASS_GAMECTRL,
|
||||
EnumDevicesCallback,
|
||||
NULL,
|
||||
DIEDFL_ATTACHEDONLY);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void Cleanup()
|
||||
{
|
||||
if (g_pd3dDevice != NULL)
|
||||
@ -105,6 +137,10 @@ void Render()
|
||||
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
InitDirectInput(hInstance);
|
||||
|
||||
return 0;
|
||||
|
||||
const wchar_t CLASS_NAME[] = L"Sample Window Class";
|
||||
|
||||
WNDCLASS wc = {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user