CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: 2D graphics

  1. #1
    Join Date
    Jul 2007
    Posts
    609

    2D graphics

    I want to make a 2D graphical app, it will be a mapping application that will allow to draw lines, squares, circles etc... and then save those configs to a file. It's to spawn a MMO world.

    Just wondering where I should start and what would be the best thing to learn for such graphics. DirectX? Also is there a standard way of doing 2D graphic / GUI apps or are most calls all OS specific? I'll be coding this for windows so it's not a huge issue but I always like to go cross platform if I can.
    http://www.uovalor.com :: Free UO Server

  2. #2
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: 2D graphics

    C++ has no knowledge of graphics or sound or similar. That is something that uses a third party library. There are some reasonably portable libraries like SDL or Allegro which on windows probably kick down to the directx functions.

  3. #3
    Join Date
    Jan 2008
    Posts
    178

    Re: 2D graphics

    Quote Originally Posted by Russco View Post
    That is something that uses a third party library. There are some reasonably portable libraries like SDL or Allegro which on windows probably kick down to the directx functions.
    No, you don't need any "third party library"
    Just use GDI/+

  4. #4
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: 2D graphics

    GDI+ is ridiculously slow for making maps for a mmo world. They gonna be kinda large. Also gdi+ is not portable, its for windows only and the OP wanted a cross-platform solution.

  5. #5
    Join Date
    Jul 2007
    Posts
    609

    Re: 2D graphics

    If there's not anything cross platform easily available then I'll go Windows only route. I'm writing the program for windows anyway, and at worse I can always rewrite it for Linux. I'll be sure to keep that in mind when I'm coding it, so that all I need to change is the graphics engine itself.

    This would be a windows app at least for now. I would probably be drawing pixel by pixel. The maps are basically links to tiles, the tiles are images in a propiatary format, so I'd actually be generating the pictures with code. OR I could maybe just have a process that converts the map to a bitmap first, that may be faster.

    Is directX best way to go?
    http://www.uovalor.com :: Free UO Server

  6. #6
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: 2D graphics

    directx limits you to windows. SDL is portable.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  7. #7
    Join Date
    Nov 2005
    Posts
    281

    Re: 2D graphics

    Whoever thinks there are no libraries that can work on *nix as well as Windows does not contain enough information for this subject and should not post in this section, not that I am bashing them, but giving incorrect knowledge is close to sabotage in my eyes. Check yourself before you give an answer.

    OpenGL will work on different platforms such as different distro's of linux and windows.

    Gamedev.net contains a HUGE amount of information that will benefit you. It has GREAT learning resources for the beginner and it contains different engines that may interest you.
    http://www.gamedev.net/

    You say you are interested in cross platform code, if you ever decide to go further than only 2D graphics, you should look into Crystal Space 3D.
    http://www.crystalspace3d.org/main/Main_Page

    If you decide to work with DirectX, then I would suggest to look at Drunken Hyena for great starting tutorials that will teach you exactly what you are asking for. I have included another great link as well.
    http://www.drunkenhyena.com/cgi-bin/directx.pl
    http://www.directxtutorial.com/


    If you decide to work with OpenGL, then here are some links to some beginner to advanced tutorials. Have fun .
    http://nehe.gamedev.net/
    http://www.videotutorialsrock.com/
    http://www.opengl.org/code/

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured