Thread: 2D in DirectX 9

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    46

    2D in DirectX 9

    Hi all,

    This probably gets asked a lot, but can anyone point me to a good link or book discussing how to do 2D in DX9 (and not in bloody C#)? ...I was using "Beginning Game Programming" by Jonathan Harbour (Thomson publishing), but after trying (and failing miserably) to compile his source-code repeatedly (I found out later that his source code is actually outdated and unsupported), I'm at my wits end and about to give up on DX... Google searches, browsing Amazon, and even searches on this board-- none have yielded good results.... Maybe I'm just an idiot when it comes to searching, but I'm really about to give up on this and go learn ASM instead (hey, at least it's straightforward).

    So, does anyone know of a good tutorial or book that will address 2D in DX9?

    Thanks a ton guys (and gals!)

    -maxthecat

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    In fear of starting a pretty well-fueled flamewar, I'll refrain from saying "use OpenGL".

    It seems to be way easier to find good tutorials (C++) for OpenGL - I'm yet to find a good Directx 9 one. Owing to Microsoft's coding conventions I can't bear to read through someone elses code and try to understand it that way, either.

    Just my thoughts; I hope none of you know where I live
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    46
    Haha... Well, to be honest, I had thought of using OpenGL (I have the "Red Book" sitting on my shelf here), but I didn't want to have to build the music and networking APIs from scratch.... I thought DX would be an easier way to go, since MS has DirectSound and DirectPlay. :P

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Not sure about networking but there is (amongst others) OpenAL for sound. I think it's AL. Hmm.

    Yeah I know what you mean though. Does the benefit of having sound / video / input / networking libraries outweight the, err, un-benefits. My answer to which I shall keep to myself.

    EDIT:
    <offtopic>
    I'm eating "The Original Poppycock Butter Almond Pecan Popcorn Clusters". Yum.
    </offtopic>
    Last edited by cboard_member; 01-06-2006 at 02:20 PM.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  5. #5
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Buy this book

    If it is the same one I have (mine has a different cover, but same author and title), then it spends the first half of the book explaining DirectX (Direct3D, DirectSound, etc) and using it to build engines. It spends some time explaining how to use 2D, so it should work for you.
    To code is divine

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    203
    A few years ago when I was wondering about 2D with DirectX, the general consensus I got was to use DirectX 7's directdraw instead of DirectX 8 which no longer had directdraw as part of it. Is this still a viable option for making 2D games? I still see books on the shelves of someplaces that teach 2D Graphics with DirectX 7 and includes the SDK on a CD. Would it be better to learn 2D in DirectX 7 and move up to DirectX 9 for 3D or just learn 2D in DirectX 9?

  7. #7
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Quote Originally Posted by Syneris
    A few years ago when I was wondering about 2D with DirectX, the general consensus I got was to use DirectX 7's directdraw instead of DirectX 8 which no longer had directdraw as part of it. Is this still a viable option for making 2D games? I still see books on the shelves of someplaces that teach 2D Graphics with DirectX 7 and includes the SDK on a CD. Would it be better to learn 2D in DirectX 7 and move up to DirectX 9 for 3D or just learn 2D in DirectX 9?
    Learn 2D in DirectX9.

    It's newer, supported, and probably easier to find help for.
    To code is divine

  8. #8
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    I have a good book on doing 2d in Direct3D, here's a gamdev article on it too:

    http://www.gamedev.net/reference/art...rticle1434.asp
    -- Rocky
    -- DreamSys Software (http://www.dreamsyssoft.com)
    -- Free Tiff 2 PDF Library (http://www.dreamsyssoft.com/tiff-to-pdf-api)

  9. #9
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67
    Quote Originally Posted by maxthecat

    I was using "Beginning Game Programming" by Jonathan Harbour (Thomson publishing), but after trying (and failing miserably) to compile his source-code repeatedly (I found out later that his source code is actually outdated and unsupported)
    -maxthecat
    max, I have been using the same book as you for about 3-4 months and I believe his code actually works but its not as "spiffy" as I would like it to be. If you believe his code dosn't work because of the window poping up and closing right away, it's because w/ dev bloodshed you need to usually put something like

    Code:
    #include<iostream>
    
    int main()
    {
    std::cout<<"Hello World!"<<std::endl;
    std::cout<<"What a fine day!"<<std::endl;
    
    system("pause");
    return 0;
    }
    the system("pause"); does what it says. It pauses till the user presses any key to continue.

    .

  10. #10
    Registered User
    Join Date
    Dec 2001
    Posts
    46
    The one I'm using is all about DirectX programming, and has nothing to do with consoles... I'd post the ISBN, but unfortunately I'm at work right now... Trust me, the code in his book will not compile (it frustrated the heck out of me), even though he claims that it will compile with a DX9.0b install. Simply put, he makes several errors to function calls (whether these be typos or just old code he cut and paste, I don't know).

    I use Visual Studio 6.0, by the way

    thanks for the input though!

    -max

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    U probably have the Beginning Game Programming with DirectX9. There was a problem at the printer with underscores in DX identifiers. Whenever you see a space in the code you know there should be an underscore.

    An easy fix and a good book.

  12. #12
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    I like the looks of the Programming RPG's with Direct X book, i wish i knew about it a few weeks ago so i could have gotten it for Xmas! Anyway, this sounds like something i would like after i finish my windows programming book. I was actually going to make a thread that said, "Where do i go now?" which would have asked what Graphical languages/API's i should learn but this thread helped me out. One quick question about that book, Do you make an RPG like Final Fantasy? Well a 2D version of course but does the combat work like FF (and most RPG's) in that its Turn Based? With like special attacks and all that stuff? Or is it not that complex, more Diablo style games? Lol thanks (even though this wasnt my thread)!

    And good luck to MaxTheCat in your endeavors!
    Last edited by Junior89; 01-08-2006 at 08:48 PM.

  13. #13
    Registered User
    Join Date
    Mar 2002
    Posts
    203
    What about Programming Role Playing Games with DirectX, Second Edition?
    http://www.gamedev.net/columns/books...?productid=422
    Same author, just using DirectX9 instead of DirectX8. The 2nd edition seems to have worse reviews than the first. Anyone who has had experience with both books have an opinion?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D in directX
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 01-25-2009, 11:23 AM
  2. text on 2d tiles in DirectX?
    By Quantum1024 in forum Game Programming
    Replies: 4
    Last Post: 04-26-2006, 11:40 PM
  3. OpenGL DirectX 2D
    By c++.prog.newbie in forum Game Programming
    Replies: 11
    Last Post: 03-01-2005, 01:54 PM
  4. 2D Game Project with DirectX and C++
    By VMJC in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 12-23-2004, 12:28 AM
  5. DirectX 2D Frames Per Second
    By LuckY in forum Game Programming
    Replies: 9
    Last Post: 09-17-2004, 11:11 PM