views:

177

answers:

8

Hello,

I'm just starting out in C++ programming and I want to try creating a space invaders clone in C++, I want to avoid using game libraries and things that would solve a lot of the problems (like game loop and vector maths etc) so I can tackle these myself, but, I have no idea how to begin drawing things to a screen.

I was wondering if there's a good library I should use to simply allow myself to draw lines or graphics to the screen or whether I can do this without the use of a library?

I'd appreciate any advice,

Thanks.

+4  A: 

Check out SDL.

R Samuel Klatchko
+2  A: 

PixelToaster (was OpenPTC/TinyPTC) is one of my favorites. It's fairly minimalistic and very easy to get started with.

Cogwheel - Matthew Orlando
+3  A: 

I guess SDL is the simple library you're looking for. If you want you can work pretty much with the screen as a framebuffer where you modify pixel by pixel if you really want. It's a C library, but it's quite object oriented, so it's nice to work with in C++ as well.

Maister
+6  A: 

I recommend either Allegro or SDL, even though they are mostly 2D:

Allegro:
http://alleg.sourceforge.net/

SDL:
http://www.libsdl.org/

Johannes Jensen
I've used both and they are both pretty easy to use if you know C++.
daveangel
This is the best book for using Allegro to make games:http://www.amazon.com/Game-Programming-All-Jonathan-Harbour/dp/1598632892/ref=ntt_at_ep_dpi_1
daveangel
+4  A: 

I would check SDL or Allegro

klez
A: 

Wouldn't it be more interesting to do it by printing 80x?? ascii characters on the screen every .x seconds?

Noah Roberts
+1  A: 

In my opinion, starting right away with a GUI library like wxWidgets (www.wxwidgets.org) is a good idea because they are often platform-independent and provide good drawing mechanisms -- plus all that other GUI stuff you might find useful later on.

tobiw
+2  A: 

There are a lot of simple libraries. SDL and Allegro have gotten a lot of mentions already, but there are several others as well:

  • OpenGL
  • DirectX (yes, yes, I know, not "simple," but certainly gets the job done)
  • Cairo (for vector drawing)
  • SFML (an SDL-alike that has some drawing primitives)
  • GGI
  • Qt (which does a lot more than widgets and is highly modular)
  • DirectFB (which works without a host GUI like X.org)

And many others I'll be kicking myself for forgetting.

greyfade
OpenGL is very low-level though, I'm not sure a guy that just wants to make a game wants to look through all that. SDL already runs on OpenGL, so I guess that could be a substitute.Also, DirectX is a Windows-only platform, OpenGL is cross-platform. :)
Johannes Jensen
@Johannes Jensen: SDL doesn't run *on* OpenGL, as far as I know. It *facilitates* OpenGL, but doesn't actually *use* it. Indeed, unless there has been some major change to the API I'm unaware of, it doesn't even have drawing primitives. It just gives you a raster surface to draw on. I'd even say SDL is *lower*-level than OpenGL for that reason. (And I mention DirectX only for completeness.)
greyfade