Ejemplo n.º 1
0
        public void Update()
        {
            if (stopwatch.IsRunning)
            {
                double elapsed = stopwatch.Elapsed.TotalSeconds - lastTime;

                float oldZoom = Zoom;
                Zoom = Util.Approach(Zoom, targetZoom, (float)elapsed * ZOOM_SPEED);
                float scale = Zoom / oldZoom;
                lastTime = stopwatch.Elapsed.TotalSeconds;

                PointF at = ScreenToEditor(zoomAt);
                Matrix.Translate(at.X, at.Y);
                Matrix.Scale(scale, scale);
                Matrix.Translate(-at.X, -at.Y);
                UpdateInverse();

                LevelEditor.Invalidate();

                if (Zoom == targetZoom)
                {
                    stopwatch.Stop();
                }
            }
        }
Ejemplo n.º 2
0
 public override void Paste(LevelEditor editor, Layer layer)
 {
     editor.StartBatch();
     foreach (var e in entities)
         editor.BatchPerform(new EntityAddAction(layer as EntityLayer, e.Clone()));
     editor.EndBatch();
 }
Ejemplo n.º 3
0
        public LevelView(LevelEditor levelEditor)
        {
            LevelEditor = levelEditor;
            Matrix      = new Matrix();
            Inverse     = new Matrix();
            targetZoom  = Zoom = 1;

            stopwatch = new Stopwatch();

            Center();
        }
Ejemplo n.º 4
0
 private void onLevelAdded(int index)
 {
     TabPage t = new TabPage(Ogmo.Levels[index].Name);
     t.ImageIndex = 1;
     LevelEditor e = new LevelEditor(Ogmo.Levels[index]);
     LevelEditors.Add(e);
     t.Controls.Add(e);
     MasterTabControl.TabPages.Add(t);
 }
Ejemplo n.º 5
0
 public override void Paste(LevelEditor editor, Layer layer)
 {
     editor.Perform(new TilePasteSelectionAction(layer as TileLayer, Area, Data));
 }
Ejemplo n.º 6
0
 public abstract LayerEditor GetEditor(LevelEditor editor);
Ejemplo n.º 7
0
 public override void Paste(LevelEditor editor, Layer layer)
 {
     editor.Perform(new GridPasteSelectionAction(layer as GridLayer, Area, Bits));
 }
Ejemplo n.º 8
0
 public abstract void Paste(LevelEditor editor, Layer layer);