public AdjustGameScaleTests(ITestOutputHelper output) { _pixelMapper = new PixelMapper(); _pixelMapper.SetViewPortSize(ScreenSize, ScreenSize); int centerViewportOffsetX = _pixelMapper.MaxGridWidth / 2 - ScreenSize / 2; int centerViewportOffsetY = _pixelMapper.MaxGridHeight / 2 - ScreenSize / 2; _pixelMapper.SetViewPort(centerViewportOffsetX, centerViewportOffsetY); _output = output; }
public CoordPixelConverstionTests(ITestOutputHelper output) { _output = output; _pixelMapper = new PixelMapper(); _pixelMapper.SetViewPortSize(ScreenSize, ScreenSize); _pixelMapper.LogData(output); if (DefaultCellSize != _pixelMapper.CellSize) { throw new Exception("Cell size is different than this test expects, these tests assume the DefaultCellSize is " + DefaultCellSize); } }
public void SetSize(int width, int height) { (int columns, int rows) = _pixelMapper.ViewPortPixelsToCoords(width, height); columns = Math.Max(columns, 1); rows = Math.Max(rows, 1); (_width, _height) = _pixelMapper.CoordsToViewPortPixels(columns, rows); _pixelMapper.SetViewPortSize(_width, _height); _gameBoard.Columns = columns; _gameBoard.Rows = rows; ResetBuffers(); }
public void SetSize(int width, int height) { _screenWidth = width; _screenHeight = height; _imageCache.SetDirtyAll(_screens); (int columns, int rows) = _pixelMapper.ViewPortPixelsToCoords(width, height); columns = Math.Max(columns, 1); rows = Math.Max(rows, 1); (width, height, _) = _pixelMapper.CoordsToViewPortPixels(columns + 1, rows + 1); if (_width != width || _height != height) { _width = width; _height = height; _pixelMapper.SetViewPortSize(_width, _height); // strictly speaking this only needs to clear renderers, but we already cleared screens // so its easier just to call clear _imageCache.Clear(); } }