5 releases (breaking)
0.5.0 | Jan 25, 2024 |
---|---|
0.4.0 | Oct 28, 2023 |
0.3.0 | Jul 22, 2023 |
0.2.0 | Jul 1, 2023 |
0.1.0 | Feb 5, 2023 |
#1511 in Game dev
255KB
313 lines
Fyrox console
A simple and ergonomic way to store and edit configuration in your game at runtime
In-game console for the Fyrox game engine for changing cvars at runtime.
Usage
- Add
cvars-console-fyrox
to yourCargo.toml
:
cargo add cvars-console-fyrox
- Create a
FyroxConsole
when initializing your game:
FyroxConsole::new(&mut engine.user_interface);
You're responsible for opening and closing the console according to your game's key bindings.
You also need to call resized
and ui_message
on the appropriate engine events.
Real-world example
See how RustCycles uses cvars and the console.
Compatibility
The version of fyrox-ui used by your game has to match the version used by cvars-console-fyrox, otherwise you'll get confusing errors such as:
expected struct `fyrox_ui::UserInterface`, found struct `UserInterface`
You can use cargo tree
to debug the issue but in general every time you update the engine after a breaking change, you have to update the console.
This means that there has to be a new major[^major] release of cvars-console-fyrox for each new major release of fyrox-ui even though there are no changes to the console. I will try to release a new version soon after Fyrox but since i am the only maintainer, it might not always be possible. If you need to use the latest Fyrox and cvars-console-fyrox hasn't caught up yet, feel free to submit a PR. Usually the only change needed is updating the version numbers.
You can also temporarily make a fork of the console with the fyrox-ui version number updated and add a patch section to your Cargo.toml
.
[^major]: Since fyrox-ui's version number is 0.y.z
, changing y
is considered a major release as per Cargo's flavor of semantic versioning.
License
AGPL-v3 or newer
Dependencies
~13–27MB
~381K SLoC