1

I'm creating an Operating System in C# using Cosmos User Kit.
I want to draw a mouse cursor in my OS.
But the "Mouse" class does not contain a definition for X and Y.

Here's my code:

using Cosmos.System.Graphics;
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using System.Drawing;
using Cosmos.Core.IOGroup;

namespace NewOPeratingSystem
{
    public class Kernel : Sys.Kernel
    {
        Canvas canvas;
        public static Mouse m = new Mouse();
        protected override void BeforeRun()
        {
            Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
            canvas = FullScreenCanvas.GetFullScreenCanvas();
            canvas.Clear(Color.Blue);

        }

        protected override void Run()
        {


            Pen pen = new Pen(Color.Red);
            canvas.DrawLine(pen, m.X, m.Y, m.X + 5, m.Y);
            canvas.DrawLine(pen, m.X, m.Y, m.X, m.Y - 5);
            canvas.DrawLine(pen, m.X, m.Y, m.X + 5, m.Y - 5);





        }
    }
}

And i receive the following error:

CS1061:'Mouse' does not contain a definition for 'X' and no accessible extension method 'X' accepting a first argument of type 'Mouse' could be found (are you missing a using directive or an assembly reference?)

and

CS1061:'Mouse' does not contain a definition for 'Y' and no accessible extension method 'Y' accepting a first argument of type 'Mouse' could be found (are you missing a using directive or an assembly reference?)

Mikev
  • 2,012
  • 1
  • 15
  • 27
Sdrf1445
  • 147
  • 2
  • 2
  • 9

1 Answers1

0

Im sorry if I am late but i found the answer.

Cosmos.System.MouseManager is the thing before using it you must give it ScreenHeight and ScreenWidth. NOTE: It is a static class.

Vuk Uskokovic
  • 155
  • 10
  • It depends how you structured your display system. – Vuk Uskokovic Apr 07 '19 at 18:40
  • @Sdrf1445 You just use (int)MouseManager.X and (int)MouseManager.Y and draw the cursor you will have to draw it every frame so it moves and is not fixed. But what I said you just at BeforeRun() do MouseManager,ScreenWidth = YourScreenWidth.That is pretty much it. – Vuk Uskokovic Apr 07 '19 at 18:42
  • @Sdrf1445 btw redraw every frame in Run() function. You have to draw it then clear the canvas.It will flicker so you have to Double Buffer It. https://en.wikipedia.org/wiki/Multiple_buffering – Vuk Uskokovic Apr 07 '19 at 18:44