From 7de2dbe941142f6437d8bab22fa1cead90590fb5 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Wed, 31 May 2023 23:04:36 -0500 Subject: [PATCH] Init: Basic one-tile map-drawing --- flora-sercha-sauna.lisp | 58 ++++++++++++++++++++++++++++++++++++++++ res/map font.png | Bin 0 -> 1026 bytes res/map font.tsx | 4 +++ res/map font.txt | 5 ++++ res/mom.tmx | 28 +++++++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 flora-sercha-sauna.lisp create mode 100644 res/map font.png create mode 100644 res/map font.tsx create mode 100644 res/map font.txt create mode 100644 res/mom.tmx diff --git a/flora-sercha-sauna.lisp b/flora-sercha-sauna.lisp new file mode 100644 index 0000000..be088f2 --- /dev/null +++ b/flora-sercha-sauna.lisp @@ -0,0 +1,58 @@ +;; +;; Copyright 2023, Jaidyn Ann +;; +;; This program is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation, either version 3 of +;; the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . +;; + +;; Made for the text-flavoured LibreJam of 2023-06! +;; https://jamgaroo.xyz/jams/2 +;; 72x20 + +(ql:quickload :cl-tiled) + +(defun main () + (clear-screen) + (draw-map "/home/jaidyn/.local/src/games/flower/res/mom.tmx")) + + +(defun move-cursor (row column &key (stream *standard-output*)) + "Moves cursor to desired position. +Borrowed from https://github.com/gorozhin/chlorophyll/ +© 2022 Mikhail Gorozhin — MIT license" + (format stream "~C[~A;~AH" #\Esc row column)) + + +(defun clear-screen (&key (stream *standard-output*)) + "Completely clear the terminal screen." + (move-cursor 0 0 :stream stream) + (format stream "~C[J" #\Esc)) + + +(defun draw-map (map-path) + (mapcar #'draw-tile-layer + (cl-tiled:map-layers (cl-tiled:load-map map-path)))) + + +(defun draw-tile-layer (tile-layer) + (mapcar #'draw-cell + (cl-tiled:layer-cells tile-layer))) + + +(defun draw-cell (cell) + (move-cursor (cl-tiled:cell-row cell) + (cl-tiled:cell-column cell)) + (write-char #\A)) + + +(main) diff --git a/res/map font.png b/res/map font.png new file mode 100644 index 0000000000000000000000000000000000000000..017a3e70a229c89093f7f1bb5f6452937e05077f GIT binary patch literal 1026 zcmV+d1pWJoP)RCwC$T-j~|Aq)%=|NqPBL!}kP2jc^>O*{`(gkTqp zuQ6;NkHVetdcD||shw?PyU{*Z`*OJQ*c-|XT+ws)<|#tIezewFYxrZQ&aE{?A&%`9 zUC}f#&#RF!ufNc3f<9L7iO+|%Hr%QbUBxJbr9cua;8!2VzoS;NA{bTpwVEO)Kh>im{DZ347!@?%7KAXCfjg@pF7v*X1&K8%nr+9*hz( zRw%i9tcZBpgK=GS6jEUD_)nbUASSPSFfeP5xDkb#NrVyP781|G8%K0S_umrz65W@i z*Wd&3#>f(yH91lI512EsPm5$hn{-8T$dZq`ew(wPLgBlK7;7@DUovqn-8S`SO2e1V zP#GR1P0OB+6`{PtQT+2&1RaS4Tjf8-q)g>;_IL7;WO{f(0xZj<{!7KNr_@7skVeV@ zO&gE%TgQr6!st`Jo_A;H?E{ho(Pi1#B z=6c;tC%yQ&Q@2(E6lHf*5e_HajvdV+{0o;T-7Q3lT<(gSsepCcT*I*|j0La?NQshr z!Qgo(5}fs=f`rjg;bDhQjUW##B339Q`s>39%pD?gBA)IXpd4A|1}OL0C6ev<{EGb! zK(APsdeRTFd_7Oz4fSv?sq6z1t7#ARRifM}V-^uZXj)IPqxk8S)n6}fk + + + diff --git a/res/map font.txt b/res/map font.txt new file mode 100644 index 0000000..2064fa7 --- /dev/null +++ b/res/map font.txt @@ -0,0 +1,5 @@ +License: CC0 +Author: domsson +URL: https://opengameart.org/content/ascii-bitmap-font-oldschool + +Used as a tilemap in Tiled — just to help visualize the maps!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