Skip to content

Commit

Permalink
improved the look of drop zone radius
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Feb 28, 2025
1 parent 5ed5f2f commit 8201f4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/java/schema/input/InputSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ protected void drawControl() {
if (has) {
Draw.mixcol(Pal.accent, 1f);
Draw.alpha(controlFade);

if (renderer.bloom != null) {
renderer.bloom.setBloomIntensity(.8f);
renderer.bloom.capture();
}
overlay.capture(.8f);

if (unit != null)
Draw.rect(unit.icon(), unit, unit instanceof BlockUnitc ? 0f : unit.rotation - 90f);
Expand All @@ -143,7 +139,7 @@ protected void drawControl() {
Draw.rect("select-arrow", sized.getX() + Angles.trnsx(rot, len), sized.getY() + Angles.trnsy(rot, len), 12f, 12f, rot - 135f);
}

if (renderer.bloom != null) renderer.bloom.render();
overlay.render();
Draw.reset();
}
}
Expand Down
22 changes: 19 additions & 3 deletions src/java/schema/tools/Overlay.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package schema.tools;

import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import mindustry.graphics.*;
Expand All @@ -14,6 +13,8 @@ public class Overlay {

/** Distance from which spawners are visible. */
public static final float spawnerMargin = 16f * tilesize;
/** Interpolation function applied to alpha. */
public static final Interp i = new Interp.PowIn(8f);

/** Draws the elements of both vanilla and schema overlay */
public void draw() {
Expand All @@ -26,13 +27,15 @@ public void draw() {

if (state.hasSpawns()) {
Lines.stroke(2f);
Draw.color(Color.gray, Color.lightGray, Mathf.absin(4f, 1f));
Draw.color(Pal.remove, Pal.lightishGray, Mathf.absin(4f, 1f));

capture(4f);
spawner.getSpawns().each(s -> s.within(player, state.rules.dropZoneRadius + spawnerMargin), s -> {

Draw.alpha(1f - (player.dst(s) - state.rules.dropZoneRadius) / spawnerMargin);
Draw.alpha(1f - i.apply((player.dst(s) - state.rules.dropZoneRadius) / spawnerMargin));
Lines.dashCircle(s.worldx(), s.worldy(), state.rules.dropZoneRadius);
});
render();
}

if (insys.block == null && !scene.hasMouse()) {
Expand All @@ -46,6 +49,19 @@ public void draw() {
}
}

/** Captures subsequent draw calls. */
public void capture(float intensity) {
if (renderer.bloom != null) {
renderer.bloom.setBloomIntensity(intensity);
renderer.bloom.capture();
}
}

/** Renders the {@link #capture(float) captured draw calls} with bloom effect. */
public void render() {
if (renderer.bloom != null) renderer.bloom.render();
}

// region agent

/** Returns the agent of this component. */
Expand Down

0 comments on commit 8201f4a

Please sign in to comment.