-
Notifications
You must be signed in to change notification settings - Fork 209
Subviews Origins and Summary of Changes
I've done a lot of the GUI, SDL graphics/input, and text rendering work over the many years I've been part of the project. During that time much effort was spent debugging and troubleshooting obscure bugs and hacking around limitations. It slowly became apparent that the best way to remedy the situation and provide a stable platform to finish missing features was to fundamentally change the GUI hierarchy and by extension the rendering subsystem. Quite the daunting task.
This is just a short list of what we were lacking and/or a source of pain:
- We had no way of dealing with views that overlap. This often results if drawing artifacts and fun hacks to force redraws upon redraws of things.
- There was little common functionality between any of our
Controlsresulting in a lot of duplicate code and difficulty keeping changes synchronized. This pain was compounded since we then needed to duplicate GUIScript functions to handle basically the same functions for different controls. - we had no good way of writing a proper text editing system
- There was no real window management in place. Drawing effectively took place directly to the screen rather than to a window. This is another problem that was multiplied when you had to go though extra pain to figure out the proper coordinates for drawing. This also made implementing things like the PST movable window a messy hack that only worked if limited to drawing over the game area.
- There was no robust input event handling. The event manager had to inspect lots of internal state to select which control got the event. Often this lead to certain events (mouse wheel) being delivered to controls nowhere near the mouse.
- The rendering backend and APIs were entirely geared towards software rendering. This made it extremely difficult to build a proper OpenGL or SDL2 backend and performance is quite lousy on mobile or lower end systems.
- Our touch input was nothing but a layer of hacks turning touches into mouse events and direct function calls on controls.
- Lots of state update was being handled directly in the
Drawfunctions so we always had to draw certain things even if they didn't need it. More importantly it is a confusing way to do state updates. - SDL1.2 is likely to continue to become unusable as time passes. It was never usable on Android, iOS, and has finally become unusable on Mac for almost 2 years now.
Over the last couple of years the vision of a real GUI toolkit, event handling, and drawing API with hardware acceleration considerations is has been slowly coming together. In fact it is on the home stretch and is slated to be included in the next major release of GemRB 👏.
There are thousands of changes on the way. I don't think I have or ever will be part of such a massive refactoring operation. There are a few major things that I want to call attention to.
- We now have a real SDL 2 backend. This actually uses hardware acceleration on all platforms we support. I'm not going to pretend the performance is breathtaking (there are still outstanding issues that wont be resolved until much later), but it is miles ahead of the current SDL 2 backend.
- The new SDL 2 backend brings with it native touch input. Touch input is now a first class citizen of our
Viewhierarchy. It should work much better and be less buggy than before. However, I have not tested it on real hardware. Bug reports are always welcome! - Game controller input is theoretically in place (untested and probably broken, but should be easily finished by somebody with the will)
-
TextAreaimprovements.- We finally have text editing capabilities; you can finally write your custom bios.
- copy and paste is supported everywhere you can input text
- The new
TextAreas will automatically add scrollbars if needed - Much improved dialog handling and history culling.
- Scrolling can be animated (original PST does this)
- Message window behavior is much improved
- A new movie player has been added that has a few noteworthy features.
- Subtitles work with BIK videos (SDL 2 only, sorry). Actually they now work in any video if you make your own subtitle file.
- You can toggle subtitles in realtime ('s' key).
- Performance is massively improved, particularly in SDL 2.
- The VLC plugin should now work on Windows and should be able to handle more formats natively.
- We have a real window manager and event manager which will help keep window layering and event input bugs at bay.
- We have the ability to use any amount of mouse buttons if we choose
- we can handle event repeats like holding down a key or a mouse button with any amount of granularity we like
- we can react to composite events (2 mouse buttons down at the same time for example)
- we can handle triple or really any number of clicks for distinct events if we choose
- foundation for game pad support if we decide we want to support it
- any window can be dragged around if you hold the ctl key and drag from its background. Reorganize your windows without modding.
- windows will now add a scrollbar if their content overflows, so it is theoretically possible to do things like add more NPC portraits or other modifications.
- hold shift key + mouse wheel to scroll anything that scrolls horizontally
- GemRB is now capable of running at any resolution without looking too awful. Widescreen mod is no longer required for this, but you may still use if you think it produces better results.
- lots of little bug fixes
There are of course a ton more changes, many of which only matter to developers :)
| backend | performance vs master | gfx notes |
|---|---|---|
| SDL1 | should be similar in most regards | should handle all gfx and options |
| SDL2 | faster, particularly on Apple devices | some stencil limitations. Objects occluded by walls are half transparent always. Dithering effect doesn't work. |
| SDL2 + OpenGL | not sure, but it is decent | should handle all gfx and options (where supported) |
| SDL2 + GLES | dropped | theoretically possible to add in just a few lines of code |