Prism-OS icon indicating copy to clipboard operation
Prism-OS copied to clipboard

Mouse doesn't work.

Open Siomek101 opened this issue 1 year ago • 5 comments

Describe the bug

Mouse doesn't move.

To Reproduce

My code: `using PrismAPI.Hardware.GPU; using Cosmos.System; using PrismAPI.Graphics; using PrismAPI.UI; using PrismAPI.UI.Controls; using System.Numerics;

namespace Renderingindimension { public class Program : Kernel { public Display Canvas = null!; public Window MyWindow = null!; public Label MyLabel = null!; public Textbox MyTextBox = null!;

    protected override void BeforeRun()
    {

        Canvas = Display.GetDisplay(800, 600); // Define the canvas instance.
        MyWindow = new Window(50, 50, 500, 400, "My Window");
        MyLabel = new(50, 55, $"{Canvas.GetFPS()} FPS");
        MyTextBox = new(30, 30, "i dunno man", "");

        MyWindow.Controls.Add(MyLabel);
        MyWindow.Controls.Add(MyTextBox);
        WindowManager.Windows.Add(MyWindow);
    }

    protected override void Run()
    {
        while (true)
        {
            Canvas.Clear(Color.CoolGreen); // Draw a green background.
            MyWindow.X += 1;
            WindowManager.Update(Canvas);
            Canvas.DrawFilledRectangle((int)MouseManager.X, (int)MouseManager.Y, 16, 16, 0, Color.StackOverflowOrange); // Draw the mouse.
            Canvas.DrawFilledTriangle(new PrismAPI.Graphics.Rasterizer.Triangle(new Vector3(40, 40, 0), new Vector3(50, 50, 0), new Vector3(35, 75, 0), Color.Red));
            Canvas.Update();
        }
        
    }
}

} ` I ran it and it moved the window, but not the mouse

Expected behavior

Mouse is working

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Siomek101 avatar Nov 10 '23 20:11 Siomek101

...you literally never initalized the mouse 💀

MouseManager.ScreenWidth = 800;
MouseManager.ScreenHeight = 600;

put this in your before run

EnterTheVoid-x86 avatar Nov 10 '23 21:11 EnterTheVoid-x86

Hi,

Cool to know people still find interest in this project, and that it even works with cosmos still. I haven't worked on this in months due to the community around cosmos being very poor in terms of people constantly fighting and having lack of respect for each other, so I won't be able to help much with issues, but I can try.

The other comment above is incorrect, Display.GetDisplay(X, Y) initializes the size. What are you running this on? If it's using raw USB input, it won't work because cosmos has no USB support as far as I'm concerned.

terminal-cs avatar Nov 12 '23 05:11 terminal-cs

The other comment above is incorrect, Display.GetDisplay(X, Y) initializes the size. What are you running this on? If it's using raw USB input, it won't work because cosmos has no USB support as far as I'm concerned.

Using PrismAPI myself, I have to add those two lines of code in order for the mouse to work. Without it, there is no mouse movement.

EnterTheVoid-x86 avatar Nov 12 '23 17:11 EnterTheVoid-x86

The other comment above is incorrect, Display.GetDisplay(X, Y) initializes the size. What are you running this on? If it's using raw USB input, it won't work because cosmos has no USB support as far as I'm concerned.

Using PrismAPI myself, I have to add those two lines of code in order for the mouse to work. Without it, there is no mouse movement.

Maybe your not doing it right https://github.com/Project-Prism/Prism-OS/blob/b8565e6cfd6b023e261151729c29d2527627e6ae/PrismAPI/Hardware/GPU/Display.cs#L27C10-L27C10

terminal-cs avatar Nov 12 '23 18:11 terminal-cs

Hi,

Cool to know people still find interest in this project, and that it even works with cosmos still. I haven't worked on this in months due to the community around cosmos being very poor in terms of people constantly fighting and having lack of respect for each other, so I won't be able to help much with issues, but I can try.

The other comment above is incorrect, Display.GetDisplay(X, Y) initializes the size. What are you running this on? If it's using raw USB input, it won't work because cosmos has no USB support as far as I'm concerned.

I had those 2 lines but it still didn't work (i had this first, then i saw source code and deleted those lines)

Siomek101 avatar Nov 12 '23 20:11 Siomek101