Hello, I found a bug tonegod GUI,Use drag DragElement controls 150 times may lead to program crashes
Drag the number 150 ,Lead to system crashes, not throw an exception !
`package test;
import tonegod.gui.controls.buttons.ButtonAdapter;
import tonegod.gui.controls.extras.DragElement;
import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Element;
import tonegod.gui.core.Screen;
import tonegod.gui.core.layouts.LayoutHelper;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.plugins.ZipLocator;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector4f;
import com.jme3.system.AppSettings;
import com.jme3.texture.Texture;
public class TestGui extends SimpleApplication implements ActionListener {
Screen screen;
Texture objIcons;
@Override
public void simpleInitApp() {
assetManager.registerLocator("assets/Gui.zip", ZipLocator.class);
flyCam.setEnabled(false);
AmbientLight ambientLight = new AmbientLight();
ambientLight.setColor(ColorRGBA.White.multLocal(1.4f));
rootNode.addLight(ambientLight);
screen = new Screen(this);
guiNode.addControl(screen);
guiNode.addLight(ambientLight);
objIcons = assetManager.loadTexture("exp_5-63182.png");
Panel panel = new Panel(screen, new Vector2f(10, 10), new Vector2f(250,
100));
panel.setIsResizable(false);
screen.addElement(panel);
ButtonAdapter grop = new ButtonAdapter(screen, "grop", new Vector2f(5,50), new Vector2f(40, 40));
grop.clearAltImages();
grop.setEffectZOrder(false);
grop.setIsDragDropDropElement(true);
panel.attachChild(grop);
ButtonAdapter grop2 = new ButtonAdapter(screen, "grop2", new Vector2f(50, 50), new Vector2f(40, 40));
grop2.clearAltImages();
grop2.setEffectZOrder(false);
grop2.setIsDragDropDropElement(true);
panel.attachChild(grop2);
ButtonAdapter grop3 = new ButtonAdapter(screen, "grop3", new Vector2f(100, 50), new Vector2f(40, 40));
grop3.clearAltImages();
grop3.setEffectZOrder(false);
grop3.setIsDragDropDropElement(true);
panel.attachChild(grop3);
DragElement drag = createDrag("t","x=40|y=40|w=40|h=40");
screen.addElement(drag);
drag.bindToDroppable(grop2);
}
public DragElement createDrag(String id, String iconModal) {
DragElement dragElement = new DragElement(screen, id, LayoutHelper.position(),new Vector2f(40, 40), Vector4f.ZERO, null) {
@Override
public void onDragStart(MouseButtonEvent evt) {
}
@Override
public boolean onDragEnd(MouseButtonEvent evt, Element dropElement) {
if (dropElement != null) {
return true;
} else {
return false;
}
}
};
dragElement.setTextureAtlasImage(objIcons, iconModal);
dragElement.setEffectZOrder(false);
dragElement.setUseLockToDropElementCenter(true);
dragElement.setUseSpringBack(true);
dragElement.setUseSpringBackEffect(true);
return dragElement;
}
@Override
public void onAction(String arg0, boolean arg1, float arg2) {
}
public static void main(String[] args) {
TestGui test = new TestGui();
AppSettings settings = new AppSettings(true);
settings.setResolution(1024, 600);
test.setShowSettings(false);
test.setSettings(settings);
test.start();
}
}