This commit is contained in:
Dávid Szilágyi 2024-02-08 10:04:50 +01:00
parent fc22e98e0d
commit fa2bbf5aba
2 changed files with 14 additions and 5 deletions

View File

@ -24,9 +24,9 @@ namespace Hanoitornyai
} }
for (int i = 0;i < kszinek.Length;i++) for (int i = 0;i < kszinek.Length;i++)
{ {
rudak[0].korongok.Add(new Korong(kszinek[i])); rudak[0].korongok.Add(new Korong(kszinek[i], i));
} }
rudakPozicio(); rudakPozicioSzamitas();
} }
@ -35,7 +35,7 @@ namespace Hanoitornyai
//Initialize(); //Initialize();
} }
private void rudakPozicio() private void rudakPozicioSzamitas()
{ {
float psz = JatekPanel.Width; float psz = JatekPanel.Width;
float pm = JatekPanel.Height; float pm = JatekPanel.Height;
@ -50,6 +50,12 @@ namespace Hanoitornyai
rudak[i].x = (rkoz*(i+1))+(i*rsz); rudak[i].x = (rkoz*(i+1))+(i*rsz);
} }
} }
private void KorongSzamitas()
{
float km = rudak[0].szelesseg*1.5f;
float ksz =
}
/* /*
public void Initialize() public void Initialize()
{ {
@ -67,9 +73,10 @@ namespace Hanoitornyai
}*/ }*/
private void Paint(object sender, PaintEventArgs e) private void Paint(object sender, PaintEventArgs e)
{ {
Graphics g = JatekPanel.CreateGraphics(); Graphics g = JatekPanel.CreateGraphics();
g.Clear(JatekPanel.BackColor);
Brush brush = new SolidBrush(rudak[0].szin); Brush brush = new SolidBrush(rudak[0].szin);
rudakPozicioSzamitas();
for (int i = 0; i < rudak.Length; i++) for (int i = 0; i < rudak.Length; i++)
{ {
g.FillRectangle(brush, rudak[i].x, rudak[i].y, rudak[i].szelesseg, rudak[i].magassag); g.FillRectangle(brush, rudak[i].x, rudak[i].y, rudak[i].szelesseg, rudak[i].magassag);

View File

@ -15,9 +15,11 @@ namespace Hanoitornyai
public float magassag { get; set; } public float magassag { get; set; }
public float x { get; set; } public float x { get; set; }
public float y { get; set; } public float y { get; set; }
public Korong(Color szin) public int meretjelzo { get; set; }
public Korong(Color szin, int meretjelzo)
{ {
this.szin = szin; this.szin = szin;
this.meretjelzo = meretjelzo;
} }
} }
} }