Libraries

Started by
10 comments, last by Daaark 18 years, 10 months ago
I use Win32 plain and simple (or Lean and Mean, depending on your fancy) and I was wondering if it would be a better idea to learn a library like SDL to do all my graphics and shizzy. Is Win32 good, or is something like SDL better?
Advertisement
In short, yes it would be a very good idea to learn a library. Win32 is slow where as graphics libraries are designed to be a single layer between you and the hardware. They are much faster.

Go for it and good luck.

ace
Any suggestions on what library I should use for 2d graphics?
Depends on what you need, obviously. Win32 is made to draw windows. That means it's relatively effective when it comes to drawing static, nonchanging rectangles that are only occasionally moved or resized.

When you try to make something that's updated and changed 60 times a second, it'll grind your system to a halt though. ;)
So yes, another API would be a very good idea if you plan to make games.
(Although Win32 and GDI is excellent for Tetris, actually)

SDL is pretty popular, but I don't have much experience with it myself. It's supposed to be one of the easier ones to learn.
Althernatives would be OpenGL, Direct3D or DirectDraw (The first two are obviously made for 3D, but there's no reason you can't do 2D in them as well).
I'm thinking of learning DDRAW awhile back, but DevCpp doesnt come with source files. Does anyone know where I can dl them?
I've heard many rumours as to SDL and OpenGL being the easiest to get started on. I use DirectX and i have been for a long time. With it, once you get used to the general approach to the problem and how COM works you are fine.

Also this is a good resource here.

EDIT: Direct Draw is not included with the current DirectX SDK. It has been made obselete but everything can be done with Direct3D in a slightly different way and more easily in my opinion.

ace
I just have a little suggestion if you are planning on using DirectDraw.
DirectDraw is getting pretty old now, and i doubt it will be supported on
future hardware. So if you are interested in starting 2D programming, i
suggest you go with Direct3D. Direct3D defines an object called ID3DXSprite.
This amazing object allows you to have incredible control over 2D aspects
of your game (such as sprites) and it allows 2D objects like sprites to be
rendered with 3D acceleration, in other words, it lets the graphics card do
some of the work for you.

ID3DXSprite *mysprite;D3DXCreateSprite(mydevice, &mysprite);// this has been taken directly from the d3dx9 header files://////////////////////////////////////////////////////////////////////////////// ID3DXSprite:// ------------// This object intends to provide an easy way to drawing sprites using D3D.// (functions:)// Begin - //    Prepares device for drawing sprites.//// Draw -//    Draws a sprite.  Before transformation, the sprite is the size of //    SrcRect, with its top-left corner specified by Position.  The color //    and alpha channels are modulated by Color.//// Flush -//    Forces all batched sprites to submitted to the device.//// End - //    Restores device state to how it was when Begin was called.//// OnLostDevice, OnResetDevice -//    Call OnLostDevice() on this object before calling Reset() on the//    device, so that this object can release any stateblocks and video//    memory resources.  After Reset(), the call OnResetDevice().//////////////////////////////////////////////////////////////////////////////
Quote:Original post by ace_lovegrove
I've heard many rumours as to SDL and OpenGL being the easiest to get started on.


SDL is really easy to get started with. It's also cross platform (which is good for me as I do my development on Linux), but works great with windows. It's also really easy to set up OpenGL with SDL.

OpenGL is great, a little tough to get started with in that there is alot to learn, but really powerful (take a look at Doom 3 to see something it's capable of doing graphically). However, it might be a bit overkill for a 2D game (then again I've got a side project that is a 2D roguelike game which i'm using SDL and OpenGL for).

I'll put in my usual pitch for clanlib. I really like it for 2d work. It has a great sprite library and resource management system using xml files. Lots of example code comes with it and 2 tutorials. If your familiar with c++ programming, it's great.
Allegro is a great begginers 2d graphics/game library though it is getting a little dated. In dev-cpp goto tools menu then package something or other and ittl let you download and install libraries like SDL, directx8, and allegro at the click of a mouse.

This topic is closed to new replies.

Advertisement