OSDN Git Service

view.lisp: created intermediate viewpoint texture
[rulp/rulp.git] / graphics / package.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 :graphics
18   (:use :cl :layers)
19   (:export
20    playground +plane+
21            ))
22
23 (in-package :graphics)
24
25 (defparameter +plane+ nil
26   "the rendered plane, this variable contain the plane which is gonna be presented
27 into the main window")
28
29 (defparameter *renderer* nil
30   "a variable containing the tool to render textures to screen, this is associated
31 with the screen and created in the view file but used almost everywhere. this is a
32 side variable and cannot be moved in a sdl enviroinment.")
33
34 (defparameter *pointer* nil
35   "this is a numeric value whose refer to the selected entity in the plane, it is
36 used combined with input to apply the actions and with view to display a 1x1 over
37 grid square of the entity"
38   )
39
40 ;; tr stands for text-rendering
41 (defparameter *tr-string* "abcdefghijklmnopqrstuvwxyz 0123456789"
42   "This string is used to generate a texture with the alphabet, the software
43 in the text.lisp file will 'write' on the screen selecting squares and using
44 this string again to parse a string variable into coordinate in the texture"
45   )
46
47 (defparameter *alphabet* "abcdefghijklmnopqrstuvwxyz"
48   "this is used to generate the grid, when the coordinates run out of letters
49 they restart from the beginning"
50   )
51
52 (defparameter *tr-texture* nil
53   "this contains the texture of the characters from *tr-string*. This
54 will be used to create text on screen by applying the single letters
55 with render-copy")
56
57 (defconstant +mouse-button-left+ 1 "this binds the left button")
58 (defconstant +mouse-button-right+ 3 "this binds the right button")
59 (defconstant +mouse-button-middle+ 2 "this binds the scroll button")
60
61 (defparameter *mouse-keybinds* (list
62                                 '(+mouse-button-left+ select-pointer)
63                                 ;; '(+mouse-button-middle+ mouse-view)
64                                 '(+mouse-button-right+ move-entity)
65                                 )
66   "This list associate the button presses to a certain action, the action is evaluated
67 as shown in graphics/input.lisp"
68   )
69
70 (defparameter *previous-mouse-position* '(0 0))
71 (defparameter *mouse-movement-delta* '(0 0)
72   "this parameter acknowledge saves the difference between the frames in mouse position.
73 It is used to move the plane around using the mouse")
74
75
76 (defparameter *is-grid* t
77   "Parameter for displaying the grid, when nil it does not display a grid, when t
78 it display a grid as defined by the +plane+")
79 (defparameter *is-indexes* t
80   "Parameter for displaying the indexes, when nil it does not display them, when t
81 it uses the grid to create a chessboard like indexes")
82
83 (defparameter *entries-list* nil
84   "List of entries, menues who are generated into the window with options")
85
86 (defparameter *window-width* 1001)
87 (defparameter *window-height* 750)