mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-08 04:01:51 +09:00
CRT glass texture is now painted by the caller (VMGUI) instead of the TexticsAdapter
This commit is contained in:
@@ -12,8 +12,8 @@ public class AppLoader {
|
||||
public static String appTitle = "tsvm";
|
||||
public static Lwjgl3ApplicationConfiguration appConfig;
|
||||
|
||||
public static int WIDTH = 640;//1080;//640;
|
||||
public static int HEIGHT = 480;//436;//480;
|
||||
public static int WIDTH = 800;//1080;//640;
|
||||
public static int HEIGHT = 540;//436;//480;
|
||||
|
||||
public static void main(String[] args) {
|
||||
ShaderProgram.pedantic = false;
|
||||
@@ -40,8 +40,8 @@ public class AppLoader {
|
||||
// VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{OEMBios.INSTANCE, BasicRom.INSTANCE});
|
||||
// VM vm = new VM("./assets", 64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}, 2, watchdogs);
|
||||
// VM vm = new VM(128 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, WPBios.INSTANCE});
|
||||
VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}, 8, watchdogs);
|
||||
// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.INSTANCE}, 8, watchdogs);
|
||||
// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}, 8, watchdogs);
|
||||
VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.INSTANCE}, 8, watchdogs);
|
||||
// VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8, watchdogs);
|
||||
|
||||
vm.getIO().getBlockTransferPorts()[0].attachDevice(new TestDiskDrive(vm, 0, diskPath));
|
||||
@@ -64,6 +64,6 @@ public class AppLoader {
|
||||
pipvm, 160, 140
|
||||
))));*/
|
||||
|
||||
new Lwjgl3Application(new VMGUI(reference, WIDTH, HEIGHT), appConfig);
|
||||
new Lwjgl3Application(new VMGUI(term, WIDTH, HEIGHT), appConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.ApplicationAdapter
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import kotlin.coroutines.*
|
||||
import net.torvald.terrarum.DefaultGL32Shaders
|
||||
import net.torvald.terrarum.modulecomputers.tsvmperipheral.WorldRadar
|
||||
@@ -49,6 +50,8 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
||||
|
||||
val usememvwr = false
|
||||
|
||||
private lateinit var crtGradTex: TextureRegion
|
||||
|
||||
override fun create() {
|
||||
super.create()
|
||||
|
||||
@@ -66,6 +69,9 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
||||
camera.update()
|
||||
batch.projectionMatrix = camera.combined
|
||||
|
||||
crtGradTex = TextureRegion(Texture("${vm.assetsDir}/crt_grad.png")).also {
|
||||
it.flip(false, true)
|
||||
}
|
||||
|
||||
init()
|
||||
}
|
||||
@@ -184,6 +190,13 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
gpu?.render(delta, batch, (viewportWidth - loaderInfo.drawWidth).div(2).toFloat(), (viewportHeight - loaderInfo.drawHeight).div(2).toFloat())
|
||||
|
||||
// draw CRT glass overlay
|
||||
batch.inUse {
|
||||
batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR)
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(crtGradTex, 0f, 0f, viewportWidth.toFloat(), viewportHeight.toFloat())
|
||||
}
|
||||
|
||||
vm.findPeribyType("oled")?.let {
|
||||
val disp = it.peripheral as ExtDisp
|
||||
|
||||
@@ -221,6 +234,7 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
||||
batch.dispose()
|
||||
fullscreenQuad.dispose()
|
||||
coroutineJob.interrupt()
|
||||
crtGradTex.texture.dispose()
|
||||
vm.dispose()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user