LibGDX, here I am.

This commit is contained in:
minjaesong
2017-06-22 02:31:07 +09:00
parent ae00e2b8a6
commit 8e5e95e5a9
356 changed files with 3125 additions and 21138 deletions

View File

@@ -1,18 +1,17 @@
package net.torvald.terrarum.virtualcomputer.peripheral
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.ModMgr
import org.luaj.vm2.Globals
import org.newdawn.slick.Graphics
import org.newdawn.slick.SpriteSheet
import org.newdawn.slick.SpriteSheetFont
/**
* Created by minjaesong on 2017-05-31.
*/
class PeripheralCharLCD(val width: Int, val height: Int) : Peripheral("charLCD") {
companion object {
private val fontSheet = SpriteSheet(ModMgr.getPath("dwarventech", "mt-32.tga"), 16, 16)
private val font = SpriteSheetFont(fontSheet, 0.toChar())
/*companion object {
private val fontSheet = BitmapFont(ModMgr.getPath("dwarventech", "mt-32.tga"), 16, 16)
private val font = BitmapFont(fontSheet, 0.toChar())
private val fontW = fontSheet.width / fontSheet.horizontalCount
private val fontH = fontSheet.height / fontSheet.verticalCount
}
@@ -34,11 +33,19 @@ class PeripheralCharLCD(val width: Int, val height: Int) : Peripheral("charLCD")
/**
* @param g Frame Buffer that holds the display of LCD screen
*/
fun render(g: Graphics) {
g.font = PeripheralCharLCD.font
fun render(batch: SpriteBatch) {
memory.forEachIndexed { index, byte ->
g.drawString("${byte.toChar()}", (index % width) * fontW.toFloat(), (index / width) * fontH.toFloat())
font.draw(batch, "${byte.toChar()}", (index % width) * fontW.toFloat(), (index / width) * fontH.toFloat())
}
}*/
override fun loadLib(globals: Globals) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun toString(): String {
return super.toString()
}
override val memSize: Int
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
}

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum.virtualcomputer.peripheral
import net.torvald.terrarum.Terrarum
import com.badlogic.gdx.graphics.Color
import net.torvald.terrarum.TerrarumGDX
import net.torvald.terrarum.gameactors.DecodeTapestry
import net.torvald.terrarum.gameactors.ai.toLua
import net.torvald.terrarum.virtualcomputer.computer.TerrarumComputer
@@ -8,7 +9,6 @@ import net.torvald.terrarum.virtualcomputer.terminal.Terminal
import org.luaj.vm2.*
import org.luaj.vm2.lib.*
import org.luaj.vm2.lib.ThreeArgFunction
import org.newdawn.slick.*
import java.util.*
/**
@@ -16,7 +16,7 @@ import java.util.*
*
* Created by SKYHi14 on 2017-02-08.
*/
class PeripheralVideoCard(val host: TerrarumComputer, val termW: Int = 80, val termH: Int = 25) :
/*class PeripheralVideoCard(val host: TerrarumComputer, val termW: Int = 80, val termH: Int = 25) :
Peripheral("ppu") {
companion object {
val blockW = 8 // MUST BE 8
@@ -163,7 +163,7 @@ class PeripheralVideoCard(val host: TerrarumComputer, val termW: Int = 80, val t
private val spriteBuffer = ImageBuffer(VSprite.width * 2, VSprite.height)
fun render(g: Graphics) {
cursorBlinkTimer += Terrarum.delta
cursorBlinkTimer += Gdx.graphics.deltaTime
if (cursorBlinkTimer > cursorBlinkTime) {
cursorBlinkTimer -= cursorBlinkTime
cursorBlinkOn = !cursorBlinkOn
@@ -641,7 +641,7 @@ class VSprite {
setPixel(i % width, i / width, data[i])
}
}
}
}*/
abstract class FourArgFunction : LibFunction() {