Skip to content
Permalink
Browse files

Add steam support shim

  • Loading branch information
Shinmera committed Feb 23, 2020
1 parent f55ba1c commit 7b65a38342729caa7da75e7364f59eadfa602374
Showing with 51 additions and 0 deletions.
  1. +34 −0 steam.lisp
  2. +17 −0 trial-steam.asd
@@ -0,0 +1,34 @@
#|
This file is a part of trial
(c) 2016 Shirakumo http://tymoon.eu (shinmera@tymoon.eu)
Author: Nicolas Hafner <shinmera@tymoon.eu>
|#

(defpackage #:org.shirakumo.fraf.trial.steam
(:use #:cl)
(:export #:main #:steam-required-p)
(:local-nicknames
(#:trial #:org.shirakumo.fraf.trial)
(#:steam #:org.shirakumo.fraf.steamworks)))
(in-package #:org.shirakumo.fraf.trial.steam)

(defclass main (trial:main)
())

(defmethod steam-required-p ((main main)) NIL)

(defmethod initialize-instance :after ((main main) &key app-id)
(handler-bind ((steam:initialization-failed
(lambda (e)
(when trial:*standalone*
(if (steam-required-p main)
(invoke-restart 'steam:restart)
(invoke-restart 'ignore))))))
(when (or (steam-required-p main)
trial:*standalone*)
(with-simple-restart (ignore "Ignore the steamworks failure.")
(make-instance 'steam:steamworks-client :app-id app-id)))))

(defmethod trial:finalize :after ((main main))
(when (steam:steamworks)
(steam:free (steam:steamworks))))
@@ -0,0 +1,17 @@
#|
This file is a part of trial
(c) 2016 Shirakumo http://tymoon.eu (shinmera@tymoon.eu)
Author: Nicolas Hafner <shinmera@tymoon.eu>
|#

(asdf:defsystem trial-steam
:version "1.2.0"
:author "Nicolas Hafner <shinmera@tymoon.eu>"
:maintainer "Nicolas Hafner <shinmera@tymoon.eu>"
:license "zlib"
:description "A flexible and extensible video game engine."
:homepage "https://Shirakumo.github.io/trial/"
:bug-tracker "https://github.com/Shirakumo/trial/issues"
:source-control (:git "https://github.com/Shirakumo/trial.git")
:components ((:file "steam"))
:depends-on (:trial :cl-steamworks))

0 comments on commit 7b65a38

Please sign in to comment.
You can’t perform that action at this time.