Skip to content

Commit

Permalink
upgrade CALM to 0.1.1
Browse files Browse the repository at this point in the history
remove JSCL related workarounds
  • Loading branch information
VitoVan committed May 25, 2023
1 parent 136b650 commit ba3cfdc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 42 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pelusica.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:

- name: Build
run: |
npm install uglify-js -g
set -x
curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/0.1.0/calm.tgz
curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/0.1.1/calm.tgz
mkdir calm
tar xvf calm.tgz --directory=calm
ls -lah calm
export PATH=$PATH:$(pwd)/calm/
export APP_NAME=Pelusica
export REBUILD_WASM_P=yes
calm publish-web
ls -lah .
zip -r -9 ${APP_NAME}-web.zip ./web
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Build
run: |
set -x
curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/0.1.0/calm.tgz
curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/0.1.1/calm.tgz
mkdir calm
tar xvf calm.tgz --directory=calm
ls -lah calm
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
set -x
export OS_SUBFIX=".${CI_MATRIX_OS}"
curl -L -o calm.dmg https://github.com/VitoVan/calm/releases/download/0.1.0/calm${OS_SUBFIX}.dmg
curl -L -o calm.dmg https://github.com/VitoVan/calm/releases/download/0.1.1/calm${OS_SUBFIX}.dmg
hdiutil attach calm.dmg
cp -R "/Volumes/Calm - CALM/Calm.app/Contents/MacOS/" calm
ls -lah calm
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
run: |
set -x
pacman -S --noconfirm --needed unzip
curl -L -o calm.zip https://github.com/VitoVan/calm/releases/download/0.1.0/calm.zip
curl -L -o calm.zip https://github.com/VitoVan/calm/releases/download/0.1.1/calm.zip
unzip calm.zip -d calm
ls -lah calm
export PATH=$PATH:$(pwd)/calm/
Expand Down
49 changes: 12 additions & 37 deletions canvas.lisp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
;; pelusica 0.0.4
;; pelusica 0.0.5

(in-package #:calm)

#-jscl
(let ((required-version "0.1.0"))
(let ((required-version "0.1.1"))
(unless (string>= *calm-version* required-version)
(format t "Sorry, CALM ~A is needed, older version (current: ~A) of CALM won't work.~%"
required-version *calm-version*)
Expand Down Expand Up @@ -178,9 +178,6 @@
(incf *ball-x* 100)))
((c:keq key :SCANCODE-LEFT :SCANCODE-J :SCANCODE-H)
(when (and (> *ball-x* 100) (play-note))
#+jscl
(incf *ball-x* -100)
#-jscl
(decf *ball-x* 100)))
(t (format t "~%KEY PRESSED: ~A~%" key)))))

Expand All @@ -190,7 +187,7 @@
(c:select-font-family "Open Sans" :normal :normal)
(c:set-font-size 24)
(apply #'c:set-source-rgb *ball-color*)
(c:move-to 142 240)
(c:move-to 140 240)
(c:show-text "press ")
(apply #'c:set-source-rgb *health-color*)
#-jscl
Expand All @@ -202,15 +199,17 @@
(c:show-text "Enter")
(c:show-text "return"))
(apply #'c:set-source-rgb *ball-color*)
(c:show-text ", and wait to die")
(c:move-to 142 290)
(c:show-text "or try pressing ")
(c:show-text " to start or restart")
(c:move-to 140 290)
(c:show-text "press ")
(apply #'c:set-source-rgb *health-color*)
(c:show-text "left")
(apply #'c:set-source-rgb *ball-color*)
(c:show-text " / ")
(c:show-text " or ")
(apply #'c:set-source-rgb *health-color*)
(c:show-text "right"))
(c:show-text "right")
(apply #'c:set-source-rgb *ball-color*)
(c:show-text " to move"))

(defun draw-died-screen ()
(if *suffocated*
Expand Down Expand Up @@ -249,9 +248,6 @@
(setf
*level* (* 40 (/ *music-index* (length *music-list*)))
*enemy-move-per-ms* (max 0.22 (/
#+jscl
(#j:Math:log (1+ *level*))
#-jscl
(log (1+ *level*)) 4))))

(defun draw-level-border ()
Expand Down Expand Up @@ -321,36 +317,15 @@
(c:play-music "assets/chord.wav"))
(when should-move
;; move downward
;; this clumsy chunk is to indulge jscl
;; track: https://github.com/jscl-project/jscl/issues/176
#+jscl
(let ((current-enemy (nth i *enemy-list*)))
(setf (nth i *enemy-list*)
(list
(car current-enemy)
(+ (cadr current-enemy)
(if *enemy-move-tick*
(* (- (c:get-ticks) *enemy-move-tick*) *enemy-move-per-ms*)
1)))))
#-jscl
(incf
(cadr (nth i *enemy-list*))
(if *enemy-move-tick*
(* (- (c:get-ticks) *enemy-move-tick*) *enemy-move-per-ms*)
1)))
else
do
;; random reset the Y position
;; this clumsy chunk is to indulge jscl
;; track: https://github.com/jscl-project/jscl/issues/176
#+jscl
(let ((current-enemy (nth i *enemy-list*)))
(setf (nth i *enemy-list*)
(list
(car current-enemy)
(* (1+ (random 400)) -1))))
#-jscl
(setf (cadr (nth i *enemy-list*)) (* (1+ (random 400)) -1)))
;; randomly reset the Y position
(setf (cadr (nth i *enemy-list*)) (* (1+ (random 400)) -1)))
(when should-move (setf *enemy-move-tick* (c:get-ticks))))))

(defun draw-ball ()
Expand Down

0 comments on commit ba3cfdc

Please sign in to comment.