split out experimental playground GUI stuff into its own crate

This commit is contained in:
Dustin Carlino 2018-09-09 18:53:54 -07:00
parent 64d4117c0c
commit 571aa2f786
5 changed files with 35 additions and 21 deletions

View File

@ -12,5 +12,6 @@ members = [
"headless",
"kml",
"map_model",
"playground_gui",
"sim",
]

View File

@ -873,3 +873,10 @@ ah no, it's because we use max_lookahead_dist in accel_to_follow, and the speed
https://www.reddit.com/r/rust_gamedev/comments/7f7w60/auditioning_a_replacement_for_bearlibterminal/
https://github.com/ggez/ggez/blob/master/examples/drawing.rs
things to follow:
- https://suhr.github.io/gsgt/
- https://wiki.alopex.li/LearningGfx
- https://github.com/nical/lyon/blob/master/examples/gfx_basic/src/main.rs
- porting to wasm: https://aimlesslygoingforward.com/blog/2017/12/25/dose-response-ported-to-webassembly/

View File

@ -27,7 +27,6 @@ extern crate strum;
extern crate strum_macros;
mod colors;
mod experimental;
mod kml;
mod plugins;
mod render;
@ -46,10 +45,6 @@ struct Flags {
#[structopt(long = "rng_seed")]
rng_seed: Option<u8>,
/// Use the experimental GUI
#[structopt(long = "experimental")]
experimental_gui: bool,
/// Extra KML to display
#[structopt(long = "kml")]
kml: Option<String>,
@ -61,19 +56,10 @@ struct Flags {
fn main() {
let flags = Flags::from_args();
if flags.experimental_gui {
ezgui::run(
experimental::UI::new(),
"Experimental drawing mechanism",
1024,
768,
);
} else {
ezgui::run(
ui::UI::new(flags.load, flags.scenario_name, flags.rng_seed, flags.kml),
"A/B Street",
1024,
768,
);
}
ezgui::run(
ui::UI::new(flags.load, flags.scenario_name, flags.rng_seed, flags.kml),
"A/B Street",
1024,
768,
);
}

11
playground_gui/Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "playground_gui"
version = "0.1.0"
authors = ["Dustin Carlino <dabreegster@gmail.com>"]
[dependencies]
ezgui = { path = "../ezgui" }
geom = { path = "../geom" }
map_model = { path = "../map_model" }
piston = "*"
piston2d-graphics = "*"

View File

@ -1,8 +1,13 @@
extern crate ezgui;
extern crate geom;
extern crate graphics;
extern crate map_model;
extern crate piston;
use ezgui::canvas::Canvas;
use ezgui::input::UserInput;
use ezgui::{EventLoopMode, GfxCtx, GUI};
use geom::{PolyLine, Polygon, Pt2D};
use graphics;
use graphics::types::Color;
use map_model::geometry;
use piston::input::Key;
@ -361,3 +366,7 @@ impl Iterator for RelatedColors {
])
}
}
fn main() {
ezgui::run(UI::new(), "GUI Playground", 1024, 768);
}