Original Post
I just started working on my engine yesterday, and yesterday I was getting a linking error that I''ve fixed now. Even though I was getting a link error, I finished my input code and my d3d init code. The prog compiles and links fine now, but now when the prog starts up, and black 800x600 (thats the resolution i want) comes up, but it''s not fullscreen because I run my comp in 1024x768, so theres a large amount of space around the window. Anyway, heres my init code:
I think it also might be in my create window code. Mt WinMain is at the bottom.
Thanks.
Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html
INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
int CDXGraphics::CreateD3D(HWND hwnd)
{
HRESULT r = 0;
lpd3d = Direct3DCreate9(D3D_SDK_VERSION);
if(lpd3d == NULL)
{
Error_Message("Create D3D");
}
ZeroMemory(&d3dpp,sizeof(d3dpp));
d3dpp.Windowed = false;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferWidth = SCREEN_WIDTH;
d3dpp.BackBufferHeight = SCREEN_HEIGHT;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hwnd;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.FullScreen_RefreshRateInHz = 0;
d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
r = lpd3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING
,&d3dpp, &lpDevice);
if(FAILED(r))
{
Error_Message("Create Device");
return(0);
}
r = lpDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&lpBackSurface);
lpDevice->Clear(0,0,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_ARGB(255,0,0,55),0.0f,0);
return(1);
}
CMainWnd::Window_Init(HINSTANCE hinstance)
{
WNDCLASSEX winclass;
HWND hwnd;
srand(GetTickCount());
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WndProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&winclass))
return(0);
hinstance_app = hinstance;
if (!(hwnd = CreateWindowEx(WS_EX_TOPMOST,
WINDOW_CLASS_NAME,
"Dragon Engine Test",
WS_POPUP | WS_SYSMENU | WS_VISIBLE,
0,0,
SCREEN_WIDTH,SCREEN_HEIGHT,
NULL,
NULL,
hinstance,
NULL)))
return(0);
main_window_handle = hwnd;
return(1);
}
int WINAPI WinMain( HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
Window.Window_Init(hinstance);
ShowWindow( Window.main_window_handle, ncmdshow );
UpdateWindow(Window.main_window_handle);
MSG msg;
Game_Init();
while(TRUE)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Game_Shutdown();
}
return(msg.wParam);
}