simvx.core.project¶
Project configuration: simvx.toml files.
Schema-driven TOML file describing a SimVX game’s display, physics, input, audio, rendering, export, and editor settings. Uses stdlib tomllib for reading and a small hand-rolled writer for round-tripping.
Public API: from simvx.core.project import ProjectSettings, load_project, save_project
settings = load_project("simvx.toml")
settings.name = "My Game"
save_project(settings, "simvx.toml")
Module Contents¶
Classes¶
TOML-based project configuration. |
Functions¶
An |
|
An action’s sources as the plain data an |
|
Load project settings from a simvx.toml file. |
|
Save project settings to a simvx.toml file. |
|
Search up the directory tree for simvx.toml. |
Data¶
API¶
- simvx.core.project.log¶
‘getLogger(…)’
- simvx.core.project.__all__¶
[‘ProjectSettings’, ‘ValidationError’, ‘load_project’, ‘save_project’, ‘find_project’, ‘input_bindin…
- simvx.core.project.TOML_FILENAME¶
‘simvx.toml’
- simvx.core.project.input_bindings_from_toml(action: str, entries: list[Any]) list[simvx.core.input.actions.Source][source]¶
An
[input]entry’s source list, read by the spelling the rebind file shares.See :mod:
simvx.core.input.spellingfor the forms: a key’s name or a combo, a control’stype:name, a table withheldandexact,{low, high},{up, down, left, right}, and{name = ...}.
- simvx.core.project.input_bindings_to_toml(sources: list[simvx.core.input.actions.Source]) list[Any][source]¶
An action’s sources as the plain data an
[input]entry holds.
- exception simvx.core.project.ValidationError[source]¶
Bases:
ValueErrorRaised when simvx.toml contains invalid values.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- class __cause__¶
- class __context__¶
- __delattr__()¶
- __dir__()¶
- __eq__()¶
- __format__()¶
- __ge__()¶
- __getattribute__()¶
- __getstate__()¶
- __gt__()¶
- __hash__()¶
- __le__()¶
- __lt__()¶
- __ne__()¶
- __new__()¶
- __reduce__()¶
- __reduce_ex__()¶
- __repr__()¶
- __setattr__()¶
- __setstate__()¶
- __sizeof__()¶
- __str__()¶
- __subclasshook__()¶
- class __suppress_context__¶
- class __traceback__¶
- add_note()¶
- class args¶
- with_traceback()¶
- class simvx.core.project.ProjectSettings(data: dict[str, Any] | None = None)[source]¶
TOML-based project configuration.
Sections are stored as plain dicts for simplicity and easy serialization. Top-level fields (name, main) are direct attributes. Any table the class does not model is kept in
extrasand written back out unchanged.Initialization
- __slots__¶
(‘name’, ‘main’, ‘display’, ‘input’, ‘physics’, ‘audio’, ‘rendering’, ‘export_web’, ‘export_desktop’…
- apply_input() None[source]¶
Make the project’s
[input]entries the project layer of every tree’s map.The layer sits over the engine’s own entries and under every tree’s contexts and the player’s rebinds, and it is read live, so a change applied here reaches trees that already exist: that is what makes the editor’s input-map dialog reach the game it is hosting. The entries may name each other in any order, and a set that cannot resolve is refused, naming the problem.
- simvx.core.project.load_project(path: str | pathlib.Path) simvx.core.project.ProjectSettings[source]¶
Load project settings from a simvx.toml file.
Raises: FileNotFoundError: If the file does not exist. tomllib.TOMLDecodeError: If the file is not valid TOML. ValidationError: If values fail schema validation.
- simvx.core.project.save_project(settings: simvx.core.project.ProjectSettings, path: str | pathlib.Path | None = None) None[source]¶
Save project settings to a simvx.toml file.
Args: settings: ProjectSettings to save. path: Output file path. If None, uses settings.project_path.