mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 03:08:38 +07:00
parent
f91cc2eace
commit
eb7e65668c
@ -484,6 +484,7 @@ filter.option.circle-scale = Circle Scale
|
|||||||
filter.option.octaves = Octaves
|
filter.option.octaves = Octaves
|
||||||
filter.option.falloff = Falloff
|
filter.option.falloff = Falloff
|
||||||
filter.option.angle = Angle
|
filter.option.angle = Angle
|
||||||
|
filter.option.rotate = Rotate
|
||||||
filter.option.amount = Amount
|
filter.option.amount = Amount
|
||||||
filter.option.block = Block
|
filter.option.block = Block
|
||||||
filter.option.floor = Floor
|
filter.option.floor = Floor
|
||||||
|
@ -111,4 +111,23 @@ public abstract class FilterOption{
|
|||||||
table.add("@filter.option." + name);
|
table.add("@filter.option." + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class ToggleOption extends FilterOption{
|
||||||
|
final String name;
|
||||||
|
final Boolp getter;
|
||||||
|
final Boolc setter;
|
||||||
|
|
||||||
|
ToggleOption(String name, Boolp getter, Boolc setter){
|
||||||
|
this.name = name;
|
||||||
|
this.getter = getter;
|
||||||
|
this.setter = setter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(Table table){
|
||||||
|
table.row();
|
||||||
|
CheckBox check = table.check("@filter.option." + name, setter).growX().padBottom(5).padTop(5).center().get();
|
||||||
|
check.changed(changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,13 @@ public class MirrorFilter extends GenerateFilter{
|
|||||||
private final Vec2 v1 = new Vec2(), v2 = new Vec2(), v3 = new Vec2();
|
private final Vec2 v1 = new Vec2(), v2 = new Vec2(), v3 = new Vec2();
|
||||||
|
|
||||||
int angle = 45;
|
int angle = 45;
|
||||||
|
boolean rotate = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FilterOption[] options(){
|
public FilterOption[] options(){
|
||||||
return Structs.arr(
|
return Structs.arr(
|
||||||
new SliderOption("angle", () -> angle, f -> angle = (int)f, 0, 360, 45)
|
new SliderOption("angle", () -> angle, f -> angle = (int)f, 0, 360, 45),
|
||||||
|
new ToggleOption("rotate", () -> rotate, f -> rotate = f)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +74,8 @@ public class MirrorFilter extends GenerateFilter{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mirror(Vec2 p, float x0, float y0, float x1, float y1){
|
void mirror(Vec2 p, float x0, float y0, float x1, float y1){
|
||||||
//special case: uneven map mirrored at 45 degree angle
|
//special case: uneven map mirrored at 45 degree angle (or someone might just want rotational symmetry)
|
||||||
if(in.width != in.height && angle % 90 != 0){
|
if((in.width != in.height && angle % 90 != 0) || rotate){
|
||||||
p.x = in.width - p.x - 1;
|
p.x = in.width - p.x - 1;
|
||||||
p.y = in.height - p.y - 1;
|
p.y = in.height - p.y - 1;
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
Reference in New Issue
Block a user