File tree Expand file tree Collapse file tree 11 files changed +59
-11
lines changed Expand file tree Collapse file tree 11 files changed +59
-11
lines changed Original file line number Diff line number Diff line change 1+ system-index.txt
Original file line number Diff line number Diff line change 1+ [Desktop Entry]
2+ Version =1.0
3+ Type =Application
4+ Name =StarWar
5+ Comment =A survival and dominance starwar game
6+ Exec =./starwar.lisp
7+ Icon =gcstar
8+ Terminal =false
9+ StartupNotify =false
Original file line number Diff line number Diff line change @@ -104,12 +104,12 @@ generateing the map. ")
104104 " read one file and load all the parameters"
105105 ; ; here, we MUST make sure that we are in the RIGHT package (that is the
106106 ; ; starwar package. or the parameters will not be set!
107- (with-open-file (s filename)
107+ (with-open-file (s (portable-pathname filename) )
108108 (do ((form (read s) (read s nil ' eof)))
109109 ((eq form ' eof) nil )
110110 (if (not (= (length form) 2 ))
111111 (error " configure file format not right!" ))
112- (setq form (cons ' defparameter form))
112+ (setq form (cons ' defvar form))
113113 (format t " eval: ~a~% " form)
114114 (eval form))))
115115
Original file line number Diff line number Diff line change 33
44(in-package :starwar )
55
6+ (defparameter *compression* 9 )
7+
8+ (defun dump-binaries ()
9+ (cffi)
10+ )
11+
612(defun make-binary ()
713 (sb-ext :save-lisp-and-die #+ unix " starwar-linux"
814 #+ win32 " starwar-win32.exe"
915 :toplevel #' starwar:main
10- :executable t ))
16+ :executable t
17+ :compression compression))
Original file line number Diff line number Diff line change 22(defpackage :starwar
33 (:use :cl :starwar-lib )
44 (:documentation " this is the star war game!" )
5- (:export :main :run :make-binary ))
5+ (:export :main :run :make-binary :fullscreen ))
Original file line number Diff line number Diff line change 1+ (in-package :starwar )
2+
3+ (defun portable-pathname (pathname &optional (system ' starwar))
4+ " PORTABLE-PATHNAME consider two possible dirnames: local and system-wide."
5+ (if (probe-file pathname )
6+ pathname
7+ (asdf :system-relative-pathname system pathname )))
Original file line number Diff line number Diff line change 7777 (setq speed star-speed-max))
7878 (setq star-speed speed ))
7979 (setq *news* (format nil " Increase speed to ~a x" star-speed)))
80+
8081(defun decrease-star-speed ()
8182 (let ((speed (- star-speed 0.5 )))
8283 (if (< speed star-speed-min)
@@ -269,7 +270,7 @@ the outter rect. the rect is filled by VALUE/FULL-VALUE"
269270 (set-game-running t )
270271 ; ; music background
271272 (sdl-mixer :open-audio)
272- (let ((music (sdl-mixer :load-music " background.mp3" )))
273+ (let ((music (sdl-mixer :load-music (portable-pathname " background.mp3" ) )))
273274 (sdl-mixer :play-music music :loop t )
274275 (sdl :with-events ()
275276 (:quit-event () (sdl-mixer :Halt-Music)
Original file line number Diff line number Diff line change 66(defsystem starwar-lib
77 :name " starwar-lib"
88 :author " Peter Xu"
9- :version " 0.0.1 "
9+ :version " 0.1.0 "
1010 :licence " MIT"
1111 :description " Some basic functions related to game"
1212 :pathname " src/lib/"
Original file line number Diff line number Diff line change 66(defsystem starwar
77 :name " starwar"
88 :author " xzpeter"
9- :version " 0.0.1 "
9+ :version " 0.1.0 "
1010 :license " MIT"
1111 :description " A very simple starwar game."
1212 :depends-on (:lispbuilder-sdl
1313 :lispbuilder-sdl-ttf
1414 :lispbuilder-sdl-gfx
1515 :lispbuilder-sdl-mixer
16+ :cffi
1617 :starwar-lib )
1718 :pathname " src"
1819 :components ((:file " packages" )
20+ (:file " path" )
1921 (:file " make-binary" )
20- (:file " globals" :depends-on (" packages" ))
22+ (:file " globals" :depends-on (" packages" " path " ))
2123 (:file " hittable-circle" :depends-on (" packages" ))
2224 (:file " classes" :depends-on (" packages"
2325 " hittable-circle" ))
3436 " classes"
3537 " globals" ))
3638 (:file " starwar" :depends-on (" packages"
39+ " path"
3740 " globals"
3841 " hittable-circle"
3942 " star"
Original file line number Diff line number Diff line change 11;; configuration file for starwar game
22
3- (fullscreen nil )
4- (screen-width 1200 )
5- (screen-height 800 )
3+ (fullscreen t )
4+ (screen-width 640 )
5+ (screen-height 400 )
66
77(star-speed-max 3.0)
88(star-speed-min 0.5)
You can’t perform that action at this time.
0 commit comments