A rudak pozicionálása és az első rúdon lévő korongok kirajzolása.
This commit is contained in:
parent
1b14e32589
commit
f34737bd30
|
@ -69,7 +69,8 @@ public class HanoiFormController {
|
||||||
for (int i = 0; i < korongokSzama; i++) {
|
for (int i = 0; i < korongokSzama; i++) {
|
||||||
Korong k = new Korong(szinek[i], korongSzelMax-i*KDIFF, korongMag);
|
Korong k = new Korong(szinek[i], korongSzelMax-i*KDIFF, korongMag);
|
||||||
/*
|
/*
|
||||||
* Rectangle tlap = k.getTlap(); tlap.setLayoutX(0);
|
* Rectangle tlap = k.getTlap();
|
||||||
|
* tlap.setLayoutX(0);
|
||||||
* tlap.setLayoutY(i*30+100);
|
* tlap.setLayoutY(i*30+100);
|
||||||
* jatekTerulet.getChildren().add(tlap);
|
* jatekTerulet.getChildren().add(tlap);
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +80,37 @@ public class HanoiFormController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rudRajzolas() {
|
private void rudRajzolas() {
|
||||||
|
double x = jatekTerulet.getWidth();
|
||||||
|
double y = jatekTerulet.getHeight();
|
||||||
|
double w = x*0.02;
|
||||||
|
double rx1 = x/4-w/2;
|
||||||
|
double ry1 = y/3;
|
||||||
|
double rx2 = rx1+x/4;
|
||||||
|
double ry2 = ry1;
|
||||||
|
double rx3 = rx2+x/4;
|
||||||
|
double ry3 = ry1;
|
||||||
|
double rh = y-15-ry1;
|
||||||
|
elsoRudRect.setLayoutX(rx1);
|
||||||
|
elsoRudRect.setLayoutY(ry1);
|
||||||
|
elsoRudRect.setWidth(w);
|
||||||
|
elsoRudRect.setHeight(rh);
|
||||||
|
masodikRudRect.setLayoutX(rx2);
|
||||||
|
masodikRudRect.setLayoutY(ry2);
|
||||||
|
masodikRudRect.setWidth(w);
|
||||||
|
masodikRudRect.setHeight(rh);
|
||||||
|
harmadikRudRect.setLayoutX(rx3);
|
||||||
|
harmadikRudRect.setLayoutY(ry3);
|
||||||
|
harmadikRudRect.setWidth(w);
|
||||||
|
harmadikRudRect.setHeight(rh);
|
||||||
|
for (int kix=0; kix < r1.getKorongok().size(); kix++) {
|
||||||
|
Korong k = r1.getKorongok().get(kix);
|
||||||
|
double kx = rx1-(k.getSzelesseg()/2-w/2);
|
||||||
|
double ky = (y-15)-((kix+1)*k.getMagassag());
|
||||||
|
Rectangle tlap = k.getTlap();
|
||||||
|
tlap.setLayoutX(kx);
|
||||||
|
tlap.setLayoutY(ky);
|
||||||
|
jatekTerulet.getChildren().add(tlap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,11 @@ public class Rud {
|
||||||
public void setTlap(Rectangle tlap) {
|
public void setTlap(Rectangle tlap) {
|
||||||
this.tlap = tlap;
|
this.tlap = tlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Korong> getKorongok() {
|
||||||
|
return korongok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user