Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example integration of korge with KMP app #2222

Open
omkar-tenkale opened this issue Apr 20, 2024 · 7 comments
Open

Example integration of korge with KMP app #2222

omkar-tenkale opened this issue Apr 20, 2024 · 7 comments

Comments

@omkar-tenkale
Copy link

omkar-tenkale commented Apr 20, 2024

I already have a kotlin multiplatform app built using KMP and Compose Multiplatform.

In one screen of the app, I want to run a small korge game but I'm unable to figure out the setup.

@omkar-tenkale omkar-tenkale changed the title Example integration of korge with KMM app Example integration of korge with KMP app Apr 20, 2024
@tarikkeskin
Copy link

tarikkeskin commented Sep 4, 2024

Did you find any documentation or any example project to solve this issue ? @omkar-tenkale

@omkar-tenkale
Copy link
Author

Nope

@tarikkeskin
Copy link

Is it possible or are we trying the wrong thing ? Could you please help us with this @soywiz

@ygdrasil-io
Copy link
Member

Did you succeed at least in configuring the dependencies? Korge libraries are published on Maven Central just like any other Multiplatform library:
https://mvnrepository.com/search?q=com.soywiz&sort=newest

For reference, I use Matrix and Image Features in this project:
https://github.com/wgpu4k/wgpu4k/blob/main/examples/common/build.gradle.kts

@tarikkeskin
Copy link

@ygdrasil-io thank you for your reply. First of all , i also can add 'korlibs-image' dependencies with adding
implementation(libs.korlibs.image) to commonMain.dependencies but when i can only see import korlibs.image.* libraries not import korlibs.korge.* libraries. When try to add plugin alias(libs.plugins.korge) i got this error:
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':composeApp:iosArm64CInterop'.

@tarikkeskin
Copy link

any comment for my last response? @ygdrasil-io

@ygdrasil-io
Copy link
Member

@tarikkeskin It's difficult to pinpoint the exact issue without examining the full stack, but it seems like the library you're using might not include support for iOS ARM64. Perhaps the version you're using doesn't support this architecture.

Additionally, if you're using the plugin with a non-pure Korge app, keep in mind that the plugin might not be designed for that scenario.

Soywiz would be the best person to ask for specific guidance on this, but you could try adding your Korge project like this:

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
    id("org.jetbrains.kotlin.multiplatform") version "2.0.20"
    id("com.android.library") version "8.2.2"
}

kotlin {
    androidTarget {
        @OptIn(ExperimentalKotlinGradlePluginApi::class)
        compilerOptions {
            jvmTarget.set(JvmTarget.JVM_11)
        }
    }

    jvm()
    iosX64()
    iosArm64()
    iosSimulatorArm64()


    sourceSets {

        commonMain.dependencies {
            implementation("com.soywiz.korge:korge:6.0.0-beta4")
        }
    }
}

android {
    namespace = "test.korge"

}

Then, you can delve into the Korge source code to understand how rendering is handled across different targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pending
Development

No branches or pull requests

3 participants