- C++
Unfortunately i can't tell you anything about C++. i'm programming in C. what i can tell you is that probably it's a good idea to learn C++ instead of C because after all C++ is the successor of C in a way. nevertheless it should be easy to find some decent C++-tutorials on the net.
here are some general rules one could follow to make the code well-structured and clear:
- functions begin with filename prefix (e.g. functions from 'file.c' begin with 'file_': 'file_find_support_file')
- structs are capitalized: LiveGame
- functions that return a value end with '_get': player_cskill_get
- functions that change a value end with '_set': player_cskill_set
- macros are uppercase LIG(i)
- functions returning gboolean (TRUE or FALSE) start with 'query_' and then the filename prefix, e.g. query_team_is_in_league(Team *tm)'
- GTK and Glade
i don't write any part of the Bygfoot interface myself. anything you see, be it a window, a button or else, is made with glade. using glade has a few disadvantages, but it spares a lot of programming time if you can make the interface by clicking around with your mouse. here i found a nice tutorial for glade 2.
of course glade only generates the interface. you still have to define what happens when the user interacts with it. this is then a mixture of normal C(++) functions and GTK stuff.
after gathering some experience with GTK, it turns out to be fairly easy to use. of course the best way to learn it is by making some small project.
here is the official and rather nicely made GTK tutorial. this is a good way to start learning.
the next step is to use the API reference, which can be found here. after you've learned the basics you won't need anything else for most of the things you want to do. - GLib
GLib is the low-level library that's being used a lot in GTK. it contains a lot of things that make your life easier, so if you have to incorporate some low-level functionality in your program (e.g. a dynamically growing and shrinking list) you should first check whether there are functions for it in GLib. the two things i use most in GLib are GStrings (dynamically growing and shrinking strings) and GArrays (dynamically growing and shrinking arrays). the biggest benefit of such GLib data types is that you don't have to take care of allocating memory; it's all done automatically.
here's the reference manual for GLib
gyözö