lipsync sample

This commit is contained in:
soywiz
2019-02-10 14:30:30 +01:00
parent 89478b9326
commit a307a78eaa
18 changed files with 39 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
apply plugin: "korge"
korge {
id = "com.soywiz.samples.lipsync"
}

View File

@@ -0,0 +1,28 @@
import com.soywiz.korev.*
import com.soywiz.korge.*
import com.soywiz.korge.atlas.*
import com.soywiz.korge.lipsync.*
import com.soywiz.korge.view.*
import com.soywiz.korio.async.*
import com.soywiz.korio.file.std.*
suspend fun main() = Korge {
val atlas = resourcesVfs["lips.atlas.json"].readAtlas(views)
val lips = image(atlas["lisa-A.png"].texture)
val lips2 = image(atlas["lisa-A.png"].texture).position(400, 0)
addEventListener<LipSyncEvent> {
println(it)
if (it.name == "lisa") {
lips2.texture = atlas["lisa-${it.lip}.png"].texture
}
}
launchImmediately {
fun handler(it: LipSyncEvent) {
views.dispatch(it)
lips.texture = atlas["lisa-${it.lip}.png"].texture
}
resourcesVfs["002.voice.wav"].readVoice().play("lisa") { handler(it) }
resourcesVfs["simple.voice.wav"].readVoice().play("lisa") { handler(it) }
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
lips

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -1,6 +1,5 @@
include(":sample-atlas")
include(":sample-box2d")
include(":sample-scenes")
include(":sample-tic-tac-toe-swf")
include(":sample-bitmap-font")
include(":sample-input")
for (file in rootDir.listFiles()) {
if (file.isDirectory && file.name.startsWith("sample-") && (File(file, "build.gradle").exists() || File(file, "build.gradle.kts").exists())) {
include(":${file.name}")
}
}