Beispiel #1
0
        public TownsScreen(IGraphicsManager gfx, int width, int height, PixelFormat format)
        {
            _gfx = gfx;
            _width = width;
            _height = height;
            _pixelFormat = format;
            // just get that bytes per pixel once, it cannot change in this instance
            // much less method calls in the loops 
            _bytesPerPixel = Surface.GetBytesPerPixel(format);
            _pitch = width * _bytesPerPixel;

            _outBuffer = new byte[_pitch * _height];
            for (int i = 0; i < _layers.Length; i++)
            {
                _layers[i] = new TownsScreenLayer();
            }
            SetupLayer(0, width, height, 256);
        }
Beispiel #2
0
        public TownsScreen(IGraphicsManager gfx, int width, int height, PixelFormat format)
        {
            _gfx         = gfx;
            _width       = width;
            _height      = height;
            _pixelFormat = format;
            // just get that bytes per pixel once, it cannot change in this instance
            // much less method calls in the loops
            _bytesPerPixel = Surface.GetBytesPerPixel(format);
            _pitch         = width * _bytesPerPixel;

            _outBuffer = new byte[_pitch * _height];
            for (int i = 0; i < _layers.Length; i++)
            {
                _layers[i] = new TownsScreenLayer();
            }
            SetupLayer(0, width, height, 256);
        }