Revert gl.Text

Revert gl.Text

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Revert gl.Text

Post by Regret »

In .80.2 gl.Text got 'accidentally' changed by jK and he refuses to revert the change, this changes fucks up all widgets that use gl.Text.

The change is this: http://springrts.com/wiki/GetTextHeight

It makes no sense as default behavior.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: Revert gl.Text

Post by TheFatController »

Was this something that could have been made easily backwards compatible?

Cause I agree with the above if so.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

He could have just added another flag for this new behavior, and keep default as it was. So yes.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Revert gl.Text

Post by jK »

please shut up troll

the true story

I won't get down to this bashing with INCORRECT statements.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

jK wrote:Accidental the default text alignment has changed, before it was descender now it's baseline. Somehow I prefer it this way, so I am hold off to revert it. The only problem I see is that lua doesn't have an opcode for the old behaviour, cuz the functions is running out of chars (b=bottom, d=baseline, ???=descender).
It broke all widgets that use gl.Text, it should be reverted. And you yourself said it's an accident.

Use a new flag for new behavior, backwards compatibility anyone?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Revert gl.Text

Post by lurker »

There already is a flag for it, and a claim that he could have made it optional when it was an accident is dubious.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

lurker wrote:There already is a flag for it, and a claim that he could have made it optional when it was an accident is dubious.
Something that breaks every widget using gl.Text should be made optional and not default.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Revert gl.Text

Post by smoth »

The question isn't how many widgets it breaks, it is whether or not it is correct.

I don't disagree with the change but can recognize the issues caused by it.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

smoth wrote:The question isn't how many widgets it breaks, it is whether or not it is correct.
There are no standards for spring, so this change is neither correct nor wrong in that perspective, but this change is purely a matter of preference of one person, and it breaks a lot of widgets. That does make it not correct.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Revert gl.Text

Post by zwzsg »

Old y offset, or new one, it is just a convention. I never saw anything "broken" or "buggy" in the old behavior. I fail to see what the new behavior fix. Whether the text is aligned to descender or baseline, none is more "correct" than the other, it's just a matter of picking one and sticking to it.

However, now that you changed the convention, there's hundreds of widgets widgets that needs to be modified. I cannot even say "fixed" or "updated", because there was nothing broken or outdated in the old behavior.
jK wrote:Somehow I prefer it this way, so I am hold off to revert it.
Just because of one guy preference, all widget that draw text are now broken. We weren't even warned about that changed. I noticed it as soon as it appeared, between 80.0 and 80.1, devs didn't deign answering me (but surely automatically uploading megabytes of infolog to mantis would have help, AF?). All widgets have to be updated, all mods have to be updated, including those whose who can't because maintener left or that have spread everywhere.

Regret wrote:There are no standards for spring
Well, there is the de-facto standard which is: what we've been using for years.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Revert gl.Text

Post by AF »

The widgets it breaks arguably already have plenty of bugs, such as not disapearing when f5 is pressed.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

AF wrote:The widgets it breaks arguably already have plenty of bugs, such as not disapearing when f5 is pressed.
No they don't. This breaks literally every widget that draws text, and not every is bugged.

Also as of certain spring version all widgets are properly hidden after f5 is pressed because drawscreen call gets disabled when UI is disabled.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Revert gl.Text

Post by zwzsg »

In one widget, and in one gadget, out of any function, but in unsynced for the gadget, I use:

Code: Select all

-- Fix gl.Text y offset that changed between 0.80.0 and 0.80.1
if tonumber(string.sub(Game.version,1,3) or 0)>=0.80 and tonumber(string.sub(Game.version,6,6) or 0)>=1 then
	local glText = gl.Text
	gl.Text = function(text,x,y,size,options)
		if size then
			glText(text,x,y+size/4,size,options)
		else
			glText(text,x,y,size,options)
		end
	end
end
This way, I revert to old behavior by editing only two files instead of god know how many. The +size/4 is not the exact offset to revert to old position, but good enough for me. Doing that probably add alot of issues, such as messing with mod-external widget, applying the offset more than once when the widget is toggled couple time ingame, and jK will probably tell me that I understood nothing and am doing it all wrong.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Revert gl.Text

Post by FLOZi »

It needs to be reverted, and it needs to be reverted for the next release, which needs to be quick. Otehrwise half the code out there will be modified for the change, and half won't, and then it will probably eventually get changed back in the far future and mess everything up again.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Revert gl.Text

Post by lurker »

Those issues are why I suggested to put it in the widget handler, if your game includes one. Definitely put it in draw.lua for gadgets.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Revert gl.Text

Post by Caydr »

Lurker, people use widgets outside of the ones included in mods... what you're saying isn't relevant to the majority of people.
FLOZi wrote:It needs to be reverted, and it needs to be reverted for the next release, which needs to be quick. Otehrwise half the code out there will be modified for the change, and half won't, and then it will probably eventually get changed back in the far future and mess everything up again.
Exactly what he said. Either announce that this isn't getting reverted, and mention that you feel the holocaust was a hoax for good measure, or announce that it will be reverted quickly. Whatever the decision, just do it fast. Otherwise it's going to be a clusterfail.
Last edited by Caydr on 23 Aug 2009, 02:11, edited 1 time in total.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Revert gl.Text

Post by lurker »

Caydr, zwzsg's function as is has an extremely high chance of conflict if you put it in a standalone widget, and doesn't belong in any of them. What you're saying isn't relevant to the majority of people.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Revert gl.Text

Post by Caydr »

Sorry, I thought you were replying to flozi.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Revert gl.Text

Post by lurker »

K. Also, I'll have a little thing to make it able to go in any and all widgets without conflict 2 minutes after dinner.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Revert gl.Text

Post by Regret »

lurker wrote:K. Also, I'll have a little thing to make it able to go in any and all widgets without conflict 2 minutes after dinner.
Irrelevant. Are you going to update every widget that uses gl.Text? No.

Revert it.
Post Reply

Return to “Engine”