Firstly I take the example eventloop.rs. __There is no reaction for window-resize-events__ like here.
I need my custom event-loop because:
MultiGesture;So I can't implement my event-loop because method ctx.gfx_context.resize_viewport (here) is private.
_And off course I can't create my own __sub__-event-loop over the standard ggez::event::run because the sdl2::EventPump can be only one._ What am I missing?
Aha. In that case, ctx.gfx_context.resize_viewport probably shouldn't be private, or should be able to be called through some other function.
For now, you can roll your own resize_viewport() by calling gfx_window_sdl::update_views(); you should be able to get the necessary arguments to pass through it through graphics::get_window() and graphics::get_gfx_objects().
It's a slightly touchy operation that invalidates some of the gfx-rs state however, which is why it's not public. It's caused some anguish in #134 and related issues. However, as you have discovered, it is also something that people implementing their own event-loop have to be able to do, and leaving that out is an oversight.
Roll your own resize_viewport for the moment, or just fork and modify the code. If it doesn't break anything horribly for you, say so and we'll shuffle things around a bit to make it public. Should be making a 0.4.1 release sometime soon anyway.
@icefoxen thx!
Maybe I can use ctx.event_context but I don't know how now?..
The ctx.event_context is just the SDL2 EventSubsystem. It's not used for anything in ggez itself except letting Context::quit() trigger a quit event.
pub(crate) gfx_context: graphics::GraphicsContext is private _for outers from crate_ too :)
@fzzr- I accidentally fixed this, I think. See this commit: https://github.com/ggez/ggez/commit/0896813451c691a28071a93f4345d7727c606afe
It adds a method Context::process_events() which calls resize_viewport() for you when necessary, so this should hopefully take care of your problem.
I think it's great! Thx!