本文介绍了如何弄湿DerectX 9中的左上角坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!!
我需要在DirectX 9中绘制一些东西。
我有兴趣以坐标的方式工作将被调整为像素,而(0,0)将是 TopLeft 角。以下是我的工作:
Hello!!
I need to draw something in DirectX 9.
I am interested to work in a way that the coordinates will be adjusted to pixels, while (0,0) will be the TopLeft corner. Here is what I do:
RECT clientRect;
::GetClientRect(m_hWIN, &clientRect);
D3DXMATRIX matOrtho2D, matIdentity;
D3DXMatrixOrthoOffCenterLH(&matOrtho2D, 0, clientRect.right, 0, clientRect.bottom, 0.0f, 1.0f);
D3DXMatrixIdentity(&matIdentity);
g_pDirect3D_Device->SetTransform(D3DTS_PROJECTION, &matOrtho2D);
g_pDirect3D_Device->SetTransform(D3DTS_WORLD, &matIdentity);
g_pDirect3D_Device->SetTransform(D3DTS_VIEW, &matIdentity);
这个工作正常,除了(0,0) )是 BottomLeft 一角。如何更改它?
谢谢!
This works fine, except the (0,0) is the BottomLeft corner. How can I change it?
Thanks!
推荐答案
D3DXMatrixTranslation(&matTranslate, 0, (float)clientRect.bottom, 0.0f);
D3DXMatrixRotationX(&matFlip, D3DXToRadian(180));
D3DXMATRIX matCoordTransform = matFlip * matTranslate;
g_pDirect3D_Device->SetTransform(D3DTS_WORLD, &matCoordTransform);
这篇关于如何弄湿DerectX 9中的左上角坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!