2D graphics in C++

Post: #1
I need to build a very simple 2D graphics library in C++. All it needs to do is respond to the following list of very simple commands:

CIRCLE(String ID, int x, int y, int radius, int R, int G, int B);
RECTANGLE(String ID, int x, int y, int width, int height, int R, int G, int B);
IMAGE(String ID, String filename, int x, int y, int width, int height);
HIDE(String ID);
SHOW(String ID);
MOVE(String ID, int x, int y);
RESIZE(String ID, int width, int height);
ROTATE(String ID, int degrees);

Basically, the CIRCLE, RECTANGLE, and IMAGE commands create new graphical elements. The other commands (HIDE, SHOW, MOVE, RESIZE, ROTATE) are applied to existing graphical elements. Then after a sequence of the previous commands, UPDATE is called to show the changes.

I will be sending the above commands to my program in real time over a network from a client program. I have already written the code that listens for these commands over the network, all I need to do now is build the graphics library. Basically what I'm looking for is the C++ equivalent of Java's Swing, except even less since I'm only drawing fullscreen and I don't need GUI widgets or anything. Someone told me SDL was a good choice, so I've gotten everything set up in SDL and can already display images and rectangles, but there seems to be no built-in function for circles. Is there a 2D graphics package that does this?


P.S. I posted the above in the "Tools & Technology" forum and everyone there told me to use OpenGL. OpenGL is not an option. The primary concern is that this be quick and easy to set up and simple enough so that the people who will be using it who have little programming experience (and no OpenGL experience) can easily see what's going on in the code. Thanks in advance.
Posts: 1,140
Joined: 2005.07
Post: #2
Since everybody there told you to use OpenGL, I think everybody here will tell you to use OpenGL as well. Wink That's generally what you use in SDL. Annoyed Seriously, somebody even posted the code to do what you want in the first place. You can even use SDL to set up the context, and you can even make a function to set it up the way you know it will always be. You're wasting more time trying to find an alternative to OpenGL and saying that it's difficult (it isn't) than it would take to just use it. I'll just shut up and see what everybody else says, but I think the consensus will remain the same.
Posts: 1,066
Joined: 2004.07
Post: #3
Yeah, considering it's all the same forum, you'll probably see the same people here.

Trust me, just learning the basic OpenGL to implement this yourself would be way easier. Heck if you started today, you could be done (assuming you are a decent learner who knows C++) in a matter of days, if even that long.

If the people using it have little programming experience, why will they care if you use SDL or OpenGL or whatever library for the background of the functions? All they'll see is that list you've provided. You can easily wrap all the functions and initialization into easy functions as well.

I'll reference you to NeHe for some tutorials to get you going. It's a pretty easy API to learn if you just try.
Posts: 509
Joined: 2002.09
Post: #4
Don't start a new thread that is exactly the same as your previous one!

Original thread: http://www.idevgames.com/forum/showthread.php?t=12010

"When you dream, there are no rules..."
Thread Closed