Skip to content

How to create a full screen scrollable #2012

Answered by soywiz
Xyndra asked this question in Q&A
Discussion options

You must be logged in to vote

Try this:

import korlibs.image.color.*
import korlibs.korge.*
import korlibs.korge.ui.*
import korlibs.korge.view.*
import korlibs.math.geom.*

// Create a window that always has the same size as the stage
suspend fun main() = Korge(backgroundColor = Colors["#2b2b2b"], title = "Aufgabe 4",
    displayMode = KorgeDisplayMode.TOP_LEFT_NO_CLIP.copy(scaleMode = ScaleMode.NO_SCALE),
) {
    uiScrollable {
        position(0, 0)
        uiGridFill(Size(2000, 2000), cols = 2, rows = 2, spacing = Spacing(4)) {
            for (color in listOf(Colors.RED, Colors.GREEN, Colors.BLUE, Colors.BLACK)) {
                solidRect(Size(500, 500), color)
            }
        }
    }.also { scrollable ->

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Xyndra
Comment options

@soywiz
Comment options

@Xyndra
Comment options

@soywiz
Comment options

Answer selected by Xyndra
@Xyndra
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2011 on November 05, 2023 09:50.