Thanks to Tetrad (for pointing out D3DXMatrixOrthoLH ) I have figured out how to set it up in DirectX9. However, the problem I am now facing is my 0,0 mouse position is now in the middle.
What I Want To Achieve: I want my 0,0 origin to be the top left of the window (not the middle). I also want to be able to zoom in.
Thanks for any help!
edit (this seems to add the 0,0 to the bottom left)
D3DXMATRIX m_d3dts_projection; D3DXMatrixOrthoOffCenterLH ( &m_d3dts_projection , 0.0f , console_editor.window_w , 0.0f , console_editor.window_h , 1.0f , 10.0f ); console_editor.directx_device->SetTransform ( D3DTS_PROJECTION , &m_d3dts_projection );
Old Post -- Dont Answer
I have been developing a map editor in C++ DX9 for the past couple of months, and have ran into a particular development problem.
How my map editor works: I split the screen into 16x16 cell blocks each with their own struct for rendering. When you click on the window, it will find the cell block that you clicked based on the win32 whereabouts of the mouse cursor. It then will do its magic. This seems to work well with a FOV of D3DXToRadian(float 90).
I also want my map editor to be able to zoom in and to zoom out, so when I increase or decrease the FOV, the mouse cursor and the cell block code are all correct, but wrong. Example:
Normal 90 FOV - Looks Good
Zoomed In - Opps
Question: How can I add functionality of zooming in and out, but still have the mouse position be relevant to the render? I assume I have to recode how everything works, and I am okay with doing that...