Search code examples
c#cosmos

How to draw mouse cursor in Cosmos when there isn't any definition for X and Y in mouse class?


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?)


Solution

  • 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.