如何将DirectX从C ++转换为C# [英] How to convert DirectX from C++ to C#

查看:118
本文介绍了如何将DirectX从C ++转换为C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我意识到我的问题是如何从C ++迁移到C#.
因为我刚刚在C ++.net中找到了Directx的说明
我在使用D3DXMATRIXA16和D3DXVECTOR3,DWORD时遇到问题.
谁可以帮助我转换?
我在这里发布代码:
//矩阵函数

Sorry,I realize my problem is how to move from C++ to C#.
Because I just found instructions Directx with C++.net
I have problems with D3DXMATRIXA16 and D3DXVECTOR3,DWORD.
Who can help me convert?
I post my code here:
// Matrices function

void CalcMatrices(void) 
{ 
   D3DXMATRIXA16 ViewMatrix; 
   // set the view matrix 
   D3DXVECTOR3 EyePoint(g_Camera.Location.x, 

                        g_Camera.Location.y, 

                        g_Camera.Location.z); 
   D3DXVECTOR3 LookAt(g_Camera.Location.x+cos(g_Camera.Rotation), 

                      g_Camera.Location.y, 

                      g_Camera.Location.z+sin(g_Camera.Rotation)); 
   D3DXVECTOR3 UpVector(0.0f, 1.0f, 0.0f); 
   D3DXMatrixLookAtLH(&ViewMatrix, &EyePoint, &LookAt, &UpVector); 
   g_pDirect3D_Device->SetTransform(D3DTS_VIEW, &ViewMatrix); 

} 


以及此处的链接: [


And a link here:[view]
Thanks

推荐答案

大写的东西可能是#define.因此,在源代码中进行查找,您将看到需要转换的实际代码.访问诸如Location之类的属性将完全相同,对象将在C#中具有相同的属性.
The stuff that''s all in caps, is probably a #define. So, look it up in the source and you''ll see the actual code you need to convert. Accessing properties like Location, would just work exactly the same, the objects will have the same properties in C#.


这篇关于如何将DirectX从C ++转换为C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆