Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
git-svn-id: https://ledcube.googlecode.com/svn/trunk@68 d0259a58-13ce…
Browse files Browse the repository at this point in the history
…-11de-b208-e5a9466b8568
  • Loading branch information
team.fish committed May 20, 2009
1 parent c962e37 commit 31a6656
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
4 changes: 4 additions & 0 deletions GUI/MagicCube/src/CubeSimulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import cubeUser.MillerUser;
import cubeUser.SerialTalk;
import cubeUser.CrystalUser;
import cubeUser.LoadUser;
import cubeUser.SaveUser;


/**
Expand Down Expand Up @@ -104,6 +106,8 @@ public void setup() {
this.manager.adduser(new MillerUser(1,1,0), "Miller");
this.manager.adduser(new CrystalUser(), "Crystal");
this.manager.adduser(new BariumTitanateUser(), "Barium");
this.manager.adduser(new LoadUser(), "Load");
this.manager.adduser(new SaveUser(), "Save");

this.manager.toggleToUser("Random");

Expand Down
20 changes: 15 additions & 5 deletions GUI/MagicCube/src/P5GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class P5GUI implements EventCodes{
Controller serialWriteOn;
Controller serialWriteOff;

Controller loadButton;
Controller saveButton;

Controller demoToggle;

/**
Expand Down Expand Up @@ -84,10 +87,17 @@ public P5GUI(CubeSimulation coreApplet, EventListener listener){


/*----Utils contoller----*/
Controller utils;
utils=gui.addButton("Load pattern", 10, 10, 40, 102, 20);
utils.setId(UTILS_START_ID);
utils.setTab("Utils");

/*----Load and Save Buttons----*/
loadButton = gui.addButton("Load Image",10, 10, 40, 102, 20);
loadButton.setId(LOAD_BUTTON_ID);
loadButton.addListener(listener);
loadButton.setTab("Utils");

saveButton = gui.addButton("Save Image",10, 10, 70, 102, 20);
saveButton.setId(SAVE_BUTTON_ID);
saveButton.addListener(listener);
saveButton.setTab("Utils");

/*----Options contoller----*/
serialWriteOn = gui.addButton("Start serial", 10, 10, 40, 102, 20);
Expand Down Expand Up @@ -134,7 +144,7 @@ public P5GUI(CubeSimulation coreApplet, EventListener listener){
isingGo.setId(ISING_START_ID);
isingGo.addListener(listener);
isingGo.setTab("Ising Model");
isingSlider= gui.addSlider("temperature", 0, 50, 0, 10, 70, 10, 350);//addSlider(theName, theMin, theMax, theDefaultValue, theX, theY, theW, theH);
isingSlider= gui.addSlider("temperature", 0, 15, 0, 10, 70, 10, 350);//addSlider(theName, theMin, theMax, theDefaultValue, theX, theY, theW, theH);
isingSlider.setId(ISING_SLIDER_ID);
isingSlider.setLabel("Temperature");
isingSlider.addListener(listener);
Expand Down
10 changes: 6 additions & 4 deletions GUI/MagicCube/src/cubeUser/BariumTitanateUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@
*/
public class BariumTitanateUser extends AbstractCubeUser {


@Override
public void loop() {
int sleeper = 200;
try{
int stage = -1;
this.BariumTitanate(cube, cube.getSize(), stage);
Thread.sleep(50);
Thread.sleep(sleeper);
stage = -2;
this.BariumTitanate(cube, cube.getSize(), stage);
Thread.sleep(50);
Thread.sleep(sleeper);
stage = -1;
this.BariumTitanate(cube, cube.getSize(), stage);
Thread.sleep(50);
Thread.sleep(sleeper);
stage = 0;
this.BariumTitanate(cube, cube.getSize(), stage);
Thread.sleep(50);
Thread.sleep(sleeper);
}catch(InterruptedException e){
System.out.println("[BARIUM]: Error: caughte InterruptedException while running. Comitting suicide.");
this.killme();
Expand Down
2 changes: 0 additions & 2 deletions GUI/MagicCube/src/cubeUser/IsingUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ public void loop(){
de=-2*sys.localenergy();
if ((Math.exp(de/temp))<=(Math.random())){
sys.perturb();
}else{
System.out.println("change");
}
}
//sys.drawParticle(this.getCube());
Expand Down
3 changes: 3 additions & 0 deletions GUI/MagicCube/src/utils/EventCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ public interface EventCodes {
final static int IBOX_ID = 21;
final static int JBOX_ID = 22;
final static int KBOX_ID = 23;

final static int LOAD_BUTTON_ID = 35;
final static int SAVE_BUTTON_ID = 36;
}

0 comments on commit 31a6656

Please sign in to comment.