This commit is contained in:
2014-08-26 19:26:58 -07:00
commit 2c38a57e48
59 changed files with 516 additions and 0 deletions

20
desktop/project.clj Normal file
View File

@@ -0,0 +1,20 @@
(defproject advent "0.0.1-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "1.3.0"]
[com.badlogicgames.gdx/gdx-backend-lwjgl "1.3.0"]
[com.badlogicgames.gdx/gdx-box2d "1.3.0"]
[com.badlogicgames.gdx/gdx-box2d-platform "1.3.0"
:classifier "natives-desktop"]
[com.badlogicgames.gdx/gdx-bullet "1.3.0"]
[com.badlogicgames.gdx/gdx-bullet-platform "1.3.0"
:classifier "natives-desktop"]
[com.badlogicgames.gdx/gdx-platform "1.3.0"
:classifier "natives-desktop"]
[org.clojure/clojure "1.6.0"]
[play-clj "0.3.9"]]
:source-paths ["src" "src-common"]
:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
:aot [advent.core.desktop-launcher]
:main advent.core.desktop-launcher)

BIN
desktop/resources/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
desktop/resources/bg2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
desktop/resources/bg2.pxi Normal file

Binary file not shown.

BIN
desktop/resources/bg3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
desktop/resources/bg3.pxi Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
</array>
</plist>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
<dict>
<key>duration</key>
<real>0.10000000149011612</real>
</dict>
</array>
</plist>

View File

@@ -0,0 +1,47 @@
(ns advent.core
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.g2d :refer :all]))
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen :renderer (stage) :camera (orthographic))
(let [player-sheet (texture! (texture "player.png") :split 18 36)
background (texture "bg3.png")]
[(assoc background :scale-y 1.0 :scale-x 1.0 :origin-y 0 :origin-x 0 :ego? false :x -60 :y -34)
{:right (animation 0.1 (for [i (range 8)]
(texture (aget player-sheet 0 i))))
:left (animation 0.1 (for [i (range 8)]
(texture (aget player-sheet 1 i))))
:anim (animation 0.1 (for [i (range 8)]
(texture (aget player-sheet 0 i))))
:x 0 :y 25 :origin-x 0 :origin-y 0 :x-velocity 1
:ego? true}]))
:on-render
(fn [screen entities]
(clear!)
(render! screen (for [entity entities]
(if (:ego? entity)
(merge (animation->texture screen (:anim entity))
{:ego? (:ego? entity) :x (+ (:x entity) (:x-velocity entity)) :y 0 :origin-x 0 :origin-y 0 :anim (:anim entity) :x-velocity (:x-velocity entity) :left (:left entity) :right (:right entity)}
(when (> (:x entity) (width screen))
{:x-velocity -1 :anim (:left entity)})
(when (< (:x entity) 0)
{:x-velocity 1 :anim (:right entity)}))
entity))))
:on-resize
(fn [screen entities]
(height! screen 135))
:on-scrolled
(fn [screen entities]
(set! (. (:camera screen) zoom) (min 1.5 (max (+ (.zoom (:camera screen)) (* 0.01 (:amount screen))) 1)))
nil))
(defgame advent
:on-create
(fn [this]
(set-screen! this main-screen)))

View File

@@ -0,0 +1,10 @@
(ns advent.core.desktop-launcher
(:require [advent.core :refer :all])
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication]
[org.lwjgl.input Keyboard])
(:gen-class))
(defn -main
[]
(LwjglApplication. advent "advent" 1920 1080)
(Keyboard/enableRepeatEvents true))