From 6953293a758a86a7eea88e27c8c72d97f9723080 Mon Sep 17 00:00:00 2001 From: Kenzi Connor Date: Tue, 16 Jul 2024 23:41:18 -0700 Subject: [PATCH] update some docs for the wasm --- Cargo.toml | 8 ++++++-- README.md | 31 ++++++++++++++++++------------- src/lib.rs | 2 +- src/terminal/main.rs | 2 +- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0f2c3e9..3927295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,14 @@ required-features = ["wasm"] [features] default = ["terminal", "png"] -terminal = ["dep:clap"] png = ["dep:image"] +#terminal related features +terminal = ["dep:clap"] +#Preview window popup for the terminal +gui = ["dep:sdl2"] +#Web usage, may want to build with no-default-features to skip irrelevant terminal stuff wasm = ["png", "dep:base64", "dep:gloo", "dep:js-sys", "dep:web-sys", "dep:yew"] -#sdl2 = ["dep:sdl2"] + [dev-dependencies] rusty-hook = "^0.11.2" diff --git a/README.md b/README.md index 1277063..e52f459 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cega -## CGA/EGA (the graphics formats from 80s games) parsing with png/gif/etc output and colored terminal preview +## CGA/EGA (graphics formats from 80s games) parsing with png/etc output, colored terminal preview, pre-alpha of wasm front-end [![github](https://img.shields.io/badge/github-knzai/cega-8da0cb?logo=github)](https://github.com/knzai/cega) [![crates.io](https://img.shields.io/crates/v/cega?logo=crates.io)](https://crates.io/crates/cega) @@ -11,29 +11,34 @@ ## Warning -This is currently very much in an alpha state: apis and CLI arguments may still change heavily and the apis aren't documented. This file has decent usage examples below. +This is currently very much in an alpha state/early beta state: apis and CLI arguments may still change heavily and the apis aren't documented. This file has decent usage examples below. -## Installation dependencies +## Installation -If you use feature `sdl2` you must install the sdl2 libraries first - -### MacOS -`brew install sdl2 sdl2_gfx sdl2_image` - -### Linux -`[sudo] apt-get install libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev` +Standard crate/cargo install ### Features/conditional compilation and related dependencies ```toml [features] default = ["terminal", "png"] -terminal = ["dep:clap"] png = ["dep:image"] -wasm = ["dep:yew"] -#sdl2 = ["dep:sdl2"] +#terminal related features +terminal = ["dep:clap"] +#Preview window popup for the terminal +gui = ["dep:sdl2"] +#web usage may want to build with no-default-features to skip irrelevant terminal stuff +wasm = ["png", "dep:base64", "dep:gloo", "dep:js-sys", "dep:web-sys", "dep:yew"] ``` Including terminal or wasm produces the corresponding binary +If you use feature `gui` you must install the sdl2 libraries: + +### MacOS +`brew install sdl2 sdl2_gfx sdl2_image` + +### Linux +`[sudo] apt-get install libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev` + ## Roadmap/Upcoming ### Priority diff --git a/src/lib.rs b/src/lib.rs index 2a47a27..92f480f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ pub mod color; pub mod image; pub mod parser; -#[cfg(feature = "sdl2")] +#[cfg(feature = "gui")] pub mod sdl; #[cfg(feature = "terminal")] diff --git a/src/terminal/main.rs b/src/terminal/main.rs index c3bb202..00aff02 100644 --- a/src/terminal/main.rs +++ b/src/terminal/main.rs @@ -10,7 +10,7 @@ use cega::image::{self, Image}; use cega::parser::ParserType; #[cfg(feature = "png")] use cega::png; -#[cfg(feature = "sdl2")] +#[cfg(feature = "gui")] use cega::sdl::render_sdl; use cega::terminal::{self, args, *}; use cega::ImageType;