mirror of
https://github.com/jlengrand/korge-samples.git
synced 2026-03-10 08:31:18 +00:00
Updated example
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
classpath "com.jtransc:jtransc-gradle-plugin:$jtranscVersion"
|
||||
classpath "com.soywiz:korge-gradle-plugin:$korVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,3 +24,4 @@ allprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
korVersion=0.8.4
|
||||
jtranscVersion=0.5.14
|
||||
kotlinVersion=1.1.1
|
||||
korVersion=0.9.0
|
||||
jtranscVersion=0.5.15
|
||||
kotlinVersion=1.1.2
|
||||
vertxVersion=3.3.3
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sat Apr 15 17:54:56 CEST 2017
|
||||
#Thu Apr 27 14:52:16 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
classpath "com.jtransc:jtransc-gradle-plugin:$jtranscVersion"
|
||||
}
|
||||
}
|
||||
|
||||
group 'com.soywiz'
|
||||
version "$korVersion"
|
||||
|
||||
@@ -17,7 +5,7 @@ apply plugin: 'java'
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
apply plugin: 'jtransc'
|
||||
apply plugin: "korge"
|
||||
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
compileTestJava.options.encoding = 'UTF-8'
|
||||
|
||||
1
korge-tic-tac-toe/.gitignore
vendored
Normal file
1
korge-tic-tac-toe/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
genresources
|
||||
@@ -5,13 +5,38 @@ apply plugin: 'application'
|
||||
|
||||
mainClassName = "com.soywiz.korge.tictactoe.TicTacToeKt"
|
||||
|
||||
sourceSets {
|
||||
generated.resources.srcDirs = [ 'genresources' ]
|
||||
|
||||
main.kotlin.srcDirs = [ 'src' ]
|
||||
main.resources.srcDirs = [ 'resources', 'genresources' ]
|
||||
test.kotlin.srcDirs = [ 'test' ]
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
compile "com.soywiz:korge:$korVersion"
|
||||
compile "com.soywiz:korge-ext-swf:$korVersion"
|
||||
compile "com.soywiz:korau-mp3:$korVersion"
|
||||
|
||||
nojtransc "com.soywiz:korge-ext-swf:$korVersion"
|
||||
nojtransc "com.soywiz:korau-mp3:$korVersion"
|
||||
}
|
||||
|
||||
jtransc {
|
||||
minimizeNames = true
|
||||
treeshaking = true
|
||||
|
||||
assets("resources")
|
||||
}
|
||||
assets("genresources")
|
||||
|
||||
skipServiceLoader("com.soywiz.korim.format.JPEG")
|
||||
skipServiceLoader("com.soywiz.korim.format.PNG")
|
||||
|
||||
skipServiceLoader("com.soywiz.korau.format.MP3")
|
||||
skipServiceLoader("com.soywiz.korau.format.OGG")
|
||||
}
|
||||
|
||||
jar.enabled = false
|
||||
distTar.enabled = false
|
||||
distZip.enabled = false
|
||||
|
||||
Binary file not shown.
9
korge-tic-tac-toe/resources/main.swf.config
Normal file
9
korge-tic-tac-toe/resources/main.swf.config
Normal file
@@ -0,0 +1,9 @@
|
||||
mipmaps: true
|
||||
antialiasing: true
|
||||
rasterizerMethod: X4
|
||||
exportScale: 2.0
|
||||
minShapeSide: 64
|
||||
maxShapeSide: 512
|
||||
minMorphShapeSide: 16
|
||||
maxMorphShapeSide: 128
|
||||
exportPaths: false
|
||||
39
korge-tic-tac-toe/resources/particle/particle.pex
Normal file
39
korge-tic-tac-toe/resources/particle/particle.pex
Normal file
@@ -0,0 +1,39 @@
|
||||
<particleEmitterConfig>
|
||||
<texture name="texture.png"/>
|
||||
<sourcePosition x="300.00" y="300.00"/>
|
||||
<sourcePositionVariance x="0.00" y="0.00"/>
|
||||
<speed value="100.00"/>
|
||||
<speedVariance value="30.00"/>
|
||||
<particleLifeSpan value="2.0000"/>
|
||||
<particleLifespanVariance value="1.9000"/>
|
||||
<angle value="270.00"/>
|
||||
<angleVariance value="2.00"/>
|
||||
<gravity x="0.00" y="0.00"/>
|
||||
<radialAcceleration value="0.00"/>
|
||||
<tangentialAcceleration value="0.00"/>
|
||||
<radialAccelVariance value="0.00"/>
|
||||
<tangentialAccelVariance value="0.00"/>
|
||||
<startColor red="1.00" green="0.31" blue="0.00" alpha="0.62"/>
|
||||
<startColorVariance red="0.00" green="0.00" blue="0.00" alpha="0.00"/>
|
||||
<finishColor red="1.00" green="0.31" blue="0.00" alpha="0.00"/>
|
||||
<finishColorVariance red="0.00" green="0.00" blue="0.00" alpha="0.00"/>
|
||||
<maxParticles value="500"/>
|
||||
<startParticleSize value="70.00"/>
|
||||
<startParticleSizeVariance value="49.53"/>
|
||||
<finishParticleSize value="10.00"/>
|
||||
<FinishParticleSizeVariance value="5.00"/>
|
||||
<duration value="-1.00"/>
|
||||
<emitterType value="0"/>
|
||||
<maxRadius value="100.00"/>
|
||||
<maxRadiusVariance value="0.00"/>
|
||||
<minRadius value="0.00"/>
|
||||
<minRadiusVariance value="0.00"/>
|
||||
<rotatePerSecond value="0.00"/>
|
||||
<rotatePerSecondVariance value="0.00"/>
|
||||
<blendFuncSource value="770"/>
|
||||
<blendFuncDestination value="1"/>
|
||||
<rotationStart value="0.00"/>
|
||||
<rotationStartVariance value="0.00"/>
|
||||
<rotationEnd value="0.00"/>
|
||||
<rotationEndVariance value="0.00"/>
|
||||
</particleEmitterConfig>
|
||||
BIN
korge-tic-tac-toe/resources/particle/texture.png
Normal file
BIN
korge-tic-tac-toe/resources/particle/texture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
69
korge-tic-tac-toe/resources/tiled/sample.tmx
Normal file
69
korge-tic-tac-toe/resources/tiled/sample.tmx
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="32" height="32" tilewidth="32" tileheight="32" nextobjectid="6">
|
||||
<tileset firstgid="1" name="wood_tileset_3" tilewidth="32" tileheight="32" tilecount="256" columns="16">
|
||||
<image source="wood_tileset_3.png" width="512" height="512"/>
|
||||
</tileset>
|
||||
<layer name="Capa de Patrones 1" width="32" height="32">
|
||||
<data encoding="csv">
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,18,18,18,18,1,49,50,51,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,18,18,18,18,1,65,66,67,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,18,18,18,1,1,81,82,83,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,18,18,1,1,1,1,1,1,1,1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
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup color="#ff00ff" draworder="index" name="Capa de Objetos 1" opacity="0.9" offsetx="5" offsety="5">
|
||||
<properties>
|
||||
<property name="boolvalue" type="bool" value="true"/>
|
||||
<property name="boolvalue2" type="bool" value="false"/>
|
||||
<property name="colorvalue1" type="color" value="#ff996633"/>
|
||||
<property name="filevalue" type="file" value="wood_tileset_3.png"/>
|
||||
<property name="floatvalue1" type="float" value="7.3"/>
|
||||
<property name="intvalue" type="int" value="-2"/>
|
||||
<property name="text" value="hello"/>
|
||||
</properties>
|
||||
<object id="2" x="224" y="64" width="96" height="96"/>
|
||||
<object id="3" x="226" y="535" width="155" height="155">
|
||||
<ellipse/>
|
||||
</object>
|
||||
<object id="4" x="191" y="762">
|
||||
<polyline points="0,0 -16,93 65,78 73,129 189,58 220,110 279,12 301,-51 167,-56 83,-77 40,-56 139,23 199,2"/>
|
||||
</object>
|
||||
<object id="5" x="335" y="907">
|
||||
<polygon points="0,0 -154,43 -56,84 96,62 165,-44 193,-4 198,-94 106,-21"/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
<imagelayer name="Capa de Imagen 1" offsetx="200" offsety="200">
|
||||
<image source="wood_tileset_3.png" trans="0000ff" width="512" height="512"/>
|
||||
<properties>
|
||||
<property name="test" type="int" value="0"/>
|
||||
</properties>
|
||||
</imagelayer>
|
||||
</map>
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.soywiz.korge.tictactoe
|
||||
|
||||
import com.soywiz.korge.animate.AnMovieClip
|
||||
import com.soywiz.korge.animate.play
|
||||
import com.soywiz.korge.input.onClick
|
||||
import com.soywiz.korge.tween.*
|
||||
@@ -7,6 +8,7 @@ import com.soywiz.korge.view.View
|
||||
import com.soywiz.korge.view.get
|
||||
import com.soywiz.korio.async.Signal
|
||||
import com.soywiz.korio.async.async
|
||||
import com.soywiz.korio.async.sleep
|
||||
import com.soywiz.korio.util.Extra
|
||||
|
||||
var Board.Cell.view by Extra.Property<View?> { null }
|
||||
@@ -22,7 +24,7 @@ fun Board.Cell.set(type: Chip) {
|
||||
})
|
||||
}
|
||||
|
||||
fun Board.Cell.setAnimate(type: Chip) {
|
||||
suspend fun Board.Cell.setAnimate(type: Chip) {
|
||||
set(type)
|
||||
async {
|
||||
view.tween(
|
||||
@@ -35,7 +37,7 @@ fun Board.Cell.setAnimate(type: Chip) {
|
||||
|
||||
var Board.Cell.highlighting by Extra.Property { false }
|
||||
|
||||
fun Board.Cell.highlight(highlight: Boolean) {
|
||||
suspend fun Board.Cell.highlight(highlight: Boolean) {
|
||||
view["highlight"].play(if (highlight) "highlight" else "none")
|
||||
this.highlighting = highlight
|
||||
if (highlight) {
|
||||
@@ -60,7 +62,7 @@ fun Board.Cell.highlight(highlight: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Board.Cell.lowlight(lowlight: Boolean) {
|
||||
suspend fun Board.Cell.lowlight(lowlight: Boolean) {
|
||||
async {
|
||||
view.tween(
|
||||
view!!::scale[1.0, 0.7],
|
||||
@@ -70,7 +72,7 @@ fun Board.Cell.lowlight(lowlight: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Board.reset() {
|
||||
suspend fun Board.reset() {
|
||||
for (cell in cells) {
|
||||
//cell.view?.removeAllComponents()
|
||||
cell.set(Chip.EMPTY)
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.soywiz.korge.Korge
|
||||
import com.soywiz.korge.animate.AnLibrary
|
||||
import com.soywiz.korge.bitmapfont.BitmapFont
|
||||
import com.soywiz.korge.input.mouse
|
||||
import com.soywiz.korge.resources.Mipmaps
|
||||
import com.soywiz.korge.resources.Path
|
||||
import com.soywiz.korge.resources.ResourcesRoot
|
||||
import com.soywiz.korge.scene.Module
|
||||
import com.soywiz.korge.scene.Scene
|
||||
import com.soywiz.korge.view.Container
|
||||
@@ -15,6 +15,7 @@ import com.soywiz.korge.view.setText
|
||||
import com.soywiz.korio.async.Signal
|
||||
import com.soywiz.korio.async.go
|
||||
import com.soywiz.korio.async.waitOne
|
||||
import com.soywiz.korio.inject.AsyncInjector
|
||||
import com.soywiz.korma.geom.PointInt
|
||||
|
||||
fun main(args: Array<String>) = Korge(TicTacToeModule)
|
||||
@@ -23,11 +24,16 @@ object TicTacToeModule : Module() {
|
||||
override val mainScene: Class<out Scene> = TicTacToeMainScene::class.java
|
||||
override val title: String = "tic-tac-toe"
|
||||
override val icon: String = "icon.png"
|
||||
|
||||
suspend override fun init(injector: AsyncInjector) {
|
||||
//injector.get<ResourcesRoot>().mapExtensions("swf" to "ani")
|
||||
//injector.get<ResourcesRoot>().mapExtensionsJustInJTransc("swf" to "ani")
|
||||
}
|
||||
}
|
||||
|
||||
// Controller
|
||||
class TicTacToeMainScene(
|
||||
@Mipmaps @Path("main.swf") val mainLibrary: AnLibrary,
|
||||
@Path("main.swf") val mainLibrary: AnLibrary,
|
||||
@Path("font/font.fnt") val font: BitmapFont
|
||||
) : Scene() {
|
||||
val board = Board(3, 3)
|
||||
|
||||
Reference in New Issue
Block a user