This program compiles just fine, but when it runs it throws this error: Unhandled exception at 0x011627d6 in dx1.exe: 0xC0000005: Access violation reading location 0x00000030.
When I go into debugging, it says the problem is with line 313:
hResult = pd3dDevice->CreateOffscreenPlainSurface(width, height, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);
However, up near the top of the program (line 26) I declare a variable for holding a font object:
If you comment out that line then the program suddenly works. I have commented out all the code that uses the font object, so I am fairly certain that this is the problem.
Anyone have any ideas? All help is GREATLY appreciated. Been searching for hours to no avail. I am using Visual Studio 2010 in case that's relevant.
Full code: http://pastebin.ca/2097898