How can I make a cursor in Cosmos #2089
Replies: 5 comments 7 replies
-
What part of making a cursor are you stuck on? Getting the mouse position? Drawing the cursor to the screen? |
Beta Was this translation helpful? Give feedback.
-
https://www.codeproject.com/Articles/842576/Cosmos-Large-Cursor-GUI-tutorial have you tried this? |
Beta Was this translation helpful? Give feedback.
-
A GUI is a lot of work. A Cursor is the least of your worries if you have nothing to draw. You want to capture the position of your mouse and depending on where you actually place your mouse on the canvas is your starting point and from there it's a matter of relative movement based on the speed of your mouse to screen. If there is a mouse class already then that's a start. |
Beta Was this translation helpful? Give feedback.
-
that should work protected override void BeforeRun()
{
Console.WriteLine("Maybe a issue on driver which not showing canvas");
canvas = new SVGAIICanvas(new Mode(800, 600, ColorDepth.ColorDepth32));
canvas.Clear(Color.Green);
Sys.MouseManager.ScreenWidth = 800;
Sys.MouseManager.ScreenHeight = 600;
Sys.MouseManager.X = (uint)((int)canvas.Mode.Columns / 2);
Sys.MouseManager.Y = (uint)((int)canvas.Mode.Rows / 2);
}
protected override void Run()
{
try
{
Pen bluepen = new Pen(Color.Cyan);
Pen brownpen = new Pen(Color.FromArgb(101, 67, 33));
canvas.DrawLine(bluepen, (int)Cosmos.System.MouseManager.X, (int)Cosmos.System.MouseManager.Y,
(int)Cosmos.System.MouseManager.X + 6, (int)Cosmos.System.MouseManager.Y);
canvas.DrawLine(bluepen, (int)Cosmos.System.MouseManager.X, (int)Cosmos.System.MouseManager.Y,
(int)Cosmos.System.MouseManager.X, (int)Cosmos.System.MouseManager.Y + 6);
canvas.DrawLine(brownpen, (int)Cosmos.System.MouseManager.X, (int)Cosmos.System.MouseManager.Y,
(int)Cosmos.System.MouseManager.X + 12, (int)Cosmos.System.MouseManager.Y + 12);
canvas.Display();
canvas.Clear(Color.Green); I added this - ProfessorDJ thx astrido
}
catch (Exception e)
{
mDebugger.Send("Exception occurred: " + e.Message);
Sys.Power.Shutdown();
}
} |
Beta Was this translation helpful? Give feedback.
-
Area of Cosmos - What area of Cosmos are we dealing with?
Hi, I'd like to know how I can code a cursor into my project. By the way the code can only be in the kernel I can't create seperate .cs files since all my GUI code is in the kernel so I want the cursor code to be in the kernel as well
Expected Behaviour - What do you think that should happen?
Actual Behaviour - What unexpectedly happens?
Reproduction - How did you get this error to appear?
Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?
UserKit c#
Beta Was this translation helpful? Give feedback.
All reactions