https://kotlinlang.org logo
#korge
Title
# korge
p

Pablo Caviglia

11/07/2020, 2:09 AM
does exists any port guide to korge 2 ? or maybe it isnt necessary ?
r

RezMike

11/07/2020, 7:50 AM
We're planning to write it soon
p

Pablo Caviglia

11/09/2020, 4:37 PM
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

RezMike

11/09/2020, 4:54 PM
Check something like
fun AsyncInjector.init()
p

Pablo Caviglia

11/09/2020, 5:44 PM
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

RezMike

11/09/2020, 5:45 PM
not a container?
p

Pablo Caviglia

11/09/2020, 5:45 PM
sorry, container
r

RezMike

11/09/2020, 5:45 PM
maybe
well, you shouldn't use Graphics instance as a container anyway
p

Pablo Caviglia

11/09/2020, 5:46 PM
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

RezMike

11/09/2020, 9:22 PM
You should use TextAlignment instead
p

Pablo Caviglia

11/09/2020, 9:30 PM
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

Deactivated User

11/10/2020, 6:55 PM
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

Pablo Caviglia

11/10/2020, 6:57 PM
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

Deactivated User

11/10/2020, 7:08 PM
Copy code
korgePluginVersion=2.0.0.2-rc2
is the latest
that uses 2.0.0-rc2 artifacts
p

Pablo Caviglia

11/10/2020, 7:08 PM
what about the repo ? is my configuration ok ?
d

Deactivated User

11/10/2020, 7:08 PM
the 2.0.0.2-rc2 is the version of the gradle plugin
these are the repositories you should have
p

Pablo Caviglia

11/10/2020, 7:09 PM
perfect
trying it now
thx
d

Deactivated User

11/10/2020, 7:09 PM
👍
p

Pablo Caviglia

11/10/2020, 7:15 PM
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

Deactivated User

11/10/2020, 7:19 PM
they are probably published
korgw is already included with korge
p

Pablo Caviglia

11/10/2020, 7:20 PM
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

Deactivated User

11/10/2020, 7:20 PM
and gradle.properties --> version=2.0.0-rc2
and: ./gradlew publishToMavenLocal
?
p

Pablo Caviglia

11/10/2020, 7:21 PM
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

Deactivated User

11/10/2020, 7:29 PM
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

Pablo Caviglia

11/10/2020, 7:29 PM
oh ok, that's soon
d

Deactivated User

11/10/2020, 7:29 PM
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

Pablo Caviglia

11/10/2020, 7:30 PM
do you know if expect/actual wil lbe part of 1.4.20 as a stable functionality ?
d

Deactivated User

11/10/2020, 7:30 PM
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

Pablo Caviglia

11/10/2020, 7:31 PM
the kotlin functionality to define an interface common to all platforms by using 'expect' keyword, and the actual implementation
d

Deactivated User

11/10/2020, 7:31 PM
multiplatform projects are 1.4.x is still experimental
but it works fine
p

Pablo Caviglia

11/10/2020, 7:32 PM
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

Deactivated User

11/10/2020, 7:32 PM
uhm?
p

Pablo Caviglia

11/10/2020, 7:32 PM
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

Deactivated User

11/10/2020, 7:32 PM
can you put the error?
p

Pablo Caviglia

11/10/2020, 7:32 PM
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

Deactivated User

11/10/2020, 7:42 PM
that's because jvm and android source sets are different
jvmAndroidMain or androidMain
p

Pablo Caviglia

11/10/2020, 7:43 PM
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

Deactivated User

11/10/2020, 7:50 PM
have you tried to put the actual on a folder called jvmAndroidMain so it works for both jvm and android?
p

Pablo Caviglia

11/10/2020, 7:50 PM
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

Deactivated User

11/10/2020, 7:55 PM
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

Pablo Caviglia

11/10/2020, 7:56 PM
using it
d

Deactivated User

11/10/2020, 7:56 PM
uhm
maybe the plugin not
p

Pablo Caviglia

11/10/2020, 7:56 PM
let me check if there's a way to list the sourcesets with some gradle task
d

Deactivated User

11/10/2020, 7:56 PM
only korge-next when building the projects
you can try to just copy the jvmMain files into androidMain
p

Pablo Caviglia

11/10/2020, 7:58 PM
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

Deactivated User

11/10/2020, 8:09 PM
then if it fails, the androidMain folder is not being loaded as part of the android source set
p

Pablo Caviglia

11/10/2020, 8:12 PM
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

Deactivated User

11/10/2020, 8:13 PM
the build/platforms/android/build.gradle doesn't reference the ../../../src/androidMain folder?
p

Pablo Caviglia

11/10/2020, 8:13 PM
let me check
looks like not
d

Deactivated User

11/10/2020, 8:42 PM
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

Pablo Caviglia

11/10/2020, 9:19 PM
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

Deactivated User

11/11/2020, 2:26 PM
well, it is a bug, should not be required, I'm going to fix that in the next release hopefully
p

Pablo Caviglia

11/11/2020, 2:26 PM
oh great, i'll wait then until its officially released
thx man
d

Deactivated User

11/11/2020, 2:26 PM
👍 thanks for trying!
👍 1
p

Pablo Caviglia

11/11/2020, 2:28 PM
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

Deactivated User

11/11/2020, 2:29 PM
oh, that's great news 😄 cool
p

Pablo Caviglia

11/11/2020, 2:29 PM
made my first demo on multiplatform with android and ios
👍 1
everything run as expected on both platforms
💯 1
3 Views