I want to implement an grafic-menue at startup where the user can choose grafical options (like antialiasing,shadows etc.). Atm i am writing the selected options into a config.prc file. The problem is, the changed options are only read when the game restarts (because the config is only read at restart). I want that option screen at startup and after that the real game should start, but i dont know how to close the optionsscreen and restart the whole engine, so the config is read. Or is there a way to force panda to read a new config-file?
Im sure this should be easy and im missing something…
You can read a new config file, either with an explicit call to loadConfigFile(), or with cpMgr.reloadImplicitPages() (if the file was automatically located by the $PANDA_PRC_DIR or $PANDA_PRC_PATH variables). However, certain config variables don’t take effect even when reloading, such as variables that are used to configure the initial window parameters (once the window is open, it’s too late).
There are different approaches to restarting the whole game. It would be possible to do it without restarting Python, but depending on your needs, it might be easier just to use something like os.system() to start the main part of the game as a separate Python process.