mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
avoid menu flickering and incorrect entries by sending a NoOp after used events
This commit is contained in:
parent
08282186a7
commit
272503873c
@ -33,3 +33,8 @@
|
||||
- canvas owning text-drawing is maybe a bit weird, at least API-wise
|
||||
- hide stuff inside the ctx's? canvas and prerender shouldnt even be known outside of crate
|
||||
- generic World with quadtree should have actions on objects
|
||||
- loading screen
|
||||
- cleanup hack: dont put glyphbrush in canvas at all
|
||||
- FileWithProgress should go directly into Timer
|
||||
- need to understand lifetimes
|
||||
- cleanup abstutil Timer stuff generally
|
||||
|
@ -26,11 +26,14 @@
|
||||
## General ezgui stuff
|
||||
|
||||
- optionally limit canvas scrolling/zooming to some map bounds
|
||||
- X on all menus
|
||||
- when dragging, dont give mouse movement to UI elements
|
||||
- start context menu when left click releases and we're not dragging
|
||||
- can we change labels in modal or top menu? show/hide
|
||||
- bold hotkey letters
|
||||
- label sections of modal menus
|
||||
- distinguish hints from status of modal menus, for hiding purposes
|
||||
- move context menus out of ezgui
|
||||
- simplify/remove UserInput.
|
||||
- maybe separate impls for context, wizard, modal menu make sense.
|
||||
|
||||
## New features
|
||||
|
||||
@ -110,4 +113,3 @@
|
||||
- highlight a region, draw counts to/from it in some meaningful way
|
||||
- timer slider (except timeslices arent neatly in hour blocks, though they maybe should be)
|
||||
- a table (with color-coded entries) is actually perfect
|
||||
|
||||
|
@ -3,7 +3,9 @@ use glium::glutin;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Event {
|
||||
InitializeApplication,
|
||||
// Used to initialize the application and also to recalculate menu state when some other event
|
||||
// is used.
|
||||
NoOp,
|
||||
LeftMouseButtonDown,
|
||||
LeftMouseButtonUp,
|
||||
RightMouseButtonDown,
|
||||
|
@ -191,11 +191,7 @@ pub fn run<G: GUI, F: FnOnce(&mut EventCtx) -> G>(
|
||||
};
|
||||
|
||||
let gui = make_gui(&mut EventCtx {
|
||||
input: &mut UserInput::new(
|
||||
Event::InitializeApplication,
|
||||
ContextMenu::new(),
|
||||
&mut canvas,
|
||||
),
|
||||
input: &mut UserInput::new(Event::NoOp, ContextMenu::new(), &mut canvas),
|
||||
canvas: &mut canvas,
|
||||
prerender: &prerender,
|
||||
program: &program,
|
||||
@ -296,6 +292,12 @@ fn loop_forever<G: GUI>(
|
||||
// Don't draw if an event was ignored. Every keypress also fires a release event, most of
|
||||
// which are ignored.
|
||||
if any_input_used {
|
||||
// But if the event caused a state-change, the drawing state might be different too.
|
||||
// Need to recalculate what menu entries and such are valid. So send through a no-op
|
||||
// event.
|
||||
let (new_state, _, _) = state.event(Event::NoOp, &prerender, &program);
|
||||
state = new_state;
|
||||
|
||||
state.draw(&prerender.display, &program, &prerender, false);
|
||||
prerender.num_uploads.set(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user