korge-samples
                                
                                
                                
                                    korge-samples copied to clipboard
                            
                            
                            
                        How to use a Camera? sample
@soywiz i maybe can create a sample myself but i dont know if i should use cameraContainer Camera or Container
I'd say the sample that currently covers the new camera API is this one: https://github.com/korlibs/korge-samples/blob/2ccda53ffeb5663f126b9836ab3dc74f1a5faadf/samples/tilemap/src/commonMain/kotlin/main.kt#L14
Though it is a very simple sample
There is a weird thing in the way it works. Every view need to be the child of the camera AND the camera move in opposite direction.
        fixedSizeContainer(256,256,clip = true) {
            val camera = camera {
                val circle = circle(15.0, fill = Colors.RED)
            }
            addUpdater {
                camera.x += 1
            }
        }
The circle will move right, because  camera.x += 1 is moving the view, not the camera... So, the circle will go right.
The code bellow will achieve the same effect:
       val camera = fixedSizeContainer(80,80) {
            val circle = circle(15.0, fill = Colors.RED)
        }
        addUpdater {
            camera.x += 8*it.seconds
        }