diff --git a/README.md b/README.md index e84033a..a551894 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,27 @@ requests a low power (aka integrated) GPU by default. If the examples are not wo You should also try to keep your graphics drivers up-to-date, especially if you have an old Intel integrated GPU. Keep in mind that some drivers and GPUs are EOL and will not be supported. +### Logging + +You may want to use the `RUST_LOG` environment variable (see [`env_logger`](https://docs.rs/env_logger) for full documentation) to gain additional insight while troubleshooting the examples. `RUST_LOG=trace` will spew all logs to `stderr` on debug builds: + +``` +$ RUST_LOG=trace cargo run --package minimal-winit +``` + +And also on release builds when default features are disabled: + +``` +$ cd examples/minimal-winit +$ RUST_LOG=trace cargo run --release --no-default-features +``` + +Alternatively, nightly Cargo allows using the `--no-default-features` flag directly from the top-level directory in combination with the unstable `-Zpackage-features` flag: + +``` +$ RUST_LOG=trace cargo run --release --package minimal-winit -Zpackage-features --no-default-features +``` + ## Comparison with `minifb` The [`minifb`](https://crates.io/crates/minifb) crate shares some similarities with `pixels`; it also allows rapid prototyping of 2D games and emulators. But it requires the use of its own window/GUI management, event loop, and input handling. One of the disadvantages with the `minifb` approach is the lack of hardware acceleration (except on macOS, which uses Metal but is not configurable). An advantage is that it relies on fewer dependencies. diff --git a/examples/conway/Cargo.toml b/examples/conway/Cargo.toml index d79d874..a0d8bbf 100644 --- a/examples/conway/Cargo.toml +++ b/examples/conway/Cargo.toml @@ -5,12 +5,16 @@ authors = ["Jay Oster "] edition = "2018" publish = false +[features] +optimize = ["log/release_max_level_warn"] +default = ["optimize"] + [dependencies] byteorder = "1.3.4" env_logger = "0.7.1" getrandom = "0.1.14" line_drawing = "0.8.0" -log = { version = "0.4.8", features = [ "release_max_level_warn" ] } +log = "0.4.8" pixels = { path = "../.." } randomize = "3.0.1" winit = "0.22.0" diff --git a/examples/invaders/Cargo.toml b/examples/invaders/Cargo.toml index 635f5a5..029cae1 100644 --- a/examples/invaders/Cargo.toml +++ b/examples/invaders/Cargo.toml @@ -5,12 +5,16 @@ authors = ["Jay Oster "] edition = "2018" publish = false +[features] +optimize = ["log/release_max_level_warn"] +default = ["optimize"] + [dependencies] byteorder = "1.3.4" env_logger = "0.7.1" getrandom = "0.1.14" gilrs = "0.7.4" -log = { version = "0.4.8", features = [ "release_max_level_warn" ] } +log = "0.4.8" pixels = { path = "../.." } randomize = "3.0.1" simple-invaders = { path = "simple-invaders" } diff --git a/examples/minimal-sdl2/Cargo.toml b/examples/minimal-sdl2/Cargo.toml index e089d9b..c896857 100644 --- a/examples/minimal-sdl2/Cargo.toml +++ b/examples/minimal-sdl2/Cargo.toml @@ -5,8 +5,12 @@ authors = ["Jay Oster "] edition = "2018" publish = false +[features] +optimize = ["log/release_max_level_warn"] +default = ["optimize"] + [dependencies] -beryllium = { version = "0.2.1", features = [ "extern_crate_raw_window_handle" ] } +beryllium = { version = "0.2.1", features = ["extern_crate_raw_window_handle"] } env_logger = "0.7.1" -log = { version = "0.4.8", features = [ "release_max_level_warn" ] } +log = "0.4.8" pixels = { path = "../.." } diff --git a/examples/minimal-winit/Cargo.toml b/examples/minimal-winit/Cargo.toml index 8eda3f5..7acbc4e 100644 --- a/examples/minimal-winit/Cargo.toml +++ b/examples/minimal-winit/Cargo.toml @@ -5,9 +5,13 @@ authors = ["Jay Oster "] edition = "2018" publish = false +[features] +optimize = ["log/release_max_level_warn"] +default = ["optimize"] + [dependencies] env_logger = "0.7.1" -log = { version = "0.4.8", features = [ "release_max_level_warn" ] } +log = "0.4.8" pixels = { path = "../.." } winit = "0.22.0" winit_input_helper = "0.6.0"