private void btnAddLayer_Click(object sender, EventArgs e) { Map.CLayer layer = _createNewLayer(); if (layer != null) { _loadedMap._layers.Add(layer); cmbLayers.Items.Add(layer.NAME); } }
private void btnInsertAfter_Click(object sender, EventArgs e) { Map.CLayer layer = _createNewLayer(); int insertIndex = cmbLayers.SelectedIndex + 1; if (layer != null) { _loadedMap._layers.Insert(insertIndex, layer); cmbLayers.Items.Insert(insertIndex, layer.NAME); } }
public EditorMode() { _componentEditor.Visible = true; _tileEditor.Visible = true; _controlManager.root = new Actors.Controllers.CEditorInputController(); _controlManager.actors.Add("btnNew", new Actors.Controllers.CEditorNew()); _controlManager.actors.Add("btnOpen", new Actors.Controllers.CEditorOpen()); _controlManager.actors.Add("btnSave", new Actors.Controllers.CEditorSave()); layers = new Map.CLayer[1]; Graphics.CSprite startingTexture = new Graphics.CSprite(_tileEditor.defaultTileSet, Graphics.CTextures.textures[_tileEditor.defaultTileSet]); layers[0] = new Map.CLayer(ref startingTexture); }
public static Texture2D generateLayerImage(Map.CLayer layerToRender, Map.CTile[] tileStrip) { _tileMapGen = new RenderTarget2D(CGraphics.GPU, layerToRender.width, layerToRender.height); CGraphics.GPU.SetRenderTarget(_tileMapGen); _tileBatch.Begin(); foreach (Map.CTile tile in tileStrip) { _tileBatch.Draw(textures[tile.tileSet].sourceImage, tile.tileCoords, textures[tile.tileSet].getTile((int)tile.atlasCoords.X, (int)tile.atlasCoords.Y), Color.White); } _tileBatch.End(); CGraphics.GPU.SetRenderTarget(null); return(_tileMapGen); }
private Map.CLayer _createNewLayer() { string layerName = string.Empty; if ((layerName = showInputDialog("Add New Layer", "Please Enter a layer name.", "New Layer" + cmbLayers.Items.Count)) == string.Empty) { return(null); } if (cmbLayers.Items.Contains(layerName)) { MessageBox.Show("There is already a layer with that name.", "Add New Layer", MessageBoxButtons.OK); return(null); } Map.CLayer layer = new Map.CLayer(_atlasCache); layer.NAME = layerName; return(layer); }