magnified screen will display everything correctly scaled (but some buttons wont work for some reason)

This commit is contained in:
minjaesong
2022-08-10 00:04:26 +09:00
parent 6e0f9a5924
commit f4d8d72715
8 changed files with 171 additions and 110 deletions

View File

@@ -72,19 +72,25 @@ class UIInventoryFull(
App.disposables.add(shapeRenderer)
}
val magn = App.scr.magn
val gradTopStart = -YPOS_CORRECTION + (App.scr.height - internalHeight).div(2).toFloat()
val gradBottomEnd = App.scr.height - gradTopStart
val gradTopStart0 = -YPOS_CORRECTION + (App.scr.height - internalHeight).div(2).toFloat()
val gradTopStart = gradTopStart0 * magn
val gradBottomEnd = (App.scr.height - gradTopStart0) * magn
val gradHeightFlat = (2*YPOS_CORRECTION + internalHeight - (2 * gradHeight)) * magn
val gradHeight = gradHeight * magn
val w = App.scr.wf * magn
val h = App.scr.hf * magn
shapeRenderer!!.inUse {
// shaperender starts at bottom-left!
it.rect(0f, gradTopStart, App.scr.wf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
it.rect(0f, gradBottomEnd, App.scr.wf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
it.rect(0f, gradTopStart, w, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
it.rect(0f, gradBottomEnd, w, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
it.rect(0f, gradTopStart + gradHeight, App.scr.wf, 2*YPOS_CORRECTION + internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
it.rect(0f, gradTopStart + gradHeight, w, gradHeightFlat, gradEndCol, gradEndCol, gradEndCol, gradEndCol)
it.rect(0f, 0f, App.scr.wf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
it.rect(0f, App.scr.hf, App.scr.wf, -(App.scr.hf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
it.rect(0f, 0f, w, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
it.rect(0f, h, w, -(h - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
}
batch.begin()

View File

@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import net.torvald.unicode.getKeycapConsole
import net.torvald.unicode.getKeycapPC
import net.torvald.terrarum.*
@@ -33,8 +32,6 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
override var openCloseTime: Second = 0f
private val shapeRenderer = ShapeRenderer()
internal val uiWidth = MODULEINFO_CELL_WIDTH
internal val uiX: Int
@@ -255,7 +252,6 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
}
override fun dispose() {
try { shapeRenderer.dispose() } catch (e: IllegalArgumentException) {}
try { sliderFBO.dispose() } catch (e: IllegalArgumentException) {}
}