This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Feronzed's profile picture

Terminal Glasses Gui Inside Repeating Functions

Started by Feronzed, 12 October 2013 - 02:05 PM
Feronzed #1
Posted 12 October 2013 - 04:05 PM
I've been troubling with this for some time now.
Are Terminal glasses just derpy in current FTB Unleashed version or am I doing something wrong:

Here is my code: http://pastebin.com/eu7K6JVj

At line 26, I'm creating text on "Icons" which is red, my GUI refreshes every second (Depends on server tick lag), why is it creating red text in some refreshes and red in others, it should be red only.

I also had a problem with icon being placed on top of text for some weird reason which is not possible cause I'm drawing text after Icon and have g.clear() at line 30 (before loading icon function).

EDIT: Even when i replaced color at line 13 to red (FF0000), it's still derpy and showing white Text randomly…
theoriginalbit #2
Posted 12 October 2013 - 04:20 PM
Firstly you should avoid clearing and redrawing the glasses all the time, it can reduce tick rate and it can also cause flicker. Instead keep a copy of the returned element somewhere and then just use the setters to change them.

The colour of the text would have something to do with the draw rate, it's not getting the chance to apply the colour before rendering sometimes (the text images are white, the image is drawn and then the colour is applied, this is how OpenGL/LWJGL works, not controlled by the mod).

As for the order of text and icons…. This statement "which is not possible cause I'm drawing text after icon" is false. This is irrelevant, both elements have the same Z-Index (1 I think) and two elements with the same index can be drawn in any order that the computer decides. To fix this change the Z-Index of the text to make sure that it is always on top of the "icon".