add a shell script to code & run
Signed-off-by: philippe lhardy <philippe@pavilionartlogiciel>
This commit is contained in:
6
README
6
README
@@ -1,10 +1,13 @@
|
|||||||
This is a personal project to generate a 2D maze using in depth path generation.
|
This is a personal project to generate a 2D maze using in depth path generation.
|
||||||
|
|
||||||
this can generate a stl file, overall goal was to print it with a 3D printer, i didn't test it yet ( even i hav actualy have a 3D printer ).
|
this can generate a stl file, overall goal was to print it with a 3D printer, i didn't test it yet ( even if i actualy have a 3D printer ).
|
||||||
|
|
||||||
This is the very first usable part.
|
This is the very first usable part.
|
||||||
It was developped under debian 7/8 but since it is java based it might be very easily recompiled or even just copied on other platform.
|
It was developped under debian 7/8 but since it is java based it might be very easily recompiled or even just copied on other platform.
|
||||||
|
|
||||||
|
|
||||||
|
there is a console gui menu base with ./doit.sh
|
||||||
|
|
||||||
run it by :
|
run it by :
|
||||||
|
|
||||||
cd java
|
cd java
|
||||||
@@ -31,7 +34,6 @@ It was tested up to 1000x1000 labyrinth and can realy generate huge labyrinth.
|
|||||||
|
|
||||||
Entry of labyrinth is upper left corner, exit is lower right ( this is different in 3D since Y axis where reversed ).
|
Entry of labyrinth is upper left corner, exit is lower right ( this is different in 3D since Y axis where reversed ).
|
||||||
|
|
||||||
|
|
||||||
BUGS are numerous, and every bug was cleverly designed to drive you mad.
|
BUGS are numerous, and every bug was cleverly designed to drive you mad.
|
||||||
DOCUMENTATION is self contained in code an in my brain.
|
DOCUMENTATION is self contained in code an in my brain.
|
||||||
|
|
||||||
|
|||||||
75
doit.sh
Executable file
75
doit.sh
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
do_code()
|
||||||
|
{
|
||||||
|
background=$1
|
||||||
|
find java/org/artisanlogiciel/games/ -name "*.java" |
|
||||||
|
{
|
||||||
|
s=
|
||||||
|
while read codeline
|
||||||
|
do
|
||||||
|
javafile=$(basename $codeline)
|
||||||
|
javaclass=${javafile/.java/}
|
||||||
|
echo "$javafile $javaclass"
|
||||||
|
s="$s $javaclass $codeline"
|
||||||
|
done
|
||||||
|
javaclass=$($DIALOG --menu "Run it" 20 100 10 $s 3>&1 1>&2 2>&3)
|
||||||
|
if [[ -n $javaclass ]]
|
||||||
|
then
|
||||||
|
pushd java
|
||||||
|
if [[ $background == codebg ]]
|
||||||
|
then
|
||||||
|
nohup make work/$javaclass &
|
||||||
|
else
|
||||||
|
make work/$javaclass
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
possible_console_gui="whiptail dialog"
|
||||||
|
|
||||||
|
for DIALOG in $possible_console_gui
|
||||||
|
do
|
||||||
|
DIALOG=$(which $DIALOG)
|
||||||
|
if [[ -n $DIALOG ]]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $DIALOG ]]
|
||||||
|
then
|
||||||
|
echo "no console gui support (within $possible_console_gui) => no menus "
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
action=initial
|
||||||
|
|
||||||
|
while [[ $action != quit ]]
|
||||||
|
do
|
||||||
|
action=$($DIALOG --menu "Run it" 20 80 8 run "Run it" test "Test it" readme "Read me" code "Code" codebg "Code in background" quit "Quit" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
if [[ $action == run ]]
|
||||||
|
then
|
||||||
|
echo "run it"
|
||||||
|
pushd java
|
||||||
|
make display
|
||||||
|
popd
|
||||||
|
elif [[ $action == test ]]
|
||||||
|
then
|
||||||
|
echo "test it"
|
||||||
|
pushd java
|
||||||
|
make display
|
||||||
|
popd
|
||||||
|
elif [[ $action =~ code ]]
|
||||||
|
then
|
||||||
|
do_code $action
|
||||||
|
elif [[ $action == readme ]]
|
||||||
|
then
|
||||||
|
$DIALOG --textbox README 20 80
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -106,7 +106,7 @@ public class Display extends JFrame
|
|||||||
goNorth();
|
goNorth();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JButton north = addDirection("North", "UP", goNorth);
|
JButton north = addDirection(this,"North", "UP", goNorth);
|
||||||
|
|
||||||
Action goEast = new AbstractAction() {
|
Action goEast = new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent evt)
|
public void actionPerformed(ActionEvent evt)
|
||||||
@@ -116,7 +116,7 @@ public class Display extends JFrame
|
|||||||
goEast();
|
goEast();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JButton east = addDirection("East", "RIGHT", goEast);
|
JButton east = addDirection(this,"East", "RIGHT", goEast);
|
||||||
|
|
||||||
|
|
||||||
Action goWest = new AbstractAction() {
|
Action goWest = new AbstractAction() {
|
||||||
@@ -127,7 +127,7 @@ public class Display extends JFrame
|
|||||||
goWest();
|
goWest();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JButton west = addDirection("West", "LEFT", goWest);
|
JButton west = addDirection(this,"West", "LEFT", goWest);
|
||||||
|
|
||||||
Action goSouth = new AbstractAction() {
|
Action goSouth = new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent evt)
|
public void actionPerformed(ActionEvent evt)
|
||||||
@@ -137,7 +137,7 @@ public class Display extends JFrame
|
|||||||
goSouth();
|
goSouth();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JButton south = addDirection("South", "DOWN", goSouth);
|
JButton south = addDirection(this,"South", "DOWN", goSouth);
|
||||||
|
|
||||||
add(button,BorderLayout.CENTER);
|
add(button,BorderLayout.CENTER);
|
||||||
controlPanel.add(north,BorderLayout.NORTH);
|
controlPanel.add(north,BorderLayout.NORTH);
|
||||||
@@ -157,14 +157,14 @@ public class Display extends JFrame
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JButton addDirection(final String direction, String key, Action goAction)
|
private JButton addDirection(final JPanel panel, final String direction, String key, Action goAction)
|
||||||
{
|
{
|
||||||
String actionName = "go" + direction;
|
String actionName = "go" + direction;
|
||||||
JButton button = new JButton(direction);
|
JButton button = new JButton(direction);
|
||||||
button.addActionListener(goAction);
|
button.addActionListener(goAction);
|
||||||
KeyStroke keystroke=KeyStroke.getKeyStroke(key);
|
KeyStroke keystroke=KeyStroke.getKeyStroke(key);
|
||||||
//getInputMap().put(keystroke,actionName);
|
panel.getInputMap().put(keystroke,actionName);
|
||||||
//getActionMap().put(actionName,goAction);
|
panel.getActionMap().put(actionName,goAction);
|
||||||
controlPanel.getInputMap().put(keystroke,actionName);
|
controlPanel.getInputMap().put(keystroke,actionName);
|
||||||
controlPanel.getActionMap().put(actionName,goAction);
|
controlPanel.getActionMap().put(actionName,goAction);
|
||||||
return button;
|
return button;
|
||||||
|
|||||||
Reference in New Issue
Block a user