VT redraw on request

Former-commit-id: 3ada71215d9291760704a982cc3952061dbc7afe
Former-commit-id: ca1495e668e88bc7214429472ad918621a650189
This commit is contained in:
Song Minjae
2017-01-24 00:50:12 +09:00
parent 92cc8ff94b
commit f46991ffbb
9 changed files with 189 additions and 43 deletions

View File

@@ -132,6 +132,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
//addState(StateFontTester())
//addState(StateNoiseTexGen())
//addState(StateBlurTest())
//addState(StateShaderTest())
ingame = StateInGame()
addState(ingame)
@@ -241,6 +242,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
val STATE_ID_TEST_LIGHTNING_GFX = 0x101
val STATE_ID_TEST_TTY = 0x102
val STATE_ID_TEST_BLUR = 0x103
val STATE_ID_TEST_SHADER = 0x104
val STATE_ID_TOOL_NOISEGEN = 0x200
@@ -538,4 +540,21 @@ fun Image.getPixel(x: Int, y: Int): IntArray {
else 255
)
}
}
}
fun Color.toInt() = redByte.shl(16) or greenByte.shl(8) or blueByte
fun Color.to10bit() = redByte.shl(20) or greenByte.shl(10) or blueByte
infix fun Color.screen(other: Color) = Color(
1f - (1f - this.r) * (1f - other.r),
1f - (1f - this.g) * (1f - other.g),
1f - (1f - this.b) * (1f - other.b),
1f - (1f - this.a) * (1f - other.a)
)
infix fun Color.mul(other: Color) = Color(
this.r * other.r,
this.g * other.g,
this.b * other.b,
this.a * other.a
)