Logic hints for draw operations

This commit is contained in:
Anuken
2021-02-17 09:49:01 -05:00
parent b8bfb30c56
commit 1ef7ae7079
4 changed files with 24 additions and 2 deletions

View File

@@ -1542,6 +1542,19 @@ lenum.shootp = Shoot at a unit/building with velocity prediction.
lenum.configure = Building configuration, e.g. sorter item. lenum.configure = Building configuration, e.g. sorter item.
lenum.enabled = Whether the block is enabled. lenum.enabled = Whether the block is enabled.
laccess.color = Illuminator color.
graphicstype.clear = Fill the display with a color.
graphicstype.color = Set color for next drawing operation.
graphicstype.stroke = Set line width.
graphicstype.line = Draw line segment.
graphicstype.rect = Fill a rectangle.
graphicstype.linerect = Draw a rectangle outline.
graphicstype.poly = Fill a regular polygon.
graphicstype.linepoly = Draw a regular polygon outline.
graphicstype.triangle = Fill a triangle.
graphicstype.image = Draw an image of some content.\nex: [accent]@router[] or [accent]@dagger[].
lenum.always = Always true. lenum.always = Always true.
lenum.idiv = Integer division. lenum.idiv = Integer division.
lenum.div = Division.\nReturns [accent]null[] on divide-by-zero. lenum.div = Division.\nReturns [accent]null[] on divide-by-zero.

View File

@@ -48,6 +48,15 @@ public class LCanvas extends Table{
} }
} }
public static void tooltip(Cell<?> cell, Enum<?> key){
String cl = key.getClass().getSimpleName().toLowerCase() + "." + key.name().toLowerCase();
if(Core.bundle.has(cl)){
tooltip(cell, cl);
}else{
tooltip(cell, "lenum." + key.name());
}
}
public void rebuild(){ public void rebuild(){
targetWidth = useRows() ? 400f : 900f; targetWidth = useRows() ? 400f : 900f;
float s = pane != null ? pane.getScrollPercentY() : 0f; float s = pane != null ? pane.getScrollPercentY() : 0f;

View File

@@ -75,7 +75,7 @@ public abstract class LStatement{
sizer.get(t.button(p.toString(), Styles.logicTogglet, () -> { sizer.get(t.button(p.toString(), Styles.logicTogglet, () -> {
getter.get(p); getter.get(p);
hide.run(); hide.run();
}).self(c -> tooltip(c, "lenum." + p.name())).checked(current == p).group(group)); }).self(c -> tooltip(c, p)).checked(current == p).group(group));
if(++i % cols == 0) t.row(); if(++i % cols == 0) t.row();
} }

View File

@@ -512,7 +512,7 @@ public class LStatements{
i.button(sensor.name(), Styles.cleart, () -> { i.button(sensor.name(), Styles.cleart, () -> {
stype("@" + sensor.name()); stype("@" + sensor.name());
hide.run(); hide.run();
}).size(240f, 40f).self(c -> tooltip(c, "lenum." + sensor.name())).row(); }).size(240f, 40f).self(c -> tooltip(c, sensor)).row();
} }
}) })
}; };