Exemplo n.º 1
0
 // draw bitmap - colored
 public static void DrawBitmap(Rectangle bounds, uint[] data, uint color, uint transCol, bool transparency)
 {
     for (int i = 0; i < bounds.width * bounds.height; i++)
     {
         int xx = bounds.x + (i % bounds.width);
         int yy = bounds.y + (i / bounds.width);
         if (transparency)
         {
             if (data[i] != transCol)
             {
                 if (driverMode == 0)
                 {
                     SVGA.SetPixel(xx, yy, color);
                 }
                 else if (driverMode == 1)
                 {
                     VGA.SetPixel(xx, yy, Color.ToARGB(color));
                 }
             }
         }
         else
         {
             SVGA.SetPixel(xx, yy, color);
         }
     }
 }
Exemplo n.º 2
0
        public static void RunGraphical()
        {
            graphical = true;

            // init mouse
            MSPS2.Initialize();

            ProcessManager.Initialize();

            //shell = new Shell();
            //ProcessManager.AddProcess(shell);

            logon = new Logon();
            ProcessManager.AddProcess(logon);

            while (true)
            {
                // update clock
                Clock.Update();

                // update system processes
                ProcessManager.UpdateWindows();
                ProcessManager.UpdateSystemProcesses();

                // debug text
                if (debugText)
                {
                    shell.DrawDebug();
                }

                // update mouse
                MSPS2.Update();

                // update display
                SVGA.Update();

                // get cpu usage
                cpuUsage = (float)((float)30 / (float)SVGA.fps) * (float)100;
                // manage keyboard
                KBPS2.Update();

                // force text mode
                if (KBPS2.CONTROL_DOWN && KBPS2.ALT_DOWN && KBPS2.IsKeyDown(Sys.ConsoleKeyEx.End))
                {
                    RunTextMode();
                }

                if (KBPS2.CONTROL_DOWN && KBPS2.IsKeyDown(Sys.ConsoleKeyEx.D))
                {
                    debugText = !debugText;
                }

                if (!graphical)
                {
                    break;
                }
            }
        }
Exemplo n.º 3
0
        protected override void BeforeRun()
        {
            CLI.Initialize();

            if (!SVGA.Initialize())
            {
                CLI.WriteLine("[FATAL ERROR] could not initialize graphics mode!", ConsoleColor.Red);
            }

            if (!PMFAT.Initialize())
            {
                Console.WriteLine("[FATAL ERROR] could not initialize fat driver!", ConsoleColor.Red);
            }
        }
Exemplo n.º 4
0
        public override void Execute(string[] args)
        {
            if (!SVGA.Initialize())
            {
                Kernel.graphical = false;
                CLI.WriteLine("[FATAL ERROR] could not switch graphics mode!");
            }
            else
            {
                Kernel.RunGraphical();
            }

            // execute base
            base.Execute(args);
        }
Exemplo n.º 5
0
 // fill rectangle
 public static void FillRectangle(Rectangle bounds, uint c)
 {
     for (int i = 0; i < bounds.width * bounds.height; i++)
     {
         int xx = i % bounds.width;
         int yy = i / bounds.width;
         if (bounds.width > 0 && bounds.height > 0)
         {
             if (driverMode == 0)
             {
                 SVGA.SetPixel(bounds.x + xx, bounds.y + yy, c);
             }
             else if (driverMode == 1)
             {
                 VGA.SetPixel(bounds.x + xx, bounds.y + yy, Color.ToARGB(c));
             }
         }
     }
 }
        public static void Initialize()
        {
            SVGA.setres(800, 600);
            SVGA.clear(Colors.DesktopBlueBackground);
            SVGA.set(10, 10, 0xFF0000);
            SVGA.svga.SetPixel((ushort)15, (ushort)15, 0xFF0000);
            Cosmos.Hardware.Drivers.PCI.Video.VMWareSVGAII svga1 = new Cosmos.Hardware.Drivers.PCI.Video.VMWareSVGAII();
            svga1.SetMode((ushort)640, (ushort)480);
            svga1.Clear(Colors.DesktopBlueBackground);
            svga1.SetPixel((ushort)15, (ushort)15, 0xFF0000);
            FlowDOS.Hardware.Mouse.Initialize();
            xold = FlowDOS.Hardware.Mouse.X;
            yold = FlowDOS.Hardware.Mouse.Y;
mainwh:
            xold = FlowDOS.Hardware.Mouse.X;
            yold = FlowDOS.Hardware.Mouse.Y;
            svga1.SetCursor(true, (uint)FlowDOS.Hardware.Mouse.X, (uint)FlowDOS.Hardware.Mouse.Y);
            while ((FlowDOS.Hardware.Mouse.X == xold) && (FlowDOS.Hardware.Mouse.Y == yold))
            {
            }
            goto mainwh;
        }