Jump to content

Cross platform GUI programming


Delscid

Recommended Posts

I have been looking at different languages for GUI programming which I would use for several projects

 

I mainly did GUI programming in C# due to .NET making it incredibly easy, but I want to try to do more cross-platform work

I've looked briefly at a few of the cross platform languages, but I was wondering what the best is.

 

I would prefer to steer away from languages would need the user to download some other platform for it to run

e.g Java(I know most people would have Java already), Python(haven't really looked into Python much, but from my experience you need to download Python to run programs).

I don't really mind learning a new language if it would help with this.

 

at the moment, C++ looks like the best choice, but I would still like an opinion on what the best choice would be or on anything I may have missed.

Link to comment
Share on other sites

Java is far better for simple cross platform programming than C++ is from what I understand. You write the same code in Java, and the JVM will convert it into whatever the OS demands(basically).

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Link to comment
Share on other sites

Java is far better for simple cross platform programming than C++ is from what I understand. You write the same code in Java, and the JVM will convert it into whatever the OS demands(basically).

 

Problem with that is that Java is not as nice as C# in my humble opinion. This is because C# has far more syntactic sugar than Java. But I digress.

 

For C#, Mono allows you to "write once and run everywhere" if by everywhere you're targeting mainstream UNIX and Windows and by write once you mean write the code and recompile for the platforms. There's GTK# if you don't want System.Windows.Forms. GTK# is pretty nice for its targets, but it's not the prettiest.

 

C++ has no good pure-C++ GUI library by the way. wxWidgets is shoddy, QT is nice and all but it depends too much on a preprocessing command. GTK is for C, and is kind of nice as far as C APIs go, but not sure if it has a C++ wrapper or such (at least a stable, tried-and-tested one). C++ is a horrible language anyway for this purpose, and you'll have to have you end-user install the Visual C runtime nonetheless.

ozXHe7P.png

Link to comment
Share on other sites

 

Problem with that is that Java is not as nice as C# in my humble opinion. This is because C# has far more syntactic sugar than Java. But I digress.

 

For C#, Mono allows you to "write once and run everywhere" if by everywhere you're targeting mainstream UNIX and Windows and by write once you mean write the code and recompile for the platforms. There's GTK# if you don't want System.Windows.Forms. GTK# is pretty nice for its targets, but it's not the prettiest.

 

C++ has no good pure-C++ GUI library by the way. wxWidgets is shoddy, QT is nice and all but it depends too much on a preprocessing command. GTK is for C, and is kind of nice as far as C APIs go, but not sure if it has a C++ wrapper or such (at least a stable, tried-and-tested one). C++ is a horrible language anyway for this purpose, and you'll have to have you end-user install the Visual C runtime nonetheless.

 

C# is a pain in the ass to use with other operating systems. Java is made to run anywhere - it's basically unbeatable for cross platform development. Without arguing the other merits of C# over Java, for this specific situation it's a no contest until Microsoft takes a genuine interest in making their technologies portable.

 

I also keep hearing about the "many advantages" of C# over Java, but I've never seen them. I haven't a huge amount of experience with the language but I've never felt hindered by using Java nor enabled by using C#. Perhaps you can enlighten me?

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Link to comment
Share on other sites

 

Problem with that is that Java is not as nice as C# in my humble opinion. This is because C# has far more syntactic sugar than Java. But I digress.

 

For C#, Mono allows you to "write once and run everywhere" if by everywhere you're targeting mainstream UNIX and Windows and by write once you mean write the code and recompile for the platforms. There's GTK# if you don't want System.Windows.Forms. GTK# is pretty nice for its targets, but it's not the prettiest.

 

C++ has no good pure-C++ GUI library by the way. wxWidgets is shoddy, QT is nice and all but it depends too much on a preprocessing command. GTK is for C, and is kind of nice as far as C APIs go, but not sure if it has a C++ wrapper or such (at least a stable, tried-and-tested one). C++ is a horrible language anyway for this purpose, and you'll have to have you end-user install the Visual C runtime nonetheless.

 

C# is a pain in the ass to use with other operating systems. Java is made to run anywhere - it's basically unbeatable for cross platform development. Without arguing the other merits of C# over Java, for this specific situation it's a no contest until Microsoft takes a genuine interest in making their technologies portable.

 

I also keep hearing about the "many advantages" of C# over Java, but I've never seen them. I haven't a huge amount of experience with the language but I've never felt hindered by using Java nor enabled by using C#. Perhaps you can enlighten me?

 

It's not really that hard to use with other operating systems. Unless you use tons of features unsupported by Mono (e.g. bleeding edge or Windows-specific aspects), there's no reason your application can't run in Windows, Linux, iDevices, and even on the Wii / PS3 if you so desire (kind of off-topic there, but Mono runs on the Wii and PS3 if you have access to the development kits). In fact, I have developed a game framework that uses the Allegro game programming library for device creation, etc and OpenGL for graphics and it runs fine on Linux and Windows. No hitches.

 

C# by itself is as portable as portable can be. Many people seem to confuse C# with the .NET Framework, of which the latter is less portable. As long as you don't use Windows-only features, your program will not break. System.Windows.Forms is kind of Windows-only as far as I can tell. In any case, basic system-agnostic programs can run on just about any platform. This goes for just about every language (C/C++, C#, Java, etc).

 

The features of C# over Java are many. Some of them are personal (e.g. I prefer the .NET framework over the standard Java libraries). Some of them are technical (you can't write an OpenGL wrapper in pure Java I'm pretty sure, but you can in C#). I am one who feels hindered by using Java and its many idiosyncrasies. That's why I choose not to use the language. Here are some of the reasons I much prefer C# over Java (mind you I come from a C background and usually program at a lower level than most of those who use Java, so this is a biased list; for a better one, search the internet):

 

  • Unsafe code. You can use pointers and other forms of unsafe code directly in C#. This limits portability if done improperly, but otherwise lets you use existing libraries (such as OpenGL and Allegro) to a much better extent and without having to write at a lower level.
  • Properties. I absolutely can't stand OOP languages without something like this. D and C# have them and they're a great asset. Typing foo.setBar(foo.getBar() + 1) is absolutely annoying.
  • Required exception handling. That's absurd in Java (has it changed or am I misinterpreting it?). I shouldn't be required to individually handle exceptions when I'm probably just going to throw them back up the chain.
  • Partial types. Good for GUI code.
  • Better event handling and delegates.
  • Better generics support.
  • etc etc.

 

That's just a few off the top of my head and from reading a website or two.

ozXHe7P.png

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.