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.

215 lines
9.4 KiB

4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 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
3 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
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.3.0",
  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.3.0",
  61. "org.typelevel" %% "cats-effect" % "2.3.0",
  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. "com.lihaoyi" %% "pprint" % "0.6.0",
  89. "org.scalatest" %% "scalatest" % "3.2.2" % "test"
  90. ),
  91. // Determine OS version of JavaFX binaries
  92. // Add JavaFX dependencies
  93. libraryDependencies ++= javaFXModules.map(m =>
  94. "org.openjfx" % s"javafx-$m" % "14.0.1" classifier osName
  95. ),
  96. scalacOptions ++= Seq(
  97. "-encoding",
  98. "UTF-8",
  99. "-deprecation",
  100. "-feature",
  101. "-language:existentials",
  102. "-language:experimental.macros",
  103. "-language:higherKinds",
  104. "-language:implicitConversions",
  105. "-unchecked",
  106. "-Xlint",
  107. "-Ywarn-numeric-widen",
  108. "-Ymacro-annotations",
  109. // "-Xlint:byname-implicit",
  110. // "utf-8", // Specify character encoding used by source files.
  111. //silence warnings for by-name implicits
  112. "-Wconf:cat=lint-byname-implicit:s",
  113. //give errors on non exhaustive matches
  114. "-Wconf:msg=match may not be exhaustive:e",
  115. "-explaintypes" // Explain type errors in more detail.
  116. ),
  117. javacOptions ++= Seq("-source", "11", "-target", "11"),
  118. javaOptions ++= Seq("-Xmx2G", "-Xms2G"),
  119. fork := true,
  120. assemblyMergeStrategy in assembly := {
  121. case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first
  122. case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
  123. case "application.conf" => MergeStrategy.concat
  124. case "unwanted.txt" => MergeStrategy.discard
  125. case x if Assembly.isConfigFile(x) =>
  126. MergeStrategy.concat
  127. case PathList("META-INF", xs @ _*) =>
  128. (xs map { _.toLowerCase }) match {
  129. case ("manifest.mf" :: Nil) | ("index.list" :: Nil) |
  130. ("dependencies" :: Nil) =>
  131. MergeStrategy.discard
  132. case ps @ (x :: xs)
  133. if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") =>
  134. MergeStrategy.discard
  135. case "plexus" :: xs =>
  136. MergeStrategy.discard
  137. case "services" :: xs =>
  138. MergeStrategy.filterDistinctLines
  139. case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
  140. MergeStrategy.filterDistinctLines
  141. case _ => MergeStrategy.first // Changed deduplicate to first
  142. }
  143. case PathList(_*) => MergeStrategy.first
  144. // case x =>
  145. // val oldStrategy = (assemblyMergeStrategy in assembly).value
  146. // oldStrategy(x)
  147. }
  148. )
  149. initialCommands in (console) := """ammonite.Main.main(Array.empty)"""
  150. // Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
  151. // we're adding the scala-parser-combinators dependency to the set of dependencies
  152. // that sbt will go and fetch when it starts up.
  153. // Now, in any Scala file, you can import classes, objects, etc., from
  154. // scala-parser-combinators with a regular import.
  155. // TIP: To find the "dependency" that you need to add to the
  156. // `libraryDependencies` set, which in the above example looks like this:
  157. // "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
  158. // You can use Scaladex, an index of all known published Scala libraries. There,
  159. // after you find the library you want, you can just copy/paste the dependency
  160. // information that you need into your build file. For example, on the
  161. // scala/scala-parser-combinators Scaladex page,
  162. // https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
  163. // the sbt dependency from the sbt box on the right-hand side of the screen.
  164. // IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
  165. // important to note that syntax in *.sbt files doesn't always behave like
  166. // regular Scala. For example, notice in this build file that it's not required
  167. // to put our settings into an enclosing object or class. Always remember that
  168. // sbt is a bit different, semantically, than vanilla Scala.
  169. // ============================================================================
  170. // Most moderately interesting Scala projects don't make use of the very simple
  171. // build file style (called "bare style") used in this build.sbt file. Most
  172. // intermediate Scala projects make use of so-called "multi-project" builds. A
  173. // multi-project build makes it possible to have different folders which sbt can
  174. // be configured differently for. That is, you may wish to have different
  175. // dependencies or different testing frameworks defined for different parts of
  176. // your codebase. Multi-project builds make this possible.
  177. // Here's a quick glimpse of what a multi-project build looks like for this
  178. // build, with only one "subproject" defined, called `root`:
  179. // lazy val root = (project in file(".")).
  180. // settings(
  181. // inThisBuild(List(
  182. // organization := "ch.epfl.scala",
  183. // scalaVersion := "2.13.1"
  184. // )),
  185. // name := "hello-world"
  186. // )
  187. // To learn more about multi-project builds, head over to the official sbt
  188. // documentation at http://www.scala-sbt.org/documentation.html
  189. addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
  190. addCompilerPlugin(
  191. "org.typelevel" %% "kind-projector" % "0.11.1" cross CrossVersion.full
  192. )
  193. ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.3"