views:

71

answers:

1

Hey there! This is my first time asking here but I've been a reader for ages! A fantastic place to learn!

I was asked to design a simple board game as a programming project this semester (using C++) and to implement GUI for a bonus mark. I was rather lost reading through tens of possible GUI toolkits and not knowing which one to use. I'm rather a beginner and this is my first big project!

My requirements for GUI are very very basic. All I want is to allow the user to pick from between two options at the start of the game. Those options determine which character the user will pick in the game to play with. This is the only input I want from the user. The console program would receive this input, interpret it and do all the logic of the game in the console window.

Currently, the console window displays a numbered list of options for the user who then picks a number and based off that character input, the console knows what to do through some if-statements.

Up till now, I've been told that GTK+ is a good option and I've been advised to check out wxWidgets and QT4. I'm confused on which one to use since I want something fast to learn and simple to implement because the purpose I want it for is also simple. I was also rather reluctant to start learning a GUI toolkit from its basics then realizing it might not have my simple requirement.

Thank you in advance fellas and sorry for the rather long post!

+3  A: 

If you want something pretty basic as far as a GUI goes, it might be worth looking into some sample applications from any of the named projects. See what you can find in a sample application that is most similar to what you have, and try to get that working. Then once you have it working, and tweaked to your liking, maybe play around with things a bit more then for a further/better understanding.

My previous experience is with WxWidgets and Qt. My advice would be to check out Qt because of the great documentation for the project as well as the QAssistant.

Good Luck, GUIs can be really fun to incrementally learn!

Brett
Thanks Brett for such a good reply...I began reading today into the sample applications and so far QProcess seems like it might be what I need to start my console application. Would you think that class might be a good idea based on your Qt experience?
Hamdy Elgammal
@Hamdy Elgammal - I'm not sure exactly what you're needs are, but I would think that you might be able to get around using QProcess, and the console window, by using some sort of output form in Qt. I'm not sure how complex your output is, but if it is somewhat simple, you might even be able to use a text output in the Qt window?
Brett
@Brett: My output is not that complex and is, at first view, a display of a two dimensional character array. Of course, to be more specific, I would have to go into details of my project but the gist of it is: it is not 'really' a character array except to the user. Personally, I'd prefer it if my output is in console completely. Currently, all I would want is a small window that appears so that the user may simply choose between two choices on that window then use that to somehow trigger the console into working based on whatever the user selected. Thanks again Brett!
Hamdy Elgammal
@Hamdy Elgammal - Oh, perfect, that should not be too difficult. Rather than trying to do something as difficult as using QProcess, an easier alternative would be to enable the console window along side the Qt application. Generally its suppressed with Qt applications. Now, when you click buttons in the interface, variables can change or functions can be executed and then your normal console display will be shown. Hope that helps!!
Brett
@Brett: I think I get what you mean Brett but just to be sure: You're basically saying that I should add whatever QT code I need to start a window in the same code I currently have and then simply run the program, which will always run the QT app first, then handle whatever input I get from the events handled by the window directly to the code?
Hamdy Elgammal
@Hamdy Elgammal - So, I actually haven't worked with the console window while using Qt, but I know that you can use it. From my understanding though, you should be able to adjust settings in the Qt application, which will have get()/set() calls to your class variables that your console will eventually be referencing. This way, you will be able to have the user choose options via the GUI and then use your standard output that you've been using in the console window. :)
Brett
@hamdy Elgammal - I guess I'd start by getting a somewhat basic Qt GUI running, see if you can get it to maybe display a few options that you want, and then when its working get it to show a console window. When you've got that working, plug in your code into the application, and see if you can get the Qt application to trigger the correct functions to run your code! Hope that helps
Brett