Skip to content

Commit

Permalink
Merge pull request #140 from Anuken/master
Browse files Browse the repository at this point in the history
Better outline implementation + BE update
  • Loading branch information
sk7725 authored May 15, 2022
2 parents cdf07ea + 9a1e899 commit 974ddf1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repositories{

dependencies{
annotationProcessor 'com.github.Anuken:jabel:0.4.0'
compileOnly "com.github.Anuken.MindustryJitpack:core:2f8b009dbb"
compileOnly "com.github.Anuken.MindustryJitpack:core:62a21c395b"
compileOnly "com.github.Anuken.Arc:arc-core:dfcb21ce56"
}

Expand Down
2 changes: 1 addition & 1 deletion src/betamindy/entities/bullet/PayloadBullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void update(Bullet b){
}
if(b.data instanceof Payload pay){
pay.set(b.x, b.y, payloadRotation(b));
pay.update(false);
pay.update(null, null);
}
}

Expand Down
29 changes: 2 additions & 27 deletions src/betamindy/graphics/Drawm.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,33 +534,8 @@ private static void prepareRollColor(float roll, Color lightColor, Color darkCol

/** Outlines a given textureRegion. Run in createIcons. */
public static void outlineRegion(MultiPacker packer, TextureRegion tex, Color outlineColor, String name){
final int radius = 4;
PixmapRegion region = Core.atlas.getPixmap(tex);
Pixmap out = new Pixmap(region.width, region.height);
Color color = new Color();
for(int x = 0; x < region.width; x++){
for(int y = 0; y < region.height; y++){

region.get(x, y, color);
out.set(x, y, color);

if(color.a < 1f){
boolean found = false;
outer:
for(int rx = -radius; rx <= radius; rx++){
for(int ry = -radius; ry <= radius; ry++){
if(Structs.inBounds(rx + x, ry + y, region.width, region.height) && Mathf.within(rx, ry, radius) && color.set(region.getRaw(rx + x, ry + y)).a > 0.01f){
found = true;
break outer;
}
}
}
if(found){
out.set(x, y, outlineColor.rgba());
}
}
}
}
Pixmap out = Pixmaps.outline(Core.atlas.getPixmap(tex), outlineColor, 4);
Drawf.checkBleed(out);
packer.add(MultiPacker.PageType.main, name, out);
}

Expand Down
5 changes: 2 additions & 3 deletions src/betamindy/world/blocks/distribution/PayloadRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.payloads.*;

import java.util.*;

import static arc.Core.atlas;
import static arc.Core.*;
import static mindustry.Vars.*;

public class PayloadRail extends PayloadConveyor {
Expand Down Expand Up @@ -159,7 +158,7 @@ public boolean updateIdle(){
if(!enabled) return false;

if(item != null){
item.update(false);
item.update(null, this);
}

lastInterp = curInterp;
Expand Down

0 comments on commit 974ddf1

Please sign in to comment.