示例#1
0
 private void onKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Home)
     {
         LevelView.Center();
     }
     else if (e.KeyCode == Keys.Oemplus)
     {
         LevelView.ZoomIn(LevelView.EditorToScreen(MousePosition));
     }
     else if (e.KeyCode == Keys.OemMinus)
     {
         LevelView.ZoomOut(LevelView.EditorToScreen(MousePosition));
     }
     else if (e.KeyCode == Keys.Left)
     {
         LevelView.Pan(new PointF(32, 0));
         foreach (var ed in LayerEditors)
         {
             ed.UpdateDrawOffset(LevelView.ScreenToEditor(new Point(0, 0)));
         }
     }
     else if (e.KeyCode == Keys.Right)
     {
         LevelView.Pan(new PointF(-32, 0));
         foreach (var ed in LayerEditors)
         {
             ed.UpdateDrawOffset(LevelView.ScreenToEditor(new Point(0, 0)));
         }
     }
     else if (e.KeyCode == Keys.Up)
     {
         LevelView.Pan(new PointF(0, 32));
         foreach (var ed in LayerEditors)
         {
             ed.UpdateDrawOffset(LevelView.ScreenToEditor(new Point(0, 0)));
         }
     }
     else if (e.KeyCode == Keys.Down)
     {
         LevelView.Pan(new PointF(0, -32));
         foreach (var ed in LayerEditors)
         {
             ed.UpdateDrawOffset(LevelView.ScreenToEditor(new Point(0, 0)));
         }
     }
     else if (mouseMode == MouseMode.Normal && e.KeyCode == Keys.Space)
     {
         mouseMode = MouseMode.Pan;
     }
     else if (mouseMode == MouseMode.Normal && e.KeyCode == Keys.C)
     {
         mouseMode = MouseMode.Camera;
     }
     else
     {
         //Call the layer event
         LayerEditors[Ogmo.LayersWindow.CurrentLayerIndex].OnKeyDown(e.KeyCode);
     }
 }
示例#2
0
 private void onKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Home)
     {
         LevelView.Center();
     }
     else if (e.KeyCode == Keys.Oemplus)
     {
         LevelView.ZoomIn(LevelView.EditorToScreen(MousePosition));
     }
     else if (e.KeyCode == Keys.OemMinus)
     {
         LevelView.ZoomOut(LevelView.EditorToScreen(MousePosition));
     }
     else if (mouseMode == MouseMode.Normal && e.KeyCode == Keys.Space)
     {
         mouseMode = MouseMode.Pan;
     }
     else if (mouseMode == MouseMode.Normal && e.KeyCode == Keys.C)
     {
         mouseMode = MouseMode.Camera;
     }
     else
     {
         //Call the layer event
         LayerEditors[Ogmo.LayersWindow.CurrentLayerIndex].OnKeyDown(e.KeyCode);
     }
 }