diff --git a/.gitignore b/.gitignore index 5217bcf..0dacc34 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,9 @@ img.png image.png /maps/ /assets/ +lib/ out/ +project/ +target/ TheGame.jar diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..30d87ad --- /dev/null +++ b/build.sbt @@ -0,0 +1,77 @@ +// The simplest possible sbt build file is just one line: + +scalaVersion := "2.13.1" +// That is, to create a valid sbt build, all you've got to do is define the +// version of Scala you'd like your project to use. + +// ============================================================================ + +// Lines like the above defining `scalaVersion` are called "settings". Settings +// are key/value pairs. In the case of `scalaVersion`, the key is "scalaVersion" +// and the value is "2.13.1" + +// It's possible to define many kinds of settings, such as: + +name := "the-game" +organization := "fr.ynerant" +version := "1.0" + +// Note, it's not required for you to define these three settings. These are +// mostly only necessary if you intend to publish your library's binaries on a +// place like Sonatype or Bintray. + + +// Want to use a published library in your project? +// You can define other libraries as dependencies in your build like this: + +// https://mvnrepository.com/artifact/net.liftweb/lift-json +libraryDependencies += "net.liftweb" %% "lift-json" % "3.4.1" + +// Here, `libraryDependencies` is a set of dependencies, and by using `+=`, +// we're adding the cats dependency to the set of dependencies that sbt will go +// and fetch when it starts up. +// Now, in any Scala file, you can import classes, objects, etc., from cats with +// a regular import. + +// TIP: To find the "dependency" that you need to add to the +// `libraryDependencies` set, which in the above example looks like this: + +// "org.typelevel" %% "cats-core" % "2.0.0" + +// You can use Scaladex, an index of all known published Scala libraries. There, +// after you find the library you want, you can just copy/paste the dependency +// information that you need into your build file. For example, on the +// typelevel/cats Scaladex page, +// https://index.scala-lang.org/typelevel/cats, you can copy/paste the sbt +// dependency from the sbt box on the right-hand side of the screen. + +// IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's +// important to note that syntax in *.sbt files doesn't always behave like +// regular Scala. For example, notice in this build file that it's not required +// to put our settings into an enclosing object or class. Always remember that +// sbt is a bit different, semantically, than vanilla Scala. + +// ============================================================================ + +// Most moderately interesting Scala projects don't make use of the very simple +// build file style (called "bare style") used in this build.sbt file. Most +// intermediate Scala projects make use of so-called "multi-project" builds. A +// multi-project build makes it possible to have different folders which sbt can +// be configured differently for. That is, you may wish to have different +// dependencies or different testing frameworks defined for different parts of +// your codebase. Multi-project builds make this possible. + +// Here's a quick glimpse of what a multi-project build looks like for this +// build, with only one "subproject" defined, called `root`: + +// lazy val root = (project in file(".")). +// settings( +// inThisBuild(List( +// organization := "ch.epfl.scala", +// scalaVersion := "2.13.1" +// )), +// name := "hello-world" +// ) + +// To learn more about multi-project builds, head over to the official sbt +// documentation at http://www.scala-sbt.org/documentation.html diff --git a/lib/gson-2.8.6.jar b/lib/gson-2.8.6.jar deleted file mode 100755 index 4765c4a..0000000 Binary files a/lib/gson-2.8.6.jar and /dev/null differ diff --git a/lib/jopt-simple-6.0-alpha-3.jar b/lib/jopt-simple-6.0-alpha-3.jar deleted file mode 100755 index 5838e90..0000000 Binary files a/lib/jopt-simple-6.0-alpha-3.jar and /dev/null differ diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 09456ce..0000000 --- a/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: fr.ynerant.leveleditor.client.main.Main - diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml deleted file mode 100644 index 8736eb0..0000000 --- a/src/main/resources/log4j2.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/main/scala/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.scala b/src/main/scala/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.scala index 34f83d2..9dc343f 100644 --- a/src/main/scala/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.scala +++ b/src/main/scala/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.scala @@ -38,7 +38,9 @@ object SpriteRegister { val name = je.getName if (name.startsWith("assets/")) { val f = new File(name) - if (name.endsWith("/")) if (!f.mkdirs && !f.isDirectory) throw new IOException("Unable to make dir: " + f) + if (name.endsWith("/")) { + if (!f.mkdirs && !f.isDirectory) throw new IOException("Unable to make dir: " + f) + } else if (!f.isFile) Files.copy(jar.getInputStream(je), Paths.get(f.toURI)) } } diff --git a/src/main/scala/fr/ynerant/leveleditor/game/GameFrame.scala b/src/main/scala/fr/ynerant/leveleditor/game/GameFrame.scala index d03789b..5923b26 100644 --- a/src/main/scala/fr/ynerant/leveleditor/game/GameFrame.scala +++ b/src/main/scala/fr/ynerant/leveleditor/game/GameFrame.scala @@ -149,6 +149,7 @@ class GameFrame(val map: RawMap) extends JFrame("Jeu") { val y = event.getY / 32 val tower = if (basicTower.isSelected) new BasicTower(x, y) else if (nullTower.isSelected) new NullTower(x, y) + else if (autoTower.isSelected) new AutoTower(x, y) else null if (tower == null || tower.getPrice > reward) return