Is there any particular reason why the window long pointer is set here instead of somewhere else? I realize the hwnd goes out of scope a few lines later, but I'm just wondering if perhaps I can just retain the handle and pass it into the constructor for the game class, and have it initialize the DX11 resources there instead? That is, is it strictly required that the window have a pointer to the game object before you can then have the DX11 resources target the window for rendering, or can I initialize the DX11 resources on the window and then after the game object and dx11 resources are initialized, set the window long pointer on the window kernel object?
I set it early mostly so that the WndProc has the right context once it starts getting a bunch of messages. It's not really used for anything else in my template.
https://github.com/walbourn/directx-vs-templates/blob/a4a53e201e2368bfc2d43d008c342761e1cec74a/d3d11game_win32_dr/Main.cpp#L82
Is there any particular reason why the window long pointer is set here instead of somewhere else? I realize the hwnd goes out of scope a few lines later, but I'm just wondering if perhaps I can just retain the handle and pass it into the constructor for the game class, and have it initialize the DX11 resources there instead? That is, is it strictly required that the window have a pointer to the game object before you can then have the DX11 resources target the window for rendering, or can I initialize the DX11 resources on the window and then after the game object and dx11 resources are initialized, set the window long pointer on the window kernel object?