Support for setting all screen orientations (#1928)

* Support for setting all screen orientations
* Gui: add flipped orientation to view
* Gui: correct assert conditions in gui_add_view_port

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Vasyl "vk" Kaigorodov
2022-10-26 20:35:49 +02:00
committed by GitHub
parent a8edb41eae
commit ebaa84b0c2
7 changed files with 112 additions and 17 deletions

View File

@@ -331,10 +331,16 @@ void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* vie
view_dispatcher->current_view = view;
// Dispatch view enter event
if(view_dispatcher->current_view) {
if(view->orientation == ViewOrientationVertical)
if(view->orientation == ViewOrientationVertical) {
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationVertical);
else if(view->orientation == ViewOrientationHorizontal)
} else if(view->orientation == ViewOrientationVerticalFlip) {
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationVerticalFlip);
} else if(view->orientation == ViewOrientationHorizontal) {
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationHorizontal);
} else if(view->orientation == ViewOrientationHorizontalFlip) {
view_port_set_orientation(
view_dispatcher->view_port, ViewPortOrientationHorizontalFlip);
}
view_enter(view_dispatcher->current_view);
view_port_enabled_set(view_dispatcher->view_port, true);
view_port_update(view_dispatcher->view_port);