public Map(int breedte, int hoogte, Canvas canvas) { CurrentMap = new MapModel(breedte, hoogte); MapCanvas = canvas; QueueList = new Queue<Queue>(); UndoHistory = new Stack<RedoUndo>(); RedoHistory = new Stack<RedoUndo>(); }
static void Main(string[] args) { //Maken nieuwe kaart MapModel mijnMap = new MapModel(5, 3); //Element met coordinaten 2,2 op 6 zetten mijnMap.SetElement(2, 2, 6); //Kaart wegschrijven mijnMap.SaveMap("testje.map"); //Kaart opnieuw inladen MapModel mijnandereMap = new MapModel("testje.map"); //Waarde van element 2,2 uitlezen int waarde = mijnandereMap.GetElement(2, 2); //Waarde op scherm zetten, hopelijk komt er 6 Console.WriteLine(waarde.ToString()); }
public void RenderRandomMap(int typeBlock, int amount) { Random r = new Random(); if (createNewMap) { currentMap = new MapModel(NewMapBreedte, NewMapHoogte); } int type = r.Next(0, 4); if (amount > (currentMap.Breedte * currentMap.Hoogte)) { amount = currentMap.Breedte * currentMap.Hoogte; } while (amount > 0) { for (int x = 0; x < currentMap.Breedte; x++) { for (int y = 0; y < currentMap.Hoogte; y++) { if (type == typeBlock && currentMap.GetElement(x, y) != type) { int current = currentMap.GetElement(x, y); currentMap.SetElement(x, y, type); amount--; } else { if (currentMap.GetElement(x, y) != typeBlock) { currentMap.SetElement(x, y, type); } } type = r.Next(0, 4); } } } this.RenderMap(); }
public void RenderRandomMap() { Random r = new Random(); if (createNewMap) { currentMap = new MapModel(NewMapBreedte, NewMapHoogte); } int type = r.Next(0, 4); for (int x = 0; x < currentMap.Breedte; x++) { for (int y = 0; y < currentMap.Hoogte; y++) { currentMap.SetElement(x, y, type); type = r.Next(0, 4); } } this.RenderMap(); }
public MainWindow() { InitializeComponent(); currentMap = new MapModel(0, 0); cmbBrush.SelectedIndex = 0; }
private void menuNew_Click(object sender, RoutedEventArgs e) { //TODO: check if current map needs to be saved MapDimensions askdims = new MapDimensions(); askdims.ShowDialog(); currentMap = new MapModel(askdims.Breedte, askdims.Hoogte); LoadMapOnView(); }
private void menuLoad_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == true) { currentMapPath = dialog.FileName; currentMap = new MapModel(currentMapPath); LoadMapOnView(); } }
public MainWindow() { InitializeComponent(); currentMap = new MapModel(0, 0); cmbBrush.SelectedIndex = 0; }