Different buttons

Started by starkhorn, 22 June 2015, 10:29:01

starkhorn

Hey,

I've started playing with the config files to develop my own theme. One of the things that I'm wondering is that I want lots of different images for my buttons. For example, I have a button that is for finance so I want the image to be a png that has coins. Then say I've another button for armies so I want the image to an army png etc etc.

So I can see quite easily how to change the image in the config files, but what if I wanted several different types of buttons? i.e. as above. the functionality is the same, i.e. you click on them and bind callbacks to them etc. I just want a different image.

Is there a way to do this easily via the theme config file?

texus

TGUI 0.6 is limited to one button per file. You would need to use a different config file for each button.

Maybe I could give the load function an extra parameter to specify the section name. I'll look into that next week.

texus

I found some time to do it already, so if you download the master branch from github then you will be able to put the different buttons in the same file by giving them different section names and loading them like this:
Code (cpp) Select
button->load("ThemeFile.txt", "MyButton");

starkhorn