Sign in to follow this  
MrJoshL

Which Of These 3 API Combinations Would You Advise (GUI's)?

Recommended Posts

I am writing a game editor in C, and these are my 3 choices I see right now, along with my reasoning. Which of these would you advise, and why?

 

1. OpenGL + X (I'm already using OpenGL for the rendering, I already know a small bit of X programming)

2. OpenGL + SDL (SDL is more abstracted and cross platform than X, but I have never used it)

3. GTK+ (It is written in C like my program, but uses more resources and I have never used it)

 

I was kind of leaning towards option 1 because my logic is that in the time it takes to learn a whole new API, I could have written a small GUI system in OpenGL and X that fulfills all of my specific needs (correct me if I am wrong) and is lighter weight.

 

My Questions:

1. Which way would you do it?

2. Why would you do it that way?

3. How long do you think it would take YOU to do it your way?

4. How long do you think it would take YOU to do it the first way?

 

I very much appreciate your answers, if you have any.

Share this post


Link to post
Share on other sites

I can't comment on X or GTK+, but I can comment on SDL. SDL is a lightweight wrapper around basic keyboard/mouse/gamepad input and graphical windows. Unless things changed with SDL 2.0, SDL doesn't have any GUI system. You can ofcourse use it in addition to a GUI system, but it doesn't come with GUI features out-of-the-box.

Edited by Servant of the Lord

Share this post


Link to post
Share on other sites
1. OpenGL + X (I'm already using OpenGL for the rendering, I already know a small bit of X programming)

2. OpenGL + SDL (SDL is more abstracted and cross platform than X, but I have never used it)

3. GTK+ (It is written in C like my program, but uses more resources and I have never used it)

1. OGL + X11 = too much nope...  detecting all the extensions, handling all the corner cases, doing backflips and handstands to use 1980s tech to do a 1990s job, no thanks.  Just choosing the right visual and obtaining the correct GLX context is painful, let alone event processing.  There's a reason why all those toolkits evolved to wrap X11 and make it entirely disappear from the API.  Very large learning curve, poor documentation, difficult to debug.

 

2. OGL + SDL = good choice.  Small learning curve, good documentation.  Sometimes a pain to debug.

 

3. GTK+ = run, don't walk away -- a massive, massive, heavyweight API in which you have to rewrite the C++ runtime in every source file, and with no upstream support (maintenance is not considered a community activity, reinventing the entire API every couple of years is where it's at). 

Very large learning curve, poor documentation, difficult to debug.

 

And yes, I've used all of the above.

Share this post


Link to post
Share on other sites

I think I will follow Bregma's advice and just use OGL + SDL. That way I can make a version for Windows, Mac, and Linux without learning the intricacies of Win32, Cocoa, and Xlib. Thank you to all of you for your advice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this