Skip to content

Commit

Permalink
Huge rework and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Dec 13, 2023
1 parent b9c5127 commit 6e2f701
Show file tree
Hide file tree
Showing 19 changed files with 530 additions and 286 deletions.
71 changes: 37 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@

[package]
name = "bevy_dev_console"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["builtin-parser"]

builtin-parser = ["dep:logos"]

[dependencies]
ahash = "0.8.6"
bevy = "0.12.1"
bevy_egui = "0.23.0"
bevy_egui = "0.24.0"
chrono = "0.4.31"
logos = "0.13.0"
instant = "0.1.12"
tracing-log = "0.2.0"
tracing-subscriber = "0.3.18"

logos = { version = "0.13.0", optional = true }

[target.'cfg(target_os = "android")'.dependencies]
android_log-sys = "0.3.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
tracing-wasm = "0.2.1"


# Enable a small amount of optimization in debug mode
[profile.dev]
Expand All @@ -25,3 +38,4 @@ opt-level = 3

[lints]
clippy.useless_format = "allow"
rust.missing_docs = "warn"
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# bevy_dev_console

`bevy_dev_console` is a [Source](https://en.wikipedia.org/wiki/Source_(game_engine))-like developer console plugin for the [Bevy Game Engine](https://github.com/bevyengine/bevy).

![Image of the developer console](doc/console.png)

> **Warning:** `bevy_dev_console` is currently in its early development stages. Expect breaking changes in the near future (especially when using the built-in command parser). For this reason its only available as a git package at the moment.
## Usage

1. Add the `bevy_dev_console` git package.
```bash
cargo add --git https://github.com/doonv/bevy_dev_console.git
```
2. Import the `prelude`.
```rs
use bevy_dev_console::prelude::*;
```
3. Add the plugins.
```rs
App::new()
.add_plugins((
// Start capturing logs before the default plugins initiate.
ConsoleLogPlugin::default(),
// Add the default plugins without the LogPlugin.
// Not removing the LogPlugin will cause a panic!
DefaultPlugins.build().disable::<LogPlugin>(),
// Add the dev console plugin itself.
DevConsolePlugin,
))
```
4. That should be it! You can now press the `` ` `` or `~` key on your keyboard and it should open the console!

## Features

`builtin-parser (default)` allows you to optionally remove the built-in parser and replace it with your own.

## Bevy Compatibility


| bevy | bevy_dev_console |
| ------ | ---------------- |
| 0.12.* | 0.1.0 |
Binary file added doc/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions examples/basic.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
use bevy::{log::LogPlugin, prelude::*};
//! A simple exmaple
use bevy::{
log::{Level, LogPlugin},
prelude::*,
};
use bevy_dev_console::prelude::*;

fn main() {
App::new()
.add_plugins((
bevy_dev_console::prelude::LogPlugin::default(),
// Start capturing logs before the default plugins initiate.
// Also append a filter that shows `TRACE` logs from this module.
ConsoleLogPlugin::default().append_filter(module_path!(), Level::TRACE),
// Add the default plugins without the LogPlugin.
// Not removing the LogPlugin will cause a panic!
DefaultPlugins.build().disable::<LogPlugin>(),
DevConsolePlugin,
// Add the dev console plugin itself.
))
.add_systems(Startup, test)
.run();
}

pub fn test() {
fn test() {
trace!("tracing");
debug!("solving issues...");
info!("hello :)");
Expand Down
Loading

0 comments on commit 6e2f701

Please sign in to comment.