mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-09 06:34:04 +09:00
CRT glass texture is now painted by the caller (VMGUI) instead of the TexticsAdapter
This commit is contained in:
@@ -11,7 +11,7 @@ import kotlin.math.absoluteValue
|
|||||||
|
|
||||||
open class TexticsAdapterBase(assetsRoot: String, vm: VM, config: AdapterConfig) : GraphicsAdapter(assetsRoot, vm, config) {
|
open class TexticsAdapterBase(assetsRoot: String, vm: VM, config: AdapterConfig) : GraphicsAdapter(assetsRoot, vm, config) {
|
||||||
|
|
||||||
private val crtGradTex = Texture("$assetsRoot/crt_grad.png")
|
// private val crtGradTex = Texture("$assetsRoot/crt_grad.png")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val crtColor = hashMapOf(
|
val crtColor = hashMapOf(
|
||||||
@@ -58,16 +58,15 @@ open class TexticsAdapterBase(assetsRoot: String, vm: VM, config: AdapterConfig)
|
|||||||
batch.color = phosphorCol
|
batch.color = phosphorCol
|
||||||
batch.draw(faketex, xoff, HEIGHT + yoff, WIDTH.toFloat(), -HEIGHT.toFloat())
|
batch.draw(faketex, xoff, HEIGHT + yoff, WIDTH.toFloat(), -HEIGHT.toFloat())
|
||||||
|
|
||||||
// CRT glass
|
// CRT glass is overlaid by the caller (e.g. VMGUI)
|
||||||
batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR)
|
// batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR)
|
||||||
batch.color = Color.WHITE
|
// batch.color = Color.WHITE
|
||||||
batch.draw(crtGradTex, xoff, HEIGHT + ALIGN + yoff, WIDTH.toFloat(), -TEX_HEIGHT)
|
// batch.draw(crtGradTex, xoff, HEIGHT + ALIGN + yoff, WIDTH.toFloat(), -TEX_HEIGHT)
|
||||||
//batch.draw(crtGradTex, xoff, HEIGHT + yoff, WIDTH.toFloat(), -HEIGHT.toFloat())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
crtGradTex.dispose()
|
// crtGradTex.dispose()
|
||||||
super.dispose()
|
super.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ public class AppLoader {
|
|||||||
public static String appTitle = "tsvm";
|
public static String appTitle = "tsvm";
|
||||||
public static Lwjgl3ApplicationConfiguration appConfig;
|
public static Lwjgl3ApplicationConfiguration appConfig;
|
||||||
|
|
||||||
public static int WIDTH = 640;//1080;//640;
|
public static int WIDTH = 800;//1080;//640;
|
||||||
public static int HEIGHT = 480;//436;//480;
|
public static int HEIGHT = 540;//436;//480;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ShaderProgram.pedantic = false;
|
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(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("./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(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[]{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[]{OpenBios.INSTANCE}, 8, watchdogs);
|
||||||
// VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.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));
|
vm.getIO().getBlockTransferPorts()[0].attachDevice(new TestDiskDrive(vm, 0, diskPath));
|
||||||
@@ -64,6 +64,6 @@ public class AppLoader {
|
|||||||
pipvm, 160, 140
|
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.Gdx
|
||||||
import com.badlogic.gdx.graphics.*
|
import com.badlogic.gdx.graphics.*
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import kotlin.coroutines.*
|
import kotlin.coroutines.*
|
||||||
import net.torvald.terrarum.DefaultGL32Shaders
|
import net.torvald.terrarum.DefaultGL32Shaders
|
||||||
import net.torvald.terrarum.modulecomputers.tsvmperipheral.WorldRadar
|
import net.torvald.terrarum.modulecomputers.tsvmperipheral.WorldRadar
|
||||||
@@ -49,6 +50,8 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
|||||||
|
|
||||||
val usememvwr = false
|
val usememvwr = false
|
||||||
|
|
||||||
|
private lateinit var crtGradTex: TextureRegion
|
||||||
|
|
||||||
override fun create() {
|
override fun create() {
|
||||||
super.create()
|
super.create()
|
||||||
|
|
||||||
@@ -66,6 +69,9 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
|||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
|
|
||||||
|
crtGradTex = TextureRegion(Texture("${vm.assetsDir}/crt_grad.png")).also {
|
||||||
|
it.flip(false, true)
|
||||||
|
}
|
||||||
|
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
@@ -184,6 +190,13 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
|||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||||
gpu?.render(delta, batch, (viewportWidth - loaderInfo.drawWidth).div(2).toFloat(), (viewportHeight - loaderInfo.drawHeight).div(2).toFloat())
|
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 {
|
vm.findPeribyType("oled")?.let {
|
||||||
val disp = it.peripheral as ExtDisp
|
val disp = it.peripheral as ExtDisp
|
||||||
|
|
||||||
@@ -221,6 +234,7 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
|
|||||||
batch.dispose()
|
batch.dispose()
|
||||||
fullscreenQuad.dispose()
|
fullscreenQuad.dispose()
|
||||||
coroutineJob.interrupt()
|
coroutineJob.interrupt()
|
||||||
|
crtGradTex.texture.dispose()
|
||||||
vm.dispose()
|
vm.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user