I want to draw in 2D,not in 3D so I thought there might be some problems.
I got the code model from a 3D simple example.And I'm interested in what I should change in that code to make it work in 2D.
Untill now I changed just how the projection matrix gets created,it uses an orthographic method,take a look:
[source lang="cpp"]XMMATRIX P = XMMatrixOrthographicLH(D3DApp::mClientHeight,D3DApp::mClientWidth,1,1000);[/source]
I also understand that I should disable the Depth buffer(since I'm in 2D there is no point to enable it).
But,should I change anything else to make drawing in 2D possible?
Dx11 + XNA in 2D
In 2d graphics, you generally use sprites. I dont use XNA, but if you google something like "XNA sprites" you should find what you are looking for.
ya microsoft naming style isn't the smartest in this case. You are talking about a library called XNAMath ( a C++ optimized math library) which has no relationship at all with XNA (C# Framework to create games). So make sure to use XNAMath or XNA Math when you google for informations.
"XNAMath" is actually called "DirectXMath" in the latest version, just to add to the confusion.
Are you just working with sprites? If so, I would consider using DirectXTK. It has a sprite renderer + font rendering + basic texture loader, which is all you need for a simple 2D games. I don't know if there are any tutorials, but you should be able to figure out a lot of it on your own. There's some basic instructions here.
Are you just working with sprites? If so, I would consider using DirectXTK. It has a sprite renderer + font rendering + basic texture loader, which is all you need for a simple 2D games. I don't know if there are any tutorials, but you should be able to figure out a lot of it on your own. There's some basic instructions here.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement