mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
centering text when setting lower resolution in robot; clearing screen when changing resolution to avoid dirty buffer space and cursor going out of scope
This commit is contained in:
parent
9a0ebf1bae
commit
7cd405361b
@ -20,3 +20,4 @@ local result, reason = component.gpu.setResolution(w, h)
|
||||
if not result then
|
||||
print(reason)
|
||||
end
|
||||
term.clear()
|
@ -76,6 +76,17 @@ class Robot(playerInventory: InventoryPlayer, val robot: tileentity.Robot) exten
|
||||
GL11.glTranslatef(8, 8, 0)
|
||||
RenderState.disableLighting()
|
||||
RenderState.makeItBlend()
|
||||
val (w, h) = buffer.resolution
|
||||
val scaleX = 48f / w
|
||||
val scaleY = 14f / h
|
||||
val scale = math.min(scaleX, scaleY)
|
||||
if (scaleX > scale) {
|
||||
GL11.glTranslated(MonospaceFontRenderer.fontWidth * w * (scaleX - scale) / 2, 0, 0)
|
||||
}
|
||||
else if (scaleY > scale) {
|
||||
GL11.glTranslated(0, MonospaceFontRenderer.fontHeight * h * (scaleY - scale) / 2, 0)
|
||||
}
|
||||
GL11.glScalef(scale, scale, scale)
|
||||
BufferRenderer.drawText()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user