TGUI Forum

General Category => Help requests => Topic started by: starkhorn on 22 June 2015, 10:29:01

Title: Different buttons
Post by: starkhorn on 22 June 2015, 10:29:01
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?
Title: Re: Different buttons
Post by: texus on 22 June 2015, 12:54:47
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.
Title: Re: Different buttons
Post by: texus on 24 June 2015, 16:41:10
I found some time to do it already, so if you download the master branch from github (https://github.com/texus/TGUI) 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:
button->load("ThemeFile.txt", "MyButton");
Title: Re: Different buttons
Post by: starkhorn on 25 June 2015, 03:14:04
great thanks.