示例#1
3
        public static Canvas GetFullScreenCanvas(Mode mode)
        {
            if (MyVideoDriver == null)
                return MyVideoDriver = new VBEScreen(mode);

            /* We have already got a VideoDriver istance simple change its mode */
            MyVideoDriver.Mode = mode;
            return MyVideoDriver;
        }
示例#2
0
文件: VBEScreen.cs 项目: fanoI/Cosmos
        public VBEScreen(Mode mode) : base(mode)
        {
            if (!IsModeValid(mode))
                throw new ArgumentOutOfRangeException($"Mode {mode} is not supported by VBE Driver");

            VBEDriver = new VBEDriver((ushort)mode.Rows, (ushort)mode.Columns, (ushort)mode.ColorDepth);
        }
示例#3
0
文件: Mode.cs 项目: fanoI/Cosmos
        public bool Equals(Mode other)
        {
            if (this.columns == other.columns && this.rows == other.rows && this.color_depth == other.color_depth)
                return true;

            return false;
        }
示例#4
0
文件: Mode.cs 项目: fanoI/Cosmos
        public int CompareTo(Mode other)
        {
            // color_depth has no effect on the orderiring
            if (this.columns < other.columns && this.rows < other.rows)
                return -1;

            if (this.columns > other.columns && this.rows > other.rows)
                return 1;

            // They are effectively Equals
            return 0;
        }
示例#5
0
文件: VGA2.cs 项目: carcarjg/Uszka
        public VGA(bool buffered = true)
        {
            byte[] g_320x200x256 =
            {
                /* MISC */
                0x63,
                /* SEQ */
                0x03, 0x01, 0x0F, 0x00, 0x0E,
                /* CRTC */
                0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F,
                0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x9C, 0x0E, 0x8F, 0x28, 0x40, 0x96, 0xB9, 0xA3,
                0xFF,
                /* GC */
                0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
                0xFF,
                /* AC */
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
                0x41, 0x00, 0x0F, 0x00, 0x00
            };

            fixed(byte *fixedPTR = g_320x200x256)
            {
                WriteRegs(fixedPTR);
            }

            if (!buffered)
            {
                writeOnVGAMem = true;
                return;
            }



            ScrW = 320;
            ScrH = 200;

            PixelStride = (byte)((BitsPerPixel | 7) >> 3);
            Pitch       = ScrW * PixelStride;
            BackBuffer  = (byte *)(ScrH * Pitch);
            bufsize     = ScrH * Pitch;

            Mode = new Sys.Graphics.Mode(ScrW, ScrH, Sys.Graphics.ColorDepth.ColorDepth8);

            colorsInBuffer = new Color[(ScrH * ScrW)];
        }
示例#6
0
文件: VBEScreen.cs 项目: fanoI/Cosmos
        /// <summary>
        /// Use this to setup the screen, this will disable the console.
        /// </summary>
        /// <param name="Mode">The desired Mode resolution</param>
        private void SetMode(Mode mode)
        {
            if (!IsModeValid(mode))
                throw new ArgumentOutOfRangeException($"Mode {mode} is not supported by VBE Driver");

            ushort xres = (ushort)Mode.Rows;
            ushort yres = (ushort)Mode.Columns;
            ushort bpp = (ushort)Mode.ColorDepth;

            //set the screen
           VBEDriver.VBESet(xres, yres, bpp);
        }
示例#7
0
文件: Canvas.cs 项目: fanoI/Cosmos
 protected Canvas(Mode mode)
 {
     this.mode = mode;
     aviableModes = getAviableModes();
     defaultGraphicMode = getDefaultGraphicMode();
 }
示例#8
0
文件: Canvas.cs 项目: fanoI/Cosmos
        protected bool IsModeValid(Mode mode)
        {
            /* This would have been the more "modern" version but LINQ is not working */
            //return aviableModes.Exists(element => element == mode);

            foreach(var elem in aviableModes)
            {
                if (elem == mode)
                    return true;
            }

            /* 'mode' was not in the 'aviableModes' List ==> 'mode' in NOT Valid */
            return false;
        }