OSDN Git Service

render/: created sdl2 interface
[rulp/rulp.git] / script.lisp
1 ;;;; Ru*** roLeplay Playground virtual tabletop
2 ;;;; Copyright (C) 2022  Zull
3 ;;;;
4 ;;;; This program is free software: you can redistribute it and/or modify
5 ;;;; it under the terms of the GNU General Public License as published by
6 ;;;; the Free Software Foundation, either version 3 of the License, or
7 ;;;; (at your option) any later version.
8 ;;;;
9 ;;;; This program is distributed in the hope that it will be useful,
10 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ;;;; GNU General Public License for more details.
13 ;;;;
14 ;;;; You should have received a copy of the GNU General Public License
15 ;;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17 (defpackage :rulp.script
18   (:use :cl :rulp.graphics :rulp.layers))
19
20 (in-package :rulp.script)
21
22 (defun active-plane ()
23   *plane*)
24
25 (defun (setf active-plane) (value)
26   (setf *plane* value))
27
28 (defun entities ()
29   *entities-list*)
30
31 (defun (setf entities) (value)
32   (if (listp value)
33       (setf *entities-list* value)
34       (warn "(setf entities) error: symbol ~A is not of type list, operation stopped" value)))
35
36 (defun add-entity (entity)
37   "add an entity into the active plane"
38   (push entity *entities-list*))
39
40 (defun remove-entity (number)
41   "remove the nth entity from the active plane"
42   (screen-purge (nth number *entities-list*))
43   (setf (nth number *entities-list*) nil)
44   (remove nil *entities-list*))