mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
now we can make PluginCtx just once
This commit is contained in:
parent
8913ea44e3
commit
8708bc750b
@ -585,7 +585,6 @@ Plugin styles are blocking or ambient. And some can conflict...
|
||||
|
||||
|
||||
- probably dont need all those methods in UIState. just a way to get the main state.
|
||||
- dont recreate PluginCtx so many times? changing plugin API or something should help.
|
||||
|
||||
- probably change Plugin APIs... ambient_event and one event() indicating done or not. dont express blockingness in that API.
|
||||
- actually, take away Plugin trait entirely? Except for the stuff that gets all boxed up?
|
||||
|
@ -104,18 +104,18 @@ impl UIState for DefaultUIState {
|
||||
cs: &mut ColorScheme,
|
||||
canvas: &mut Canvas,
|
||||
) {
|
||||
let mut ctx = PluginCtx {
|
||||
primary: &mut self.primary,
|
||||
secondary: &mut self.secondary,
|
||||
canvas,
|
||||
cs,
|
||||
input,
|
||||
hints,
|
||||
recalculate_current_selection,
|
||||
};
|
||||
|
||||
// Exclusive blocking plugins first
|
||||
{
|
||||
let mut ctx = PluginCtx {
|
||||
primary: &mut self.primary,
|
||||
secondary: &mut self.secondary,
|
||||
canvas,
|
||||
cs,
|
||||
input,
|
||||
hints,
|
||||
recalculate_current_selection,
|
||||
};
|
||||
|
||||
// Special cases of weird blocking exclusive plugins!
|
||||
if self
|
||||
.primary_plugins
|
||||
@ -212,16 +212,6 @@ impl UIState for DefaultUIState {
|
||||
|
||||
// Exclusive nonblocking plugins
|
||||
{
|
||||
let mut ctx = PluginCtx {
|
||||
primary: &mut self.primary,
|
||||
secondary: &mut self.secondary,
|
||||
canvas,
|
||||
cs,
|
||||
input,
|
||||
hints,
|
||||
recalculate_current_selection,
|
||||
};
|
||||
|
||||
if self.exclusive_nonblocking_plugin.is_some() {
|
||||
if !self
|
||||
.exclusive_nonblocking_plugin
|
||||
@ -243,16 +233,6 @@ impl UIState for DefaultUIState {
|
||||
}
|
||||
|
||||
// Stackable modal plugins
|
||||
let mut ctx = PluginCtx {
|
||||
primary: &mut self.primary,
|
||||
secondary: &mut self.secondary,
|
||||
canvas,
|
||||
cs,
|
||||
input,
|
||||
hints,
|
||||
recalculate_current_selection,
|
||||
};
|
||||
|
||||
if self.show_score.is_some() {
|
||||
if !self
|
||||
.show_score
|
||||
|
Loading…
Reference in New Issue
Block a user