From e1ca4666b4b68a7c241a92a8497a577eef16e0e4 Mon Sep 17 00:00:00 2001
From: Elias Leinenweber <elias.leinenweber@etu.unistra.fr>
Date: Mon, 29 Mar 2021 16:06:45 +0200
Subject: [PATCH] =?UTF-8?q?Cr=C3=A9e=20Designer=20MapView?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Wanderer.csproj                   |  1 +
 view/Controls/MapView.Designer.cs | 23 +++++++++++++++++++++++
 view/Controls/MapView.cs          | 12 +++++++++---
 3 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 view/Controls/MapView.Designer.cs

diff --git a/Wanderer.csproj b/Wanderer.csproj
index 1868afb..91c3b56 100644
--- a/Wanderer.csproj
+++ b/Wanderer.csproj
@@ -47,6 +47,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="view\Controls\MapView.Designer.cs" />
     <Compile Include="view\FormFin.cs">
       <SubType>Form</SubType>
     </Compile>
diff --git a/view/Controls/MapView.Designer.cs b/view/Controls/MapView.Designer.cs
new file mode 100644
index 0000000..2e078c1
--- /dev/null
+++ b/view/Controls/MapView.Designer.cs
@@ -0,0 +1,23 @@
+using System.ComponentModel;
+
+namespace Wanderer.view.Controls
+{
+    public partial class MapView
+    {
+        private IContainer components = null;
+        
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null)) {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            this.ResumeLayout(false);
+        }
+    }
+}
\ No newline at end of file
diff --git a/view/Controls/MapView.cs b/view/Controls/MapView.cs
index af665ca..71fbd8b 100644
--- a/view/Controls/MapView.cs
+++ b/view/Controls/MapView.cs
@@ -2,16 +2,22 @@
 
 namespace Wanderer.view.Controls
 {
-    public class MapView : TableLayoutPanel
+    public partial class MapView : TableLayoutPanel
     {
         private TileView[,] tileViews;
 
         public MapView(Map map)
         {
-            for (int i = 0; i < map.Tiles.GetLength(0); ++i)
-                for (int j = 0; j < map.Tiles.GetLength(1); ++j)
+            InitializeComponent();
+            
+            ColumnCount = map.Tiles.GetLength(0);
+            RowCount = map.Tiles.GetLength(1);
+
+            for (int i = 0; i < ColumnCount; ++i)
+                for (int j = 0; j < RowCount; ++j)
                 {
                     tileViews[i, j] = new TileView(map.Tiles[i, j]);
+                    Controls.Add(tileViews[i, j], i, j);
                 }
         }
     }
-- 
GitLab