diff --git a/docs/api/api.md b/docs/api/api.md index 5e5c931..a9e9843 100644 --- a/docs/api/api.md +++ b/docs/api/api.md @@ -7,6 +7,7 @@ new_window(title: str, width: int, height: int) change_icon(image_path: str) loop(your_loop_func) set_fps(self, fps: int) +force_quit() ``` ## Event diff --git a/docs/wiki/wiki.md b/docs/wiki/wiki.md index fda24fa..20fbdf7 100644 --- a/docs/wiki/wiki.md +++ b/docs/wiki/wiki.md @@ -321,3 +321,10 @@ main.ui.text.print_text(window, "Your text", 10, 10, "Arial", 20, main.color.WHI ## Quit The quitting of the engine is done automaticly for you, so you dont have to worry about it. + +### Force to quit +If you want to force quit due to some reason, its pretty easy: +```python +main.window.force_quit() +``` + diff --git a/src/fusionengine/files/window.py b/src/fusionengine/files/window.py index f075378..7cc5ebd 100644 --- a/src/fusionengine/files/window.py +++ b/src/fusionengine/files/window.py @@ -95,6 +95,15 @@ def set_fps(self, fps: int) -> None: """ self._fps = fps + def force_quit(self) -> None: + """Force quits the window. + + Args: + window: Your window + """ + self._running = False + del self.window + def _refresh(self, window: _CustomRenderer) -> None: """Does all things for refreshing window. (Not for the user)