From c03f5f1b64f3f823ff720c405d0a7194fe7ab026 Mon Sep 17 00:00:00 2001 From: David O'Toole Date: Wed, 7 Apr 2010 02:37:50 -0400 Subject: [PATCH] more --- forest/forest.pak | 2 +- forms.lisp | 2 +- widgets.lisp | 11 ++++++++++- xiodev/README | 6 ++---- xiodev/xiodev.lisp | 38 +++++++++++++++++++++++++++++++------- xiodev/xiodev.pak | 2 +- xiotank/tones.sh | 15 +++++++++++++++ xong/xong.pak | 2 +- 8 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 xiotank/tones.sh diff --git a/forest/forest.pak b/forest/forest.pak index 0e0e0c5..96064cd 100644 --- a/forest/forest.pak +++ b/forest/forest.pak @@ -189,5 +189,5 @@ (:name "forest-lisp" :type :lisp :file "forest.lisp" :properties (:autoload t)) (:name "mountain-lisp" :type :lisp :file "mountain.lisp" :properties (:autoload t)) (:name "monastery-lisp" :type :lisp :file "monastery.lisp" :properties (:autoload t)) - (:name ".startup" :type :lisp :file "startup.lisp" :properties (:autoload t)) + (:name ".startup" :type :lisp :file "startup.lisp") ) diff --git a/forms.lisp b/forms.lisp index 345db2c..9f4115f 100644 --- a/forms.lisp +++ b/forms.lisp @@ -37,7 +37,7 @@ ;; (message "OBJEKKT: ~S" (find-resource page)) (let ((object (find-resource-object page))) (prog1 object - (setf (field-value :name object) page)))))))) + (setf (field-value :name object) (generate-page-name object))))))))) ;; (maphash #'(lambda (k v) (when (resource-p v) ;; (when (eq :object (resource-type v)) diff --git a/widgets.lisp b/widgets.lisp index 3dd6564..4b5dd3e 100644 --- a/widgets.lisp +++ b/widgets.lisp @@ -687,6 +687,7 @@ normally." (define-prototype textbox (:parent =widget=) (font :initform ".default-font") (buffer :initform nil) + (read-only :initform nil) (bordered :initform nil) (max-displayed-rows :initform nil :documentation "An integer when scrolling is enabled.") (max-displayed-columns :initform nil) @@ -697,6 +698,13 @@ normally." (point-column :initform 0) (visible :initform t)) +(define-method handle-key textbox (event) + (unless + (let ((func (gethash event ))) + (when func + (prog1 t + (funcall func)))))) + (define-method set-buffer textbox (buffer) (setf buffer)) @@ -951,6 +959,8 @@ text INSERTION to be inserted at point." :color :destination image))))))) + + ;;; The pager switches between different visible groups of widgets (define-prototype pager (:parent =widget=) @@ -1049,4 +1059,3 @@ text INSERTION to be inserted at point." ;; draw the string (render-formatted-line (nreverse line) 0 0 :destination )))) -;;; widgets.lisp ends here diff --git a/xiodev/README b/xiodev/README index 75cf579..b6442e8 100644 --- a/xiodev/README +++ b/xiodev/README @@ -1,5 +1,3 @@ -((("This is the help screen. Press F2 to return to play. While playing you")) - (("can left-click any object for help. Press PAUSE (or CONTROL-P) to pause,")) - (("this makes it easier to click and see what all the different objects are.")) - (("Press Control Q to quit."))) +This is the help screen for XIODEV. Press F2 to return to the +spreadsheet view. diff --git a/xiodev/xiodev.lisp b/xiodev/xiodev.lisp index 4816b38..6bda738 100644 --- a/xiodev/xiodev.lisp +++ b/xiodev/xiodev.lisp @@ -42,6 +42,18 @@ (defvar *pager*) (defvar *forms*) +(define-prototype help-prompt (:parent =prompt=) + (default-keybindings :initform '(("N" nil "page-down .") + ("P" nil "page-up .")))) + +(define-prototype help-textbox (:parent =textbox=)) + +(define-method render help-textbox () + [parent>>render self] + [message *pager* + (list (format nil " --- Line ~A of ~A. Use N (NEXT) and P (PREVIOUS) to scroll the text." + (length )))]) + (add-hook '*after-load-module-hook* (lambda () [message *pager* (list (format nil " CURRENT MODULE: ~S." *module*))])) @@ -104,7 +116,8 @@ (xe2:set-screen-height *window-height*) (xe2:set-screen-width *window-width*) (let* ((prompt (clone =xiodev-prompt=)) - (help (clone =formatter=)) + (help (clone =help-textbox=)) + (help-prompt (clone =help-prompt=)) (quickhelp (clone =formatter=)) (form (clone =form=)) (form2 (clone =form= "*index*")) @@ -123,7 +136,7 @@ *prompt-height* *pager-height*) :width (- *screen-width* *sidebar-width* 2)] [resize form2 :height (- *screen-height* *terminal-height* *prompt-height* *pager-height*) :width (- *sidebar-width* 2)] - [resize help :height 540 :width 800] + [resize-to-scroll help :height (- *screen-height* *pager-height*) :width *screen-width*] [resize stack :width *screen-width* :height (- *screen-height* *pager-height*)] [resize split :width (- *screen-width* 1) :height (- *screen-height* *pager-height* *prompt-height* *terminal-height*)] [resize terminal :height *terminal-height* :width *screen-width*] @@ -145,6 +158,18 @@ [move form :x 0 :y 0] [set-prompt form prompt] [set-narrator form terminal] + ;; + [resize-to-scroll help :height 540 :width 800] + [move help :x 0 :y 0] + (setf (field-value :read-only help) t) + (let ((text (find-resource-object "help-message"))) + [set-buffer help text]) + ;; + [resize help-prompt :width 10 :height 10] + [move help-prompt :x 0 :y 0] + [hide help-prompt] + [set-receiver help-prompt help] + ;; [resize form2 :height (- *screen-height* *terminal-height* *prompt-height* *pager-height*) :width *sidebar-width*] [move form2 :x 0 :y 0] @@ -154,13 +179,12 @@ ;; (xe2:halt-music 1000) ;; - [resize help :height 540 :width 800] + ;; [resize help :height 540 :width 800] + ;; [move help :x 0 :y 0] + [resize-to-scroll help :height 540 :width 800] [move help :x 0 :y 0] (let ((text (find-resource-object "help-message"))) - (dolist (line text) - (dolist (string line) - (funcall #'send nil :print-formatted-string help string)) - [newline help])) + [set-buffer help text]) ;; ;; ;; [resize quickhelp :height 72 :width 250] ;; [move quickhelp :y (- *screen-height* 130) :x (- *screen-width* 250)] diff --git a/xiodev/xiodev.pak b/xiodev/xiodev.pak index cf21ee7..c417a66 100644 --- a/xiodev/xiodev.pak +++ b/xiodev/xiodev.pak @@ -1,5 +1,5 @@ ( - (:name "help-message" :type :formatted-text :file "README") + (:name "help-message" :type :text :file "README") (:name ".default-font" :type :font :properties (:height 14 :width 7) :data "7x14b") (:name ".startup" :type :lisp :file "xiodev.lisp" :properties (:autoload t)) ) diff --git a/xiotank/tones.sh b/xiotank/tones.sh new file mode 100644 index 0000000..4e0c3ad --- /dev/null +++ b/xiotank/tones.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ecasound -i:tone,sine,261.63,5 -o:C-2-sine.wav +ecasound -i:tone,sine,277.18,5 -o:C\#2-sine.wav +ecasound -i:tone,sine,293.66,5 -o:D-2-sine.wav +ecasound -i:tone,sine,311.13,5 -o:D\#2-sine.wav +ecasound -i:tone,sine,329.63,5 -o:E-2-sine.wav +ecasound -i:tone,sine,349.23,5 -o:F-2-sine.wav +ecasound -i:tone,sine,369.99,5 -o:F\#2-sine.wav +ecasound -i:tone,sine,392.00,5 -o:G-2-sine.wav +ecasound -i:tone,sine,415.30,5 -o:G\#2-sine.wav +ecasound -i:tone,sine,440.00,5 -o:A-2-sine.wav +ecasound -i:tone,sine,466.16,5 -o:A\#2-sine.wav +ecasound -i:tone,sine,493.88,5 -o:B-2-sine.wav +ecasound -i:tone,sine,523.25,5 -o:C-3-sine.wav diff --git a/xong/xong.pak b/xong/xong.pak index 4a1209a..6f02c9a 100644 --- a/xong/xong.pak +++ b/xong/xong.pak @@ -197,5 +197,5 @@ (:name "player-lisp" :type :lisp :file "player.lisp" :properties (:autoload t)) (:name "enemy-lisp" :type :lisp :file "enemy.lisp" :properties (:autoload t)) (:name "tutorial-lisp" :type :lisp :file "tutorial.lisp" :properties (:autoload t)) - (:name ".startup" :type :lisp :file "xong.lisp" :properties (:autoload t)) + (:name ".startup" :type :lisp :file "xong.lisp") )