Developing GUI objects in C - advice needed
I finished my second attempt at a GUI button yesterday (C and openGL). Not great, but it does resize and I can change the label .... AND! the label stays centred throughout the resize. Thanks to the help I got here yesterday, the code is a little more tidy and organised in one place.
However, it still did take a lot of lines of code, started to resemble spaghetti, and started to get pretty complicated. For example it took ages to figure out how the various updating functions affected each other so that I could get resizing to also update the button label so it stayed centred. Then there were loads of little internal functions like shifting between screen and ortho coordinates, which became increasingly hard to keep track of.
It lead me to question a number of things....
1) I have read that OOP is a natural way to program GUIs. People talk a lot about code reuse and inheritance as being some of the reasons for this. Is this true?
a) If so, does this mean it would be better if I started to learn something on C++ or objC (I'm on a mac)
b) Is C a perfectly adequate for the job? ... And if so, are there any top tips for programming GUI objects in C, or is it simply 'code and learn'.
2) The searches I have made tend to lead me to existing GUI frameworks rather than referring to the process of developing GUI's. Does anyone know of a good basic reference for this which will talk about things like a framework for thinking about GUI code and structure, and concrete stuff such as "Making a button"
Sorry for all the questions and I hope this is not too general a question for the forum.