mirror of
https://github.com/jlengrand/korge-samples.git
synced 2026-03-10 08:31:18 +00:00
Update to korge 1.10.0.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
buildscript {
|
||||
val korgePluginVersion: String by project
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = uri("https://dl.bintray.com/korlibs/korlibs") }
|
||||
@@ -1,6 +1,8 @@
|
||||
korgePluginVersion=1.5.7.0
|
||||
korgePluginVersion=1.10.0.0
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
web.bind.port=8080
|
||||
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
org.gradle.parallel=true
|
||||
org.gradle.parallel.intra=true
|
||||
org.gradle.configureondemand=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
29
gradlew
vendored
29
gradlew
vendored
@@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -175,14 +175,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
3
gradlew.bat
vendored
3
gradlew.bat
vendored
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.korge3d"
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.bitmapfont"
|
||||
}
|
||||
7
sample-atlas/build.gradle.kts
Normal file
7
sample-atlas/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.bitmapfont"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.bitmapfont"
|
||||
}
|
||||
7
sample-bitmap-font/build.gradle.kts
Normal file
7
sample-bitmap-font/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.bitmapfont"
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.sample1"
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.dragonbones"
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.filters"
|
||||
}
|
||||
7
sample-filters/build.gradle.kts
Normal file
7
sample-filters/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.filters"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.input"
|
||||
}
|
||||
7
sample-input/build.gradle.kts
Normal file
7
sample-input/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.input"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.korio"
|
||||
}
|
||||
7
sample-korio/build.gradle.kts
Normal file
7
sample-korio/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.korio"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.lipsync"
|
||||
supportMp3()
|
||||
}
|
||||
8
sample-lipsync/build.gradle.kts
Normal file
8
sample-lipsync/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.lipsync"
|
||||
supportMp3()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.luak"
|
||||
dependencyMulti "com.soywiz.korlibs.luak:luak:0.1.7"
|
||||
}
|
||||
8
sample-luak/build.gradle.kts
Normal file
8
sample-luak/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.luak"
|
||||
dependencyMulti("com.soywiz.korlibs.luak:luak:0.2.0")
|
||||
}
|
||||
@@ -165,27 +165,3 @@ fun Views.registerProcessSystem() {
|
||||
|
||||
suspend fun readImage(path: String) = resourcesVfs[path].readBitmapSlice()
|
||||
suspend fun readSound(path: String) = resourcesVfs[path].readNativeSoundOptimized()
|
||||
|
||||
// Remove once in KorGE
|
||||
fun <T : View> T.dockedTo2(anchor: Anchor, scaleMode: ScaleMode = ScaleMode.NO_SCALE): T = this.also { DockingComponent2(this, anchor, scaleMode).attach() }
|
||||
class DockingComponent2(override val view: View, var anchor: Anchor, var scaleMode: ScaleMode = ScaleMode.NO_SCALE) : ResizeComponent {
|
||||
//private val bounds = Rectangle()
|
||||
|
||||
val initialViewSize = Size(view.width, view.height)
|
||||
private val actualVirtualSize = Size(0, 0)
|
||||
private val targetSize = Size(0, 0)
|
||||
|
||||
override fun resized(views: Views, width: Int, height: Int) {
|
||||
view.position(
|
||||
views.actualVirtualLeft.toDouble() + (views.actualVirtualWidth) * anchor.sx,
|
||||
views.actualVirtualTop.toDouble() + (views.actualVirtualHeight) * anchor.sy
|
||||
)
|
||||
if (scaleMode != ScaleMode.NO_SCALE) {
|
||||
actualVirtualSize.setTo(views.actualVirtualWidth, views.actualVirtualHeight)
|
||||
val size = scaleMode.invoke(initialViewSize, actualVirtualSize, targetSize)
|
||||
view.setSize(size.width, size.height)
|
||||
}
|
||||
view.invalidate()
|
||||
view.parent?.invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.soywiz.korge.samples.minesweeper
|
||||
|
||||
import com.soywiz.korev.*
|
||||
import com.soywiz.korge.*
|
||||
import com.soywiz.korge.component.docking.*
|
||||
import com.soywiz.korge.service.process.*
|
||||
import com.soywiz.korge.view.*
|
||||
import com.soywiz.korma.geom.*
|
||||
@@ -24,7 +25,7 @@ class MainProcess(parent: Container) : Process(parent) {
|
||||
val lights = arrayListOf<RandomLight>()
|
||||
|
||||
override suspend fun main() {
|
||||
image(readImage("bg.jpg")).dockedTo2(Anchor.TOP_LEFT, ScaleMode.EXACT)
|
||||
image(readImage("bg.jpg")).dockedTo(Anchor.TOP_LEFT, ScaleMode.EXACT)
|
||||
val light = readImage("light.png")
|
||||
val imageset = readImage("buscaminas.png")
|
||||
val imagenes = imageset.split(imageset.height, imageset.height)
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.onscreencontroller"
|
||||
}
|
||||
7
sample-onscreen-controller/build.gradle.kts
Normal file
7
sample-onscreen-controller/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.onscreencontroller"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.particles"
|
||||
}
|
||||
7
sample-particles/build.gradle.kts
Normal file
7
sample-particles/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.particles"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.polyphonic"
|
||||
}
|
||||
7
sample-polyphonic/build.gradle.kts
Normal file
7
sample-polyphonic/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.polyphonic"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.scenes"
|
||||
}
|
||||
7
sample-scenes/build.gradle.kts
Normal file
7
sample-scenes/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.scenes"
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.sample1"
|
||||
@@ -1,10 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.tictactoe"
|
||||
name = "tic-tac-toe"
|
||||
icon = new File(projectDir, "src/commonMain/resources/icon.png")
|
||||
|
||||
//dependencyMulti("com.soywiz:korge-swf:$korgeVersion")
|
||||
supportSwf()
|
||||
}
|
||||
13
sample-tic-tac-toe-swf/build.gradle.kts
Normal file
13
sample-tic-tac-toe-swf/build.gradle.kts
Normal file
@@ -0,0 +1,13 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
import com.soywiz.korge.gradle.util.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.tictactoe"
|
||||
name = "tic-tac-toe"
|
||||
icon = projectDir["src/commonMain/resources/icon.png"]
|
||||
|
||||
//dependencyMulti("com.soywiz:korge-swf:$korgeVersion")
|
||||
supportSwf()
|
||||
}
|
||||
@@ -37,14 +37,11 @@ class TicTacToeMainScene : Scene() {
|
||||
val board = Board(3, 3)
|
||||
lateinit var game: Game
|
||||
|
||||
override suspend fun init(injector: AsyncInjector) {
|
||||
super.init(injector)
|
||||
|
||||
//mainLibrary = resourcesVfs["main.swf"].readSWF(views)
|
||||
override suspend fun Container.sceneInit() {
|
||||
mainLibrary = resourcesVfs["main.ani"].readAni(views)
|
||||
}
|
||||
|
||||
override suspend fun Container.sceneInit() {
|
||||
override suspend fun Container.sceneMain() {
|
||||
|
||||
sceneView += mainLibrary.createMainTimeLine()
|
||||
|
||||
@@ -59,30 +56,29 @@ class TicTacToeMainScene : Scene() {
|
||||
//val p2 = InteractivePlayer(board, Chip.CIRCLE)
|
||||
|
||||
game = Game(board, listOf(p1, p2))
|
||||
launchImmediately {
|
||||
while (true) {
|
||||
game.board.reset()
|
||||
val result = game.game()
|
||||
while (true) {
|
||||
game.board.reset()
|
||||
val result = game.game()
|
||||
|
||||
println(result)
|
||||
println(result)
|
||||
|
||||
val results = mainLibrary.createMovieClip("Results")
|
||||
//(results["result"] as AnTextField).format?.face = Html.FontFace.Bitmap(font)
|
||||
when (result) {
|
||||
is Game.Result.DRAW -> results["result"].setText("DRAW")
|
||||
is Game.Result.WIN -> {
|
||||
results["result"].setText("WIN")
|
||||
for (cell in result.cells) cell.highlight(true)
|
||||
for (cell in game.board.cells.toList() - result.cells) cell.lowlight(true)
|
||||
}
|
||||
val results = mainLibrary.createMovieClip("Results")
|
||||
//(results["result"] as AnTextField).format?.face = Html.FontFace.Bitmap(font)
|
||||
when (result) {
|
||||
is Game.Result.DRAW -> results["result"].setText("DRAW")
|
||||
is Game.Result.WIN -> {
|
||||
results["result"].setText("WIN")
|
||||
for (cell in result.cells) cell.highlight(true)
|
||||
for (cell in game.board.cells.toList() - result.cells) cell.lowlight(true)
|
||||
}
|
||||
sceneView += results
|
||||
results["hit"]?.mouse?.onClick?.waitOne()
|
||||
//sceneView -= results
|
||||
results.removeFromParent()
|
||||
|
||||
}
|
||||
sceneView += results
|
||||
results["hit"]?.mouse?.onClick?.waitOne()
|
||||
//sceneView -= results
|
||||
results.removeFromParent()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
apply plugin: "korge"
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.tilemap"
|
||||
}
|
||||
7
sample-tilemap/build.gradle.kts
Normal file
7
sample-tilemap/build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samples.tilemap"
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.sampleui"
|
||||
@@ -25,7 +25,7 @@ suspend fun main() = Korge(quality = GameWindow.Quality.PERFORMANCE, title = "UI
|
||||
//uiSkin(OtherUISkin()) {
|
||||
defaultUISkin = OtherUISkin()
|
||||
defaultUIFont = Html.FontFace.Bitmap(resourcesVfs["uifont.fnt"].readBitmapFontWithMipmaps())
|
||||
uiTextButton(256.0, 32.0) {
|
||||
textButton(256.0, 32.0) {
|
||||
text = "Disabled Button"
|
||||
position(128, 128)
|
||||
onClick {
|
||||
@@ -33,7 +33,7 @@ suspend fun main() = Korge(quality = GameWindow.Quality.PERFORMANCE, title = "UI
|
||||
}
|
||||
disable()
|
||||
}
|
||||
uiTextButton(256.0, 32.0) {
|
||||
textButton(256.0, 32.0) {
|
||||
text = "Enabled Button"
|
||||
position(128, 128 + 32)
|
||||
onClick {
|
||||
@@ -68,7 +68,7 @@ suspend fun main() = Korge(quality = GameWindow.Quality.PERFORMANCE, title = "UI
|
||||
}) {
|
||||
|
||||
for (n in 0 until 16) {
|
||||
uiTextButton(text = "HELLO $n").position(0, n * 64)
|
||||
textButton(text = "HELLO $n").position(0, n * 64)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ suspend fun OtherUISkin(): UISkin = OtherUISkinOnce {
|
||||
|
||||
DefaultUISkin.copy(
|
||||
normal = ui.sliceWithSize(0, 0, 64, 64),
|
||||
hover = ui.sliceWithSize(64, 0, 64, 64),
|
||||
over = ui.sliceWithSize(64, 0, 64, 64),
|
||||
down = ui.sliceWithSize(127, 0, 64, 64),
|
||||
backColor = DefaultUISkin.backColor.transform(otherColorTransform)
|
||||
//,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
apply plugin: "korge"
|
||||
import com.soywiz.korge.gradle.*
|
||||
|
||||
apply<KorgeGradlePlugin>()
|
||||
|
||||
korge {
|
||||
id = "com.soywiz.samplevideo"
|
||||
@@ -8,5 +10,5 @@ korge {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
commonMainApi("com.soywiz.korlibs.korvi:korvi:0.0.1")
|
||||
add("commonMainApi", "com.soywiz.korlibs.korvi:korvi:0.1.1")
|
||||
}
|
||||
Reference in New Issue
Block a user