Initial import

This commit is contained in:
oakes
2013-12-29 02:35:49 -05:00
parent f4e4a58035
commit ec40af834a
9 changed files with 91 additions and 4 deletions

14
.gitignore vendored
View File

@@ -1,6 +1,12 @@
/target
/lib
/classes
/checkouts
pom.xml
*jar
/lib/
/classes/
/targets/
pom.xml.asc
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history

6
android/project.clj Normal file
View File

@@ -0,0 +1,6 @@
(defproject play-clj-android "0.1.0-SNAPSHOT"
:description "Library for making Android games"
:license {:name "Public Domain"
:url "http://unlicense.org/UNLICENSE"}
:dependencies [[com.badlogicgames.gdx/gdx-backend-android "0.9.9"]
[play-clj "0.1.0-SNAPSHOT"]])

View File

@@ -0,0 +1 @@
(ns play-clj.android)

6
common/project.clj Normal file
View File

@@ -0,0 +1,6 @@
(defproject play-clj "0.1.0-SNAPSHOT"
:description "Library for making cross-platform games"
:license {:name "Public Domain"
:url "http://unlicense.org/UNLICENSE"}
:dependencies [[com.badlogicgames.gdx/gdx "0.9.9" :use-resources true]
[org.clojure/clojure "1.5.1"]])

View File

@@ -0,0 +1,36 @@
(ns play-clj.core
(:import [com.badlogic.gdx Game Screen]))
(defn set-screen!
[^Game game ^Screen screen]
(.setScreen game screen))
(defn defscreen*
[{:keys [on-show on-render on-dispose on-hide on-pause on-resize on-resume]}]
(let [total-time (atom 0)
on-show (or on-show (fn []))
on-render (or on-render (fn [d t]))
on-dispose (or on-dispose (fn []))
on-hide (or on-hide (fn []))
on-pause (or on-pause (fn []))
on-resize (or on-resize (fn [w h]))
on-resume (or on-resume (fn []))]
(proxy [Screen] []
(show [] (on-show))
(render [delta-time]
(swap! total-time + delta-time)
(on-render delta-time @total-time))
(dispose [] (on-dispose))
(hide [] (on-hide))
(pause [] (on-pause))
(resize [w h] (on-resize w h))
(resume [] (on-resume)))))
(defmacro defscreen
[name & {:keys [] :as options}]
`(def ~name (defscreen* ~options)))
(defn create-game
[{:keys [start-screen]}]
(proxy [Game] []
(create [] (when start-screen (set-screen! this start-screen)))))

8
desktop/project.clj Normal file
View File

@@ -0,0 +1,8 @@
(defproject play-clj-desktop "0.1.0-SNAPSHOT"
:description "Library for making desktop games"
:license {:name "Public Domain"
:url "http://unlicense.org/UNLICENSE"}
:dependencies [[com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"]
[com.badlogicgames.gdx/gdx-platform "0.9.9"
:classifier "natives-desktop"]
[play-clj "0.1.0-SNAPSHOT"]])

View File

@@ -0,0 +1,17 @@
(ns play-clj.desktop
(:require [play-clj.core :refer :all])
(:import [com.badlogic.gdx.backends.lwjgl LwjglApplication]
[org.lwjgl.input Keyboard]))
(defmacro defgame
[name & {:keys [title width height]
:as options}]
(let [title (or title "")
width (or width 800)
height (or height 600)]
`(do
(def ~name (create-game ~options))
(defn ~'-main
[]
(LwjglApplication. ~name ~title ~width ~height true)
(Keyboard/enableRepeatEvents true)))))

6
ios/project.clj Normal file
View File

@@ -0,0 +1,6 @@
(defproject play-clj-ios "0.1.0-SNAPSHOT"
:description "Library for making iOS games"
:license {:name "Public Domain"
:url "http://unlicense.org/UNLICENSE"}
:dependencies [[com.badlogicgames.gdx/gdx-backend-robovm "0.9.9"]
[play-clj "0.1.0-SNAPSHOT"]])

1
ios/src/play_clj/ios.clj Normal file
View File

@@ -0,0 +1 @@
(ns play-clj.ios)