Different buttons
« 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?

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Different buttons
« Reply #1 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.

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Different buttons
« Reply #2 on: 24 June 2015, 16:41:10 »
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:
button->load("ThemeFile.txt", "MyButton");

Re: Different buttons
« Reply #3 on: 25 June 2015, 03:14:04 »
great thanks.