Exemple #1
0
        protected override void Initialize()
        {
            base.Initialize();
            textureHandler.LoadContent(this);

            Color[] az = Enumerable.Range(0, 1).Select(i => Color.Red).ToArray();
            mouseIntersectTexture = textureHandler.colorTexture;
            mouseIntersectTexture.SetData(az);

            collisionTexture = textureHandler.collisionMap;
            depthTexture     = textureHandler.depthMap;
            tileTexture      = textureHandler.tileMapTexture;
            entityTexture    = textureHandler.entityMap;

            camera = new Camera(Editor.graphics.Viewport);

            form = (MainForm)FindForm();

            tileMap      = new int[tmWidth * tmHeight];
            collisionMap = new int[tmWidth * tmHeight];
            depthMap     = new int[tmWidth * tmHeight];
            entityMap    = new int[tmWidth * tmHeight];

            tileMapEditHandler = new UndoRedoHandler(tileMap);
            tileMapEditHandler.AddIteration(tileMap);
        }
Exemple #2
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     isClicking = false;
     if (IsMouseInsideControl)
     {
         tileMapEditHandler.AddIteration(tileMap);
     }
 }
Exemple #3
0
        public void OpenMap(string location)
        {
            string text = File.ReadAllText(location);

            string[] split = text.Split('#');
            tmWidth  = Convert.ToInt32(split[0].Split(',')[0]);
            tmHeight = Convert.ToInt32(split[0].Split(',')[0]);

            tileMap      = new int[tmWidth * tmHeight];
            collisionMap = new int[tmWidth * tmHeight];
            depthMap     = new int[tmWidth * tmHeight];
            entityMap    = new int[tmWidth * tmHeight];

            string[] tileMapTest = split[1].Split(',');
            tileMap      = Array.ConvertAll(split[1].Split(','), int.Parse);
            collisionMap = Array.ConvertAll(split[2].Split(','), int.Parse);
            depthMap     = Array.ConvertAll(split[3].Split(','), int.Parse);
            entityMap    = Array.ConvertAll(split[4].Split(','), int.Parse);

            tileMapEditHandler = new UndoRedoHandler(tileMap);
            tileMapEditHandler.AddIteration(tileMap);
        }