wall half closure control + layers
- add onewaywall option to create a wall if there is not step back - add layers of maze - load minetest scheme .we with onewall option
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package org.artisanlogiciel.games.maze.gui;
|
||||
|
||||
import org.artisanlogiciel.games.maze.DrawingGenerator;
|
||||
import org.artisanlogiciel.games.maze.LabyModel;
|
||||
import org.artisanlogiciel.games.maze.MazeParams;
|
||||
import org.artisanlogiciel.games.maze.MazeParamsFixed;
|
||||
import org.artisanlogiciel.games.maze.*;
|
||||
import org.artisanlogiciel.games.maze.persist.MazePersistWorldEdit;
|
||||
import org.artisanlogiciel.games.maze.persist.MazePersistRaw;
|
||||
import org.artisanlogiciel.games.maze.solve.SolvingModel;
|
||||
@@ -40,6 +37,9 @@ implements StatusListener
|
||||
|
||||
public final static ResourceBundle labels = ResourceBundle.getBundle("LabelsBundle", Locale.getDefault(), Display.class.getClassLoader(), new UTF8Control());
|
||||
|
||||
LabyLayers layers = new LabyLayers();
|
||||
int layer = 0;
|
||||
|
||||
MazeComponent maze;
|
||||
MazeControler controler;
|
||||
LabyModel model;
|
||||
@@ -110,12 +110,17 @@ implements StatusListener
|
||||
}
|
||||
}
|
||||
|
||||
void setModel( LabyModel model)
|
||||
{
|
||||
this.model = model;
|
||||
layers.addLabyModel(layer, model);
|
||||
}
|
||||
|
||||
void resetModel() {
|
||||
// recreate labyrinth
|
||||
if (params != null) {
|
||||
params = controler.getSettings().resetParams();
|
||||
model = new LabyModel(params);
|
||||
|
||||
setModel(new LabyModel(params));
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +138,6 @@ implements StatusListener
|
||||
maze.changed(null, null, model);
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,11 +627,19 @@ implements StatusListener
|
||||
setAutoSize(autoSlide.isSelected());
|
||||
}
|
||||
});
|
||||
final JSlider layerSlide = new JSlider( JSlider.HORIZONTAL, 0,10, 0);
|
||||
layerSlide.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
int r = setLayer(layerSlide.getValue());
|
||||
//layerSlide.setMaximum(r);
|
||||
}
|
||||
});
|
||||
|
||||
resizecontrol = new JPanel(new FlowLayout());
|
||||
resizecontrol.add(showAll);
|
||||
resizecontrol.add(slider);
|
||||
resizecontrol.add(autoSlide);
|
||||
resizecontrol.add(layerSlide);
|
||||
|
||||
add(controlDisplayPanel, BorderLayout.SOUTH);
|
||||
add(resizecontrol, BorderLayout.WEST);
|
||||
@@ -658,7 +670,7 @@ implements StatusListener
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(infile);
|
||||
model = new MazePersistRaw().parseInputStream("raw",inputStream);
|
||||
setModel(new MazePersistRaw().parseInputStream("raw",inputStream));
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace(System.err);
|
||||
statusField.setText("[ERROR] Can't load " + infile.getAbsolutePath());
|
||||
@@ -787,7 +799,7 @@ implements StatusListener
|
||||
FileInputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(infile);
|
||||
model = new MazePersistWorldEdit().parseInputStream("we",inputStream);
|
||||
setModel(new MazePersistWorldEdit().parseInputStream("we",inputStream));
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace(System.err);
|
||||
statusField.setText("[ERROR] Can't load " + infile.getAbsolutePath());
|
||||
@@ -874,6 +886,24 @@ implements StatusListener
|
||||
}
|
||||
}
|
||||
|
||||
private int setLayer(int x)
|
||||
{
|
||||
addStatus("set layer " + x);
|
||||
LabyModel layermodel = layers.getLayer(x);
|
||||
if ( layermodel == null )
|
||||
{
|
||||
// clone it
|
||||
model = new LabyModel(model);
|
||||
layers.addLabyModel(x, model);
|
||||
}
|
||||
else
|
||||
{
|
||||
model = layermodel;
|
||||
}
|
||||
layer = x;
|
||||
refresh();
|
||||
return layer;
|
||||
}
|
||||
|
||||
public static void main(String pArgs[]) {
|
||||
LabyModel model = null;
|
||||
|
||||
@@ -15,6 +15,7 @@ public class MazeSettings extends JPanel {
|
||||
JTextField textHeight = null;
|
||||
JTextField textDepth = null;
|
||||
JTextField textSeed = null;
|
||||
JCheckBox onewaywallCB = null;
|
||||
|
||||
// TODO set width and height and depth of maze with gui
|
||||
public MazeSettings(MazeParams params) {
|
||||
@@ -53,6 +54,8 @@ public class MazeSettings extends JPanel {
|
||||
textSeed = new JTextField( "" + params.getSeed(),16);
|
||||
add(seedLabel);
|
||||
add(textSeed);
|
||||
onewaywallCB = new JCheckBox("one way wall", false);
|
||||
add(onewaywallCB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user