From 542d37f7680df6a98d3b7599b6befd787dec5d92 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Sun, 15 Nov 2015 23:31:59 +0000 Subject: [PATCH] spielfeld von lena --- Spielfeld.sln | 20 ++++ Spielfeld/Form1.Designer.cs | 108 +++++++++++++++++++ Spielfeld/Form1.cs | 115 ++++++++++++++++++++ Spielfeld/Form1.resx | 120 +++++++++++++++++++++ Spielfeld/Program.cs | 21 ++++ Spielfeld/Properties/AssemblyInfo.cs | 36 +++++++ Spielfeld/Properties/Resources.Designer.cs | 71 ++++++++++++ Spielfeld/Properties/Resources.resx | 117 ++++++++++++++++++++ Spielfeld/Properties/Settings.Designer.cs | 30 ++++++ Spielfeld/Properties/Settings.settings | 7 ++ Spielfeld/Spielfeld.csproj | 92 ++++++++++++++++ Spielfeld/Spielfeld.csproj.user | 6 ++ Spielfeld/TBewegung.cs | 40 +++++++ Spielfeld/TCrash.cs | 33 ++++++ Spielfeld/TLocation.cs | 66 ++++++++++++ Spielfeld/TVariablen.cs | 11 ++ Spielfeld/TWand_Ziehen.cs | 38 +++++++ 17 files changed, 931 insertions(+) create mode 100644 Spielfeld.sln create mode 100644 Spielfeld/Form1.Designer.cs create mode 100644 Spielfeld/Form1.cs create mode 100644 Spielfeld/Form1.resx create mode 100644 Spielfeld/Program.cs create mode 100644 Spielfeld/Properties/AssemblyInfo.cs create mode 100644 Spielfeld/Properties/Resources.Designer.cs create mode 100644 Spielfeld/Properties/Resources.resx create mode 100644 Spielfeld/Properties/Settings.Designer.cs create mode 100644 Spielfeld/Properties/Settings.settings create mode 100644 Spielfeld/Spielfeld.csproj create mode 100644 Spielfeld/Spielfeld.csproj.user create mode 100644 Spielfeld/TBewegung.cs create mode 100644 Spielfeld/TCrash.cs create mode 100644 Spielfeld/TLocation.cs create mode 100644 Spielfeld/TVariablen.cs create mode 100644 Spielfeld/TWand_Ziehen.cs diff --git a/Spielfeld.sln b/Spielfeld.sln new file mode 100644 index 0000000..a1ebccc --- /dev/null +++ b/Spielfeld.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spielfeld", "Spielfeld\Spielfeld.csproj", "{DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9}.Debug|x86.ActiveCfg = Debug|x86 + {DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9}.Debug|x86.Build.0 = Debug|x86 + {DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9}.Release|x86.ActiveCfg = Release|x86 + {DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Spielfeld/Form1.Designer.cs b/Spielfeld/Form1.Designer.cs new file mode 100644 index 0000000..d7db25a --- /dev/null +++ b/Spielfeld/Form1.Designer.cs @@ -0,0 +1,108 @@ +namespace Spielfeld +{ + partial class Form1 + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.btnstart = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(81, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(388, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.TabIndex = 1; + this.label2.Text = "label2"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(4, 0); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(71, 20); + this.textBox1.TabIndex = 2; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(429, 0); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(80, 20); + this.textBox2.TabIndex = 3; + // + // btnstart + // + this.btnstart.Location = new System.Drawing.Point(216, 0); + this.btnstart.Name = "btnstart"; + this.btnstart.Size = new System.Drawing.Size(75, 23); + this.btnstart.TabIndex = 4; + this.btnstart.Text = "Start\r\n"; + this.btnstart.UseVisualStyleBackColor = true; + this.btnstart.Click += new System.EventHandler(this.btnstart_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(518, 459); + this.Controls.Add(this.btnstart); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button btnstart; + } +} + diff --git a/Spielfeld/Form1.cs b/Spielfeld/Form1.cs new file mode 100644 index 0000000..a9fb35c --- /dev/null +++ b/Spielfeld/Form1.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Spielfeld +{ + public partial class Form1 : Form + { + TBewegung bewegung; + TCrash crash; + TWand_Ziehen wand; + System.Threading.Thread t; + public Form1() + { + InitializeComponent(); + this.bewegung = new TBewegung(this); + this.crash = new TCrash(this); + this.wand = new TWand_Ziehen(this); + this.t = new System.Threading.Thread(spielen); + } + private void spielen() + { + this.bewegung.aussuchen(); + //this.netzwerk.senden(); + //this.netzwerk.empfangen(); + this.crash.crash(); + this.wand.malen(this.CreateGraphics()); + } + + private int x=1; + private int y = 225; + public int X + { + get + { + return x; + } + set { + if (value <= 510 && value >= 6) + { x = value; } + } + } + public int Y + { + get + { + return y; + } + set + { + if (value >= 55 && value <= 398) + { + y = value; + } + } + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + + if (keyData == Keys.W) + bewegung.richtung = 'w'; + if (keyData == Keys.A) + bewegung.richtung = 'a'; + if (keyData == Keys.S) + bewegung.richtung = 's'; + if (keyData == Keys.D) + bewegung.richtung = 'd'; + + return base.ProcessCmdKey(ref msg, keyData); + } + private void Form1_Load(object sender, EventArgs e) + { + + } + + private void Form1_Paint(object sender, PaintEventArgs e) + { + int x = 58; + int y = 90; + e.Graphics.DrawLine(new Pen(Brushes.Black, 6), 1, 50, 515, 50); + e.Graphics.DrawLine(new Pen(Brushes.Black, 6), 1, 50, 1, 403); + e.Graphics.DrawLine(new Pen(Brushes.Black, 6), 1, 403, 515, 403); + e.Graphics.DrawLine(new Pen(Brushes.Black, 6), 515, 403, 515, 50); + while(x<=500){ + e.Graphics.DrawLine(new Pen(Brushes.Black, 3), x, 50, x, 403); + x += 57; + } + while (y <= 390) + { + e.Graphics.DrawLine(new Pen(Brushes.Black, 3), 1, y, 515, y); + y += 39; + } + + //wand.malen(e.Graphics); + + } + + private void button1_Click(object sender, EventArgs e) + { + + } + public bool control = false; + private void btnstart_Click(object sender, EventArgs e) + { + control = true; + this.t.Start(); + } + } +} diff --git a/Spielfeld/Form1.resx b/Spielfeld/Form1.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Spielfeld/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Spielfeld/Program.cs b/Spielfeld/Program.cs new file mode 100644 index 0000000..dac2976 --- /dev/null +++ b/Spielfeld/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace Spielfeld +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Spielfeld/Properties/AssemblyInfo.cs b/Spielfeld/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a51c376 --- /dev/null +++ b/Spielfeld/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("Spielfeld")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Spielfeld")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("b32d02da-5c51-4e1e-9599-cb1acad35bc9")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Spielfeld/Properties/Resources.Designer.cs b/Spielfeld/Properties/Resources.Designer.cs new file mode 100644 index 0000000..90d7182 --- /dev/null +++ b/Spielfeld/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.269 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Spielfeld.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Spielfeld.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Spielfeld/Properties/Resources.resx b/Spielfeld/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/Spielfeld/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Spielfeld/Properties/Settings.Designer.cs b/Spielfeld/Properties/Settings.Designer.cs new file mode 100644 index 0000000..31d0f87 --- /dev/null +++ b/Spielfeld/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Spielfeld.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Spielfeld/Properties/Settings.settings b/Spielfeld/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/Spielfeld/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Spielfeld/Spielfeld.csproj b/Spielfeld/Spielfeld.csproj new file mode 100644 index 0000000..0334c58 --- /dev/null +++ b/Spielfeld/Spielfeld.csproj @@ -0,0 +1,92 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {DAA96BEF-BD3A-43AA-89CD-C1BAB4E6E9C9} + WinExe + Properties + Spielfeld + Spielfeld + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Spielfeld/Spielfeld.csproj.user b/Spielfeld/Spielfeld.csproj.user new file mode 100644 index 0000000..566c009 --- /dev/null +++ b/Spielfeld/Spielfeld.csproj.user @@ -0,0 +1,6 @@ + + + + ShowAllFiles + + \ No newline at end of file diff --git a/Spielfeld/TBewegung.cs b/Spielfeld/TBewegung.cs new file mode 100644 index 0000000..0006b1e --- /dev/null +++ b/Spielfeld/TBewegung.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; + + +namespace Spielfeld +{ + class TBewegung + { + //Form1 form = new Form1(); + //Richtung + public char richtung; + private Form1 form; + + public TBewegung(Form1 form) + { + // TODO: Complete member initialization + this.form = form; + } + + public Location aussuchen(Location pos) + { + switch (richtung) + { + case 'a': pos.X -= 10; break; + case 'd': pos.X += 10; break; + case 'w': pos.Y -= 10; break; + case 's': pos.Y += 10; break; + default: break; + } + return pos; + } + public void bewegen() + { + this.spieler1.addLocation(this.aussuchen(this.spieler1.getLocation())); + } + } +} diff --git a/Spielfeld/TCrash.cs b/Spielfeld/TCrash.cs new file mode 100644 index 0000000..057e8b3 --- /dev/null +++ b/Spielfeld/TCrash.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Drawing; + +namespace Spielfeld +{ + class TCrash + { + public TLocation location; + private Form1 form; + + public TCrash(Form1 form) + { + // TODO: Complete member initialization + this.form = form; + } + private Color GetPixelAtPoint(System.Windows.Forms.Control Ctrl, System.Drawing.Point Location) + { + Bitmap TmpImg = new Bitmap(Ctrl.ClientSize.Width, Ctrl.ClientSize.Height); + Ctrl.DrawToBitmap(TmpImg, Ctrl.ClientRectangle); + return TmpImg.GetPixel(Location.X, Location.Y); + } + public void crash() + { + if (GetPixelAtPoint(form, new System.Drawing.Point(1, 1)).ToArgb() == 0) + { + + } + } + } +} diff --git a/Spielfeld/TLocation.cs b/Spielfeld/TLocation.cs new file mode 100644 index 0000000..384b0d9 --- /dev/null +++ b/Spielfeld/TLocation.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Drawing; + using System.Collections; + +namespace Spielfeld +{ + public struct Location + { + public int X; + public int Y; + public bool Control; + + + public Location(int x, int y,bool control) + { + X = x; + Y = y; + Control=control; + } + public static bool equals(this Location l1, Location l2) + { + return (l1.X == l2.X && l1.Y == l2.Y); + } + }; + public delegate void ProcessLocationDelegate(Location location); + public class TLocation + { + + // List of all books in the database: + Queue list = new Queue(); + + // Add a book to the database: + Location altePos; + public void AddLocation(Location l) + { + list.Enqueue(l); + if (list.Count > 50) + list.Dequeue(); + this.altePos = l; + } + public Location getLocation() + { + return this.altePos; + } + + // Call a passed-in delegate on each paperback book to process it: + public void ProcessPaperbackLocation(ProcessLocationDelegate processLocation) + { + foreach (Location b in list) + { + if (b.Control) + // Calling the delegate: + processLocation(b); + } + } + } +} + + + + + + diff --git a/Spielfeld/TVariablen.cs b/Spielfeld/TVariablen.cs new file mode 100644 index 0000000..054db79 --- /dev/null +++ b/Spielfeld/TVariablen.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Spielfeld +{ + class TVariablen + { + } +} diff --git a/Spielfeld/TWand_Ziehen.cs b/Spielfeld/TWand_Ziehen.cs new file mode 100644 index 0000000..42217bf --- /dev/null +++ b/Spielfeld/TWand_Ziehen.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Drawing; +using System.Threading; + +namespace Spielfeld +{ + class TWand_Ziehen + { + + + Form1 form; + + public void malen(Graphics g) + { + + g.FillRectangle(Brushes.Red, form.X+1, form.Y+1, 10, 10); + } + Thread thread; + public TWand_Ziehen(Form1 aform) + { + form = aform; + thread = new Thread(move); + } + + public void move() + { + while (form.control) + { + Thread.Sleep(100); + form.X++; + + } + } + } +}