giant freakin documentation and reorganization pass, it also uses cmake because all the building was getting too complicated for shell scripts
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
## \file desktop.py
|
||||
# \brief Entrypoint file for desktop versions of the Seagull Game.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
@@ -9,8 +12,19 @@ import webview
|
||||
|
||||
import flask
|
||||
import fs.tree
|
||||
try:
|
||||
import pyi_splash
|
||||
except ImportError:
|
||||
class NullModule():
|
||||
def update_text(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
from pylocal import core, actions, desktop, dev, gamedata, items, tick
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
pyi_splash = NullModule()
|
||||
|
||||
from pylocal import core, actions, desktop, dev, gamedata, items, tick, upgrades
|
||||
|
||||
core.desktop_mode = True
|
||||
sig_exit = threading.Event()
|
||||
@@ -23,13 +37,14 @@ argo = argp.parse_args()
|
||||
def index():
|
||||
if not core.base_context_live:
|
||||
core.render_base_context()
|
||||
core.base_context["scripts"].insert(0, core.app.url_for("static", filename="js/desktop-structuredclone.js"))
|
||||
core.base_context["scripts"].insert(1, core.app.url_for("static", filename="js/seagull-desktop.js"))
|
||||
core.base_context["scripts"].insert(0, (core.app.url_for("static", filename="js/desktop-structuredclone.js"), False))
|
||||
core.base_context["scripts"].insert(1, (core.app.url_for("static", filename="js/seagull-desktop.js"), False))
|
||||
gamedata.vfs.copy_out("templates/main_page.j2", dest=core.path_appdir.as_posix())
|
||||
return flask.render_template("main_page.j2", **core.base_context)
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
pyi_splash.update_text("Determining storage directory")
|
||||
if sys.platform.startswith("win"):
|
||||
storage_dir = pathlib.Path(os.environ["APPDATA"]) / "seagull"
|
||||
elif sys.platform.startswith("darwin"): # macos
|
||||
@@ -39,13 +54,16 @@ if __name__ == "__main__":
|
||||
storage_dir = pathlib.Path(os.environ["HOME"]) / ".local/share/seagull"
|
||||
desktop.path_storagedir = storage_dir
|
||||
|
||||
pyi_splash.update_text("Loading VFS")
|
||||
gamedata.vfs.load_data_source("basepak")
|
||||
gamedata.vfs.load_data_source("seagull.pak", proto="zip")
|
||||
|
||||
if argo.debug:
|
||||
desktop.api.debug_mode = True
|
||||
pyi_splash.update_text("Starting browser shell")
|
||||
storage_dir.mkdir(exist_ok=True, parents=True)
|
||||
webview.create_window("Seagull Game", core.app, js_api=desktop.api)
|
||||
webview.create_window("Seagull Game", core.app, js_api=desktop.api, width=1280, height=720)
|
||||
pyi_splash.close()
|
||||
webview.start(private_mode=False, storage_path=storage_dir.as_posix(), debug=True if argo.debug else False)
|
||||
except KeyboardInterrupt:
|
||||
core.log.info("Goodnight, moon ...")
|
||||
|
Reference in New Issue
Block a user