mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed spellbook tabs appearing cut off on certain screen resolutions
This commit is contained in:
parent
d47433a463
commit
b10a26e150
2 changed files with 17 additions and 5 deletions
|
@ -172,7 +172,17 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
context.drawTexture(TEXTURE, bounds.left, bounds.top, isRight ? 510 - bounds.width : 402, v, bounds.width, bounds.height, 512, 256);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
context.drawTexture(tab.icon().get(), isRight ? bounds.left + bounds.width - 16 - 10 : bounds.left + 10, bounds.top + (bounds.height - 16) / 2, 0, 0, 16, 16, 16, 16);
|
||||
float widthScale = bounds.width / 35F;
|
||||
int resolution = (int)(16 * widthScale);
|
||||
int iconInset = (int)(Math.min(widthScale * 2, 1) * 10);
|
||||
|
||||
context.drawTexture(tab.icon().get(),
|
||||
isRight ? bounds.left + bounds.width - resolution - iconInset : bounds.left + iconInset,
|
||||
bounds.top + (bounds.height - resolution) / 2,
|
||||
0, 0,
|
||||
resolution, resolution,
|
||||
resolution, resolution
|
||||
);
|
||||
});
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
|
|
|
@ -38,19 +38,21 @@ public class SpellbookTabBar {
|
|||
int backgroundHeight = screen.getBackgroundHeight();
|
||||
int backgroundWidth = screen.getBackgroundWidth();
|
||||
|
||||
int tabInset = 14;
|
||||
|
||||
|
||||
int tabInset = 14 + Math.min((screen.width - backgroundWidth) / 2, 0);
|
||||
|
||||
int top = (screen.height - backgroundHeight) / 2 + 20;
|
||||
int left = (screen.width - backgroundWidth) / 2;
|
||||
|
||||
int tabWidth = Math.min(35, left + 15);
|
||||
int tabHeight = 23;
|
||||
|
||||
List<Chapter> leftTabs = chapters.getTabs(side)
|
||||
.sorted(Comparator.comparing(Chapter::tabY))
|
||||
.toList();
|
||||
|
||||
|
||||
int tabWidth = 35;
|
||||
int tabHeight = 23;
|
||||
|
||||
int totalTabs = leftTabs.size();
|
||||
float squashFactor = Math.min(1, (float)(backgroundHeight - 40) / ((tabHeight + 8) * leftTabs.size()));
|
||||
|
||||
|
|
Loading…
Reference in a new issue