make background color configurable

This commit is contained in:
Dustin Carlino 2018-06-22 14:08:52 -07:00
parent 5ce158cb90
commit b3267bb2e7
4 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,11 @@
{
"map": {
"Background": [
1.0,
1.0,
1.0,
1.0
],
"Debug": [
1.0,
0.0,

View File

@ -10,6 +10,7 @@ use strum::IntoEnumIterator;
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, EnumIter, EnumString, ToString,
PartialOrd, Ord, Clone, Copy)]
pub enum Colors {
Background,
Debug,
BrightDebug,
Road,

View File

@ -87,10 +87,6 @@ fn main() {
if let Some(args) = ev.render_args() {
gl.draw(args.viewport(), |c, g| {
use graphics::clear;
clear([1.0; 4], g);
ui.draw(
&mut ezgui::canvas::GfxCtx {
glyphs,

View File

@ -14,6 +14,7 @@ use ezgui::ToggleableLayer;
use ezgui::canvas::{Canvas, GfxCtx};
use ezgui::input::UserInput;
use geom;
use graphics;
use graphics::types::Color;
use map_model::IntersectionID;
use piston::input::{Key, MouseCursorEvent};
@ -303,6 +304,8 @@ impl UI {
}
pub fn draw(&self, g: &mut GfxCtx, input: UserInput) {
graphics::clear(self.cs.get(Colors::Background), g.gfx);
g.ctx = self.canvas.get_transformed_context(&g.orig_ctx);
let screen_bbox = self.canvas.get_screen_bbox(&g.window_size);