gl.Text and reseting to white

gl.Text and reseting to white

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

gl.Text and reseting to white

Post by zwzsg »

In 7.8.2.1, the text color was reset to white at the beginning of every gl.Text.

In new Spring test build, it's not.

I have KP tooltip that use stuff such as:
txt = "\255\255\213\213Health: ".."\255\255\170\170"..ud.health
gl.Text(txt,x,y,FontSize,'o')
gl.Color(1,1,1,1) -- doesn't affect change to text color done within the string with escape character things

And then the red color gets carried over to the gl.Text of another widget (KP's buildbar's widget firewall/terminal timer.)

Since setting to white before a new line "\255\255\255\255\n" gets ignored, the only fix I found was to to do gl.Text("\255\255\255\255 ",0,0,FontSize,'o') at the end of my widget to leave gl.Text back to its default color.

Was it really intented behavior, or is it a bug? Either way, I'm sure many widget will leak their text colors to other widgets because of it.
Post Reply

Return to “Lua Scripts”