Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
9.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
  1. // The simplest possible sbt build file is just one line:
  2. scalaVersion := "2.13.3"
  3. // That is, to create a valid sbt build, all you've got to do is define the
  4. // version of Scala you'd like your project to use.
  5. // ============================================================================
  6. // Lines like the above defining `scalaVersion` are called "settings". Settings
  7. // are key/value pairs. In the case of `scalaVersion`, the key is "scalaVersion"
  8. // and the value is "2.13.1"
  9. // It's possible to define many kinds of settings, such as:
  10. // Note, it's not required for you to define these three settings. These are
  11. // mostly only necessary if you intend to publish your library's binaries on a
  12. // place like Sonatype or Bintray.
  13. // Want to use a published library in your project?
  14. // You can define other libraries as dependencies in your build like this:
  15. resolvers += "Jcenter" at "https://jcenter.bintray.com/"
  16. resolvers += "JME Bintray" at "https://bintray.com/jmonkeyengine/com.jme3"
  17. resolvers += "Jitpack" at "https://jitpack.io"
  18. resolvers += Resolver.mavenLocal
  19. resolvers += Resolver.sonatypeRepo("snapshots")
  20. lazy val jmeVersion = "3.3.2-stable"
  21. lazy val osName = System.getProperty("os.name") match {
  22. case n if n.startsWith("Linux") => "linux"
  23. case n if n.startsWith("Mac") => "mac"
  24. case n if n.startsWith("Windows") => "win"
  25. case _ => throw new Exception("Unknown platform!")
  26. }
  27. lazy val javaFXModules =
  28. Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
  29. lazy val root = (project in file(".")).settings(
  30. inThisBuild(
  31. List(
  32. scalaVersion := scalaVersion.value, // 2.11.12, or 2.13.3
  33. semanticdbEnabled := true, // enable SemanticDB
  34. semanticdbVersion := "4.3.24" // use Scalafix compatible version
  35. )
  36. ),
  37. name := "mygame",
  38. organization := "wow.doge",
  39. version := "1.0-SNAPSHOT",
  40. libraryDependencies ++= Seq(
  41. // "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
  42. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-core
  43. "org.jmonkeyengine" % "jme3-core" % jmeVersion,
  44. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-desktop
  45. "org.jmonkeyengine" % "jme3-desktop" % jmeVersion,
  46. // https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-lwjgl3
  47. "org.jmonkeyengine" % "jme3-lwjgl3" % jmeVersion,
  48. "org.jmonkeyengine" % "jme3-effects" % jmeVersion,
  49. "org.jmonkeyengine" % "jme3-plugins" % jmeVersion,
  50. "org.jmonkeyengine" % "jme3-blender" % jmeVersion,
  51. "com.github.stephengold" % "Minie" % "3.0.0",
  52. "com.simsilica" % "zay-es" % "1.2.1",
  53. "org.typelevel" %% "cats-core" % "2.1.1",
  54. "com.lihaoyi" % "ammonite" % "2.2.0" cross CrossVersion.full,
  55. "org.jetbrains.kotlin" % "kotlin-main-kts" % "1.4.10",
  56. "org.jetbrains.kotlin" % "kotlin-scripting-jsr223" % "1.4.10",
  57. "org.codehaus.groovy" % "groovy-all" % "3.0.6" pomOnly (),
  58. "org.scalafx" %% "scalafx" % "14-R19",
  59. "com.typesafe.akka" %% "akka-actor-typed" % "2.6.10",
  60. "org.typelevel" %% "cats-core" % "2.1.1",
  61. "org.typelevel" %% "cats-effect" % "2.1.4",
  62. "io.monix" %% "monix" % "3.2.2",
  63. "io.monix" %% "monix-bio" % "1.1.0",
  64. "io.circe" %% "circe-core" % "0.13.0",
  65. "io.circe" %% "circe-generic" % "0.13.0",
  66. "com.softwaremill.sttp.client" %% "core" % "2.2.5",
  67. "com.softwaremill.sttp.client" %% "monix" % "2.2.5",
  68. "com.softwaremill.sttp.client" %% "circe" % "2.2.5",
  69. "com.softwaremill.sttp.client" %% "async-http-client-backend-monix" % "2.2.5",
  70. "com.github.valskalla" %% "odin-monix" % "0.8.1",
  71. "com.github.valskalla" %% "odin-json" % "0.9.1",
  72. "com.softwaremill.macwire" %% "util" % "2.3.7",
  73. "com.softwaremill.macwire" %% "macros" % "2.3.7" % "provided",
  74. // "com.softwaremill.macwire" %% "macrosakka" % "2.3.6" % "provided",
  75. "com.github.valskalla" %% "odin-slf4j" % "0.8.1",
  76. "com.softwaremill.quicklens" %% "quicklens" % "1.6.1",
  77. "org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.0-RC1",
  78. "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
  79. "io.circe" %% "circe-config" % "0.8.0",
  80. "com.beachape" %% "enumeratum-circe" % "1.6.1",
  81. "com.lihaoyi" %% "os-lib" % "0.7.1",
  82. // "com.jayfella" % "jme-jfx-11" % "1.1.5",
  83. "com.github.goxr3plus" % "FX-BorderlessScene" % "4.4.0",
  84. "com.github.Oshan96" % "CustomStage" % "v1.3.1",
  85. "com.badlogicgames.gdx" % "gdx-ai" % "1.8.2",
  86. "org.recast4j" % "recast" % "1.2.5",
  87. "org.recast4j" % "detour" % "1.2.5"
  88. ),
  89. // Determine OS version of JavaFX binaries
  90. // Add JavaFX dependencies
  91. libraryDependencies ++= javaFXModules.map(m =>
  92. "org.openjfx" % s"javafx-$m" % "14.0.1" classifier osName
  93. ),
  94. scalacOptions ++= Seq(
  95. "-encoding",
  96. "UTF-8",
  97. "-deprecation",
  98. "-feature",
  99. "-language:existentials",
  100. "-language:experimental.macros",
  101. "-language:higherKinds",
  102. "-language:implicitConversions",
  103. "-unchecked",
  104. "-Xlint",
  105. "-Ywarn-numeric-widen",
  106. "-Ymacro-annotations",
  107. // "-Xlint:byname-implicit",
  108. // "utf-8", // Specify character encoding used by source files.
  109. //silence warnings for by-name implicits
  110. "-Wconf:cat=lint-byname-implicit:s",
  111. //give errors on non exhaustive matches
  112. "-Wconf:msg=match may not be exhaustive:e",
  113. "-explaintypes" // Explain type errors in more detail.
  114. ),
  115. javacOptions ++= Seq("-source", "11", "-target", "11"),
  116. javaOptions ++= Seq("-Xmx2G", "-Xms2G"),
  117. fork := true,
  118. assemblyMergeStrategy in assembly := {
  119. case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
  120. case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
  121. case "application.conf" => MergeStrategy.concat
  122. case "unwanted.txt" => MergeStrategy.discard
  123. case x if Assembly.isConfigFile(x) =>
  124. MergeStrategy.concat
  125. case PathList("META-INF", xs @ _*) =>
  126. (xs map { _.toLowerCase }) match {
  127. case ("manifest.mf" :: Nil) | ("index.list" :: Nil) |
  128. ("dependencies" :: Nil) =>
  129. MergeStrategy.discard
  130. case ps @ (x :: xs)
  131. if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") =>
  132. MergeStrategy.discard
  133. case "plexus" :: xs =>
  134. MergeStrategy.discard
  135. case "services" :: xs =>
  136. MergeStrategy.filterDistinctLines
  137. case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
  138. MergeStrategy.filterDistinctLines
  139. case _ => MergeStrategy.first // Changed deduplicate to first
  140. }
  141. case PathList(_*) => MergeStrategy.first
  142. // case x =>
  143. // val oldStrategy = (assemblyMergeStrategy in assembly).value
  144. // oldStrategy(x)
  145. }
  146. // scalaVersion := "2.13.2", // 2.11.12, or 2.13.3
  147. // semanticdbEnabled := true, // enable SemanticDB
  148. // semanticdbVersion := scalafixSemanticdb.revision // use Scalafix compatible version
  149. // semanticdbVersion := "4.3.24",
  150. )
  151. initialCommands in (console) := """ammonite.Main.main(Array.empty)"""
  152. // Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
  153. // we're adding the scala-parser-combinators dependency to the set of dependencies
  154. // that sbt will go and fetch when it starts up.
  155. // Now, in any Scala file, you can import classes, objects, etc., from
  156. // scala-parser-combinators with a regular import.
  157. // TIP: To find the "dependency" that you need to add to the
  158. // `libraryDependencies` set, which in the above example looks like this:
  159. // "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
  160. // You can use Scaladex, an index of all known published Scala libraries. There,
  161. // after you find the library you want, you can just copy/paste the dependency
  162. // information that you need into your build file. For example, on the
  163. // scala/scala-parser-combinators Scaladex page,
  164. // https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
  165. // the sbt dependency from the sbt box on the right-hand side of the screen.
  166. // IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
  167. // important to note that syntax in *.sbt files doesn't always behave like
  168. // regular Scala. For example, notice in this build file that it's not required
  169. // to put our settings into an enclosing object or class. Always remember that
  170. // sbt is a bit different, semantically, than vanilla Scala.
  171. // ============================================================================
  172. // Most moderately interesting Scala projects don't make use of the very simple
  173. // build file style (called "bare style") used in this build.sbt file. Most
  174. // intermediate Scala projects make use of so-called "multi-project" builds. A
  175. // multi-project build makes it possible to have different folders which sbt can
  176. // be configured differently for. That is, you may wish to have different
  177. // dependencies or different testing frameworks defined for different parts of
  178. // your codebase. Multi-project builds make this possible.
  179. // Here's a quick glimpse of what a multi-project build looks like for this
  180. // build, with only one "subproject" defined, called `root`:
  181. // lazy val root = (project in file(".")).
  182. // settings(
  183. // inThisBuild(List(
  184. // organization := "ch.epfl.scala",
  185. // scalaVersion := "2.13.1"
  186. // )),
  187. // name := "hello-world"
  188. // )
  189. // To learn more about multi-project builds, head over to the official sbt
  190. // documentation at http://www.scala-sbt.org/documentation.html
  191. addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
  192. ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.3"