does exists any port guide to korge 2 ? or maybe i...
# korge
p
does exists any port guide to korge 2 ? or maybe it isnt necessary ?
r
We're planning to write it soon
p
i've some questions maybe before writing the docs you can help me out
Copy code
com.soywiz.korge.view.Fonts
doesn't exists anymore
Copy code
override suspend fun init(injector: AsyncInjector): Unit = injector.run
i have this in my module definition, but looks like the method init cannot be overriden anymore
r
Check something like
fun AsyncInjector.init()
p
i have this:
Copy code
val graphics = mainGraphics.graphics {
    fill(Colors[if(lives[i]) "#00D4A9" else "#AAAAAA"]) {
        roundRect(liveX, liveY, liveWidth, liveHeight, 30.0, 30.0)
    }
}
but the extension function of Graphics to add a new Graphics instance to itself doesn't work anymore
can it be that Graphics is not a component anymore ?
r
not a container?
p
sorry, container
r
maybe
well, you shouldn't use Graphics instance as a container anyway
p
ok, got it, will refactor that
Copy code
text(text = if(valid) "GREAT" else "WRONG") {
    resultTextView = this
    format = Html.Format(align = Html.Alignment.MIDDLE_CENTER, color = colorState, size = 40, face = Html.FontFace.Bitmap(fontLoader[FontLoader.Font.NORMAL_FONT]))
    xy(circleResult.x + circleResult.width / 2 - width / 2, circleResult.y + circleResult.height * 1.1)
}
format attribute doesn't exists anymore on Text ?
r
You should use TextAlignment instead
p
perfect, that works
when upgrade to korge 2 the font rendering is quite different. Anything I should know about it to change ?
this is the font definition i'm using
@Deactivated User sorry, can you help me with this? what can have happened that the font definition that previosuly worked fine now it looks weird ?
d
I have fixed the text rendering a few hours ago not in rc2
will be in the next release
you can try it by downloading korge-next repo, changing version to 2.0.0-rc2 on the gradle.properties, and ./gradlew publishToMavenLocal
it should be fixed by now
p
i've this one configured as buildscript dependency:
Copy code
"com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:$korgePluginVersion"
and this repo:
Copy code
maven { url = uri("<https://dl.bintray.com/korlibs/korlibs>") }
Copy code
korgePluginVersion=2.0.0.1-rc2
d
Copy code
korgePluginVersion=2.0.0.2-rc2
is the latest
that uses 2.0.0-rc2 artifacts
p
what about the repo ? is my configuration ok ?
d
the 2.0.0.2-rc2 is the version of the gradle plugin
these are the repositories you should have
p
perfect
trying it now
thx
d
👍
p
i've also defined this project dependencies:
Copy code
dependencies {
    add("commonMainApi", "com.soywiz.korlibs.korvi:korvi:2.0.0-rc2")
    add("commonMainApi", "com.soywiz.korlibs.korgw:korgw:2.0.0-rc2")
}
should I change these versions ?
d
they are probably published
korgw is already included with korge
p
they are, and they work fine, but not sure if your font fix is in that version because i'm getting the same result
d
and gradle.properties --> version=2.0.0-rc2
and: ./gradlew publishToMavenLocal
?
p
oooh gotcha, you havent published it yet to the mvn repo
ok, i'll have to wait because whenever i push my code i'll have the build server to fail because it will go search the dependencies remotely
i can wait if you tell me that you'll release the next version later
when are you planning to actually release that version ?
d
we are waiting for the final release of Kotlin 1.4.20
there are still a couple of issues I have to fix before the final release, but probably that will happen in the next days
p
oh ok, that's soon
d
yeah, if Kotlin 1.4.20 is not released this week, I will release rc3 using the 1.4.20-rc version that is already on central
p
do you know if expect/actual wil lbe part of 1.4.20 as a stable functionality ?
d
what do you mean by expect/actual?
korge requires 1.4.20 because 1.4.10 had some nasty bugs with the js backend
p
the kotlin functionality to define an interface common to all platforms by using 'expect' keyword, and the actual implementation
d
multiplatform projects are 1.4.x is still experimental
but it works fine
p
when I try to compile with gradle a korge's project using that syntax I get an error message indicating that I should enable explicitly multiplatform
d
uhm?
p
and i weren't able to find yet the place to let the kotlin compiler to know that I do want to use the experimental api
d
can you put the error?
p
sure, one sec
ok, for some reason, probably because I've updated to korge 2, the error has changed and looks simpler to fix
the weird thing is that I actually have defined the Video implementation for jvm...
d
that's because jvm and android source sets are different
jvmAndroidMain or androidMain
p
uhhhm, yes, in fact I'm getting this only when trying to build androidAar task
when I run runJvm task it doesn't complain
does it have something to do with android build variants ?
I see there's a well known nomenclature on the error message: C\devel\projects\tool framework multi platform\src\commonMain\kotlin\com\senaptec\toolframework\ui\Video.kt (3, 14): Expected class 'Video' has no actual declaration in module <tool_framework_multi_platform_debug> for JVM that _debug at the end of the module name seems to be the debug variant of an android project
d
have you tried to put the actual on a folder called jvmAndroidMain so it works for both jvm and android?
p
didnt know that target exists
let me try
should I define something else on build.gradle or only by adding that extra folder should be enough ?
d
is not a target, but a source set, both the android and the jvm targets include that folder to read the kotlin files from there
if you are using the korge plugin, that plugin configures those folders automatically
p
using it
d
uhm
maybe the plugin not
p
let me check if there's a way to list the sourcesets with some gradle task
d
only korge-next when building the projects
you can try to just copy the jvmMain files into androidMain
p
actually there's no implementation at all in that only class, they are defined exactly the same on both androidMain and jvmMain as this:
Copy code
package com.senaptec.toolframework.ui

actual class Video {
}
and then in commonMain as this:
Copy code
package com.senaptec.toolframework.ui

expect class Video {
}
d
then if it fails, the androidMain folder is not being loaded as part of the android source set
p
i'm using this flag on korge's plugin, will try without it to trace if that's causing it... not probable, but let's give it a try
Copy code
androidLibrary = true
d
the build/platforms/android/build.gradle doesn't reference the ../../../src/androidMain folder?
p
let me check
looks like not
d
wtf, looks like!
then that's a bug
There is a
build.extra.gradle
you can add that manually
Copy code
android
    sourceSets {
        main {
            java.srcDirs += ["C:\\devel\\projects\\tool_framework_multi_platform\\src\\androidMain\\kotlin"]
     }
}
at least to try if that way it works
p
trying it now
@Deactivated User man, sorry it took this long to get back to you. The android sourcesets fix on build.extra.gradle worked perfectly
now the expect/actual declarations works as expected
how can I write into that file in 'the normal way', because it's on the build folder and after a clean it'll get deleted
d
well, it is a bug, should not be required, I'm going to fix that in the next release hopefully
p
oh great, i'll wait then until its officially released
thx man
d
👍 thanks for trying!
👍 1
p
everything is getting a great shape, congrats for all the hard work man, really appreciate all of this
🙏 1
1
simple smile 1
i've convinced my boss to stay on korge instead of unity
👍 1
d
oh, that's great news 😄 cool
p
made my first demo on multiplatform with android and ios
👍 1
everything run as expected on both platforms
💯 1