0

I am attempting to create a 2D game using DirectX 10. I've been having lots of problems with figuring out how to actually get started to create such a thing. I've discovered mixed ideas, such as just use shaders and stick with Direct3D and I've seen some people using libraries such as SFML. I am rather new to DirectX, and am wondering what I should be using to create a 2D game (shaders or a library). Are shaders something that I should look into, or should I just use a library?

Charsmud
  • 183
  • 1
  • 4
  • 19
  • SFML is a good choice for 2D. You can use OpenGL with it since it is based on top of OpenGL. If you use DirectX then you simply ignore the z axis and handle everything else normally and in Ortho projection. I do suggest you learn about shaders because the old methods "fixed function" are being replaced by the programmable pipeline. – Aleks Jul 20 '13 at 04:10
  • I'm unsure what you mean by "ignore the z axis". From the experimenting that I have done, when you render a primitive to a screen, you have to declare an x, y and z, and I assume that it is transferable to sprites and textures as well. How would I ignore the z axis? – Charsmud Jul 20 '13 at 04:14
  • Well since you want to do 2D graphics you simply set z to 0. The only time the z axis is relevant is during rotation since you rotate about the z axis. (assuming your z is your depth) – Aleks Jul 20 '13 at 05:39

1 Answers1

0

Well if you are interested in learning DirectX itself, you should try to write your own 2D engine, which with a little experience isn't as hard as it may seem. But if you want to get straight to game developement, you can take a look at some engines that take care of that part. Shaders can really enhance scenes (3D as well as 2D) and if I were you, I would definitely use them, instead of just using simple unprocessed textures. Most engines won't take the shader programming from you, so you will probably need to look into hlsl anyway. Also what I experienced with several engines and librarys: at some point they will come to an end, and if you are enthousiastic about your project, you don't want to live with those limitations. That's why I would recommend writing your own engine which you can easily expand as needed.

A good starting point for pure DirectX: http://www.rastertek.com/tutdx10.html (Mainly for 3D but also covers 2D, which you will notice isn't that different)

theCNG27
  • 405
  • 8
  • 27
  • I was thinking of creating my own engine or library, but I would have no idea where to start..... any tips? – Charsmud Jul 20 '13 at 02:06
  • well I really like rastertek. Its basicly for 3D, but there is also a 2D tutorial and as Aleks pointed out, its basicly just ignoring z (set to 0) and rendering in ortho. – theCNG27 Jul 20 '13 at 08:09