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

Docs: Adds Hot Reloading page #1746

Merged
merged 1 commit into from
Jul 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/korge/reference/hot-reloading/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: default
title: "Hot Reloading"
title_prefix: KorGE
fa-icon: fa-fire
priority: 901
---

KorGE supports Hot Reloading / Auto Reloading on the JVM target. That means that, you can make changes in the code and see those changes
reflected almost immediately in your game window. To do so, you need to use scenes and call the `runJvmAutoreload` gradle task.

## Main & Scene

```kotlin
suspend fun main() = Korge(windowSize = Size(512, 512), backgroundColor = Colors["#2b2b2b"]) {
val sceneContainer = sceneContainer()

sceneContainer.changeTo({ MyScene() })
}

class MyScene : Scene() {
override suspend fun SContainer.sceneMain() {
// Put your code here
}
}
```

## Gradle Task

```
./gradlew runJvmAutoreload
```