Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Simple 2D Example

  1. #1
    OutcastOrange is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Simple 2D Example

    This is a pretty simple request, I hope.

    I have Visual C++ (Which I've gotten rather good at)
    and DirectX SDK.

    I've programmed a bunch of 2D stuff in other languages, but so far I've only been capable of text-based games in C++.
    I learned that C++ doesn't do graphics on its own, and DirectX is required.

    So I was browsing the samples that came with it, hoping to dissect one of them, and learn how it worked.
    The only problem is that the "simple sample" they included, consisted of over 15 different components (.cpp, .h, .etc)


    I would just like a program that uses DirectX and draws a basic window on screen, and then a sprite in that window.

    The more simple the better, I want bare minimum, just so I can pick it apart line for line and learn how it works.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brownhead's Avatar
    brownhead is offline Programmer
    Join Date
    Apr 2009
    Posts
    172
    Rep Power
    12

    Re: Simple 2D Example

    If you're using Visual C++ than you might as well just use Window's GDI+ since your not worried about cross platform compatibility.

    Check out the example on this page to get started.

    Note: The reason I'm suggesting GDI+ over DirectX is because DirectX is mainly for 3D graphics, it can still draw 2D graphics really well, but it's a lot harder. GDI+ on the other hand is strictly for 2D graphics (I think).

  4. #3
    OutcastOrange is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: Simple 2D Example

    If you help me out this one time, you very well may save my future!
    Please dear friend, how do I follow this new GDI+ path?
    It sounds so new and shiny.

    Perhaps you know a better way to bridge the gap?
    I long for a clear reply.

    PS: Don't worry, I've just had a few perspective realizations and now reality seems to be fleeting from me.

  5. #4
    brownhead's Avatar
    brownhead is offline Programmer
    Join Date
    Apr 2009
    Posts
    172
    Rep Power
    12

    Re: Simple 2D Example

    What are you having trouble with specifically? The example and references on MSDN should be pretty helpful, but perhaps you're having difficulty with the actual language?

  6. #5
    OutcastOrange is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: Simple 2D Example

    I know how to make loops and use headers and reference libraries for my text based games.

    I need to learn which libraries I will need for 2d programming, and then some basic commands for:
    -Creating Sprites
    -Hide/Show Sprites
    -Change Sprite Image
    -Change Sprite Position

    Then I can really throw down some awesome.
    Thank you for all of your help, I intend to learn more about GDI+ today.

  7. #6
    SolidState is offline Learning Programmer
    Join Date
    Aug 2008
    Posts
    38
    Blog Entries
    2
    Rep Power
    0

    Re: Simple 2D Example

    For 2D stuff I like SDL which has quite a bit of community support. The software library is open source and Lazy Foo' Productions has a good tutorial for setting it up and getting to blit surfaces and render fonts as images, amongst other things.

    There are a many SDL tutorials out there to affiliate you with its basic concepts.

  8. #7
    brownhead's Avatar
    brownhead is offline Programmer
    Join Date
    Apr 2009
    Posts
    172
    Rep Power
    12

    Re: Simple 2D Example

    This is a guide to GDI+ using Visual C++ that does an excellent job at explaining everything. Read through it all and you should get a start.

    Visual C++ GDI: Introduction

    Look under the heading GDI Fundamentals and all other subjects in that row.

  9. #8
    OutcastOrange is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: Simple 2D Example

    I've been browsing the stuff you guys suggested, and I've learned quite a bit.

    I found this at brownhead's link:
    1.Start a new project and name it Bitmap1

    2.Create it as a Single Document application based on CView

    3.In the Class View, expand everything and access the CMainFrame::PreCreateWindow() method.
    What am I supposed to get out of "single document application based in CView"? That means gibberish to me.

    Please advise.

  10. #9
    brownhead's Avatar
    brownhead is offline Programmer
    Join Date
    Apr 2009
    Posts
    172
    Rep Power
    12

    Re: Simple 2D Example

    I'm guessing it's a project template. Hit New Project and then see if you can find something that sounds like that in the list of templates. But I'm not positive.

  11. #10
    OutcastOrange is offline Newbie
    Join Date
    Sep 2009
    Posts
    5
    Rep Power
    0

    Re: Simple 2D Example

    That's what I thought too. I tried a few different templates that sounded similar, and didn't get anything like what it describes...

    I wish there was a step-by-step out there somewhere.
    I did search extensively before posting on this forum the first time though.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-13-2011, 08:52 PM
  2. I'm stumped by this simple, simple code...
    By scottbomb in forum Java Help
    Replies: 6
    Last Post: 03-10-2011, 08:35 PM
  3. The simple are often the best
    By Rudd in forum General Programming
    Replies: 0
    Last Post: 11-10-2008, 11:46 PM
  4. Very Simple Help ... Im sure
    By amped designs in forum PHP Development
    Replies: 7
    Last Post: 10-30-2008, 12:54 PM
  5. Simple help please.
    By Skel in forum Visual Basic Programming
    Replies: 4
    Last Post: 11-06-2007, 02:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts