Попытка сделать Clickable Home Button в моей ОС - PullRequest
0 голосов
/ 30 апреля 2020

Итак, я делаю GUI для моей ОС Cosmos. Я сделал маленькую домашнюю кнопку, но я не знаю, как сделать ее кликабельной. Код, который я попробовал (ниже), не работал, потому что, например, «У мыши нет определения для кнопок».

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

Это связано с моим драйвером мыши или нет? Мне действительно нужна помощь, поэтому, пожалуйста, дайте мне знать, если кто-то другой делал это или есть решение. Вот полный код кнопки моего дома. Я не уверен, стоит ли мне включать код мыши, но дайте мне знать

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();
                    }

                }
            }

Вот ссылка на драйвер мыши, который я использовал https://mega.nz/file/puoTlCaC#p1BPMlQKMhEQDlw5h -3PBDT47cZI2lsbGOv2OmWCO7I и вот код для активации всего

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.
}
...