public void handleMouse(MouseDriver mouse) { if (mouse.LeftClickState()) { if (held) { x = mouse.X(); y = mouse.Y(); } else { if (mouse.X() > x && mouse.X() < (x + width - 60) && mouse.Y() > y && mouse.Y() < y + 20) { held = true; } } } else { held = false; } }
/* protected override void Run() * { * Font f = new BasicFont(); * FontRenderer fr = new FontRenderer(display, f, 63); * FontRenderer dfr = new FontRenderer(display, f, 0); * * IconPack ip = new BasicIconPack(); * IconRenderer ir = new IconRenderer(display, ip); * * startMenu = false; * held = false; * * second = time.Second(); * while (true) * { * WindowManager.handleMouse(mouse); * handleMouse(mouse); * draw(fr, dfr, startMenu, ir); * WindowManager.drawWindows(display, ir, dfr); * mr.renderMouse(); * display.step(); * } */ public void handleMouse(MouseDriver mouse) { if (mouse.LeftClickState()) { if (held == false) { if (mouse.X() > 0 && mouse.X() < 120 && mouse.Y() > 0 && mouse.Y() < 15) { startMenu = !startMenu; } else if (startMenu && mouse.X() > 0 && mouse.X() < 120 && mouse.Y() > 15 && mouse.Y() < 155) { if (mouse.X() > 25 && mouse.X() < 110 && mouse.Y() > 80 && mouse.Y() < 95) { Sys.Power.Reboot(); } } else { if (mouse.X() > 85 && mouse.X() < 105 && mouse.Y() > 15 && mouse.Y() < 25) { NotepadWindow.reset(); } if (startMenu == true) { startMenu = false; } } held = true; } } else { held = false; } }