The new renderer classes in v0.7

Started by starkhorn, 27 August 2015, 01:19:09

starkhorn

Hi Texus,

So I'm using v0.6.9 and I was looking to change the background image of a chatbox. I realized that there was no method for that but I spotted in the v0.7 docs that there is something called a chatbox renderer with such a method.

Now I am curious that is something new/different between v0.6.9 and v0.7 and I can see that lots of other widgets have such a class as well. So I was wondering how the renderer class would work/differ in v0.7?

I saw the below example code where we have to call the getRenderer() method. So just to confirm my understanding that from v0.7 onwards, all widget display methods need to go through the getRenderer() method first?

https://tgui.eu/example-code/v07/simple-console/

texus

Correct, all functions that change the look of the widget are in the Renderer class which you access with getRenderer().

Unlike in v0.6 you can now change every property dynamically, this lead to a lot of functions which is why I decided to put them in a separate class. The widgets and their renderer classes could perfectly be merged but it would result in a lot of functions in the class which you probably never use, making it harder to find functionality of the widget.

starkhorn

Looks awesome mate. I must get around to using the v0.7 more.....