예제 #1
0
        private async Task <int> Run(Options options)
        {
            try
            {
                using (var ledDriver = LedDriver.Create())
                {
                    var  displayDriver = new DisplayDriver(ledDriver);
                    Task task;

                    if (options.StringValue != null)
                    {
                        if (options.ForceScroll || DisplayFrame.GetDisplayedStringLength(options.StringValue) > 3)
                        {
                            task = displayDriver.ScrollString(options.StringValue, options.Duration);
                        }
                        else
                        {
                            displayDriver.WriteString(options.StringValue);
                            task = Task.Delay(options.Duration);
                        }
                    }
                    else if (options.DecimalValue != null)
                    {
                        displayDriver.WriteFrame(DisplayFrame.FromDecimal(options.DecimalValue.Value, StatusLed.Blue));
                        task = Task.Delay(options.Duration);
                    }
                    else if (options.BusyDelay != null)
                    {
                        task = displayDriver.BusyLoop(options.BusyDelay.Value, options.Duration);
                    }
                    else if (options.RawValue != null)
                    {
                        for (int i = 0; i < 32; i++)
                        {
                            bool bit = ((options.RawValue.Value << i) & 0x80000000u) != 0u;
                            ledDriver.WriteBit(bit);
                        }
                        ledDriver.Latch();
                        task = Task.Delay(options.Duration);
                    }
                    else
                    {
                        Console.WriteLine("No option selected.");
                        return(-1);
                    }

                    await task;
                    displayDriver.Clear();
                }

                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex}");
                return(-1);
            }
        }
예제 #2
0
        protected override void BeforeRun()
        {
            DisplayDriver display = new DisplayDriver();

            display.init();
            Console.WriteLine("Welcome to the MEH OS 0.1, built on the COSMOS kernel");
            Console.WriteLine("WARNING; This OS is PRE-ALPHA, and not a substitute for your main OS");
            Console.WriteLine("We are not responsible if you lose your data");
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();

            IDisplayDriver displayDriver = new DisplayDriver(this, myCanvas);
            IInputDriver   inputDriver   = new InputDriver(this);

            myGame = new DummyGame(displayDriver, inputDriver);
        }
예제 #4
0
        protected override void BeforeRun()
        {
            //This function is called before COSMOS starts
            //Console.WriteLine("Cosmos booted sucessfully, now starting Kernel");
            display = new BufferedDisplayDriver();
            PrintDebug("After display create");
            display.init();
            PrintDebug("After display init");

            mouse = new MouseDriver(display.getHeight(), display.getWidth());
            mr    = new MouseRenderer(mouse, display, 2);
        }
예제 #5
0
        public WindowManager(DisplayDriver dd, Desktop desk, FontRenderer fr)
        {
            display      = dd;
            desktop      = desk;
            fontRenderer = fr;

            sX = 10;
            sY = 10;
            eX = display.getWidth() - 10;
            eY = display.getHeight() - 10;

            backGroundWindows = new Window[0];
        }
예제 #6
0
        public void mainrunbypass()
        {
            ////////////////////////////////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("main os...... build 12.3");

            display = new DisplayDriver();
            display.init();

            //////////////////////////////////////////////

            //draw mouse
            display.draw_mouse();
            ///////////////////////////////////////////////



            /////////////////////////////////////////////////////////////////////////////////////////////////////////////
        }
예제 #7
0
 public FontRenderer(DisplayDriver dd, Font f, int sc = 2)
 {
     driver   = dd;
     font     = f;
     stdColor = sc;
 }
예제 #8
0
 public IconRenderer(DisplayDriver dd, IconPack ip)
 {
     driver   = dd;
     iconPack = ip;
 }
예제 #9
0
 public MouseRenderer(MouseDriver m, DisplayDriver d, int c = 2)
 {
     mouse   = m;
     display = d;
     color   = c;
 }
예제 #10
0
 public PictureManger(DisplayDriver dd, Picture f)
 {
     driver  = dd;
     Picture = f;
 }
예제 #11
0
파일: Desktop.cs 프로젝트: vogon101/BasicOS
 public Desktop(DisplayDriver d)
 {
     display = d;
 }