Skip to content

Commit 9b69eca

Browse files
committed
adding config file and a script that make binary under both windows/linux
1 parent 61ed581 commit 9b69eca

File tree

8 files changed

+48
-350
lines changed

8 files changed

+48
-350
lines changed

README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a game written in CL.
2+
3+
You may check the homepage at http://xzpeter.github.com/starwar for more information.

globals.lisp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ generateing the map. ")
8686
(defparameter planet-core-radius 3)
8787
(defparameter star-max-amount 1000)
8888

89+
(defparameter screen-rightmost (- world-rightmost screen-width))
90+
(defparameter screen-bottommost (- world-bottommost screen-height))
91+
(defparameter world-width (- world-rightmost world-leftmost))
92+
(defparameter world-height (- world-bottommost world-topmost))
93+
(defparameter margin-bottom (- screen-height 10))
94+
(defparameter margin-right (- screen-width 10))
95+
8996
(defun generate-bg-stars (n)
9097
"generate N bg stars and return list"
9198
(loop repeat n collect
@@ -95,13 +102,16 @@ generateing the map. ")
95102

96103
(defun load-file-set-parameters (filename)
97104
"read one file and load all the parameters"
105+
;; without this, the settings won't work
106+
(in-package :org.xzpeter.game.starwar)
98107
(with-open-file (s filename)
99108
(do ((form (read s) (read s nil 'eof)))
100109
((eq form 'eof) nil)
101110
(if (not (= (length form) 2))
102111
(error "configure file format not right!"))
103112
(setq form (cons 'defparameter form))
104-
(eval form))))
113+
(format t "eval: ~a~%" form)
114+
(eval form))))
105115

106116
(defun auto-generate-planets (amount)
107117
"auto generate planets and normally set the *planet-list* var.
@@ -152,10 +162,6 @@ INIT-AMOUNT is how many planets one player own at the beginning of game"
152162
(incf count)
153163
(setq vlist (cons v vlist)))))))))
154164

155-
(defun set-game-running (n)
156-
"set running status of the game"
157-
(setf (sdl:frame-rate) (if n frame-rate -1)))
158-
159165
(defun clear-global-vars ()
160166
(setq *planet-list* nil)
161167
(setq *running* nil)
@@ -181,18 +187,16 @@ INIT-AMOUNT is how many planets one player own at the beginning of game"
181187
*bg-stars* (generate-bg-stars bg-star-n)
182188
*planet-list* (planet-sort-by-size
183189
(auto-generate-planets planet-total)))
184-
;; defaultly, the first planet for player1, then player2
190+
185191
(setf (player (fifth *planet-list*)) *player1*)
186192
(setf (player (sixth *planet-list*)) *player2*)
187193

188194
;; load all the configure file
189195
(load-file-set-parameters "starwar.conf")
190196

191-
(defparameter screen-rightmost (- world-rightmost screen-width))
192-
(defparameter screen-bottommost (- world-bottommost screen-height))
193-
(defparameter world-width (- world-rightmost world-leftmost))
194-
(defparameter world-height (- world-bottommost world-topmost))
195-
(defparameter margin-bottom (- screen-height 10))
196-
(defparameter margin-right (- screen-width 10))
197-
198-
(set-game-running t))
197+
(setq screen-rightmost (- world-rightmost screen-width))
198+
(setq screen-bottommost (- world-bottommost screen-height))
199+
(setq world-width (- world-rightmost world-leftmost))
200+
(setq world-height (- world-bottommost world-topmost))
201+
(setq margin-bottom (- screen-height 10))
202+
(setq margin-right (- screen-width 10)))

make-binary.lisp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
;; using this to make linux binary. Before that, we have to configure asdf
2+
;; correctly, so that ASD files can be found.
3+
4+
#+win32
5+
(setq asdf:*central-registry*
6+
(append asdf:*central-registry*
7+
'("Z:\\home\\xzpeter\\git-repo\\starwar\\"
8+
"Z:\\home\\xzpeter\\git-repo\\starwar\\lib\\")))
9+
10+
(require "org.xzpeter.game.starwar")
11+
(sb-ext:save-lisp-and-die #+unix "starwar-linux"
12+
#+win32 "starwar-win32.exe"
13+
:toplevel #'org.xzpeter.game.starwar:main
14+
:executable t)

make-linux-binary.lisp

Lines changed: 0 additions & 6 deletions
This file was deleted.

readme.html

Lines changed: 0 additions & 264 deletions
This file was deleted.

0 commit comments

Comments
 (0)