Skip to content

Commit f5a47df

Browse files
committed
🎊 add game template for CfD and release v1.4.0
1 parent 1ed4329 commit f5a47df

File tree

9 files changed

+62
-8
lines changed

9 files changed

+62
-8
lines changed

.idea/artifacts/create_compose_app_main_jar.xml

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/create-compose-app.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Choose platform
2323
2) Desktop
2424
3) Web
2525
4) Chrome extension
26+
5) Desktop (game)
2627
```
2728

2829
### ✨ Demo
@@ -65,6 +66,9 @@ Choose platform
6566

6667
- A simple popup window
6768

69+
#### Desktop (game) ([see template](https://github.com/theapache64/compose-desktop-game-template))
70+
71+
![](demo_desktop_game.gif)
6872

6973
## ✍️ Author
7074

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group 'com.theapache64'
6-
version '1.3.1'
6+
version '1.4.0'
77

88
repositories {
99
mavenCentral()

demo_desktop_game.gif

1.13 MB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "index.js",
88
"preferGlobal": true,
99
"repository": "https://github.com/theapache64/create-compose-app",
10-
"version": "1.3.1",
10+
"version": "1.4.0",
1111
"jdeploy": {},
1212
"dependencies": {
1313
"shelljs": "0.8.4"

src/main/kotlin/com/theapache64/createcomposeapp/Main.kt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ enum class Platform(val title: String) {
1414
Desktop("Desktop"),
1515
Web("Web"),
1616
ChromeExt("Chrome extension"),
17+
DesktopGame("Desktop (game)"),
1718
}
1819

1920

2021
fun main(args: Array<String>) {
2122

2223
val platform = if (IS_DEBUG) {
23-
Platform.Android
24+
Platform.DesktopGame
2425
} else {
2526
println(Color.YELLOW, "Choose platform")
2627
val platforms = Platform.values()
2728

2829
for ((index, p) in platforms.withIndex()) {
29-
println("${index + 1}) $p")
30+
println("${index + 1}) ${p.title}")
3031
}
3132
val selPlatformIndex = InputUtils.getInt(
3233
"Choose platform #",
@@ -44,6 +45,7 @@ fun main(args: Array<String>) {
4445
Platform.Android -> createAndroidApp()
4546
Platform.Web -> createComposeWebApp()
4647
Platform.ChromeExt -> createChromeExtensionApp()
48+
Platform.DesktopGame -> createDesktopGameApp()
4749
}
4850
}
4951

@@ -129,7 +131,7 @@ private fun createDesktopApp() {
129131
"src",
130132
"data"
131133
),
132-
isDebug = false
134+
isDebug = IS_DEBUG
133135
)
134136

135137
val replaceMap = mapOf(
@@ -143,4 +145,24 @@ private fun createDesktopApp() {
143145

144146
corvette.start(replaceMap)
145147
println(Color.YELLOW, "Run `./gradlew run` from project root to run the app")
148+
}
149+
150+
private fun createDesktopGameApp() {
151+
val corvette = Corvette(
152+
githubRepoUrl = "https://github.com/theapache64/compose-desktop-game-template",
153+
isDebug = IS_DEBUG,
154+
modules = arrayOf("src"),
155+
srcDirs = arrayOf("main"),
156+
srcPackagePath = Path("com") / "mygame"
157+
)
158+
159+
val replaceMap = mapOf(
160+
"rootProject.name = \"compose-desktop-game-template\"" to "rootProject.name = \"${corvette.projectName}\"", // settings.gradle.kt
161+
"mainClass = \"com.mygame.MainKt\"" to "mainClass = \"${corvette.packageName}.MainKt\"", // build.gradle
162+
"packageName = \"compose-desktop-game-template\"" to "packageName = \"${corvette.projectName}\"", // build.gradle
163+
"com.mygame" to corvette.packageName, // app kt files
164+
)
165+
166+
corvette.start(replaceMap)
167+
println(Color.YELLOW, "Run `./gradlew run` from project root to run the game")
146168
}

0 commit comments

Comments
 (0)