New overdrive visuals for colorblind users (#4807)

This commit is contained in:
Sunny Kim 2021-03-01 07:32:28 +09:00 committed by GitHub
parent 1a30edc55f
commit 01f7b1c9a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import arc.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.annotations.Annotations.*;
@ -134,7 +135,19 @@ public class OverdriveProjector extends Block{
Draw.rect(topRegion, x, y);
Draw.alpha(1f);
Lines.stroke((2f * f + 0.1f) * heat);
Lines.square(x, y, Math.min(1f + (1f - f) * size * tilesize / 2f, size * tilesize/2f));
//float hype = 1.414f * size * tilesize / 2f; // hypotenuse
float r = Math.max(0f, Mathf.clamp(2f - f * 2f) * size * tilesize / 2f - f - 0.2f);
float w = Mathf.clamp(0.5f - f) * size * tilesize;
Lines.beginLine();
for(int i = 0; i < 4; i++){
Lines.linePoint(x + Geometry.d4(i).x * r + Geometry.d4(i).y * w, y + Geometry.d4(i).y * r - Geometry.d4(i).x * w);
if(f < 0.5f) Lines.linePoint(x + Geometry.d4(i).x * r - Geometry.d4(i).y * w, y + Geometry.d4(i).y * r + Geometry.d4(i).x * w);
//Lines.lineAngleCenter(x + Geometry.d8edge(i).x * size * tilesize / 2f * (1f - f), y + Geometry.d8edge(i).y * size * tilesize / 2f * (1f - f), 135f + 90f * i, hype * (0.5f - Math.abs(f - 0.5f)) * 2f);
//if(f < 0.5f) Lines.lineAngleCenter(x + Geometry.d4(i).x * size * tilesize / 2f - Geometry.d4(i).x * f, y + Geometry.d4(i).y * size * tilesize / 2f - Geometry.d4(i).y * f, 90f + 90f * i, (0.5f - f) * 2f * size * tilesize);
}
Lines.endLine(true);
//Lines.square(x, y, Math.min(1f + (1f - f) * size * tilesize / 2f, size * tilesize/2f));
Draw.reset();
}