I am trying to make an application the locks the screen, then on my button psuh, it closes. I have the press part and the close part but now I am trying to make sure it stays open if somone Alt+f4 or Control+Alt+Delete. Here is my code so far:
protected override void Update(GameTime gameTime){
keyboardState =
Keyboard.GetState(); // If the ESC key is pressed, skip the rest of the update. if (exitKeyPressed() == false){
base.Update(gameTime);Simulate();
}
}
void Simulate(){
// Add game-specific logic.}
bool exitKeyPressed(){
// Check to see if ESC was pressed on the keyboard or Back was pressed on the controller. if (keyboardState.IsKeyDown(Keys.Q)){
if (keyboardState.IsKeyDown(Keys.W)){
if (keyboardState.IsKeyDown(Keys.E)){
if (keyboardState.IsKeyDown(Keys.R)){
if (keyboardState.IsKeyDown(Keys.M)){
Exit();
return true;}
}
}
}
}
return false; if (keyboardState.IsKeyDown(Keys.F4)){
using (Game1 game = new Game1()){
game.Run();
}
}
}
Moderators: I know this is longer than 10 lines but this is the part of the program that I need help with, it can't be shortened. (Im pretty sure)
____________________________________
How do I keep it open for Alt+f4 or Control+Alt+Delete and any other tricky ways