mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-02 20:33:50 +07:00
functional scrolling
This commit is contained in:
parent
6dca449b08
commit
4efba475de
@ -24,7 +24,7 @@ import mindustry.editor.*;
|
|||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.logic.LDialog;
|
import mindustry.logic.LogicDialog;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
import mindustry.ui.fragments.*;
|
import mindustry.ui.fragments.*;
|
||||||
@ -68,7 +68,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public SchematicsDialog schematics;
|
public SchematicsDialog schematics;
|
||||||
public ModsDialog mods;
|
public ModsDialog mods;
|
||||||
public ColorPicker picker;
|
public ColorPicker picker;
|
||||||
public LDialog logic;
|
public LogicDialog logic;
|
||||||
|
|
||||||
public Cursor drillCursor, unloadCursor;
|
public Cursor drillCursor, unloadCursor;
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
research = new ResearchDialog();
|
research = new ResearchDialog();
|
||||||
mods = new ModsDialog();
|
mods = new ModsDialog();
|
||||||
schematics = new SchematicsDialog();
|
schematics = new SchematicsDialog();
|
||||||
logic = new LDialog();
|
logic = new LogicDialog();
|
||||||
|
|
||||||
Group group = Core.scene.root;
|
Group group = Core.scene.root;
|
||||||
|
|
||||||
|
@ -133,6 +133,10 @@ public class LCanvas extends Table{
|
|||||||
Seq<Element> seq = new Seq<>();
|
Seq<Element> seq = new Seq<>();
|
||||||
int insertPosition = 0;
|
int insertPosition = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
setTransform(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void layout(){
|
public void layout(){
|
||||||
float cy = 0;
|
float cy = 0;
|
||||||
@ -151,7 +155,7 @@ public class LCanvas extends Table{
|
|||||||
if(dragging == e) continue;
|
if(dragging == e) continue;
|
||||||
|
|
||||||
e.setSize(width - margin * 2f, e.getPrefHeight());
|
e.setSize(width - margin * 2f, e.getPrefHeight());
|
||||||
e.setPosition(x + margin, height + y - margin - cy, Align.topLeft);
|
e.setPosition(x + margin, height- margin - cy, Align.topLeft);
|
||||||
|
|
||||||
cy += e.getPrefHeight() + space;
|
cy += e.getPrefHeight() + space;
|
||||||
seq.add(e);
|
seq.add(e);
|
||||||
@ -202,7 +206,7 @@ public class LCanvas extends Table{
|
|||||||
if(dragging != null && insertPosition <= seq.size){
|
if(dragging != null && insertPosition <= seq.size){
|
||||||
float shiftAmount = dragging.getHeight();
|
float shiftAmount = dragging.getHeight();
|
||||||
float lastX = x + margin;
|
float lastX = x + margin;
|
||||||
float lastY = insertPosition == 0 ? height + y - margin : seq.get(insertPosition - 1).y - space;
|
float lastY = insertPosition == 0 ? height + y - margin : seq.get(insertPosition - 1).y + y - space;
|
||||||
|
|
||||||
Tex.pane.draw(lastX, lastY - shiftAmount, width - margin*2f, dragging.getHeight());
|
Tex.pane.draw(lastX, lastY - shiftAmount, width - margin*2f, dragging.getHeight());
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import arc.scene.ui.layout.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
public class LDialog extends BaseDialog{
|
public class LogicDialog extends BaseDialog{
|
||||||
LCanvas canvas;
|
LCanvas canvas;
|
||||||
Cons<String> consumer = s -> Log.info(s);
|
Cons<String> consumer = s -> Log.info(s);
|
||||||
|
|
||||||
public LDialog(){
|
public LogicDialog(){
|
||||||
super("logic");
|
super("logic");
|
||||||
|
|
||||||
clearChildren();
|
clearChildren();
|
@ -45,6 +45,9 @@ public class LogicDisplay extends Block{
|
|||||||
|
|
||||||
if(buffer == null){
|
if(buffer == null){
|
||||||
buffer = new FrameBuffer(displaySize, displaySize);
|
buffer = new FrameBuffer(displaySize, displaySize);
|
||||||
|
//clear the buffer - some OSs leave garbage in it
|
||||||
|
buffer.begin(Color.clear);
|
||||||
|
buffer.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!commands.isEmpty()){
|
if(!commands.isEmpty()){
|
||||||
|
Loading…
Reference in New Issue
Block a user