Jump to content
  • Advertisement
Sign in to follow this  
gerbenvv

Programming on linux

This topic is 4671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've programmed a lot on windows, but I would like to make my programs on linux available too. I've been searching a lot how to do it on linux, like making a window etc, but I don't get it. What does X-window, Gnome and KDE mean? And do I have to make different versions of my program for different linux distributions, like Suse, Mandrake, Redhat etc, or does it run on all of them? Are there any good tutorials on this subject. I'm programming in C++. thanks, Gerben VV

Share this post


Link to post
Share on other sites
Advertisement
X-Windows is the name of the most prevalent windowing system available for *nix machines. Gnome and KDE are window managers, which is something that exists on top of the windowing system that actually draws and manages the windows that applications create. Depending on how you code an X-Windows application, it can be tied to a specific window manager like Gnome or KDE, or it can run on anything that supports the version of XLib that you used to create your application.

If you want to actually do linux game programming, I would just use a cross platform library like SDL.

Share this post


Link to post
Share on other sites
Unix uses a way to handle graphics that is quite old but stable and flexible, called X. It allows for graphics systems to communicate through a network and a ton of other features. On top of that API is the window manager. What it does is basicly handle window creation and management, for example there's Sawfish (I think it's what Gnome uses) and I think enlightenment is one too. On top of that you can have a desktop enviroment (which is like desktop icons, start menu, etc.), as examples there are KDE and Gnome (the most popular). To code graphics systems on Linux, you need to code for the X system (which handles all the graphics). But because X is so powerful and complex, it can become hard to code. That's why there are GUI toolkits which make it easier to create GUIs, windows, etc. Most GUI toolkits are cross-platform too.

If you want to learn how to code programs on Linux for X, you should either search for Xlib tutorial (the library you use to create the windows and to draw on them) or use an already available toolkit like FOX, FLTK, wxWindows, Qt, Gtk, etc. You should search the net for them and see which one you find easier to use. Hope this helps,

JVFF

Share this post


Link to post
Share on other sites
X-windows [or x.org] are the system used to draw windows on the screen

KDE and Gnome are window managers, they define their own styles, have their own api, and have lots of useful applications [like konqueror in KDE the eqlivent of IE in windows [including the file management stuff]]

if you use a library like wxwidgets you can write applications abstracted away from the differences of different window mangers and also abstracted away from the differences of different operating systems [your thing should be able to compile and run on windows too... and OSX if I recall]

there are essentially two differences between distributions in this context.
1. different package management systems [kind of like wether your app is in its own executable, or a special archive, or another type of special archive... The tools coming with each distro usually only support one type of package]
2. different library versions. some distributions don't by default come with a particular version of the c standard library or other things your program might depend on. So your program would have to be recompiled for the distribution.


you could distribute your program in a tgz archive [instead of a rpm, deb, or gentoo package], but then it wouldn't install in the expected place [unless you did it like slackware, where to install something you extract it at / ]. As long as you require versions of libraries that the current distros include this would be the best approach.


SuSe, redhat, mandrake, fedora all use rpm
gentoo has its own package thing
debian-derived distros use deb packages [mepis, ubuntu, kubuntu, knoppix,...]

Share this post


Link to post
Share on other sites
Well, I use openGL right now, and that works on linux too, so I'm more interesting in how to set openGL up on linux. I have a special settings program, which is a window with buttons, input boxes, etc. I could use Qt for that.

Share this post


Link to post
Share on other sites
Qt offers an OpenGL widget you can use to draw with OpenGL onto. See the documentation here.
Also have a look into the examples.

Share this post


Link to post
Share on other sites
I personally have not used Qt so i cannot vouch either way. However if you have code already written for OpenGL, i'de highly suggest re-writing your code to utilize SDL (libsdl.org) instead of the Win32 API (or whatever it is currently). SDL is cross platform compatible to the major *nix distrobutions.

My development environment changes multiple times throughout a single day. Win32/64, MAC OSX, Gnome/KDE. I transport my code via a thumbdrive and never have issues compiling and/or running.

Do some research though about what you want to do. Qt, Gtk, wxWidgets, etc may be more suited.

Share this post


Link to post
Share on other sites
For starters, if you want to be making programs in linux, make them in linux. Get yourself a distro on a computer (you can dual boot linux and windows) and start writing applications for linux (Java, C, C++, python, etc..) now, once you've written apps in linux you can port them easily to windows by using the MSYS (mingw) or cygwin cross-compiler environments. The SDL site actually had a nice script to do this automatically but I think it has been outdated for some time.

Basically, there is no EASY way to cross-compile your code. You need to familiarize yourself with linux and windows before you can compile for both operating systems. By-far you do NOT need to be an expert in either OS, but you should know basic commands for compiling in Linux.

Quote:

I personally have not used Qt so i cannot vouch either way. However if you have code already written for OpenGL, i'de highly suggest re-writing your code to utilize SDL (libsdl.org) instead of the Win32 API (or whatever it is currently). SDL is cross platform compatible to the major *nix distrobutions.


This is not correct at all, OpenGL is cross-platform and will work on windows, linux, macos, and more. I do not suggest DOWNGRADING to SDL if you are already using OpenGL. When SDL2 comes out the whole API will rely on OpenGL and will be much better suited for what you're talking about, but until then, stick with OpenGL and maybe use SDL for input, fi/fo, audio, and network. Since SDL provides cross-platform APIs for all those.

Gnome/KDE will have very little to do with your actual programming, unless you want to program specifically for certain aspects of GNOME or KDE (such as the graphical front-end applications and widgets).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!