What 2D GUI Foundation Do You Use?
Zmee writes "I am looking to build a 2D application for personal use and I will need to use a canvas to paint custom objects. I am trying to determine what foundation to use and have not located a good side-by-side comparison of the various flavors. For reference, I need the final application to work in Windows; Linux is preferred, but not required. I have looked at WPF, Qt, OpenGL, Tcl/Tk, Java's AWT, and others. I have little preference as to the language itself, but each of the tutorials appear to require significant time investment. As such, I am looking to see what the community uses and what seems to work for people prior to making that investment."
HTML and Javascript?
Have you checked out vpython? not many people have heard of it and I find it quite usable.
OpenGL is portable across all platforms, hardware accelerated, and lightweight. Win, win, win.
Qt would be my next choice but it's not lightweight at all. You can always wrap your OpenGL app with Qt for extra "GUI stuff" if needed. OpenGL works with practically everything.
GDI+ is good enough for low frame rates and trivial to use if you have any C# experience. If these are static controls that need to be painted and then updated on user input, it's more than sufficient.
Nothing is easier for amateurs, even though I'm no Microsoft fan.
I'd use Java AWT or OpenGL. They're both cross-platform, and what you learn will can be easily leveraged elsewhere, since they're widely adopted technologies. (No matter what you pick, you're going to have some learning curve.)
QT 4+ has been pretty decent. It has bindings for most languages and is really nice to work with.
Out of everything I've tried (pretty much everything usable from C, C++, and C#), WPF is the best UI framework around. It is extremely flexible and can be very intimidating if you try to learn all the details too quickly, but the basics of it are easy. You should be able to pop out a good design pretty quickly. It's a shame that Mono has no plans to implement it, because everything else feels primitive in comparison.
If you don't mind dirtying your C++ with a less-than-modern design and ugly preprocessor hijinks, Qt can be a pretty solid framework. Works well on many platforms and is full of features. Has a lot of portable non-UI things too, but I haven't used much of it.
Python's UI stuff is simple but has a lot of features. Great for quick, portable apps. Easy integration with C++ if you need it.
I avoid wxWidgets. The last time I tried using it (about a year ago), I ended up very frustrated rooting around their code to find that it makes a bunch of stupid assumptions about things like DPI, default fonts, etc. that fall apart pretty easily.
I also avoid GTK, but mainly just because it always feels "off" on Windows.
Having used everything on the list and much more (such as wx, GTK, etc), as well as making my own toolkits for embedded devices and products, my personal experience tells me hands down that Qt is the best choice for anything GUI related. It's power, ease of use, tools, documentation and learning curve are unparalleled to this day and age. Any other toolkit or API I've use fails in one or more of such areas.
Qt is the only toolkit that made me feel as if they could know in advance everything i'd ever need (so when i go to the docs it's there, right how as i imagined it should be), yet keeping the bloat down with great modularization. I have used it from C++ as well as from Python with great success.
I use the Qt framework at home and at work and I have published a couple teeny GPL'd apps:
Regardless of which framework you decide to use, I wish you luck!
Who suggested Java AWT? What is this, 1998? Someone is behind on their homework :).
Java's Swing + Java2D is *fully hardware accelerated* (ever since Java 1.6.0_u10 some time ago), multi-platform, with good multi-thread support (not for rendering, you don't need that, but for the rest of the program), very customizable, and looks fantastic with the Nimbus look&feel (a standard part of Java). Swing is used a lot on the enterprise desktop (and a few shrink wrapped products too - I know I've purchased some as they were best-of-breed tools). Many of the Java Swing ttools are free and there are a lot of them (eg. Matisse in Netbeans makes creating GUIs a snap). Java2D had extensive contributions from Adobe who happen to know a thing or two about presentation. Plus, drawing in Java2D also allows printing relatively simply.
I haven't got a clue what kind of app you want to write, but have a look at Processing.org .
It's an abstraction layer built on top of Java (cross platformity, including web browsers).
It has loads of handy stuff for 2D and 3D, including OpenGL.
Talking about OpenGL, you can use it in it's raw form as well.
In fact, you can just write in Java afaik.
I found it very usefull for making custom ui's.
I use QT and love it too, but it has some serious drawbacks, from my perspective. The biggest is that it requires a wonky special compilation system. You either have to use the build system they offer (qmake) or you have to manually run their generator yourself (moc - though if you were a masochist you could learn to write out the files moc makes yourself and avoid using it).
I compare every IDE to Eclipse, because that's the best IDE I've seen for any language. But I've never found that CDT, the C++ plugin for Eclipse, is any good. It fails to work out of the box for me and is a pain to configure (but I haven't tried it in a few years). QT Creator, while usable, is really an immature product. There's no support for refactoring, the UI is unintuitive and awkward (for me, at least) and there's lots of little issues with it. Plus you're committed to MingW, which can be a problem depending on what libraries you want to use. Codeblocks is a pretty good IDE, but it doesn't have a QT plugin, so you're left with the problem of dealing with moc files. Visual Studio has a plugin, but it only works with the paid versions.
All of this can be dealt with (and I do) but it's annoying.
Adobe Air -
Easy UI interaction framework, very powerful drawing APIs, runs on windows/linux/mac/android.
http://www.adobe.com/products/air/
Latest version lets you call native apps on windows/linux/mac.
I don't have much time... I write the GUI, and any drawing logic with Tcl/Tk. Easy, portable. Any time critical or extensive logic gets pushed into C or FORTRAN (depending on what it is). Just standard in/standard out. Parse the output with Tcl, and display.
A recent example -- I needed to upgrade some systems for a client (Solaris 6 to 10). We needed to identify the binary parts (non-OS) that needed to move. I wrote a GUI tool (binport) for this. Took 2 days to write, ran on Linux and MacOS X (two of us shared the work). After the job, the tool was essentially discarded.
No time to "debug" really, and I don't typically have time for compile and test cycles. Tcl is an interpreter, with very simple syntax and semantics.
Other examples that have used Tcl/Tk -- the GUI layer for GDB, Redhat Source Navigator, etc.
Yes, it's not "sexy", or even particularly "new", but it works, and works well.
Just another "Cubible(sic) Joe" 2 17 3061
(For those that missed the reference, this is it)
"I'm never quite so stupid as when I'm being smart" (Linus van Pelt)
Qt has recently introduced Qt Quick, a collection of technologies meant to help you create animation-rich UIs similar to those used on touch phones. The most important part is the QML language, which is used to describe the user interface of a program. QML is declarative and animation-friendly, and makes it easy to create fluid interfaces. On the downside, it is not mature yet and lacks most of the standard UI widgets at the moment (basically, you have text input and clickable areas). I wouldn't have recommended it for general application writing just yet, but the original question was not very specific on the requirements so it might be suitable already in its current form.
Good post, just wanted to add that there are bindings for Java available, see here
Umm... Qtjambi (QT's Java bindings) has been available for ages, although recently Nokia transferred the ownership to community, but from the looks of it, the community is very active and the releases are on track.
for the last time people, I am "frodo from middle eaRTH", not "middle eaST".
Original poster here. I am looking to implement a customized card game (think Magic or Yu-Gi-Oh). This is my step-son's first foray into development, and my first UI requiring any custom controls. (I have done a fair bit of ASP.NET, PHP, and Windows Forms, but most of that is not applicable given what I am planning here). The idea is to be able to create the card images from a combination of stored bitmaps, text, and some general backgrounds. As such, much of the GUI will be vectored, but some must be raster (ie the bitmaps). Note that given the general structure, framerate is not a high consideration.
Note that I have not ruled out a HTML 5 UI and if I went with Java AWT, I may wrap it as an applet. I would certainly like to stay away from Flash (& am leaning against Java for similar reasons), but have not ruled that out either.
Except that JavaFX is less powerful than Swing. They're meant for different purposes.
One (JavaFX) is simplified and really intended for the web and web developers who can get away with less complex interfaces (since the expectations for interactivity on the web are so low compared with expectations on the desktop). The default set of controls for JavaFX have even more omissions than the default set for Swing (which both SwingLabs and the marketplace make up for fortunately).
On the other hand Swing is comprehensive and powerful. It is too much for many, but if you know how to wrangle it there is no substitute. If you want to *deeply* customize your controls you have the power to do so (many frameworks, eg SWT, WinForms etc have nice defaults, but once you start trying to extend them it gets very painful - moreso than Swing in my experience). I understand many hate Swing because of it's complexity or it doesn't work exactly as the Win32/WPF APIs do, but for me personally it is brilliant for multi-platform work and not yet found anything else that can touch it for sheer flexibility and customization.
So, while JavaFX is an option I don't think it is a generic solution to all classes of GUI problems (if you are going to invest time, effort and money you might as well use a 'swiss-army' toolkit that can apply to many problems).