Closed Captions / Subtitles for Vintage Story.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adjust styling to match mockup better.

Make sounds starting with ~ cyan.
Adjust color of orange to match mockup.
Adjust padding on subtitle text.
Remove stroke from elements without an attention-grabbing color.
Shrink background box by 1px on all sides.

+14 -5
+14 -5
ClosedCaptions/CaptionsList.cs
··· 104 104 var brightness = ((1 - (sound.age / MAX_AGE_SECONDS)) * Math.Max(1, sound.volume) / 2 + 0.5); 105 105 106 106 ctx.SetSourceRGBA(0, 0, 0, 0.25 + (brightness * 0.5)); 107 - ctx.Rectangle(0, y, 300, 32); 107 + ctx.Rectangle(1, y+1, 298, 30); 108 108 ctx.Fill(); 109 - ctx.Rectangle(0, y, 300, 32); 109 + //ctx.Rectangle(0, y, 300, 32); 110 110 ctx.SetSourceRGBA(.25, .25, .25, 0.5 + (brightness * 0.5)); 111 111 ctx.LineWidth = 1.0; 112 - ctx.Stroke(); 112 + //ctx.Stroke(); 113 113 114 114 var soundName = sound.name; 115 115 if (soundName.StartsWith("!")) 116 116 { 117 117 soundName = soundName.Substring(1); 118 - ctx.SetSourceRGB(brightness, brightness * 0.35, brightness * .25); 118 + ctx.SetSourceRGB(brightness, brightness * 0.635, brightness * .27); 119 + ctx.Rectangle(0, y, 300, 32); 120 + ctx.Stroke(); 121 + } 122 + else if (soundName.StartsWith("~")) 123 + { 124 + soundName = soundName.Substring(1); 125 + ctx.SetSourceRGB(brightness * 0.7, brightness, brightness*0.9); 126 + ctx.Rectangle(0, y, 300, 32); 127 + ctx.Stroke(); 119 128 } 120 129 else 121 130 { 122 131 ctx.SetSourceRGB(brightness, brightness, brightness); 123 132 } 124 - textUtil.DrawTextLine(ctx, font, soundName, 150 - sound.textWidth / 2, y+6); 133 + textUtil.DrawTextLine(ctx, font, soundName, 150 - sound.textWidth / 2, y+3); 125 134 126 135 if (sound.position == null || sound.position.IsZero) continue; 127 136