mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
Add GUI scale setting and volume contrast setting
GUI scale (#737): - add display.gui-scale setting (0 - auto, 1..4 - fixed integer scale) - auto mode picks the largest scale keeping at least 640x480 UI units - apply scale in GUI (root size, camera, cursor, tooltips, scissors) - HUD layout and ModelViewer use scaled coordinates - add GUI Scale trackbar to display settings Volume contrast (#399): - add audio.volume-contrast setting (100% - unchanged sounds, 0% - loud sounds are lowered to the level of quiet ones) - loudness (RMS) of a sound is calculated once and cached - add trackbar to audio settings and reset page
This commit is contained in:
parent
dacebf94bc
commit
708c276787
14 changed files with 158 additions and 17 deletions
|
|
@ -370,7 +370,7 @@ void Hud::update(bool visible) {
|
|||
element.getNode()->setVisible(visible);
|
||||
}
|
||||
|
||||
const auto& windowSize = engine.getWindow().getSize();
|
||||
const auto windowSize = gui.getContainer()->getSize();
|
||||
glm::vec2 caSize = contentAccessPanel->getSize();
|
||||
contentAccessPanel->setVisible(inventoryView != nullptr && showContentPanel);
|
||||
contentAccessPanel->setSize(glm::vec2(caSize.x, windowSize.y));
|
||||
|
|
@ -626,7 +626,8 @@ void Hud::setDebug(bool flag) {
|
|||
void Hud::draw(const DrawContext& ctx){
|
||||
const auto& viewport = ctx.getViewport();
|
||||
|
||||
updateElementsPosition(viewport);
|
||||
// UI layout is calculated in GUI units (window size / GUI scale)
|
||||
updateElementsPosition(gui.getContainer()->getSize());
|
||||
|
||||
uicamera->setFov(viewport.y);
|
||||
uicamera->setAspectRatio(viewport.x / static_cast<float>(viewport.y));
|
||||
|
|
@ -653,7 +654,7 @@ void Hud::draw(const DrawContext& ctx){
|
|||
}
|
||||
}
|
||||
|
||||
void Hud::updateElementsPosition(const glm::uvec2& viewport) {
|
||||
void Hud::updateElementsPosition(const glm::vec2& viewport) {
|
||||
if (inventoryOpen) {
|
||||
float caWidth = inventoryView && showContentPanel
|
||||
? contentAccess->getSize().x
|
||||
|
|
@ -698,7 +699,7 @@ void Hud::updateElementsPosition(const glm::uvec2& viewport) {
|
|||
}
|
||||
}
|
||||
if (exchangeSlot != nullptr) {
|
||||
exchangeSlot->setPos(input.getCursor().pos);
|
||||
exchangeSlot->setPos(gui.getCursor().pos);
|
||||
}
|
||||
hotbarView->setPos(glm::vec2(viewport.x / 2, viewport.y - 65));
|
||||
hotbarView->setSelected(player.getChosenSlot());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue