public AnaPencere(int width, int height) { String path = Application.StartupPath; if (!File.Exists("skorlar.xml")) { createXML = new XmlTextWriter("skorlar.xml", UTF8Encoding.UTF8); createXML.WriteStartDocument(); createXML.WriteStartElement("Skorlar"); createXML.WriteEndDocument(); createXML.Close(); for (int i = 0; i < 5; i++) { XmlDocument _data = new XmlDocument(); _data.Load("skorlar.xml"); XmlElement _element = _data.CreateElement("Skor"); _element.SetAttribute("sira", (i + 1).ToString()); XmlElement _ad = _data.CreateElement("Ad"); _ad.InnerText = "İSİMSİZ"; _element.AppendChild(_ad); XmlElement _sure = _data.CreateElement("Sure"); _sure.InnerText = "0000000"; _element.AppendChild(_sure); _data.DocumentElement.AppendChild(_element); XmlTextWriter _write = new XmlTextWriter("skorlar.xml", null); _write.Formatting = Formatting.Indented; _data.WriteContentTo(_write); _write.Close(); } } xmlOku(); path = path.Substring(0, path.LastIndexOf('\\')); path = path.Substring(0, path.Length - 3); gameOver = new SoundPlayer(path + "Sounds\\pacman_death.wav"); topKnock = new SoundPlayer(path + "Sounds\\doorKnock5.wav"); mAraclar = new Panel(); mYSkorlar = new Button(); mYSkorlar.Click += MYSkorlar_Click; mSaat = new Label(); mBilgi = new Label(); skor = "00:00:000"; DoubleBuffered = true; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); SetBounds((Screen.GetBounds(this).Width / 2) - (width / 2), (Screen.GetBounds(this).Height / 2) - (height / 2), width, height); Text = "Arcanoid"; raket = new Raket(AnaPencere.MousePosition.X - 100, this.ClientSize.Height - 20); top = new Top(0, 0, 0); timer1 = new Timer(); timer1.Interval = 1; timer1.Tick += new EventHandler(timer1_Tick); timer2 = new Timer(); timer1.Interval = 1; timer2.Tick += new EventHandler(timer2_Tick); Paint += new PaintEventHandler(AnaPencere_Paint); MouseClick += new MouseEventHandler(AnaPencere_MouseClick); MouseMove += new MouseEventHandler(AnaPencere_MouseMove); timer1.Start(); }
private void topOlustur(int x) { top = new Top(x, this.ClientSize.Height - 50, 15); }