XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Issues with 2D Drawing

Last post 11/06/2009 14:18 by NightCreature. 1 replies.
  • 11/06/2009 0:20

    Issues with 2D Drawing

    Hello folks,

    I rarely have anything to do with games, but as I suddenly got all excited about the idea of writing a RPG, I took my first steps with DX.
    Oh, and I'm using VB.Net and managed DX.

    So, I looked up some tutorials and eventually managed to draw sprites, figured out how to use alpha-blend and other cool stuff added in Direct3D. My game's not supposed to be 3D whatsoever, but DX had decided to do so. I looked around for a solution and.. ha! I'll replace
    Sprite.Draw 
    with
    Sprite.Draw2D 
    and my problem must be solved. Well, as you can imagine - it wasn't. Here's how I'm declaring my device : 
    device = New Direct3D.Device(0, DeviceType.Hardware, frmHandle, CreateFlags.SoftwareVertexProcessing, presentParams) 

    Here's a picture to demonstrate the problem:
    <--I'll add it as soon as I figure out how, for now I uploaded it HERE -->
    Those tiles are drawn as the form was a 3D-Space ( which it is ), while I want them to be drawn plain 2D.

    So I come before you oh wise & mighty fellow developers, as uncle google didn't give me an answer, neither did MSDN ( which ain't no surprise ).

    Best Regards :)
  • 11/06/2009 14:18 In reply to

    Re: Issues with 2D Drawing

    You do realise that now a days 2D is achieved by rendering in 3D with an orthographic projection. The orthographic projection will give you no depth distortion an dpresent the scene as a perfectly flat image, and you can make advantage of the fact that there actually is a 3 dimension in effects like having a background image appear infront of the player.

    To do 2D rendering in one plain would be achieved then with giving al x, y or z coordinates the same value, the x, y or z value is dependant on the look vector you are using. So if float3(0.0f, 0.0f, 10.0f) is your look vector 2D rendering can be achieved with having the same Y coordinate for all your squares.

Page 1 of 1 (2 items) Previous Next