Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse doesn't work. #88

Open
Siomek101 opened this issue Nov 10, 2023 · 5 comments
Open

Mouse doesn't work. #88

Siomek101 opened this issue Nov 10, 2023 · 5 comments

Comments

@Siomek101
Copy link

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.

@EnterTheVoid-x86
Copy link

...you literally never initalized the mouse 💀

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

put this in your before run

@terminal-cs
Copy link
Contributor

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.

@EnterTheVoid-x86
Copy link

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.

@terminal-cs
Copy link
Contributor

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

@Siomek101
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants