adding the logo to the title screen and filling out some credits

This commit is contained in:
Dustin Carlino 2019-11-24 07:21:21 -08:00
parent f0314c31b1
commit 573edbd13e
10 changed files with 115 additions and 21 deletions

View File

@ -79,10 +79,34 @@ writes:
Existing urban planning software is either proprietary or hard to use. A/B
Street strives to set the accessibility bar high, by being a fun, engaging game.
## Credits
- Created by Dustin Carlino (<dabreegster@gmail.com>)
- Software engineering
- Lightning-fast pathfinding thanks to
[fast_paths](https://github.com/easbar/fast_paths) by Andreas Barth
(<easbar.mail@posteo.net>)
- And some
[contributors](https://github.com/dabreegster/abstreet/graphs/contributors)
found via [Democracy Lab](https://www.democracylab.org/)
- Design
- Logo by [Ryan Pierson](https://www.ryandpierson.com/)
- UX design by [Yuwen Li](https://www.yuwen-li.com/)
- Art direction with help from [Starcat Games](http://starcatgames.com/)
- Data
- Special thanks to all [OpenStreetMap](https://www.openstreetmap.org/about)
contributors!
- [King County GIS](https://www.kingcounty.gov/services/gis.aspx)
- [Seattle Open Data](https://data.seattle.gov/)
- [Puget Sound Regional Council](https://www.psrc.org/)
- Sounding boards
- [CUGOS](https://cugos.org/)
- [Julian Michael](http://julianmichael.org/)
## Contributing
I'm a one-person team. If you want to bring this to your city or if you're
skilled in user experience design, traffic simulation, data visualization, or
Help always needed! If you want to bring this to your city or if you're skilled
in graphic or user experience, traffic simulation, data visualization, or
civic/government outreach, please contact Dustin Carlino at
<dabreegster@gmail.com> or post at
[r/abstreet](https://www.reddit.com/r/abstreet/). I also welcome any

View File

@ -14,8 +14,9 @@ pub enum Color {
TileTexture(TextureID, (f64, f64)),
// Stretches the entire texture to fit the entire polygon. Rotates from the center of the
// polygon. Not sure what this means for anything but circles right now. Have to manually
// fiddle with the original orientation to fix y inversion.
StretchTexture(TextureID, Angle),
// fiddle with the original orientation to fix y inversion. Also embeds (texture width,
// height).
StretchTexture(TextureID, (f64, f64), Angle),
// A polygon with UV coordinates for each point must be used.
CustomUVTexture(TextureID),
// TODO Figure out how to pack more data into this.
@ -32,9 +33,11 @@ impl fmt::Display for Color {
"Color::TileTexture({}:{}, width={}, height={})",
id.0, id.1, w, h
),
Color::StretchTexture(id, angle) => {
write!(f, "Color::StretchTexture({}:{}, {})", id.0, id.1, angle)
}
Color::StretchTexture(id, (w, h), angle) => write!(
f,
"Color::StretchTexture({}:{}, width={}, height={}, {})",
id.0, id.1, w, h, angle
),
Color::CustomUVTexture(id) => write!(f, "Color::CustomUVTexture({}:{})", id.0, id.1),
Color::HatchingStyle1 => write!(f, "Color::HatchingStyle1"),
Color::HatchingStyle2 => write!(f, "Color::HatchingStyle2"),
@ -100,7 +103,15 @@ impl Color {
pub fn rotate(&self, angle: Angle) -> Color {
match self {
Color::StretchTexture(id, _) => Color::StretchTexture(*id, angle),
Color::StretchTexture(id, dims, _) => Color::StretchTexture(*id, *dims, angle),
_ => unreachable!(),
}
}
pub fn texture_dims(&self) -> (f64, f64) {
match self {
Color::TileTexture(_, dims) => *dims,
Color::StretchTexture(_, dims, _) => *dims,
_ => unreachable!(),
}
}

View File

@ -445,7 +445,7 @@ impl<'a> Prerender<'a> {
let ty = pt.y() / tex_height;
[tx as f32, ty as f32, id.0, 100.0 + id.1]
}
Color::StretchTexture(id, angle) => {
Color::StretchTexture(id, _, angle) => {
// TODO Cache
let b = poly.get_bounds();
let center = poly.center();

View File

@ -89,21 +89,20 @@ impl<'a> EventCtx<'a> {
if dims_to_textures.len() > 15 {
panic!("Only 15 texture arrays supported by some videocards. Group more textures by using the same image dimensions.");
}
for (group_idx, (dims, list)) in dims_to_textures.into_iter().enumerate() {
for (group_idx, (raw_dims, list)) in dims_to_textures.into_iter().enumerate() {
let mut raw_data = Vec::new();
for (tex_idx, (filename, raw, tex_type)) in list.into_iter().enumerate() {
let tex_id = (group_idx as f32, tex_idx as f32);
let dims = (f64::from(raw_dims.0), f64::from(raw_dims.1));
self.canvas.texture_lookups.insert(
filename,
match tex_type {
TextureType::Stretch => Color::StretchTexture(tex_id, Angle::ZERO),
TextureType::Tile => {
Color::TileTexture(tex_id, (f64::from(dims.0), f64::from(dims.1)))
}
TextureType::Stretch => Color::StretchTexture(tex_id, dims, Angle::ZERO),
TextureType::Tile => Color::TileTexture(tex_id, dims),
TextureType::CustomUV => Color::CustomUVTexture(tex_id),
},
);
raw_data.push(RawImage2d::from_raw_rgba(raw, dims));
raw_data.push(RawImage2d::from_raw_rgba(raw, raw_dims));
}
self.canvas
.texture_arrays

View File

@ -20,8 +20,9 @@ pub use crate::runner::{run, EventLoopMode, Settings, GUI};
pub use crate::screen_geom::{ScreenDims, ScreenPt, ScreenRectangle};
pub use crate::text::{Line, Text, TextSpan, HOTKEY_COLOR};
pub use crate::widgets::{
Autocomplete, Button, Choice, ItemSlider, MenuUnderButton, ModalMenu, NewScroller, Scroller,
Slider, SliderWithTextBox, TextButton, Warper, WarpingItemSlider, Wizard, WrappedWizard,
Autocomplete, Button, Choice, ItemSlider, JustDraw, MenuUnderButton, ModalMenu, NewScroller,
Scroller, Slider, SliderWithTextBox, TextButton, Warper, WarpingItemSlider, Wizard,
WrappedWizard,
};
pub enum InputResult<T: Clone> {

View File

@ -4,6 +4,7 @@ mod context_menu;
mod log_scroller;
mod menu_under_button;
mod modal_menu;
mod no_op;
mod popup_menu;
mod screenshot;
mod scroller;
@ -17,6 +18,7 @@ pub use self::button::{Button, TextButton};
pub(crate) use self::context_menu::ContextMenu;
pub use self::menu_under_button::MenuUnderButton;
pub use self::modal_menu::ModalMenu;
pub use self::no_op::JustDraw;
pub(crate) use self::popup_menu::PopupMenu;
pub(crate) use self::screenshot::{screenshot_current, screenshot_everything};
pub use self::scroller::{NewScroller, Scroller};

View File

@ -0,0 +1,47 @@
use crate::layout::Widget;
use crate::{Drawable, EventCtx, GeomBatch, GfxCtx, ScreenDims, ScreenPt};
use geom::{Distance, Polygon, Pt2D};
// Just draw something. A widget just so layouting works.
pub struct JustDraw {
draw: Drawable,
dims: ScreenDims,
top_left: ScreenPt,
}
impl JustDraw {
pub fn image(filename: &str, ctx: &EventCtx) -> JustDraw {
let color = ctx.canvas.texture(filename);
let (w, h) = color.texture_dims();
let draw = GeomBatch::from(vec![(
color,
Polygon::rectangle_topleft(
Pt2D::new(0.0, 0.0),
Distance::meters(w),
Distance::meters(h),
),
)])
.upload(ctx);
JustDraw {
draw,
dims: ScreenDims::new(w, h),
top_left: ScreenPt::new(0.0, 0.0),
}
}
pub fn draw(&self, g: &mut GfxCtx) {
g.fork(Pt2D::new(0.0, 0.0), self.top_left, 1.0);
g.redraw(&self.draw);
}
}
impl Widget for JustDraw {
fn get_dims(&self) -> ScreenDims {
self.dims
}
fn set_pos(&mut self, top_left: ScreenPt, _total_width: f64) {
self.top_left = top_left;
}
}

BIN
game/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -7,7 +7,9 @@ use crate::sandbox::{GameplayMode, SandboxMode};
use crate::tutorial::TutorialMode;
use crate::ui::UI;
use abstutil::elapsed_seconds;
use ezgui::{layout, Color, EventCtx, EventLoopMode, GfxCtx, Line, ScreenPt, Text, TextButton};
use ezgui::{
layout, Color, EventCtx, EventLoopMode, GfxCtx, JustDraw, Line, ScreenPt, Text, TextButton,
};
use geom::{Duration, Line, Pt2D, Speed};
use map_model::Map;
use rand::Rng;
@ -15,6 +17,7 @@ use rand_xorshift::XorShiftRng;
use std::time::Instant;
pub struct TitleScreen {
logo: JustDraw,
play_btn: TextButton,
screensaver: Screensaver,
rng: XorShiftRng,
@ -24,7 +27,7 @@ impl TitleScreen {
pub fn new(ctx: &mut EventCtx, ui: &UI) -> TitleScreen {
let mut rng = ui.primary.current_flags.sim_flags.make_rng();
TitleScreen {
// TODO logo
logo: JustDraw::image("assets/logo.png", ctx),
// TODO that nicer font
play_btn: TextButton::new(Text::from(Line("PLAY")), Color::BLUE, Color::ORANGE, ctx),
screensaver: Screensaver::start_bounce(&mut rng, ctx, &ui.primary.map),
@ -35,10 +38,12 @@ impl TitleScreen {
impl State for TitleScreen {
fn event(&mut self, ctx: &mut EventCtx, ui: &mut UI) -> Transition {
// TODO I'm betting that I'll wind up extracting the ManagedGUIState pattern to work along
// with another state
layout::stack_vertically(
layout::ContainerOrientation::Centered,
ctx,
vec![&mut self.play_btn],
vec![&mut self.logo, &mut self.play_btn],
);
// TODO or any keypress
@ -53,6 +58,7 @@ impl State for TitleScreen {
}
fn draw(&self, g: &mut GfxCtx, _: &UI) {
self.logo.draw(g);
self.play_btn.draw(g);
}
}
@ -125,7 +131,10 @@ fn about(ctx: &EventCtx) -> Box<dyn State> {
txt.add(Line("Contact: dabreegster@gmail.com"));
txt.add(Line("Project: http://github.com/dabreegster/abstreet"));
txt.add(Line("Map data from OpenStreetMap and King County GIS"));
// TODO Lots more credits
// TODO Add more here
txt.add(Line(
"See full credits at https://github.com/dabreegster/abstreet#credits",
));
// TODO centered
state.draw_text(txt, ScreenPt::new(100.0, 100.0));

View File

@ -25,6 +25,7 @@ impl UI {
let (primary, prebaked) = ctx.loading_screen("load map", |ctx, mut timer| {
// Always load some small icons.
let mut textures = vec![
("assets/logo.png", TextureType::Stretch),
("assets/ui/edit_bike.png", TextureType::Stretch),
("assets/ui/edit_bus.png", TextureType::Stretch),
("assets/ui/edit_construction.png", TextureType::Stretch),