this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

snap screen up with the software keyboard on Android, scale border to whole window #1818

nesbox 89c50825 9c0d0a27

+36 -13
+36 -13
src/system/sdl/main.c
··· 590 590 { 591 591 bool integerScale = studio_config(platform.studio)->options.integerScale; 592 592 593 - SDL_GetWindowSize(platform.window, &rect->w, &rect->h); 593 + s32 sw, sh, w, h; 594 + SDL_GetWindowSize(platform.window, &sw, &sh); 594 595 595 596 enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT}; 596 597 597 - s32 w, h; 598 - 599 - if (rect->w * Height < rect->h * Width) 598 + if (sw * Height < sh * Width) 600 599 { 601 - w = rect->w - (integerScale ? rect->w % Width : 0); 600 + w = sw - (integerScale ? sw % Width : 0); 602 601 h = Height * w / Width; 603 602 } 604 603 else 605 604 { 606 - h = rect->h - (integerScale ? rect->h % Height : 0); 605 + h = sh - (integerScale ? sh % Height : 0); 607 606 w = Width * h / Height; 608 607 } 609 608 610 - *rect = (SDL_Rect){(rect->w - w) / 2, (rect->h - h) / 2, w, h}; 609 + *rect = (SDL_Rect) 610 + { 611 + (sw - w) / 2, 612 + #if defined (TOUCH_INPUT_SUPPORT) 613 + // snap the screen up to get a place for the software keyboard 614 + sw > sh ? (sh - h) / 2 : 0, 615 + #else 616 + (sh - h) / 2, 617 + #endif 618 + w, h 619 + }; 611 620 } 612 621 613 622 static void processMouse() ··· 1555 1564 #endif 1556 1565 1557 1566 { 1558 - enum {Header = TIC80_OFFSET_TOP, Top = TIC80_OFFSET_TOP, Left = TIC80_OFFSET_LEFT}; 1567 + s32 w, h; 1568 + SDL_GetWindowSize(platform.window, &w, &h); 1559 1569 1560 - s32 width = 0; 1561 - SDL_GetWindowSize(platform.window, &width, NULL); 1570 + static const SDL_Rect Src[] = 1571 + { 1572 + {0, 0, TIC80_FULLWIDTH, TIC80_OFFSET_TOP}, 1573 + {0, TIC80_FULLHEIGHT-TIC80_OFFSET_TOP, TIC80_FULLWIDTH, TIC80_OFFSET_TOP}, 1574 + {0, 0, TIC80_OFFSET_LEFT, TIC80_FULLHEIGHT}, 1575 + {TIC80_FULLWIDTH-TIC80_OFFSET_LEFT, 0, TIC80_OFFSET_LEFT, TIC80_FULLHEIGHT}, 1576 + {0, 0, TIC80_FULLWIDTH, TIC80_FULLHEIGHT}, 1577 + }; 1562 1578 1563 - SDL_Rect src = {0, 0, TIC80_FULLWIDTH, TIC80_FULLHEIGHT}; 1564 - SDL_Rect dst = {rect.x, rect.y, rect.w, rect.h}; 1579 + const SDL_Rect Dst[] = 1580 + { 1581 + {0, 0, w, rect.y}, 1582 + {0, rect.y + rect.h, w, h - (rect.y + rect.h)}, 1583 + {0, rect.y, rect.x, rect.h}, 1584 + {rect.x + rect.w, rect.y, w - (rect.x + rect.w), rect.h}, 1585 + {rect.x, rect.y, rect.w, rect.h} 1586 + }; 1565 1587 1566 - renderCopy(platform.screen.renderer, platform.screen.texture, src, dst); 1588 + for(s32 i = 0; i < COUNT_OF(Src); ++i) 1589 + renderCopy(platform.screen.renderer, platform.screen.texture, Src[i], Dst[i]); 1567 1590 } 1568 1591 1569 1592 #if defined(TOUCH_INPUT_SUPPORT)