internal void _updateBrush() { if (Input.F1.Down) { _symmetryX = _parent._selector.X; _parent.Render(_parent.Screen); } else if (Input.F2.Down) { _symmetryY = _parent._selector.Y; _parent.Render(_parent.Screen); } else if (Input.F3.Clicked) { _symmetryX = -1; _symmetryY = -1; _parent.Render(_parent.Screen); } else if (Input.Attack.Down) { if (_parent._isBorder(_parent._selector.X, _parent._selector.Y)) { return; } _fillSelected(); } }
public void Paste(int selectedX, int selectedY) { for (int i = 0; i < Width; i++) { for (int j = 0; j < Height; j++) { if (_parent._isBorder(selectedX + i, selectedY + j)) { continue; } _parent._setTopTile(selectedX + i, selectedY + j, GetTile(i, j).Create(selectedX, selectedY)); if (GetEntity(i, j).Type == -1) { _parent._setTopEntity(selectedX + i, selectedY + j, null); } else { _parent._setTopEntity(selectedX + i, selectedY + j, GetEntity(i, j).Create(selectedX, selectedY)); } } } _parent.Render(_parent.Screen); }
public void Update() { NeedToRender = false; int dx = 0, dy = 0; if (Input.Up.Clicked && _selectedY - 1 >= 0) { dy--; } else if (Input.Down.Clicked && _selectedY + 1 < _parent.LevelHeight) { dy++; } else if (Input.Left.Clicked && _selectedX - 1 >= 0) { dx--; } else if (Input.Right.Clicked && _selectedX + 1 < _parent.LevelWidth) { dx++; } if (Input.Shift.Clicked) { if (_selectedW + dx <= _parent.LevelWidth) { _selectedW += dx; } if (_selectedH + dy <= _parent.LevelHeight) { _selectedH += dy; } if (_selectedW == 0) { _selectedW = -1; } if (_selectedH == 0) { _selectedH = -1; } if (_selectedX + _selectedW - _parent._tileOffsetX > _parent.DisplayedElementsX) { _selectedW--; } if (_selectedY + _selectedH - _parent._tileOffsetY > _parent.DisplayedElementsY) { _selectedH--; } if (_selectedX + _selectedW < _parent._tileOffsetX) { _selectedW++; } if (_selectedY + _selectedH < _parent._tileOffsetY) { _selectedH++; } if (_selectedW == -1) { _selectedX++; _selectedW = -2; } if (_selectedH == -1) { _selectedY++; _selectedH = -2; } NeedToRender = true; } else if (dx != 0 || dy != 0) { _clear(_parent.Screen); _selectedW = 1; _selectedH = 1; _selectedX += dx; _selectedY += dy; NeedToRender = true; } if (Input.Ctrl.Down && Input.C.Down && Width > 1 && Height > 1) { _clipboard.Clear(); _clipboard.Width = Width; _clipboard.Height = Height; _clipboard.Copy(X, Y); } else if (Input.Ctrl.Down && Input.V.Down) { if (!_clipboard.IsEmpty) { _parent._history.Add(X, Y, _clipboard.Width, _clipboard.Height); _clipboard.Paste(X, Y); NeedToRender = true; } } else if (Input.Ctrl.Down && Input.X.Clicked) { _clipboard.Clear(); _clipboard.Width = Width; _clipboard.Height = Height; _clipboard.Copy(X, Y); Delete(); NeedToRender = true; } if (X < _parent._tileOffsetX) { _parent._tileOffsetX--; _parent._background.SetOffset(_parent._tileOffsetX * GTile.WIDTH, _parent._tileOffsetY * GTile.HEIGHT); _parent.Render(_parent.Screen); return; } else if (X > _parent._tileOffsetX + _parent.DisplayWidth / GTile.WIDTH) { _parent._tileOffsetX++; _parent._background.SetOffset(_parent._tileOffsetX * GTile.WIDTH, _parent._tileOffsetY * GTile.HEIGHT); _parent.Render(_parent.Screen); return; } if (Y < _parent._tileOffsetY) { _parent._tileOffsetY--; _parent._background.SetOffset(_parent._tileOffsetX * GTile.WIDTH, _parent._tileOffsetY * GTile.HEIGHT); _parent.Render(_parent.Screen); return; } else if (Y >= _parent._tileOffsetY + _parent.DisplayHeight / GTile.HEIGHT) { _parent._tileOffsetY++; _parent._background.SetOffset(_parent._tileOffsetX * GTile.WIDTH, _parent._tileOffsetY * GTile.HEIGHT); _parent.Render(_parent.Screen); return; } if (Input.Delete.Clicked) { Delete(); NeedToRender = true; } if (_parent._isOutsideBorder(X, Y)) { _rectColor = Color.Silver; } else if (_parent._isBorder(X, Y)) { _rectColor = Color.Red; } else { _rectColor = Color.White; } }