should allow steam achievements.

This commit is contained in:
Bryce Covert
2015-11-10 19:57:22 -08:00
parent 061008c97b
commit 6e9ada941b
7 changed files with 35 additions and 3 deletions

View File

@@ -28,6 +28,9 @@
[org.clojure/data.csv "0.1.3"]]
:warn-on-reflection true}
:steam {
:dependencies [[com.code-disaster.steamworks4j/steamworks4j "1.2.2"]]
}
}
:aot [advent.core.desktop-launcher]
:main advent.core.desktop-launcher)

View File

@@ -1,7 +1,7 @@
#!/bin/bash
gawk -i inplace ' { print $1+1; } ' last-release
git tag -a v0.1.`cat last-release` -m "tagging version 0.1.`cat last-release`"
lein do clean, compile, uberjar
lein with-profile steam do clean, compile, uberjar
java -jar packr.jar build-windows.json
java -jar packr.jar build-osx.json
read -p "Steam pass: " STEAM_PASS

View File

@@ -9,6 +9,7 @@
[advent.screens.credits :as credits]
[advent.screens.inventory :as inventory]
[advent.screens.safe :as safe]
[advent.steam :as steam]
[clojure.pprint]
[advent.pathfind])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
@@ -23,6 +24,7 @@
(defgame advent
:on-create
(fn [this]
(steam/init)
(set-screen! this title/title-screen)))

View File

@@ -4,11 +4,13 @@
[advent.screens.items :as items]
[advent.actions :as actions]
[advent.utils :as utils]
[advent.steam :as steam]
[clojure.zip :as zip]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
[play-clj.g2d :refer :all])
)
(defn make-night [entities]
(assoc-in entities [:room :entities :peeling :opacity] 0))
@@ -86,7 +88,9 @@
(actions/play-sound entities "safe-sound.ogg" 0.1)
(actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there."))
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")
(steam/set-achievement "MASTER_SLEUTH")
)
:else
(do (actions/walk-to entities :ego [80 80] :face :left)

View File

@@ -15,6 +15,7 @@
[advent.utils :as utils]
[advent.saves :as saves]
[advent.tween :as tween]
[advent.steam :as steam]
[advent.screens.rooms :as rooms]
[advent.screens.fade :refer [fade-screen]]
[advent.screens.items :as items]
@@ -1122,6 +1123,7 @@ void main ()
:on-render
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport] :as screen} [entities]]
(steam/update)
(.apply viewport)
(if (get-in entities [:closing? :value])

View File

@@ -0,0 +1,20 @@
(ns advent.steam)
(def has-steam?
(try
(import '[com.codedisaster.steamworks SteamUserStats SteamUserStatsCallback SteamAPI])
true
(catch Exception e
false)))
(defn init []
(when has-steam?
(eval `(SteamAPI/init))))
(defn update []
(when (and has-steam? (eval `(SteamAPI/isSteamRunning)))
(eval `(SteamAPI/runCallbacks))))
(defn set-achievement [achievement]
(when has-steam?
(eval `(.setAchievement (SteamUserStats. nil) ~achievement))))

1
desktop/steam_appid.txt Normal file
View File

@@ -0,0 +1 @@
411610