https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
korge
  • j

    jeff

    12/27/2020, 9:08 PM
    Anyone have an example of adding an npm dependency to a Korge project? The Kotlin documentation says to use
    npm()
    but that doesn't seem to resolve.
    d
    a
    • 3
    • 4
  • p

    Pablo Caviglia

    12/28/2020, 3:13 PM
    and another question related to animations:
    scene.launchImmediately {
    
        animate(completeOnCancel = false) {
            sequence(looped = true) {
                parallel {
                    circleOuter.moveToWithSpeed(width - 100, 0.0)
                    circleInner.moveToWithSpeed(width - 100, 0.0)
                }
                parallel {
                    circleOuter.moveTo(width - 100, height - 100)
                    circleInner.moveTo(width - 100, height - 100)
                }
            }
        }
    }
    even after setting looped=true I'm not getting an animated loop, just one animation and then it gets finished
    d
    • 2
    • 2
  • p

    Pablo Caviglia

    12/28/2020, 5:41 PM
    how can a looped animator be stopped gently? By gently I mean waiting to finish the last animation of the list
    d
    • 2
    • 1
  • g

    Gregor Zeitlinger

    12/30/2020, 9:29 AM
    Hi, I'd like to use java sources for the jvm target 1. I've played around with using KMP plugin directly, but this didn't work 2. Then I tried to modify the plugin, but the new plugin was not used
    Index: korge-gradle-plugin/src/main/kotlin/com/soywiz/korge/gradle/targets/jvm/Jvm.kt
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/korge-gradle-plugin/src/main/kotlin/com/soywiz/korge/gradle/targets/jvm/Jvm.kt b/korge-gradle-plugin/src/main/kotlin/com/soywiz/korge/gradle/targets/jvm/Jvm.kt
    --- a/korge-gradle-plugin/src/main/kotlin/com/soywiz/korge/gradle/targets/jvm/Jvm.kt	(revision Staged)
    +++ b/korge-gradle-plugin/src/main/kotlin/com/soywiz/korge/gradle/targets/jvm/Jvm.kt	(date 1609320472418)
    @@ -9,6 +9,7 @@
     import org.gradle.api.tasks.bundling.*
     import org.gradle.api.tasks.testing.*
     import org.gradle.jvm.tasks.Jar
    +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
     import org.jetbrains.kotlin.gradle.plugin.mpp.*
     import proguard.gradle.*
     
    @@ -19,6 +20,7 @@
     	val jvmTarget = jvmPreset.createTarget("jvm")
     	gkotlin.targets.add(jvmTarget)
     	//jvmTarget.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm)
    +    jvmTarget.withJava()
     
     	project.korge.addDependency("jvmMainImplementation", "org.jetbrains.kotlin:kotlin-stdlib-jdk8")
     	project.korge.addDependency("jvmTestImplementation", "org.jetbrains.kotlin:kotlin-test")
    d
    • 2
    • 7
  • m

    Mayank

    01/03/2021, 1:20 PM
    As discussed at https://kotlinlang.slack.com/archives/CJEF0LB6Y/p1608383468306500?thread_ts=1608035617.266900&amp;cid=CJEF0LB6Y, I'm trying to make changes to Logger so that it can be used in multithreaded environments. The main problem is using it from K/N due to concurrency model when using the functionality to have a single logger based on name. I have identified few approaches as follows: 1. Loading the properties from file/str in an immutable shared variable. Remove option to set level and output in Logger (effectively removing mutable variables from Logger) and instead set them using props. This would build a new object even for same name but as the props are immutable, configuration is effectively the same. 2. Use atomic references to hold Logger_* variables. This would have minimal change in functionality but atomicfu dependency need to be added and would also have performance penalty as everytime we need to log, atomic ref will be accessed. 3. Using ThreadLocal Logger and SharedImmutable/ThreadLocal Logger_* global variables. Modifications to Logger in one thread won't be visible to Logger in another thread What are your thoughts @Deactivated User? If anyone has any suggestions, I would be happy to have them.
    d
    • 2
    • 33
  • j

    jeff

    01/11/2021, 4:32 PM
    I just started getting this
    Error Compiling Shader
    crash (blank white game window) this morning. No changes on my side, was working fine yesterday. I did install updates on Ubuntu, didn't notice if there was anything OpenGL-related. Anyone seen something similar?
    d
    • 2
    • 5
  • j

    jeff

    01/11/2021, 8:28 PM
    Changing the
    .scale
    of most views does not affect the output of
    getBounds()
    (SolidRect for example). But changing the
    .scale
    of
    Text
    views does (slightly) -- is that expected?
    d
    • 2
    • 21
  • j

    Jess Nielsen

    01/12/2021, 7:31 AM
    There seems to be a lot of changes in korge from the version used in the 2048 tutorial and the current version. Is the tutorial author still around? You might want to update it a bit.
    r
    • 2
    • 3
  • j

    jeff

    01/16/2021, 8:16 PM
    Is there any built-in way to clip views to only draw within a certain rectangle? Didn't see anything in the docs.
    m
    • 2
    • 3
  • j

    jeff

    01/18/2021, 1:53 AM
    Conflicting calls to
    tween
    cause an ugly flicker. Is there a better way to avoid that than manually tracking Jobs? Example in :thread-please:
    m
    d
    • 3
    • 9
  • m

    Michael Sigl

    01/21/2021, 12:52 PM
    Hello, is there any way to use online multiplayer in korge? I tried it with AsyncServer, but it didn't work(maybe I did something wrong). How can I implement an online multiplayer?
    s
    t
    • 3
    • 8
  • m

    Michael Sigl

    01/22/2021, 12:12 PM
    Are there any alternative tools for bone-animations like spine or dragonbones which are supported in korge? Is it possible to load for example adobe animate graphics and animations? I would like to use adobe tools. So is it possible to work with them in korge?
    d
    • 2
    • 4
  • m

    Mayank

    01/23/2021, 2:29 PM
    Hi, I tried running mask sample but mask is not working on JVM (MacOS), nativeMacOS, iOS. It works fine on Js and Android though. Any idea why would this be happening?
    d
    • 2
    • 13
  • m

    Mayank

    01/24/2021, 7:30 PM
    Hi, is there any way to run sample in korge-next on ios and android? I couldn’t find the tasks to do so.
    d
    • 2
    • 1
  • j

    jeff

    01/24/2021, 8:09 PM
    What kind of Dispatcher does Korge use? It seems like maybe a single-thread one? Anywhere I can read about that? (code or docs)
    m
    • 2
    • 2
  • m

    Max

    01/27/2021, 10:18 PM
    Hi! Currently looking at creating a multiplayer game with Korge. I wanted to interpolate player positions between server updates to make the movement smooth. I tried using Tween to do the interpolation. This led me to create a new tween for each interpolation. But it didnt really work as the tween sometimes overlapped. Ended up creating my own InterpolationTween without coroutine parts and method to update start and stop variables. What do you think about this? Is there any good way to do this without creating my new Tween? Here is the whole project if you want more context: https://github.com/maxonline/KotlinJsJvmGame/tree/korge
    d
    t
    • 3
    • 4
  • t

    tobsef

    01/28/2021, 8:17 PM
    Is it a special design decision, that some
    View
    -classes are not
    open
    anymore? For exampe in my game, I extend
    Image
    to add some meta data to it. But this isn't possible in Korge
    2.0.5.1
    anymore. It's also not consistence because these views are open: Circle, Mesh, Sprite, Text,
    d
    • 2
    • 1
  • m

    Michael Sigl

    01/30/2021, 12:14 AM
    Is it possible to get a method by a string name in kotlin? It would work with
    javaClass.enclosingMethod.name
    in java, but java is not available and I don't want to just run on the jvmMain, I want to have commonMain. So is there any way to get and execute a method with just its name as string?
    t
    • 2
    • 4
  • t

    tobsef

    01/30/2021, 10:26 AM
    I want to create line paths on a map like in the screenshot. The requirements are: • Stroked sould be possible (like the red one) • Path shouldn't do hard brakes. • More than one line next to each other, following the same path Because Im trying to achive this during a short game jam, I want to know: Is this possible with some tricks in KorgGE. Or is there missing too much (like Splines, Stroke Patterns eg.) so that I shouldn't waste my time - and better draw them by hand in some graphic app?
    d
    • 2
    • 1
  • m

    Michael Sigl

    01/30/2021, 2:24 PM
    How can I get access to kotlin reflection like members, isAbstract, isFinal etc. ? When importing kotlin-reflect in build.gradle.kts in Korge, kotlin reflection is only available in jvmMain-module. In commonMain I only have access to qualifiedName and simpleName, but not to all the other things like members etc. How can I get these functions in commonMain-module?
    n
    • 2
    • 2
  • j

    jeff

    01/30/2021, 7:44 PM
    Is there any mechanism to access a component of particular type (e.g.
    MyCustomComponent : Component
    ) that is attached to a view IFF it is already attached (i.e. don't create one if it doesn't exist)?
    d
    • 2
    • 11
  • j

    jeff

    02/02/2021, 6:55 PM
    discord.korge.org invite code seems to have expired. Anyone have an updated one?
    👍 1
    r
    • 2
    • 1
  • d

    Deactivated User

    02/04/2021, 2:45 PM
    🥳 Korge 2.0.6.0 Released. This version: * Uses Kotlin 1.4.30 * Includes some major JS performance improvements
    :kotlin-intensifies: 7
    :thank-you: 3
    👍 9
    m
    • 2
    • 5
  • c

    Ch8n

    02/05/2021, 2:55 PM
    Hi I'm new to game dev, and learning korge, I want to make a mimic of pokemon GBA games (top-down view if I correct), can anyone help me by sharing some resource? I have gone through youtube series but im not able to put in right use...😅
    s
    • 2
    • 1
  • c

    Ch8n

    02/06/2021, 10:11 AM
    Hi is there any docs and samples regarding new
    camera
    and
    cameraContainer
    ?
    m
    • 2
    • 1
  • m

    Michael Sigl

    02/11/2021, 7:03 AM
    Hi, I know how to read from a VfsFile, but what's about writing? I want to write to a xml file. Basically I want to specify the file-path and the data as parameters into a function. If the file already exists, it should be opened and written to in in xml style. If it doesn't exist, it should be created first and then opened and then written data to it. How to do that?
    d
    • 2
    • 1
  • m

    Michael Sigl

    02/11/2021, 4:50 PM
    How to draw a convex polygon in korge by just passing an array of vertices(Vec2 or Point)?
    d
    • 2
    • 9
  • t

    Trevor

    02/27/2021, 6:01 PM
    korge doesn't happen to have an ecs that works with it does it? works against all targets? I'm assuming I can't use something like Ashley ecs?
    d
    n
    • 3
    • 3
  • d

    Deactivated User

    03/05/2021, 10:16 AM
    🎊 KorGE 2.0.8.1 released! ## Breaking changes * Sound.play now requires a
    coroutineContext
    , or being called from a suspend function. You can use the old version with
    playOld
    but you might have issues with sounds being stopped in some cases. Details here: https://github.com/korlibs/korge-next/pull/181 ## Fixes * Fixed BitSet memory usage. https://github.com/korlibs/korge-next/pull/179 Thanks @andrei-cosmin ! * Added missing
    Pinned<FloatArray>.startAddressOf
    and
    Pinned<DoubleArray>.startAddressOf
    * Fixes AudioData.toStream hang * Prevents audio from stop working when spamming on JVM/JNA/OpenAL * Fixes audio not playing when loaded from one coroutineContext Job that was already completed * Fixes audio startup on JS. Now it tries to unlock audio when KorGE starts, so any initial user input event will unlock audio. ## New features * Support trimmed atlases on BaseImage, Sprite, etc. https://github.com/korlibs/korge-next/pull/172 Thanks @jobe-m ! * Added FlagFilter. https://github.com/korlibs/korge-next/pull/182 Thanks @MikeSmithEU ! * Added
    arrayinterleave
    to kmem * Added
    FastByteTransfer
    ,
    FastShortTransfer
    ,
    FastIntTransfer
    ,
    FastFloatTransfer
    to be able to unsafely read/write from/to arrays faster on K/N while working on all the targets * Added
    waitSubscriber
    and
    waitSubscriberCloseable
    ## Performance improvements * Substantial performance improvement on audio on Android and Win32 * Cache refresh rate from displays (fixes low framerate regression on some linux setups) * arraycopy in MemBuffer is now faster on Kotlin/Native * arrayfill now uses the embedded array filling from the stdlib * WeakMap.getOrPut is now inline * Improve performance of some Audio operations on all the targets ## Deprecations * Deprecate
    redirect(KProperty)
    and
    KProperty.redirected
    since
    by ::field
    already does that on latest versions of Kotlin
    💃 2
    🤘 3
    ❤️ 6
    🕺 2
    :kotlin-intensifies: 10
    👾 2
    • 1
    • 2
  • l

    Lucas Hebinger

    03/17/2021, 6:06 PM
    Here's my error.
    d
    • 2
    • 5
Powered by Linen
Title
l

Lucas Hebinger

03/17/2021, 6:06 PM
Here's my error.
d

Deactivated User

03/17/2021, 8:30 PM
Uhm. Which KorGE version are you using? Are you embedding KorGE into an existing Android app, or it just uses the default gradle android tasks provided by KorGE?
l

Lucas Hebinger

03/17/2021, 8:46 PM
Hi, I fixed to problem by replacing AppCompatActivity by KorgwActivity on my main activity. But now I've another problem... I'm implementing Korge on an existing Android project and I need to load an image, so I use
resourcesVfs["top_arrow.png"].readBitmap()
But I got java.io.FileNotFoundException: top_arrow.png. Where do I have to put the file on an Android project ?
Here's my project.
d

Deactivated User

03/18/2021, 8:39 PM
So you are creating an android application in the end, right? You have a sample android project using KorGE here: https://github.com/korlibs/korge-samples/tree/master/integrations/android
l

Lucas Hebinger

03/18/2021, 8:40 PM
Thanks for your answer. Finally found the solution by creating an "assets" folder inside src/main.
👍 1
View count: 5