make logic stuff public, cleanup

This commit is contained in:
DeltaNedas
2020-11-01 19:35:22 +00:00
parent a13f7f633e
commit cda6a6973d
5 changed files with 31 additions and 36 deletions

View File

@@ -21,10 +21,10 @@ public class LCanvas extends Table{
//ew static variables
static LCanvas canvas;
DragLayout statements;
StatementElem dragging;
ScrollPane pane;
Group jumps;
public DragLayout statements;
public StatementElem dragging;
public ScrollPane pane;
public Group jumps;
float targetWidth;
public LCanvas(){
@@ -69,18 +69,18 @@ public class LCanvas extends Table{
}
}
void add(LStatement statement){
public void add(LStatement statement){
statements.addChild(new StatementElem(statement));
}
String save(){
public String save(){
Seq<LStatement> st = statements.getChildren().<StatementElem>as().map(s -> s.st);
st.each(LStatement::saveUI);
return LAssembler.write(st);
}
void load(String asm){
public void load(String asm){
jumps.clear();
Seq<LStatement> statements = LAssembler.read(asm);
@@ -239,7 +239,7 @@ public class LCanvas extends Table{
}
public class StatementElem extends Table{
LStatement st;
public LStatement st;
public StatementElem(LStatement st){
this.st = st;
@@ -319,7 +319,7 @@ public class LCanvas extends Table{
marginBottom(7);
}
void copy(){
public void copy(){
LStatement copy = st.copy();
if(copy != null){
StatementElem s = new StatementElem(copy);
@@ -345,15 +345,15 @@ public class LCanvas extends Table{
}
public static class JumpButton extends ImageButton{
Color hoverColor = Pal.place;
Color defaultColor = Color.white;
Prov<StatementElem> to;
boolean selecting;
float mx, my;
ClickListener listener;
StatementElem hovered;
public Color hoverColor = Pal.place;
public Color defaultColor = Color.white;
public Prov<StatementElem> to;
public boolean selecting;
public float mx, my;
public ClickListener listener;
public StatementElem hovered;
JumpCurve curve;
public JumpCurve curve;
public JumpButton(Prov<StatementElem> getter, Cons<StatementElem> setter){
super(Tex.logicNode, Styles.colori);
@@ -421,7 +421,7 @@ public class LCanvas extends Table{
}
}
StatementElem hovered(){
public StatementElem hovered(){
Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
if(e != null){
while(e != null && !(e instanceof StatementElem)){
@@ -434,7 +434,7 @@ public class LCanvas extends Table{
}
public static class JumpCurve extends Element{
JumpButton button;
public JumpButton button;
public JumpCurve(JumpButton button){
this.button = button;
@@ -483,7 +483,7 @@ public class LCanvas extends Table{
}
}
void drawCurve(float x, float y, float x2, float y2){
public void drawCurve(float x, float y, float x2, float y2){
Lines.stroke(4f, button.color);
Draw.alpha(parentAlpha);
@@ -494,8 +494,7 @@ public class LCanvas extends Table{
x + dist, y,
x2 + dist, y2,
x2, y2,
Math.max(20, (int)(Mathf.dst(x, y, x2, y2) / 6))
);
Math.max(20, (int)(Mathf.dst(x, y, x2, y2) / 6)));
}
}
}