Example #1
0
 public static Vec2 operator -(Vec2 a, int b)
 {
     Vec2 v = new Vec2();
     v.X = a.X - b;
     v.Y = a.Y - b;
     return v;
 }
Example #2
0
 public static Vec2 operator /(Vec2 a, int b)
 {
     Vec2 v = new Vec2();
     v.X = (Int32)(a.X / b);
     v.Y = (Int32)(a.Y / b);
     return v;
 }
Example #3
0
 public ExitButton(Vec2 loc, Vec2 size, Image parent, Forms.Form parf)
 {
     if (size.X == 0 || size.Y == 0)
     {
         throw new Exception("No dimention of size can be zero!");
     }
     this.X = loc.X;
     this.Y = loc.Y;
     this.Size = size;
     this.iSize = new Vec2(size.X - 1, size.Y - 1);
     this.parent = parent;
     this.parForm = parf;
     this.bounds = new BoundingBox(this.X, this.X + Size.X, this.Y + Size.Y, this.Y);
     Click = new ObjectClick(this.ExitButtonClicked);
     MouseEnter = new ObjectClick(this.ExitButtonEnter);
     MouseLeave = new ObjectClick(this.ExitButtonLeave);
     MouseDown = new ObjectClick(this.ExitButtonMouseDown);
     MouseUp = new ObjectClick(this.ExitButtonMouseUp);
     evnts = new ObjectEvents(
         new ObjectClick(Click),
         new ObjectClick(MouseEnter),
         new ObjectClick(MouseLeave),
         new ObjectClick(MouseDown),
         new ObjectClick(MouseUp),
         new DrawMethod(Draw),
         bounds);
     i = new Image(size);
     this.DrawDefault();
 }
Example #4
0
 public static Vec2 operator /(Vec2 a, Vec2 b)
 {
     Vec2 v = new Vec2();
     v.X = a.X / b.X;
     v.Y = a.Y / b.Y;
     return v;
 }
Example #5
0
 public static Vec2 operator -(Vec2 v)
 {
     Vec2 vec = new Vec2();
     vec.X = -v.X;
     vec.Y = -v.Y;
     return vec;
 }
Example #6
0
 private void ButtonEnter(Vec2 loc, MouseButtons buttons)
 {
     if (IsMouseDown)
     {
         this.DrawMouseDown();
     }
     else
     {
         this.DrawMouseOver();
     }
 }
Example #7
0
 private void ButtonMouseUp(Vec2 loc, MouseButtons buttons)
 {
     if (Bounds.IsInBounds(loc))
     {
         this.DrawMouseOver();
     }
     else
     {
         this.DrawDefault();
     }
 }
Example #8
0
 void bt_Click(Vec2 loc, MouseButtons buttons)
 {
     //if (w1.CurrentState == OForms.Windows.WindowState.Normal)
     //{
     //    windowManager.MaximizeWindow(w1);
     //}
     //else
     //{
     //    windowManager.RestoreWindow(w1);
     //}
     Window w = new Window(new Vec2(130, 30), new Vec2(120, 80), "Test Window 3");
     w.ClearColor = Colors.Blue;
     windowManager.AddWindow(w);
 }
Example #9
0
 /// <summary>
 /// The default constructor for a button.
 /// </summary>
 /// <param name="loc">The location of the button in the parent control.</param>
 /// <param name="size">The size of the button.</param>
 public Button(Vec2 loc, Vec2 size)
     : base(loc, size)
 {
     if (size.X == 0 || size.Y == 0)
     {
         throw new Exception("No dimention of size can be zero!");
     }
     this.X = loc.X;
     this.Y = loc.Y;
     this.Size = size;
     this.iSize = new Vec2(size.X - 1, size.Y - 1);
     this.Bounds = new BoundingBox(this.X, this.X + Size.X, this.Y + Size.Y, this.Y);
     MouseEnter += new MouseEvent(this.ButtonEnter);
     MouseLeave += new MouseEvent(this.ButtonLeave);
     MouseDown += new MouseEvent(this.ButtonMouseDown);
     MouseUp += new MouseEvent(this.ButtonMouseUp);
     Buffer = new Image(size);
     this.DrawDefault();
 }
Example #10
0
        private void pictureBox1_MouseUp(object sender, Forms.MouseEventArgs e)
        {
            windowManager.HandleMouseUp(new Vec2(e.X, e.Y), Utils.GetButtons(e.Button), i);

            foreach (ObjectEvents c in Objects)
            {
                if (c.IsMouseDown)
                {
                    c.IsMouseDown = false;
                    c.MouseUp(sender, new Forms.MouseEventArgs(Forms.MouseButtons.Left, 1, (int)MouseX, (int)MouseY, 0));
                }
            }


            SetMouseUp();
            DrawCursor();
            pictureBox1.Image = (System.Drawing.Bitmap)i;
            pictureBox1.Refresh();
            Vec2 v = new Vec2((int)MouseX, (int)MouseY);
            i.DrawImage(v, behindMouseImage);
        }
Example #11
0
        private void pictureBox1_MouseMove(object sender, Forms.MouseEventArgs e)
        {
            MouseX = (uint)e.X;
            MouseY = (uint)e.Y;
            if (MouseX >= i.Width - 5)
            {
                MouseX = (uint)(i.Width - 6);
            }
            if (MouseY >= i.Height - 5)
            {
                MouseY = (uint)(i.Height - 6);
            }


            windowManager.HandleMouseMove(new Vec2((int)MouseX, (int)MouseY), Utils.GetButtons(e.Button), i);


            foreach (ObjectEvents c in Objects)
            {
                if (!c.IsIn)
                {
                    if (c.Bounds.IsInBounds(new Vec2(e.X, e.Y)))
                    {
                        c.IsIn = true;
                        if (c.IsMouseDown)
                        {
                            c.MouseDown(sender, new Forms.MouseEventArgs(Forms.MouseButtons.Left, 1, (int)MouseX, (int)MouseY, 0));
                        }
                        else
                        {
                            c.MouseEnter(sender, new Forms.MouseEventArgs(Forms.MouseButtons.Left, 1, (int)MouseX, (int)MouseY, 0));
                        }
                    }
                }
                else
                {
                    if (!c.Bounds.IsInBounds(new Vec2(e.X, e.Y)))
                    {
                        c.IsIn = false;
                        c.MouseLeave(sender, new Forms.MouseEventArgs(Forms.MouseButtons.Left, 1, (int)MouseX, (int)MouseY, 0));
                    }
                }
            }

            DrawCursor();
            pictureBox1.Image = (System.Drawing.Bitmap)i;
            pictureBox1.Refresh();
            // Now we need to restore what was behind the mouse.
            Vec2 v = new Vec2((int)MouseX, (int)MouseY);
            i.DrawImage(v, behindMouseImage);
        }
Example #12
0
 /// <summary>
 /// Processes a MouseMove event.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="buttons">The buttons of the mouse that are pressed.</param>
 /// <param name="i">The image to draw to.</param>
 public void HandleMouseMove(Vec2 loc, MouseButtons buttons, Image i)
 {
     MouseLocation = loc;
     if (Taskbar.Bounds.IsInBounds(loc))
     {
         Taskbar.DoMouseMove(loc);
     }
     else
     {
         if (Taskbar.WasOverButton)
         {
             Taskbar.UndrawOverButton(Taskbar.WindowButtonBounds[Taskbar.overButtonIndx], Taskbar.Windows[Taskbar.overButtonIndx]);
         }
         if (ActiveWindows.Length > 0)
         {
             ActiveWindow.DoMouseMove(loc, buttons);
         }
     }
     this.Draw(i);
 }
Example #13
0
 /// <summary>
 /// Invokes the MouseDown event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoMouseDown(Vec2 v, MouseButtons b) { MouseDown.Invoke(v, b); }
Example #14
0
 /// <summary>
 /// Invokes the MouseEnter event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoMouseEnter(Vec2 v, MouseButtons b) { MouseEnter.Invoke(v, b); }
Example #15
0
 /// <summary>
 /// The dummy MouseEvent method.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="button">The current state of the mouse buttons.</param>
 private void DummyMouseEvent(Vec2 loc, MouseButtons button) { }
Example #16
0
 private void ButtonMouseDown(Vec2 loc, MouseButtons buttons)
 {
     this.DrawMouseDown();
 }
Example #17
0
 /// <summary>
 /// The default constructor.
 /// </summary>
 public WindowManager(Vec2 size)
 {
     ActiveWindows = new Window[0];
     this.Size = size;
     this.Taskbar = new Taskbar(this);
 }
Example #18
0
 /// <summary>
 /// Processes a MouseUp event.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="buttons">The MouseButtons that are still pressed.</param>
 /// <param name="i">The Image to draw to.</param>
 public void HandleMouseUp(Vec2 loc, MouseButtons buttons, Image i)
 {
     MouseLocation = loc;
     if (ActiveWindows.Length > 0)
     {
         ActiveWindow.DoMouseUp(loc, buttons);
         this.Draw(i);
     }
 }
Example #19
0
 /// <summary>
 /// Processes a MouseDown event.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="buttons">The MouseButtons that are pressed.</param>
 /// <param name="i">The Image to draw to.</param>
 public void HandleMouseDown(Vec2 loc, MouseButtons buttons, Image i)
 {
     MouseLocation = loc;
     if (ActiveWindows.Length > 0)
     {
         if (ActiveWindow.Bounds.IsInBounds(loc))
         {
             ActiveWindow.DoMouseDown(loc, buttons);
             this.Draw(i);
         }
     }
 }
Example #20
0
        private void DrawCursor()
        {

            #region SaveBehindMouse

            behindMouseImage.SetPixel(0, 0, i.GetPixel(MouseX, MouseY));
            behindMouseImage.SetPixel(1, 0, i.GetPixel(MouseX + 1, MouseY));
            behindMouseImage.SetPixel(2, 0, i.GetPixel(MouseX + 2, MouseY));
            behindMouseImage.SetPixel(0, 1, i.GetPixel(MouseX, MouseY + 1));
            behindMouseImage.SetPixel(0, 2, i.GetPixel(MouseX, MouseY + 2));
            behindMouseImage.SetPixel(1, 1, i.GetPixel(MouseX + 1, MouseY + 1));
            behindMouseImage.SetPixel(2, 2, i.GetPixel(MouseX + 2, MouseY + 2));
            behindMouseImage.SetPixel(3, 3, i.GetPixel(MouseX + 3, MouseY + 3));
            behindMouseImage.SetPixel(4, 4, i.GetPixel(MouseX + 4, MouseY + 4));

            #region Old Block Mouse
            //behindMouseImage.SetPixel(0, 0, i.GetPixel(MouseX, MouseY));
            //behindMouseImage.SetPixel(1, 0, i.GetPixel(MouseX + 1, MouseY));
            //behindMouseImage.SetPixel(2, 0, i.GetPixel(MouseX + 2, MouseY));
            //behindMouseImage.SetPixel(3, 0, i.GetPixel(MouseX + 3, MouseY));
            //behindMouseImage.SetPixel(4, 0, i.GetPixel(MouseX + 4, MouseY));

            //behindMouseImage.SetPixel(0, 1, i.GetPixel(MouseX, MouseY + 1));
            //behindMouseImage.SetPixel(1, 1, i.GetPixel(MouseX + 1, MouseY + 1));
            //behindMouseImage.SetPixel(2, 1, i.GetPixel(MouseX + 2, MouseY + 1));
            //behindMouseImage.SetPixel(3, 1, i.GetPixel(MouseX + 3, MouseY + 1));
            //behindMouseImage.SetPixel(4, 1, i.GetPixel(MouseX + 4, MouseY + 1));

            //behindMouseImage.SetPixel(0, 2, i.GetPixel(MouseX, MouseY + 2));
            //behindMouseImage.SetPixel(1, 2, i.GetPixel(MouseX + 1, MouseY + 2));
            //behindMouseImage.SetPixel(2, 2, i.GetPixel(MouseX + 2, MouseY + 2));
            //behindMouseImage.SetPixel(3, 2, i.GetPixel(MouseX + 3, MouseY + 2));
            //behindMouseImage.SetPixel(4, 2, i.GetPixel(MouseX + 4, MouseY + 2));

            //behindMouseImage.SetPixel(0, 3, i.GetPixel(MouseX, MouseY + 3));
            //behindMouseImage.SetPixel(1, 3, i.GetPixel(MouseX + 1, MouseY + 3));
            //behindMouseImage.SetPixel(2, 3, i.GetPixel(MouseX + 2, MouseY + 3));
            //behindMouseImage.SetPixel(3, 3, i.GetPixel(MouseX + 3, MouseY + 3));
            //behindMouseImage.SetPixel(4, 3, i.GetPixel(MouseX + 4, MouseY + 3));

            //behindMouseImage.SetPixel(0, 4, i.GetPixel(MouseX, MouseY + 4));
            //behindMouseImage.SetPixel(1, 4, i.GetPixel(MouseX + 1, MouseY + 4));
            //behindMouseImage.SetPixel(2, 4, i.GetPixel(MouseX + 2, MouseY + 4));
            //behindMouseImage.SetPixel(3, 4, i.GetPixel(MouseX + 3, MouseY + 4));
            //behindMouseImage.SetPixel(4, 4, i.GetPixel(MouseX + 4, MouseY + 4));
            #endregion

            #endregion

            #region Draw Mouse
            Vec2 v = new Vec2((int)MouseX, (int)MouseY);
            i.DrawImage(v, MouseImage);
            #endregion

        }
Example #21
0
 /// <summary>
 /// Processes a click event.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="buttons">The buttons that are pressed.</param>
 internal void DoClick(Vec2 loc, MouseButtons buttons)
 {
     if (!Drawn)
     {
         RedrawBuffer();
     }
     if (WasOverButton)
     {
         if (WindowButtonBounds[overButtonIndx].IsInBounds(loc))
         {
             if (Windows[overButtonIndx].IsActiveWindow)
             {
                 Manager.MinimizeWindow(Windows[overButtonIndx]);
             }
             else if (Windows[overButtonIndx].CurrentState == WindowState.Minimized)
             {
                 Manager.RestoreWindow(Windows[overButtonIndx]);
             }
             else
             {
                 Manager.BringWindowToFront(Windows[overButtonIndx]);
             }
             DrawnOverButton = false;
             DoMouseMove(loc);
         }
         else
         {
             for (int i = 0; i < Windows.Length; i++)
             {
                 if (WindowButtonBounds[i].IsInBounds(loc))
                 {
                     DrawOverButton(WindowButtonBounds[i], Windows[i]);
                     overButtonIndx = i;
                     DrawnOverButton = false;
                     if (Windows[i].IsActiveWindow)
                     {
                         Manager.MinimizeWindow(Windows[i]);
                     }
                     else if (Windows[i].CurrentState == WindowState.Minimized)
                     {
                         Manager.RestoreWindow(Windows[i]);
                     }
                     else
                     {
                         Manager.BringWindowToFront(Windows[i]);
                     }
                     DoMouseMove(loc);
                     return;
                 }
             }
         }
     }
     else
     {
         for (int i = 0; i < Windows.Length; i++)
         {
             if (WindowButtonBounds[i].IsInBounds(loc))
             {
                 DrawOverButton(WindowButtonBounds[i], Windows[i]);
                 overButtonIndx = i;
                 DrawnOverButton = false;
                 if (Windows[i].IsActiveWindow)
                 {
                     Manager.MinimizeWindow(Windows[i]);
                 }
                 else if (Windows[i].CurrentState == WindowState.Minimized)
                 {
                     Manager.RestoreWindow(Windows[i]);
                 }
                 else
                 {
                     Manager.BringWindowToFront(Windows[i]);
                 }
                 DoMouseMove(loc);
                 return;
             }
         }
     }
 }
Example #22
0
 /// <summary>
 /// The default constructor.
 /// </summary>
 /// <param name="loc">The location of the control in it's parent container.</param>
 /// <param name="size">The size of the control.</param>
 public Control(Vec2 loc, Vec2 size)
 {
     this.X = loc.X;
     this.Y = loc.Y;
     this.Size = size;
     this.Closing = new DisposingEvent(DummyDisposingEvent);
     this.BeforeDispose = new DisposingEvent(DummyDisposingEvent);
     this.AfterDispose = new DisposingEvent(DummyDisposingEvent);
     this.Click = new MouseEvent(DummyMouseEvent);
     this.MouseEnter = new MouseEvent(DummyMouseEvent);
     this.MouseLeave = new MouseEvent(DummyMouseEvent);
     this.MouseDown = new MouseEvent(DummyMouseEvent);
     this.MouseUp = new MouseEvent(DummyMouseEvent);
     this.Bounds = new BoundingBox(this.X, this.X + Size.X, this.Y + Size.Y, this.Y);
 }
Example #23
0
 public Image(Vec2 v)
     : this(v.X, v.Y)
 {
 }
Example #24
0
 /// <summary>
 /// Invokes the Click event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoClick(Vec2 v, MouseButtons b) { Click.Invoke(v, b); }
Example #25
0
        private void Form1_Load(object sender, EventArgs e)
        {
            w1 = new Window(new Vec2(30, 30), new Vec2(120, 80), "Test Window 1");
            w1.ClearColor = Colors.Green;
            Button bt = new Button(new Vec2(10, 10), new Vec2(30, 10));
            bt.Click += new MouseEvent(bt_Click);
            bt.Parent = w1;
            w1.Controls.Add(bt);
            Window w2 = new Window(new Vec2(80, 30), new Vec2(120, 80), "Test Window 2");
            w2.ClearColor = Colors.Red;
            Window w3 = new Window(new Vec2(130, 30), new Vec2(120, 80), "Test Window 3");
            w3.ClearColor = Colors.Blue;
            windowManager.AddWindow(w1);
            windowManager.AddWindow(w2);
            windowManager.AddWindow(w3);
            windowManager.BringWindowToFront(w1);

            InitializeMouse();
            Forms.Cursor.Hide();

            i.Clear(Colors.White);

            //i.DrawString(new Vec2(30, 30), "T", fnt, 20, Orvid.Graphics.FontSupport.FontStyle.Normal, Colors.Black);

            // Draw exit button.
            ExitButton b = new ExitButton(new Vec2(DesktopWidth - 21, 1), new Vec2(20, 20), i, this);
            Objects.Add(b.evnts);


            DrawCursor();
            pictureBox1.Image = (System.Drawing.Bitmap)i;
            pictureBox1.Refresh();
            // Now we need to restore what was behind the mouse.
            Vec2 v = new Vec2((int)MouseX, (int)MouseY);
            i.DrawImage(v, behindMouseImage);
        }
Example #26
0
 /// <summary>
 /// Invokes the MouseLeave event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoMouseLeave(Vec2 v, MouseButtons b) { MouseLeave.Invoke(v, b); }
Example #27
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            foreach (ObjectEvents o in Objects)
            {
                if (o.Bounds.IsInBounds(new Vec2((int)MouseX, (int)MouseY)))
                {
                    o.MouseClick(sender, new Forms.MouseEventArgs(Forms.MouseButtons.Left, 1, (int)MouseX, (int)MouseY, 0));
                }
            }

            windowManager.HandleMouseClick(new Vec2((int)MouseX, (int)MouseY), OForms.MouseButtons.Left, i);

            DrawCursor();
            pictureBox1.Image = (System.Drawing.Bitmap)i;
            pictureBox1.Refresh();
            // Now we need to restore what was behind the mouse.
            Vec2 v = new Vec2((int)MouseX, (int)MouseY);
            i.DrawImage(v, behindMouseImage);
        }
Example #28
0
 /// <summary>
 /// Invokes the MouseUp event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoMouseUp(Vec2 v, MouseButtons b) { MouseUp.Invoke(v, b); }
Example #29
0
 /// <summary>
 /// Handles a MouseClick event.
 /// </summary>
 /// <param name="loc">The location of the mouse.</param>
 /// <param name="buttons">The MouseButtons that are pressed.</param>
 /// <param name="i">The image to draw to.</param>
 public void HandleMouseClick(Vec2 loc, MouseButtons buttons, Image i)
 {
     MouseLocation = loc;
     if (Taskbar.Bounds.IsInBounds(loc))
     {
         Taskbar.DoClick(loc, buttons);
     }
     else
     {
         if (Taskbar.WasOverButton)
         {
             Taskbar.UndrawOverButton(Taskbar.WindowButtonBounds[Taskbar.overButtonIndx], Taskbar.Windows[Taskbar.overButtonIndx]);
         }
         foreach (Window w in ActiveWindows)
         {
             if (w.Bounds.IsInBounds(loc))
             {
                 w.DoClick(loc, OForms.MouseButtons.Left);
                 break;
             }
         }
     }
     this.Draw(i);
 }
Example #30
0
        protected override void Run()
        {
            Console.WriteLine("This is just a test.");

            Vec2 v;
            s.Taskbar.Clear(new Pixel(0,255,0,255));

            //#region Draw myself a palette reference
            //uint i = 0;
            //for (uint height = 0; height < 16; height++)
            //{
            //    for (uint width = 0; width < 16; width++)
            //    {
            //        s.Taskbar.SetPixel((width * 4 + 1), (height * 4 + 1), i);
            //        s.Taskbar.SetPixel((width * 4 + 1), (height * 4 + 2), i);
            //        s.Taskbar.SetPixel((width * 4 + 1), (height * 4 + 3), i);
            //        s.Taskbar.SetPixel((width * 4 + 1), (height * 4 + 4), i);
            //        s.Taskbar.SetPixel((width * 4 + 2), (height * 4 + 1), i);
            //        s.Taskbar.SetPixel((width * 4 + 2), (height * 4 + 2), i);
            //        s.Taskbar.SetPixel((width * 4 + 2), (height * 4 + 3), i);
            //        s.Taskbar.SetPixel((width * 4 + 2), (height * 4 + 4), i);
            //        s.Taskbar.SetPixel((width * 4 + 3), (height * 4 + 1), i);
            //        s.Taskbar.SetPixel((width * 4 + 3), (height * 4 + 2), i);
            //        s.Taskbar.SetPixel((width * 4 + 3), (height * 4 + 3), i);
            //        s.Taskbar.SetPixel((width * 4 + 3), (height * 4 + 4), i);
            //        s.Taskbar.SetPixel((width * 4 + 4), (height * 4 + 1), i);
            //        s.Taskbar.SetPixel((width * 4 + 4), (height * 4 + 2), i);
            //        s.Taskbar.SetPixel((width * 4 + 4), (height * 4 + 3), i);
            //        s.Taskbar.SetPixel((width * 4 + 4), (height * 4 + 4), i);
            //        i++;
            //    }
            //}
            //s.Taskbar.SetPixel(1, 1, 255);
            //s.Taskbar.SetPixel(1, 2, 255);
            //s.Taskbar.SetPixel(1, 3, 255);
            //s.Taskbar.SetPixel(1, 4, 255);
            //s.Taskbar.SetPixel(2, 1, 255);
            //s.Taskbar.SetPixel(2, 2, 255);
            //s.Taskbar.SetPixel(2, 3, 255);
            //s.Taskbar.SetPixel(2, 4, 255);
            //s.Taskbar.SetPixel(3, 1, 255);
            //s.Taskbar.SetPixel(3, 2, 255);
            //s.Taskbar.SetPixel(3, 3, 255);
            //s.Taskbar.SetPixel(3, 4, 255);
            //s.Taskbar.SetPixel(4, 1, 255);
            //s.Taskbar.SetPixel(4, 2, 255);
            //s.Taskbar.SetPixel(4, 3, 255);
            //s.Taskbar.SetPixel(4, 4, 255);
            //#endregion

            v = new Vec2(150, 100);
            s.Taskbar.DrawCircleOutline(v, 10, new Pixel(0, 0, 128, 255));

            //int i1 = 4;
            //int i2 = 9;
            //int i3 = 5;
            //double i1r = Sqrt(i1);
            //double i2r = Sqrt(i2);
            //double i3r = Sqrt(i3);
            //Cosmos.System.Global.Console.WriteLine("The Square root of 4 is: '" + i1r.ToString() + "'");
            //Cosmos.System.Global.Console.WriteLine("The Square root of 9 is: '" + i2r.ToString() + "'");
            //Cosmos.System.Global.Console.WriteLine("The Square root of 5 is: '" + i3r.ToString() + "'");

            //Vec2 lp = new Vec2(175, 50);
            //Vec2 rp = new Vec2(225, 50);
            //Vec2 tp = new Vec2(200, 150);
            //s.Taskbar.DrawTriangle(lp, rp, tp, 4);
            //lp = new Vec2(185, 50);
            //rp = new Vec2(235, 50);
            //tp = new Vec2(210, 150);
            //s.Taskbar.DrawTriangle(lp, rp, tp, 4);

            //s.Taskbar.DrawPolygon(new Vec2[] { new Vec2(100, 50), new Vec2(150, 50), new Vec2(175, 75), new Vec2(175, 125), new Vec2(150, 150), new Vec2(100, 150), new Vec2(75, 125), new Vec2(75, 75) }, (uint)4);
            
            while (true)
            {
                Console.WriteLine("This is just a test.");
                Tick++;
                MouseX = (uint)m.X;
                MouseY = (uint)m.Y;
                //m.HandleMouse();

                if (OddRefresh)
                {
                    s.Taskbar.SetPixel(312, 4, Colors.Black);
                    s.Taskbar.SetPixel(313, 4, Colors.Black);
                    s.Taskbar.SetPixel(312, 5, Colors.Black);
                    s.Taskbar.SetPixel(313, 5, Colors.Black);
                    OddRefresh = false;
                }
                else
                {
                    s.Taskbar.SetPixel(312, 4, new Pixel(0,255,0,255));
                    s.Taskbar.SetPixel(313, 4, new Pixel(0,255,0,255));
                    s.Taskbar.SetPixel(312, 5, new Pixel(0,255,0,255));
                    s.Taskbar.SetPixel(313, 5, new Pixel(0,255,0,255));
                    OddRefresh = true;
                }


                //OButton b = new OButton();
                //b.Color = 31;
                //b.Location = new Vec2(150, 100);
                //b.Size = new Vec2(75, 20);
                //b.Draw();

                char c;
                if (k.GetChar(out c))
                {
                    v = new Vec2(150, 100);
                    s.Taskbar.DrawCircleOutline(v, 20, new Pixel(255, 0, 0, 255));
                    ProcessKeyboard(c);
                    HadCharPrev = true;
                }
                else if (HadCharPrev)
                {
                    v = new Vec2(150, 100);
                    s.Taskbar.DrawCircleOutline(v, 20, new Pixel(0, 255, 0, 255));
                    HadCharPrev = false;
                }
                chrsProcd = 0;

                if (m.Buttons != Mouse.MouseState.None)
                {
                    v = new Vec2(150, 100);
                    s.Taskbar.DrawCircleOutline(v, 30, new Pixel(255, 0, 0, 255));
                }
                else
                {
                    v = new Vec2(150, 100);
                    s.Taskbar.DrawCircleOutline(v, 30, new Pixel(0, 255, 0, 255));
                }

                //for (uint height = 0; height < s.s.PixelHeight; height++)
                //    for (uint width = 0; width < s.s.PixelWidth; width++)
                //        s.SetPixel(height, width, (byte)(width + height));

                //s.DrawPolygon(new Vec2[] { new Vec2(100, 50), new Vec2(150, 50), new Vec2(175, 75), new Vec2(175, 125), new Vec2(150, 150), new Vec2(100, 150), new Vec2(75, 125), new Vec2(75, 75) }, (uint)4);
                //s.DrawPolygonOutline(new Vec2[] { new Vec2(400, 50), new Vec2(450, 50), new Vec2(475, 75), new Vec2(475, 125), new Vec2(450, 150), new Vec2(400, 150), new Vec2(375, 125), new Vec2(375, 75) }, (uint)4);
                //s.DrawTriangle(new Vec2(75,100), new Vec2(75,75), new Vec2(25,100), (uint)216);
                //v = new Vec2(100, 100);
                //s.Taskbar.DrawCircle(v, 20, (uint)16);
                //s.DrawCircleOutline(new Vec2(150, 100), 20, (uint)8);
                //s.DrawCircleOutline(new Vec2(Mouse.X, Mouse.Y), 15, (uint)16);
                //s.Taskbar.DrawElipticalArc(v, 30, 10, 10, 300, (uint)90);
                //s.Taskbar.DrawReverseRectangle(new Vec2(120, 80), new Vec2(80, 140), (uint)238);



                //s.DrawLine(new Vec2(30, 30), new Vec2(80, 80), 9);
                //s.DrawElipse(new Vec2(150, 50), 10, 10, 8);


                // And finally, update the screen
                s.Update();
            }
        }
Example #31
0
 private void ButtonLeave(Vec2 loc, MouseButtons buttons)
 {
     this.DrawDefault();
 }