Esempio n. 1
0
        public void Init()
        {
            camera     = new Camera(this);
            background = new Background();

            templateMenu = new TemplateMenu(this);
            tilesetList  = new TilesetList(this);

            manipulators.Add(EditMode.Select, new SelectManipulator(this));
            manipulators.Add(EditMode.Move, new MoveManipulator(this));
            manipulators.Add(EditMode.Rotate, new RotateManipulator(this));
            manipulators.Add(EditMode.Scale, new ScaleManipulator(this));

            gridMesh       = new Mesh(PrimitiveType.Quads);
            gridMesh.Color = new Color(1, 1, 1, 0.2f);

            List <Vector2> gridVectorList = new List <Vector2>();

            for (int x = -50; x <= 50; x++)
            {
                gridVectorList.Add(new Vector2(1 * x - 0.01f, -50));
                gridVectorList.Add(new Vector2(1 * x + 0.01f, -50));
                gridVectorList.Add(new Vector2(1 * x + 0.01f, 50));
                gridVectorList.Add(new Vector2(1 * x - 0.01f, 50));

                gridVectorList.Add(new Vector2(-50, 1 * x - 0.01f));
                gridVectorList.Add(new Vector2(-50, 1 * x + 0.01f));
                gridVectorList.Add(new Vector2(50, 1 * x + 0.01f));
                gridVectorList.Add(new Vector2(50, 1 * x - 0.01f));
            }

            gridMesh.Vertices = gridVectorList.ToArray();

            originMesh       = new Mesh(PrimitiveType.Quads);
            originMesh.Color = new Color(1, 1, 1, 0.4f);

            gridVectorList.Clear();

            gridVectorList.Add(new Vector2(-0.02f, -50));
            gridVectorList.Add(new Vector2(+0.02f, -50));
            gridVectorList.Add(new Vector2(+0.02f, 50));
            gridVectorList.Add(new Vector2(-0.02f, 50));

            gridVectorList.Add(new Vector2(-50, -0.02f));
            gridVectorList.Add(new Vector2(-50, +0.02f));
            gridVectorList.Add(new Vector2(50, +0.02f));
            gridVectorList.Add(new Vector2(50, -0.02f));

            originMesh.Vertices = gridVectorList.ToArray();

            templateCreator = new TemplateCreator(this);
            layerCreator    = new LayerCreator(this);
        }
            public Marker(TemplateCreator creator)
            {
                this.creator = creator;

                mesh = new Mesh(PrimitiveType.Quads);

                mesh.Vertices = new Vector2[] {
                    new Vector2(0, 0),
                    new Vector2(1, 0),
                    new Vector2(1, 1),
                    new Vector2(0, 1)
                };

                mesh.UIElement    = true;
                mesh.InvertColors = true;
            }