config: make hud scale a float

This commit is contained in:
Bixilon 2021-04-10 00:22:59 +02:00
parent 9905173e25
commit b2f6e310a0
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 2 additions and 25 deletions

View File

@ -13,8 +13,6 @@
package de.bixilon.minosoft.config.config.game package de.bixilon.minosoft.config.config.game
import de.bixilon.minosoft.gui.rendering.hud.HUDScale
data class HUDGameConfig( data class HUDGameConfig(
var scale: HUDScale = HUDScale.MEDIUM, var scale: Float = 2.0f,
) )

View File

@ -182,7 +182,7 @@ class HUDRenderer(val connection: PlayConnection, val renderWindow: RenderWindow
if (forcePrepare || needsUpdate) { if (forcePrepare || needsUpdate) {
for ((elementProperties, hudElement) in enabledHUDElement.values) { for ((elementProperties, hudElement) in enabledHUDElement.values) {
val realScaleFactor = elementProperties.scale * Minosoft.getConfig().config.game.hud.scale.scale val realScaleFactor = elementProperties.scale * Minosoft.getConfig().config.game.hud.scale
val realSize = Vec2i(hudElement.layout.fakeX ?: hudElement.layout.size.x, hudElement.layout.fakeY ?: hudElement.layout.size.y) * realScaleFactor val realSize = Vec2i(hudElement.layout.fakeX ?: hudElement.layout.size.x, hudElement.layout.fakeY ?: hudElement.layout.size.y) * realScaleFactor
val elementStart = getRealPosition(realSize, elementProperties, renderWindow.screenDimensions) val elementStart = getRealPosition(realSize, elementProperties, renderWindow.screenDimensions)

View File

@ -1,21 +0,0 @@
/*
* Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.gui.rendering.hud
enum class HUDScale(val scale: Float) {
TINY(1.0f),
MEDIUM(2.0f),
LARGE(3.0f),
SENIOR(4.0f),
}