xna 4.0 - XNA how to check if the game window cross "X" is clicked -


Hi creating a game for Windows PC using XNA and when I click the "X" across the game window I want to check, so instead of pulling a menu I can do other things instead of closing the game.

So yes, how can I check the cross-click?

Thank you!

XNA needs nothing special, you can do it without it like that.

In your Start or LoadContent method, your form is used for reference in Windows Form, and need to find a Conclusion Event on that.

  form form = form. Form farmland (window.handle) form; Form.FormClosing + = OnClosing;   

Then using this OnClosing method, you can cancel the closest event, and run your own menu screen. (Possibly by changing the game state and drawing some more)

  zero on-closing (Object Sender, FormClosingEventArgs e) {e.Cancel = true; ShowMenuScreen (); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -