Example #1
0
        public static void Step()
        {
            //Display.DrawFilledRectangle(0, 0, 320, 11, 56);
            //FontDrawer.WriteText(MenuText, 25, 1, 0);

            for (int i = 0; i < iconIndex; i++)
            {
                if (Mouse.GetLeftButton())
                {
                    if (icons[i].MouseInside())
                        IconCallback(icons[i].text);
                }
                icons[i].Draw();
            }

            if (Mouse.GetLeftButton())
            {
                if (dragging != null)
                {
                    dragging.x = Mouse.GetX() + xOffset;
                    dragging.y = Mouse.GetY() + yOffset;
                }
            }
            else
                dragging = null;

            for (int i = 0; i < winIndex; i++)
            {
                Window win = windows[i];
                if (win != null)
                {
                    if (Mouse.GetLeftButton())
                    {
                        if (win.MouseInExit())
                        {
                            win = null;
                            windows[i] = null;
                        }
                        else if (win.MouseInTitle())
                        {
                            dragging = win;
                            xOffset = dragging.x - Mouse.GetX();
                            yOffset = dragging.y - Mouse.GetY();
                        }
                    }
                    if (win != null)
                        win.Draw();
                }
            }
        }
Example #2
0
 public void BeforeRun()
 {
     Console.WriteLine("Cosmos booted successfully.");
     //initialize
     Display.Init();
     Mouse.Init(Display.GetWidth(), Display.GetHeight());
     window = new Window(50, 50, 170, 30, "Welcome", "Welcome to the\nAndromeda Operating System.", 2);
     Desktop.Add(window);
     icon = new Icon("Info", 2, 10, 10);
     Desktop.Add(icon);
     icon = new Icon("Power", 2, 50, 10);
     Desktop.Add(icon);
     icon = new Icon("Pong", 2, 90, 10);
     Desktop.Add(icon);
 }
Example #3
0
 public static void IconCallback(string text)
 {
     string date;
     string time;
     if (text == "Info")
     {
         date = "Month: " + RTC.Month.ToString() + " Day: " + RTC.DayOfTheMonth.ToString() + "\nYear: " + RTC.Year.ToString();
         time = RTC.Hour.ToString() + ":" + RTC.Minute.ToString() + ":" + RTC.Second.ToString();
         string str = "Andromeda OS 0.1\n" + date + "\n" + time;
         win2 = new Window(100, 50, 100, 50, "Info", str, 2);
         Add(win2);
     }
     else if (text == "Power")
     {
         Power.Reboot();
     }
     else if (text == "Pong")
     {
         pong = new Pong();
     }
 }
Example #4
0
 public static void Add(Window win)
 {
     windows[winIndex] = win;
     winIndex++;
 }