Exemple #1
0
        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;
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        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();
            }
        }