docs.rs failed to build amethyst-console-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
amethyst-console
A framework around cvar
and imgui
that allows you to easily modify
system configurations at runtime in a user configurable way.
Examples:
width 120
- Set width to 120width
- Print the current widthreset width
- Reset width to its default value (100)find a
- Find all commands witha
in their namereset
- Reset all variables to their defaults
Setup
Add this to your Cargo.toml
[]
= "0.1.0"
Basic Example
Create your config
Be sure it supports the default trait
Implement the visit trait
Create a system
- Call
create_system
using a type parameter to specify the name of your config.
/// This will:
/// - Initialize the struct to its default value
/// - Add it to the world so other services can read in their run loops
/// - Create a console window with everything added by `visit_mut_ext`
let console_system = ;
- Add the system to your app initialization.
let game_data = default
.with_system_desc // <--- ADDED
// ....
Use the config in your systems
Add a console binding
Update your input.ron
file. This will let users open/close the console.
(
axes: {},
actions: {
"toggle_console": [[Key(Escape)]],
},
)
Done
That's it. Your system is now configurable by the user intiated commands. Have fun!
See examples/demo_console.rs
for a complete example with more comments.
Standalone usage
- Disable the
amethyst-system
feature.
[ ]
= "0.1.0"
= false
= []
- Create a console window and your config
let mut console = create_console;
let mut config = default;
- Call build in your render loop
let ui: Ui = ... ;
loop