1

So I'm making a GUI for my Cosmos OS. I made a little home button but I don't Know how to make it clickable. The code I tried (below) didn't work Because for example "Mouse doesn't have a Definition for Buttons".

if (Mouse.Buttons == Mouse.MouseState.Left && Mouse.y >= 600) //No need to check x
{
     ifMouseClicked();
}

Does this have to do with my mouse driver or not? I Really need help so please let me know if there is another was of doing this or if there's a fix. Here's the full code of my home button. I'm not sure if I should include the mouse code too but let me know

for (uint w = 0; w < 30; w++)
            {

                for (uint h = 0; h < 30; h++)
                {

                    uint x = w;

                    uint y = 600 - h;

                    driver.SetPixel(x, y, 0xFFFFFF); //SetPixel(x,y,color)

                    if (Mouse.Buttons == Mouse.MouseState.Left && Mouse.y >= 600) //No need to check x
                    {
                        ifMouseClicked();
                    }

                }
            }

Here is the link to the Mouse Driver I used https://mega.nz/file/puoTlCaC#p1BPMlQKMhEQDlw5h-3PBDT47cZI2lsbGOv2OmWCO7I and here is the code to activate everything

Cosmos.HAL.Drivers.PCI.Video.VMWareSVGAII driver = new Cosmos.HAL.Drivers.PCI.Video.VMwareSVGAII();
driver.SetMode(800, 600);
driver.Clear(0x255);


Mouse m = new Mouse(800, 600); // Note that you'll have to specify the screen 
resolution (width and height).
bool OK = true; // Directly using true will cause debugging issues, and even if you disable it, (to make the GUI not lag) it's still very useful to just 
disable the GUI.
while (OK)
{
   uint Width = 800;
   uint Height = 600;
   m.Draw(driver); // Draws the mouse with the specified driver
   driver.Update(0, 0, Width, Height); // Updates the screen as a whole to reduce flicker.
}
  • Add the full code please, I will test and try to debug it for you – A user Apr 30 '20 at 07:19
  • @Auser Like the full OS code? –  Apr 30 '20 at 19:13
  • just the mouse driver as well please – A user May 02 '20 at 06:25
  • @Auser sorry it took so long but I posted the link to the mouse driver I used. –  May 05 '20 at 04:14
  • Thanks, I am working on it., @It's McNoswald, meanwhile check out this example of a GUI that I found: https://www.codeproject.com/script/Articles/Download.aspx?file=/KB/cs/842576/Article_src.zip&rp=https://www.codeproject.com/ – A user May 05 '20 at 09:20

0 Answers0