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 X and Y always 0 #3102

Open
Kazancik opened this issue Nov 16, 2024 · 3 comments
Open

Mouse X and Y always 0 #3102

Kazancik opened this issue Nov 16, 2024 · 3 comments
Labels

Comments

@Kazancik
Copy link

Area of Cosmos - What area of Cosmos are we dealing with?

Graphics(Mouse, Visual Basic)

Expected Behaviour - What do you think that should happen?

It displaying the correct place of the mouse

Actual Behaviour - What unexpectedly happens?

It always shows 0 as X and Y

Reproduction - How did you get this error to appear?

Running this in VMware or VirtualBox
`Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Runtime.ConstrainedExecution
Imports System.Text
Imports Cosmos.Core
Imports Cosmos.Core.IOGroup
Imports Cosmos.System
Imports Cosmos.System.FileSystem.CosmosVFS
Imports Cosmos.System.Graphics
Imports Cosmos.System.Graphics.Extensions
Imports Console = System.Console
Imports Point = Cosmos.System.Graphics.Point

Namespace Emulated_Operating_System
Public Class Kernel
Inherits Cosmos.System.Kernel
Dim theCanvas As Canvas

    Public Overrides Sub Start()
        MyBase.Start()
    End Sub

    Protected Overrides Sub BeforeRun()

    End Sub


    Protected Overrides Sub Run()
        Try

            Console.Write("Komutum: ")
            Dim imp = Console.ReadLine()

            If imp.StartsWith("kurgui", StringComparison.InvariantCultureIgnoreCase) Then
                theCanvas = FullScreenCanvas.GetFullScreenCanvas()
                theCanvas.Clear(Color.DarkGoldenrod)

                While True

                    Dim cur = New Point(Int(MouseManager.X), (Int(MouseManager.Y)))
                    theCanvas.DrawRectangle(Color.Beige.ToPen(1), cur.X + 1, cur.Y + 1, cur.X + 50, cur.Y + 50)
                    theCanvas.Display()
                End While
            End If
        Catch ex As Exception

        End Try



    End Sub
End Class

End Namespace`

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

Latest User Kit and Visual Studio 2022

@Kazancik Kazancik added the Bug label Nov 16, 2024
@Gabolate
Copy link

You need to set MouseManager.ScreenWidth and ScreenHeight, otherwise the kernel doesn't know the area where the mouse is allowed to move

@Kazancik
Copy link
Author

Oh, I guess I didn't read the doc correctly. Do you know how to get the current ScreenWidth and ScreenHeight? (because I belive it sets the best setting for the screen)

@Gabolate
Copy link

canvas.Mode.Width and canvas.Mode.Height will give you the screen size, just give it to MouseManager and it should work

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

No branches or pull requests

2 participants