Пример #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;
        }
Пример #2
0
        // Open an open file dialogue to open a world file.
        private void ShowOpenWorldDialog()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.DereferenceLinks = true;
            openFileDialog.Filter           = "Zelda world files (*.zwd)|*.zwd";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Console.WriteLine("Opened file " + openFileDialog.FileName + ".");
                editorControl.OpenFile(openFileDialog.FileName);
            }
        }