NeoEditor icon indicating copy to clipboard operation
NeoEditor copied to clipboard

Pause lua function

Open brycehenley opened this issue 11 years ago • 2 comments

One of the first things I need to add to the engine is the ability to pause the game in script. This is already done when you Alt-Tab out of the player on any OS. This is probably a system call or something generic related to the window manager. I'll look first to figure out if the pause on Alt-Tab was written intentionally into the player.

brycehenley avatar Sep 11 '14 04:09 brycehenley

The game only updates when the window is active. That is completely intentional.

You should not stop all script updates. That way you are not able to resume game play! Only make a "pausePhysics" function for Lua to pause all physics updates and do the pausing logic in your game. That way you can show a menu, play animations etc.

If you stop all scripts you will not be able to resume them from a script. You might want to look into MGame.cpp for this. There is most of the update logic.

ypflanzer avatar Sep 11 '14 08:09 ypflanzer

This functionality is basically implemented now. You can turn off physics simulation by setting a game flag. This might be exposed as a global configuration variable ("g_physics" or something).

ypflanzer avatar Oct 24 '16 10:10 ypflanzer