Skip to content

Commit

Permalink
🎊 add game template for CfD and release v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
theapache64 committed Aug 29, 2021
1 parent 1ed4329 commit f5a47df
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .idea/artifacts/create_compose_app_main_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/create-compose-app.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Choose platform
2) Desktop
3) Web
4) Chrome extension
5) Desktop (game)
```

### ✨ Demo
Expand Down Expand Up @@ -65,6 +66,9 @@ Choose platform

- A simple popup window

#### Desktop (game) ([see template](https://github.com/theapache64/compose-desktop-game-template))

![](demo_desktop_game.gif)

## ✍️ Author

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'com.theapache64'
version '1.3.1'
version '1.4.0'

repositories {
mavenCentral()
Expand Down
Binary file added demo_desktop_game.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "index.js",
"preferGlobal": true,
"repository": "https://github.com/theapache64/create-compose-app",
"version": "1.3.1",
"version": "1.4.0",
"jdeploy": {},
"dependencies": {
"shelljs": "0.8.4"
Expand Down
28 changes: 25 additions & 3 deletions src/main/kotlin/com/theapache64/createcomposeapp/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ enum class Platform(val title: String) {
Desktop("Desktop"),
Web("Web"),
ChromeExt("Chrome extension"),
DesktopGame("Desktop (game)"),
}


fun main(args: Array<String>) {

val platform = if (IS_DEBUG) {
Platform.Android
Platform.DesktopGame
} else {
println(Color.YELLOW, "Choose platform")
val platforms = Platform.values()

for ((index, p) in platforms.withIndex()) {
println("${index + 1}) $p")
println("${index + 1}) ${p.title}")
}
val selPlatformIndex = InputUtils.getInt(
"Choose platform #",
Expand All @@ -44,6 +45,7 @@ fun main(args: Array<String>) {
Platform.Android -> createAndroidApp()
Platform.Web -> createComposeWebApp()
Platform.ChromeExt -> createChromeExtensionApp()
Platform.DesktopGame -> createDesktopGameApp()
}
}

Expand Down Expand Up @@ -129,7 +131,7 @@ private fun createDesktopApp() {
"src",
"data"
),
isDebug = false
isDebug = IS_DEBUG
)

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

corvette.start(replaceMap)
println(Color.YELLOW, "Run `./gradlew run` from project root to run the app")
}

private fun createDesktopGameApp() {
val corvette = Corvette(
githubRepoUrl = "https://github.com/theapache64/compose-desktop-game-template",
isDebug = IS_DEBUG,
modules = arrayOf("src"),
srcDirs = arrayOf("main"),
srcPackagePath = Path("com") / "mygame"
)

val replaceMap = mapOf(
"rootProject.name = \"compose-desktop-game-template\"" to "rootProject.name = \"${corvette.projectName}\"", // settings.gradle.kt
"mainClass = \"com.mygame.MainKt\"" to "mainClass = \"${corvette.packageName}.MainKt\"", // build.gradle
"packageName = \"compose-desktop-game-template\"" to "packageName = \"${corvette.projectName}\"", // build.gradle
"com.mygame" to corvette.packageName, // app kt files
)

corvette.start(replaceMap)
println(Color.YELLOW, "Run `./gradlew run` from project root to run the game")
}

0 comments on commit f5a47df

Please sign in to comment.