Can you show us what you've got so-far(code)?
also are you going to use it with more then one frame(or buffer, w/e you wanna call em), will you use it to render mainly 2D or 3D?
I'm familier with DX9, though I don't think there's much difference in the setup I will try to help my best.
Edit:
check this out
http://takinginitiative.wordpress.com/2 ... 10-device/
this is how i set up my Windows part of the application.
Code: Select all
LRESULT WINAPI WinProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_DESTROY:
//release the Direct3D objects
if (d3ddev != NULL) d3ddev->Release();
if (d3d != NULL) d3d->Release();
//release sound objects (not a DX object!)
if (dsound != NULL) delete dsound;
//release input objects
if (dinput != NULL) dinput->Release();
Kill_Keyboard();
Kill_Mouse();
//Release all the nasty shit
Game_End(hWnd);
//Send a message to kill the program
PostQuitMessage(0);
return 0;
/*
case WM_ACTIVATE:
switch(wParam)
{
case WA_CLICKACTIVE:
active=true;
Resume(hwnd);
break;
case WA_ACTIVE:
if(!active)
Resume(hwnd);
break;
case WA_INACTIVE:
active=false;
break;
}*/
/* case WM_MOUSEMOVE:
absMouseX = GET_X_LPARAM(lParam);
absMouseY = GET_Y_LPARAM(lParam);
break;*/
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
//helper function to set up the window properties
ATOM MyRegisterClass(HINSTANCE hInstance)
{
//create the window class structure
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
//fill the struct with info
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(2));
wc.hIconSm = LoadIcon(wc.hInstance,MAKEINTRESOURCE(2));
wc.hCursor = LoadCursor(NULL, IDC_HAND);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE;
wc.hIconSm = NULL;
//set up the window with the class info
return RegisterClassEx(&wc);
}
//entry point for a Windows program
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HWND hWnd;
// register the class
MyRegisterClass(hInstance);
//SCREENMODE is 1 or 0, windowed or fullscreen
DWORD style;
if (SCREENMODE)
style = WS_EX_TOPMOST | WS_VISIBLE | WS_POPUP;
else
style = WS_OVERLAPPED;
//create a new window
hWnd = CreateWindow(
APPTITLE, //window class
APPTITLE, //title bar
style, //window style
0, //x position of window
0, //y position of window
SCREEN_WIDTH, //width of the window
SCREEN_HEIGHT, //height of the window
NULL, //parent window
NULL, //menu
hInstance, //application instance
NULL); //window parameters
//was there an error creating the window?
if (!hWnd)
return FALSE;
//display the window
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
//initialize Direct3D
if (!Init_Direct3D(hWnd, SCREEN_WIDTH, SCREEN_HEIGHT, SCREENMODE))
{
MessageBox(hWnd, "Error initializing Direct3D", "Error", MB_OK);
return 0;
}
//initialize DirectSound
if (!Init_DirectSound(hWnd))
{
MessageBox(hWnd, "Error initializing DirectSound", "Error", MB_OK);
return 0;
}
//initialize DirectInput
if (!Init_DirectInput(hWnd))
{
MessageBox(hWnd, "Error initializing DirectInput", "Error", MB_OK);
return 0;
}
//initialize the game
if (!Game_Init(hWnd))
{
MessageBox(hWnd, "Error initializing the game", "Error", MB_OK);
return 0;
}
// main message loop
int done = 0;
while (!done)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
//look for quit message
if (msg.message == WM_QUIT)
done = 1;
//decode and pass messages on to WndProc
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
//Run the game loop
Game_Run(hWnd);
}
}
return msg.wParam;
}