Example #1
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        protected override void Initialize()
        {
            content     = new ContentManager(Services, "Content");
            spriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(GraphicsDevice);

            selectedRoom  = null;
            selectedTiles = new HashSet <BaseTileDataInstance>();
            selectionGrid = null;

            editorControl.Initialize(content, GraphicsDevice);

            //this.ContextMenuStrip = editorControl.EditorForm.ContextMenuStripTileInLevel;

            /*levelRenderTarget = new Microsoft.Xna.Framework.Graphics.RenderTarget2D(
             *      GraphicsDevice, 2048, 2048, false,
             *      Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color,
             *      Microsoft.Xna.Framework.Graphics.DepthFormat.None, 0,
             *      Microsoft.Xna.Framework.Graphics.RenderTargetUsage.PreserveContents);*/

            // Wire the events.
            MouseMove        += OnMouseMove;
            MouseDown        += OnMouseDown;
            MouseUp          += OnMouseUp;
            MouseLeave       += OnMouseLeave;
            MouseDoubleClick += OnMouseDoubleClick;

            this.ResizeRedraw = true;

            // Start the timer to refresh the panel.
            Application.Idle += delegate { Invalidate(); };

            // TEMP: Open this world file upon starting the editor.
            if (File.Exists("./temp_world.zwd"))
            {
                editorControl.OpenFile("temp_world.zwd");
            }
            else if (File.Exists("../../../../WorldFiles/temp_world.zwd"))
            {
                editorControl.OpenFile("../../../../WorldFiles/temp_world.zwd");
            }
            //editorControl.OpenFile("temp_world.zwd");

            UpdateLevel();

            this.highlightedRoom = -Point2I.One;
            this.highlightedTile = -Point2I.One;
        }
Example #2
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        protected override void Initialize()
        {
            content     = new ContentManager(Services, "Content");
            spriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(GraphicsDevice);

            editorControl.Initialize(content, GraphicsDevice);

            // Wire the events.
            MouseMove  += OnMouseMove;
            MouseDown  += OnMouseDown;
            MouseLeave += OnMouseLeave;
            MouseEnter += OnMouseEnter;

            // Start the timer to refresh the panel.
            Application.Idle += delegate { Invalidate(); };
            this.ResizeRedraw = true;

            UpdateTileset();
        }