-
Notifications
You must be signed in to change notification settings - Fork 0
/
window-intro.lisp
48 lines (38 loc) · 2.11 KB
/
window-intro.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(in-package :trader-rl)
(defclass intro-window (window)
((win-type :initarg :win-type :accessor win-type :type keyword) ; :new - new game intro
; :error - load error intro
; :load - load intro
))
(defmethod generate-win-actions ((win intro-window))
(setf (win-actions win) nil)
)
(defmethod make-output ((win intro-window))
;; fill with black background
(sdl:fill-surface sdl:*black*)
(let ((str (create-string)))
(cond
((eq (win-type win) :new)
;; output new game intro info
(format str "TRADER RL~%~%Welcome to Trader RL. You are a trader in the harsh dark world of Arq. The surface has long become inhospitable and all life has moved underground. People live in lonely settlements linked by long twisted tunnels.~%Traders like you connect these dots of civilization, travelling and trading. Your dream is to become memeber of the ruler's court and ascend as the Master Treasurer of the realm. May the gods be with you!~%~%[Press any key to continue]~%"))
((eq (win-type win) :error)
;; output error intro info
(format str "TRADER RL~%~%Error loading the save game.~%New game is created.~%~%[Press any key to continue]~%"))
((eq (win-type win) :load)
;; output error intro info
(format str "TRADER RL~%~%Loading the save game.~%~%[Press any key to continue]~%"))
)
(sdl:with-default-font ((sdl:initialise-default-font sdl:*font-6x13*))
(write-text str (sdl:rectangle :x 1 :y 1 :w 800 :h 600)))
)
(sdl:update-display))
(defmethod run-window ((win intro-window))
(tagbody
(sdl:with-events ()
(:quit-event () (funcall (quit-func win)) t)
(:key-down-event (:key key :mod mod :unicode unicode)
(setf *current-window* (make-instance 'settlement-window))
(make-output *current-window*)
(go exit-func))
(:video-expose-event () (make-output *current-window*)))
exit-func (make-output *current-window*)))