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