mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-28 17:04:20 +03:00
revamp toggleable layers plugin, and get rid of debug mode
This commit is contained in:
parent
ad3ef954eb
commit
597828ce28
@ -585,3 +585,4 @@ Plugin styles are blocking or ambient. And some can conflict...
|
|||||||
- actually, take away Plugin trait entirely? Except for the stuff that gets all boxed up?
|
- actually, take away Plugin trait entirely? Except for the stuff that gets all boxed up?
|
||||||
- can we somehow fold PluginsPerMap into PerMapUI? :D different API that doesnt blindly pass in all of primary field
|
- can we somehow fold PluginsPerMap into PerMapUI? :D different API that doesnt blindly pass in all of primary field
|
||||||
- Layers could be stackable modal too, but do that later. low-pri.
|
- Layers could be stackable modal too, but do that later. low-pri.
|
||||||
|
- probably dont need all those methods in UIState. just a way to get the main state.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::objects::ID;
|
use crate::objects::ID;
|
||||||
use ezgui::{ToggleableLayer, UserInput};
|
use crate::plugins::PluginCtx;
|
||||||
|
use ezgui::ToggleableLayer;
|
||||||
|
|
||||||
// TODO ideally these would be tuned kind of dynamically based on rendering speed
|
// TODO ideally these would be tuned kind of dynamically based on rendering speed
|
||||||
const MIN_ZOOM_FOR_LANES: f64 = 0.15;
|
const MIN_ZOOM_FOR_LANES: f64 = 0.15;
|
||||||
@ -45,13 +46,14 @@ impl ToggleableLayers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event(&mut self, input: &mut UserInput) -> bool {
|
pub fn ambient_event(&mut self, ctx: &mut PluginCtx) {
|
||||||
for layer in self.toggleable_layers().into_iter() {
|
for layer in self.toggleable_layers().into_iter() {
|
||||||
if layer.event(input) {
|
if layer.event(ctx.input) {
|
||||||
return true;
|
*ctx.recalculate_current_selection = true;
|
||||||
|
ctx.primary.current_selection = None;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggleable_layers(&mut self) -> Vec<&mut ToggleableLayer> {
|
fn toggleable_layers(&mut self) -> Vec<&mut ToggleableLayer> {
|
||||||
|
@ -4,35 +4,3 @@ pub mod floodfill;
|
|||||||
pub mod geom_validation;
|
pub mod geom_validation;
|
||||||
pub mod hider;
|
pub mod hider;
|
||||||
pub mod layers;
|
pub mod layers;
|
||||||
|
|
||||||
use crate::objects::ID;
|
|
||||||
use crate::plugins::{Plugin, PluginCtx};
|
|
||||||
|
|
||||||
pub struct DebugMode {
|
|
||||||
// Ambient; they don't conflict with any of the main plugins.
|
|
||||||
pub layers: layers::ToggleableLayers,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DebugMode {
|
|
||||||
pub fn new() -> DebugMode {
|
|
||||||
DebugMode {
|
|
||||||
layers: layers::ToggleableLayers::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn show(&self, obj: ID) -> bool {
|
|
||||||
self.layers.show(obj)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Plugin for DebugMode {
|
|
||||||
fn blocking_event(&mut self, ctx: &mut PluginCtx) -> bool {
|
|
||||||
// Always run ambient plugins. If either returns true, the selection state could have
|
|
||||||
// changed.
|
|
||||||
if self.layers.event(ctx.input) {
|
|
||||||
*ctx.recalculate_current_selection = true;
|
|
||||||
ctx.primary.current_selection = None;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::objects::Ctx;
|
use crate::objects::Ctx;
|
||||||
use crate::plugins::{choose_edits, choose_scenario, load_ab_test, Plugin, PluginCtx};
|
use crate::plugins::{choose_edits, choose_scenario, load_ab_test, Plugin, PluginCtx};
|
||||||
use crate::state::{PerMapUI, PluginsPerMap};
|
use crate::state::{PerMapUI, PluginsPerMap};
|
||||||
use ezgui::{Canvas, GfxCtx, LogScroller, Wizard, WrappedWizard};
|
use ezgui::{GfxCtx, LogScroller, Wizard, WrappedWizard};
|
||||||
use map_model::Map;
|
use map_model::Map;
|
||||||
use sim::{ABTest, SimFlags};
|
use sim::{ABTest, SimFlags};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ impl Plugin for ABTestManager {
|
|||||||
);
|
);
|
||||||
if ctx.input.modal_action("run A/B test") {
|
if ctx.input.modal_action("run A/B test") {
|
||||||
let ((new_primary, new_primary_plugins), new_secondary) =
|
let ((new_primary, new_primary_plugins), new_secondary) =
|
||||||
launch_test(test, &ctx.primary.current_flags, &ctx.canvas);
|
launch_test(test, &ctx.primary.current_flags);
|
||||||
*ctx.primary = new_primary;
|
*ctx.primary = new_primary;
|
||||||
if let Some(p_plugins) = ctx.primary_plugins.as_mut() {
|
if let Some(p_plugins) = ctx.primary_plugins.as_mut() {
|
||||||
**p_plugins = new_primary_plugins;
|
**p_plugins = new_primary_plugins;
|
||||||
@ -92,7 +92,6 @@ fn pick_ab_test(map: &Map, mut wizard: WrappedWizard) -> Option<ABTest> {
|
|||||||
fn launch_test(
|
fn launch_test(
|
||||||
test: &ABTest,
|
test: &ABTest,
|
||||||
current_flags: &SimFlags,
|
current_flags: &SimFlags,
|
||||||
canvas: &Canvas,
|
|
||||||
) -> ((PerMapUI, PluginsPerMap), (PerMapUI, PluginsPerMap)) {
|
) -> ((PerMapUI, PluginsPerMap), (PerMapUI, PluginsPerMap)) {
|
||||||
info!("Launching A/B test {}...", test.test_name);
|
info!("Launching A/B test {}...", test.test_name);
|
||||||
let load = format!(
|
let load = format!(
|
||||||
@ -113,7 +112,6 @@ fn launch_test(
|
|||||||
edits_name: test.edits1_name.clone(),
|
edits_name: test.edits1_name.clone(),
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
canvas,
|
|
||||||
);
|
);
|
||||||
let secondary = PerMapUI::new(
|
let secondary = PerMapUI::new(
|
||||||
SimFlags {
|
SimFlags {
|
||||||
@ -123,7 +121,6 @@ fn launch_test(
|
|||||||
edits_name: test.edits2_name.clone(),
|
edits_name: test.edits2_name.clone(),
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
canvas,
|
|
||||||
);
|
);
|
||||||
// That's all! The scenario will be instantiated.
|
// That's all! The scenario will be instantiated.
|
||||||
(primary, secondary)
|
(primary, secondary)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::objects::Ctx;
|
use crate::objects::Ctx;
|
||||||
use crate::plugins::{choose_edits, Plugin, PluginCtx};
|
use crate::plugins::{choose_edits, Plugin, PluginCtx};
|
||||||
use crate::state::{PerMapUI, PluginsPerMap};
|
use crate::state::{PerMapUI, PluginsPerMap};
|
||||||
use ezgui::{Canvas, GfxCtx, Wizard, WrappedWizard};
|
use ezgui::{GfxCtx, Wizard, WrappedWizard};
|
||||||
use map_model::Map;
|
use map_model::Map;
|
||||||
use sim::SimFlags;
|
use sim::SimFlags;
|
||||||
|
|
||||||
@ -28,7 +28,6 @@ impl Plugin for EditsManager {
|
|||||||
&mut ctx.primary.current_flags,
|
&mut ctx.primary.current_flags,
|
||||||
&ctx.primary.map,
|
&ctx.primary.map,
|
||||||
&mut new_primary,
|
&mut new_primary,
|
||||||
&ctx.canvas,
|
|
||||||
self.wizard.wrap(ctx.input, ctx.canvas),
|
self.wizard.wrap(ctx.input, ctx.canvas),
|
||||||
)
|
)
|
||||||
.is_some()
|
.is_some()
|
||||||
@ -54,7 +53,6 @@ fn manage_edits(
|
|||||||
current_flags: &mut SimFlags,
|
current_flags: &mut SimFlags,
|
||||||
map: &Map,
|
map: &Map,
|
||||||
new_primary: &mut Option<(PerMapUI, PluginsPerMap)>,
|
new_primary: &mut Option<(PerMapUI, PluginsPerMap)>,
|
||||||
canvas: &Canvas,
|
|
||||||
mut wizard: WrappedWizard,
|
mut wizard: WrappedWizard,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
// TODO Indicate how many edits are there / if there are any unsaved edits
|
// TODO Indicate how many edits are there / if there are any unsaved edits
|
||||||
@ -94,7 +92,7 @@ fn manage_edits(
|
|||||||
flags.edits_name = load_name;
|
flags.edits_name = load_name;
|
||||||
|
|
||||||
info!("Reloading everything...");
|
info!("Reloading everything...");
|
||||||
*new_primary = Some(PerMapUI::new(flags, None, canvas));
|
*new_primary = Some(PerMapUI::new(flags, None));
|
||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
// Copyright 2018 Google LLC, licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
use crate::objects::ID;
|
use crate::objects::ID;
|
||||||
use crate::plugins::debug::DebugMode;
|
|
||||||
use crate::render::area::DrawArea;
|
use crate::render::area::DrawArea;
|
||||||
use crate::render::building::DrawBuilding;
|
use crate::render::building::DrawBuilding;
|
||||||
use crate::render::bus_stop::DrawBusStop;
|
use crate::render::bus_stop::DrawBusStop;
|
||||||
@ -238,7 +237,6 @@ impl DrawMap {
|
|||||||
pub fn get_objects_onscreen<T: ShowObjects>(
|
pub fn get_objects_onscreen<T: ShowObjects>(
|
||||||
&self,
|
&self,
|
||||||
screen_bounds: Bounds,
|
screen_bounds: Bounds,
|
||||||
debug_mode: &DebugMode,
|
|
||||||
map: &Map,
|
map: &Map,
|
||||||
sim: &GetDrawAgents,
|
sim: &GetDrawAgents,
|
||||||
show_objs: &T,
|
show_objs: &T,
|
||||||
@ -257,7 +255,7 @@ impl DrawMap {
|
|||||||
let mut peds: Vec<Box<Renderable>> = Vec::new();
|
let mut peds: Vec<Box<Renderable>> = Vec::new();
|
||||||
|
|
||||||
for &(id, _, _) in &self.quadtree.query(screen_bounds.as_bbox()) {
|
for &(id, _, _) in &self.quadtree.query(screen_bounds.as_bbox()) {
|
||||||
if debug_mode.show(*id) && show_objs.show(*id) {
|
if show_objs.show(*id) {
|
||||||
match id {
|
match id {
|
||||||
ID::Area(id) => areas.push(Box::new(self.get_a(*id))),
|
ID::Area(id) => areas.push(Box::new(self.get_a(*id))),
|
||||||
ID::Parcel(id) => parcels.push(Box::new(self.get_p(*id))),
|
ID::Parcel(id) => parcels.push(Box::new(self.get_p(*id))),
|
||||||
|
@ -2,7 +2,6 @@ use crate::colors::ColorScheme;
|
|||||||
use crate::objects::{Ctx, RenderingHints, ID};
|
use crate::objects::{Ctx, RenderingHints, ID};
|
||||||
use crate::plugins;
|
use crate::plugins;
|
||||||
use crate::plugins::debug;
|
use crate::plugins::debug;
|
||||||
use crate::plugins::debug::DebugMode;
|
|
||||||
use crate::plugins::edit;
|
use crate::plugins::edit;
|
||||||
use crate::plugins::logs::DisplayLogs;
|
use crate::plugins::logs::DisplayLogs;
|
||||||
use crate::plugins::time_travel::TimeTravel;
|
use crate::plugins::time_travel::TimeTravel;
|
||||||
@ -54,6 +53,7 @@ pub struct DefaultUIState {
|
|||||||
|
|
||||||
// Ambient plugins always exist, and they never block anything.
|
// Ambient plugins always exist, and they never block anything.
|
||||||
pub sim_controls: plugins::sim::controls::SimControls,
|
pub sim_controls: plugins::sim::controls::SimControls,
|
||||||
|
layers: debug::layers::ToggleableLayers,
|
||||||
|
|
||||||
active_plugin: Option<usize>,
|
active_plugin: Option<usize>,
|
||||||
}
|
}
|
||||||
@ -63,8 +63,8 @@ impl DefaultUIState {
|
|||||||
// Do this first to trigger the log console initialization, so anything logged by sim::load
|
// Do this first to trigger the log console initialization, so anything logged by sim::load
|
||||||
// isn't lost.
|
// isn't lost.
|
||||||
DisplayLogs::initialize();
|
DisplayLogs::initialize();
|
||||||
let (primary, primary_plugins) = PerMapUI::new(flags, kml, &canvas);
|
let (primary, primary_plugins) = PerMapUI::new(flags, kml);
|
||||||
DefaultUIState {
|
let mut state = DefaultUIState {
|
||||||
primary,
|
primary,
|
||||||
primary_plugins,
|
primary_plugins,
|
||||||
secondary: None,
|
secondary: None,
|
||||||
@ -72,16 +72,18 @@ impl DefaultUIState {
|
|||||||
exclusive_nonblocking_plugin: None,
|
exclusive_nonblocking_plugin: None,
|
||||||
show_score: None,
|
show_score: None,
|
||||||
sim_controls: plugins::sim::controls::SimControls::new(),
|
sim_controls: plugins::sim::controls::SimControls::new(),
|
||||||
|
layers: debug::layers::ToggleableLayers::new(),
|
||||||
active_plugin: None,
|
active_plugin: None,
|
||||||
}
|
};
|
||||||
|
state.layers.handle_zoom(-1.0, canvas.cam_zoom);
|
||||||
|
state
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_active_plugin(&self) -> Option<&Plugin> {
|
fn get_active_plugin(&self) -> Option<&Plugin> {
|
||||||
let idx = self.active_plugin?;
|
let idx = self.active_plugin?;
|
||||||
match idx {
|
match idx {
|
||||||
x if x == 0 => Some(&self.primary_plugins.debug_mode),
|
x if x == 0 => Some(&self.primary_plugins.view_mode),
|
||||||
x if x == 1 => Some(&self.primary_plugins.view_mode),
|
x if x == 1 => Some(&self.primary_plugins.time_travel),
|
||||||
x if x == 2 => Some(&self.primary_plugins.time_travel),
|
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Illegal active_plugin {}", idx);
|
panic!("Illegal active_plugin {}", idx);
|
||||||
}
|
}
|
||||||
@ -108,9 +110,8 @@ impl DefaultUIState {
|
|||||||
recalculate_current_selection,
|
recalculate_current_selection,
|
||||||
};
|
};
|
||||||
match idx {
|
match idx {
|
||||||
x if x == 0 => self.primary_plugins.debug_mode.blocking_event(&mut ctx),
|
x if x == 0 => self.primary_plugins.view_mode.blocking_event(&mut ctx),
|
||||||
x if x == 1 => self.primary_plugins.view_mode.blocking_event(&mut ctx),
|
x if x == 1 => self.primary_plugins.time_travel.blocking_event(&mut ctx),
|
||||||
x if x == 2 => self.primary_plugins.time_travel.blocking_event(&mut ctx),
|
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Illegal active_plugin {}", idx);
|
panic!("Illegal active_plugin {}", idx);
|
||||||
}
|
}
|
||||||
@ -120,10 +121,7 @@ impl DefaultUIState {
|
|||||||
|
|
||||||
impl UIState for DefaultUIState {
|
impl UIState for DefaultUIState {
|
||||||
fn handle_zoom(&mut self, old_zoom: f64, new_zoom: f64) {
|
fn handle_zoom(&mut self, old_zoom: f64, new_zoom: f64) {
|
||||||
self.primary_plugins
|
self.layers.handle_zoom(old_zoom, new_zoom);
|
||||||
.debug_mode
|
|
||||||
.layers
|
|
||||||
.handle_zoom(old_zoom, new_zoom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_current_selection(&mut self, obj: Option<ID>) {
|
fn set_current_selection(&mut self, obj: Option<ID>) {
|
||||||
@ -280,6 +278,7 @@ impl UIState for DefaultUIState {
|
|||||||
// Ambient plugins
|
// Ambient plugins
|
||||||
ctx.primary_plugins = Some(&mut self.primary_plugins);
|
ctx.primary_plugins = Some(&mut self.primary_plugins);
|
||||||
self.sim_controls.ambient_event(&mut ctx);
|
self.sim_controls.ambient_event(&mut ctx);
|
||||||
|
self.layers.ambient_event(&mut ctx);
|
||||||
|
|
||||||
// TODO legacy stuff
|
// TODO legacy stuff
|
||||||
// If there's an active plugin, just run it.
|
// If there's an active plugin, just run it.
|
||||||
@ -289,7 +288,7 @@ impl UIState for DefaultUIState {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Run each plugin, short-circuiting if the plugin claimed it was active.
|
// Run each plugin, short-circuiting if the plugin claimed it was active.
|
||||||
for idx in 0..=2 {
|
for idx in 0..=1 {
|
||||||
if self.run_plugin(idx, input, hints, recalculate_current_selection, cs, canvas) {
|
if self.run_plugin(idx, input, hints, recalculate_current_selection, cs, canvas) {
|
||||||
self.active_plugin = Some(idx);
|
self.active_plugin = Some(idx);
|
||||||
break;
|
break;
|
||||||
@ -313,7 +312,6 @@ impl UIState for DefaultUIState {
|
|||||||
|
|
||||||
self.primary.draw_map.get_objects_onscreen(
|
self.primary.draw_map.get_objects_onscreen(
|
||||||
canvas.get_screen_bounds(),
|
canvas.get_screen_bounds(),
|
||||||
&self.primary_plugins.debug_mode,
|
|
||||||
&self.primary.map,
|
&self.primary.map,
|
||||||
draw_agent_source,
|
draw_agent_source,
|
||||||
self,
|
self,
|
||||||
@ -321,11 +319,7 @@ impl UIState for DefaultUIState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_debug_mode_enabled(&self) -> bool {
|
fn is_debug_mode_enabled(&self) -> bool {
|
||||||
self.primary_plugins
|
self.layers.debug_mode.is_enabled()
|
||||||
.debug_mode
|
|
||||||
.layers
|
|
||||||
.debug_mode
|
|
||||||
.is_enabled()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(&self, g: &mut GfxCtx, ctx: &Ctx) {
|
fn draw(&self, g: &mut GfxCtx, ctx: &Ctx) {
|
||||||
@ -346,6 +340,7 @@ impl UIState for DefaultUIState {
|
|||||||
|
|
||||||
// Ambient
|
// Ambient
|
||||||
self.sim_controls.draw(g, ctx);
|
self.sim_controls.draw(g, ctx);
|
||||||
|
// Layers doesn't draw
|
||||||
|
|
||||||
// TODO legacy
|
// TODO legacy
|
||||||
if let Some(p) = self.get_active_plugin() {
|
if let Some(p) = self.get_active_plugin() {
|
||||||
@ -382,7 +377,7 @@ impl UIState for DefaultUIState {
|
|||||||
|
|
||||||
// The exclusive_nonblocking_plugins don't color_obj.
|
// The exclusive_nonblocking_plugins don't color_obj.
|
||||||
|
|
||||||
// show_score, hider, and sim_controls don't color_obj.
|
// show_score, hider, sim_controls, and layers don't color_obj.
|
||||||
|
|
||||||
// TODO legacy
|
// TODO legacy
|
||||||
if let Some(p) = self.get_active_plugin() {
|
if let Some(p) = self.get_active_plugin() {
|
||||||
@ -415,26 +410,23 @@ impl ShowObjects for DefaultUIState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.primary_plugins
|
self.layers.show_all_turn_icons.is_enabled() || {
|
||||||
.debug_mode
|
// TODO This sounds like some old hack, probably remove this?
|
||||||
.layers
|
if let Some(ID::Turn(t)) = self.primary.current_selection {
|
||||||
.show_all_turn_icons
|
t.parent == id
|
||||||
.is_enabled()
|
} else {
|
||||||
|| {
|
false
|
||||||
// TODO This sounds like some old hack, probably remove this?
|
|
||||||
if let Some(ID::Turn(t)) = self.primary.current_selection {
|
|
||||||
t.parent == id
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show(&self, obj: ID) -> bool {
|
fn show(&self, obj: ID) -> bool {
|
||||||
if let Some(ref p) = self.primary_plugins.hider {
|
if let Some(ref p) = self.primary_plugins.hider {
|
||||||
return p.show(obj);
|
if !p.show(obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
true
|
self.layers.show(obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +441,7 @@ pub struct PerMapUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PerMapUI {
|
impl PerMapUI {
|
||||||
pub fn new(flags: SimFlags, kml: Option<String>, canvas: &Canvas) -> (PerMapUI, PluginsPerMap) {
|
pub fn new(flags: SimFlags, kml: Option<String>) -> (PerMapUI, PluginsPerMap) {
|
||||||
let mut timer = abstutil::Timer::new("setup PerMapUI");
|
let mut timer = abstutil::Timer::new("setup PerMapUI");
|
||||||
|
|
||||||
let (map, sim) = sim::load(flags.clone(), Some(Tick::from_seconds(30)), &mut timer);
|
let (map, sim) = sim::load(flags.clone(), Some(Tick::from_seconds(30)), &mut timer);
|
||||||
@ -478,7 +470,7 @@ impl PerMapUI {
|
|||||||
current_selection: None,
|
current_selection: None,
|
||||||
current_flags: flags,
|
current_flags: flags,
|
||||||
};
|
};
|
||||||
let plugins = PluginsPerMap::new(&state, canvas, &mut timer);
|
let plugins = PluginsPerMap::new(&state, &mut timer);
|
||||||
timer.done();
|
timer.done();
|
||||||
(state, plugins)
|
(state, plugins)
|
||||||
}
|
}
|
||||||
@ -490,20 +482,17 @@ pub struct PluginsPerMap {
|
|||||||
// plugins or ambient plugins.
|
// plugins or ambient plugins.
|
||||||
hider: Option<debug::hider::Hider>,
|
hider: Option<debug::hider::Hider>,
|
||||||
|
|
||||||
debug_mode: DebugMode,
|
// TODO legacy
|
||||||
view_mode: ViewMode,
|
view_mode: ViewMode,
|
||||||
time_travel: TimeTravel,
|
time_travel: TimeTravel,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PluginsPerMap {
|
impl PluginsPerMap {
|
||||||
pub fn new(state: &PerMapUI, canvas: &Canvas, timer: &mut Timer) -> PluginsPerMap {
|
pub fn new(state: &PerMapUI, timer: &mut Timer) -> PluginsPerMap {
|
||||||
let mut plugins = PluginsPerMap {
|
PluginsPerMap {
|
||||||
hider: None,
|
hider: None,
|
||||||
debug_mode: DebugMode::new(),
|
|
||||||
view_mode: ViewMode::new(&state.map, &state.draw_map, timer),
|
view_mode: ViewMode::new(&state.map, &state.draw_map, timer),
|
||||||
time_travel: TimeTravel::new(),
|
time_travel: TimeTravel::new(),
|
||||||
};
|
}
|
||||||
plugins.debug_mode.layers.handle_zoom(-1.0, canvas.cam_zoom);
|
|
||||||
plugins
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user