small patch - easier to see markers

small patch - easier to see markers

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

Moderator: Moderators

User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

small patch - easier to see markers

Post by Belmakor »

Hi,

I am just getting my feet wet with Spring programming. Am interested in doing some gui related work. To start off with, though, I tried something small. I've always been annoyed by map markers that are very hard to see when the player colour is close to the colour of the map. So, this is my first attempt at a solution - make the marker have a black outline. I personally think it's easier to see, but others may disagree. Here is the patched code:

Code: Select all

Index: InMapDraw.cpp
===================================================================
--- InMapDraw.cpp	(revision 1433)
+++ InMapDraw.cpp	(working copy)
@@ -46,23 +46,31 @@
 	for(int y=0;y<64;y++){	//circular thingy
 		for(int x=0;x<64;x++){
 			float dist=sqrt((float)(x-32)*(x-32)+(y-32)*(y-32));
-			if(dist>31.875)
-				dist=31.875;
-			tex[y][x][0]=255;
-			tex[y][x][1]=255;
-			tex[y][x][2]=255;
-			tex[y][x][3]=(unsigned char) (255-dist*8);
+			if (dist > 31.875) {
+				// do nothing - leave transparent
+			} else if (dist > 24.5) {
+				// black outline
+				tex[y][x][3]=255;
+			} else {
+				tex[y][x][0]=255;
+				tex[y][x][1]=255;
+				tex[y][x][2]=255;
+				tex[y][x][3]=(unsigned char) (255-dist*8);
+			}
 		}
 	}
 	for(int y=0;y<64;y++){	//linear falloff
 		for(int x=0;x<64;x++){
 			float dist=abs(y-32);
-			if(dist>31.5)
-				dist=31.5;
-			tex[y][x+64][0]=255;
-			tex[y][x+64][1]=255;
-			tex[y][x+64][2]=255;
-			tex[y][x+64][3]=(unsigned char) (255-dist*8);
+			if(dist > 24.5) {
+				// black outline
+				tex[y][x+64][3]=255;
+			} else {
+				tex[y][x+64][0]=255;
+				tex[y][x+64][1]=255;
+				tex[y][x+64][2]=255;
+				tex[y][x+64][3]=(unsigned char) (255-dist*8);
+			}
 		}
 	}
 	glGenTextures(1, &texture);
Also, I know I'm still an unknown, but what would it take for me to earn the privilege to get commit access to the svn repository? As a little background to my skill set - Java programmer for 6+ years, plus I've been doing C++ (mostly on Symbian though) on and off for the past couple of years.

Belmakor
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

screenshot?
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Post by Belmakor »

Er... yeah, that would be a good idea. Later tonight.
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Post by Belmakor »

Here's a screen grab. Where this would be very useful is when, say, a player is grey and the map is something like MoonQ10...

Image
Sheekel
Posts: 1391
Joined: 19 Apr 2005, 19:23

Post by Sheekel »

That looks really useful.
esteroth12
Posts: 501
Joined: 18 May 2006, 21:19

Post by esteroth12 »

I personally think it looks icky atm.make it border the color (make the edge of the point, not a ring)

also, for grey and black make it a white border

finish quickly and it might get into the next patch!
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

Sorry to be contrary, but I like the ring, and the black edge for grey much better.

But I do like white border for black teamcolor, or maybe a light grey.
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Post by Belmakor »

esteroth12 wrote:I personally think it looks icky atm.make it border the color (make the edge of the point, not a ring)
I'm not sure what you mean by "edge of the point, not a ring".
also, for grey and black make it a white border
For grey, the black border would look fine. For a black marker, it is probably not necessary for the border at all - how many maps have a black texture? (hmm... except maybe in deep shadow I guess)
finish quickly and it might get into the next patch!
Gotta see what the main devs think of the idea first. So far none of them have commented.
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

I think what he means by "edge, not ring" is this (ASCII warning...):

You have, where K is black and B is blue, and size is opacity,

KKKBBBBBBBBBKKK

And he would like,

KKKKBBBBBBBKKKK

But IMO it looks better the top way, the way it is now.[/b]
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

What does K stand for, anyway? As in, CMYK. Cyan, Magenta, Yellow... Kellogs? What the heck?
User avatar
Decimator
Posts: 1118
Joined: 24 Jul 2005, 04:15

Post by Decimator »

Black
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

I like it, BUTm I think because the things are supposed to be... kinda sticking out of the ground they should have the bottom clipped off... like an upside down 'U'...
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

As above, K is black, since B is already blue. I think this is pretty comon notation...[/i]
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

SinbadEV wrote:I like it, BUTm I think because the things are supposed to be... kinda sticking out of the ground they should have the bottom clipped off... like an upside down 'U'...
Agree!

Also does it affect drawing?
does it affect the letters on labels?
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Post by Belmakor »

like an upside down 'U'...

I'll see what I can do... but I'm a OpenGL newbie so am still figuring out how the stuff works...
Also does it affect drawing
No. And I don't think it would work for freehand drawing, either.
does it affect the letters on labels?
I'd like it to, but I haven't figured out how to make that happen yet.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Post by Das Bruce »

Modable FTW.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Looks nice,

I already tried committing it but svn was complaining about the patch for reasons I don't understand (It complained that "line" "Index: " could not be found..).
Maybe it expects unix style newlines or something.
We'll commit it sometime though..
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Post by Belmakor »

I already tried committing it but svn was complaining about the patch for reasons I don't understand (It complained that "line" "Index: " could not be found..).
If you had attempted the commit from the spring root directory, then that would have explained it. I created the patch from the rts/Rendering directory.

BTW, no one has answered my question as to how I can earn the right to get commit access to the svn repository? What's the procedure to "prove myself" (beyond contributing a few useful patches and generally showing I'm a nice guy? ;-) )
User avatar
Tim Blokdijk
Posts: 1242
Joined: 29 May 2005, 11:18

Post by Tim Blokdijk »

Belmakor wrote:...
(beyond contributing a few useful patches and generally showing I'm a nice guy? ;-) )
There is no real procedure but being a nice guy and having a few useful patches helps a lot.
I value good behaviour so if you are (and not only showing to be) a nice guy I'm more than willing to pester Jelmer with your svn commit request.

Ow and btw like the new markers :-)
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

I hand-applied the patch.

Please could you next time just link to it from the forum and upload it in the bug tracker / anywhere else (rafb.net/paste?). The

Code: Select all

[/Code ] tags mess up tabs (converted to spaces) and insert an extra space in front of each line, making it impossible to machine-apply it. Thanks.
Post Reply

Return to “Engine”