vE5li / korangar

A next-gen Ragnarok Online client
MIT License
147 stars 33 forks source link

Rework main application loop. #105

Closed hasenbanck closed 3 weeks ago

hasenbanck commented 3 weeks ago

We used the old pattern of handling the windows and surface lifetimes, which is not the most portable way do it. winit recommends this pattern, so that we can properly support for example Android, iOS and the web.

This change also has the added benefit, that we start to separate the gigantic main function into smaller, easier to understand parts.

I had to change some state tracking, so that it could properly be defined as a struct (anonymous closure don't really have a valid function signature you could write down, so I had to create a reference counted trait object).

I also had to cleanup the usage of the windows/screen size at some places and unified it to use "ScreenSize" in most places. We also properly guard against windows sizes of "0,0" at the source (when winit gives us the window size via an event).

(I will most likely need to re-base some PRs)