finalize revision 0.032
[SwashRL.git] / src / global.d
blob6565358a75a127cd571ff476c52d58ba07bc4562
1 /*
2 * Copyright (c) 2015-2020 Philip Pavlick. See '3rdparty.txt' for other
3 * licenses. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the SwashRL project nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 // global.d:
30 // This is the global file for SwashRL. It will public import config.d and
31 // util.d for you and process the data in both of these files to configure
32 // how SwashRL will compile. THIS FILE SHOULD BE IMPORTED AT THE TOP OF
33 // EVERY FILE. It will import all of the other files for you.
35 // SECTION 0: ////////////////////////////////////////////////////////////////
36 // SwashRL version control & configuration //
37 //////////////////////////////////////////////////////////////////////////////
39 /* The name of the compiled game
41 * If you're using the source code for a derivative software product, change
42 * this value to the name of your game to change all references to SwashRL.
44 enum NAME = "SwashRL";
46 /* The version number
48 * In the current version numbering system, the first number is the release
49 * number and the second is the three-digit revision number. This number
50 * is stored as a floating-point number.
52 enum VERSION = 0.032;
54 /* The commit ID
56 * This string value represents the first seven digits of the commit number
57 * that the git repository was in when SwashRL was compiled. This acts as
58 * the "patch number" for that version of the program.
60 * This value will be declared as "HOMEMOD" if `INCLUDE_COMMIT` is `false`
62 static if( INCLUDE_COMMIT )
64 import std.string : split;
66 enum COMMIT = import( ".git/" ~ import( ".git/HEAD" ).split[1] )[0 .. 7];
68 else
70 enum COMMIT = "HOMEMOD";
73 // Include the config file
74 public import config;
76 // SECTION 1: ////////////////////////////////////////////////////////////////
77 // Compiler configuration //
78 //////////////////////////////////////////////////////////////////////////////
80 // Include the sys file to detect operating system
81 public import sys;
83 // SECTION 2: ////////////////////////////////////////////////////////////////
84 // Display configuration //
85 //////////////////////////////////////////////////////////////////////////////
87 // curses configuration //////////////////////////////////////////////////////
89 // public import the necessary version of curses
91 // Which version of curses we import is determined by a `version' check as
92 // defined in ``dub.json''. Building with the `pdcurses' configuration will
93 // import pdcurses, `ncurses' will import ncurses. The `version' given by
94 // those configurations has the same name as the configuration itself.
96 // `CURSES_ENABLED' evaluates to `true' if either ncurses or pdcurses is being
97 // used and `false' otherwise.
99 version( ncurses )
101 public import deimos.ncurses.curses;
102 enum CURSES_ENABLED = true;
104 else version( pdcurses )
106 public import pdcurses;
107 enum CURSES_ENABLED = true;
109 else
111 enum CURSES_ENABLED = false;
114 // SDL configuration /////////////////////////////////////////////////////////
116 version( sdl )
118 enum SDL_ENABLED = true;
120 public import derelict.sdl2.sdl, derelict.sdl2.ttf;
121 public import fonts;
123 static if( DYSLEXIA )
125 enum FONT = TileSet.dyslexic;
126 enum MESSAGE_FONT = TileSet.dyslexic;
128 else
130 enum FONT = TileSet.standard;
131 enum MESSAGE_FONT = BOLD_MESSAGE_FONT ? TileSet.bold : TileSet.standard;
134 else
136 enum SDL_ENABLED = false;
139 // SECTION 3: ////////////////////////////////////////////////////////////////
140 // SwashRL final setup //
141 //////////////////////////////////////////////////////////////////////////////
143 // Used to determine the height of the map. 22 is recommended.
144 enum MAP_Y = 22;
146 // Used to determine the width of the map. 80 is recommended.
147 enum MAP_X = 80;
149 // Used by some `for` loops as a maximum value for zero-counted arrays.
150 enum MAP_y = MAP_Y - 1;
152 // Used by some `for` loops as a maximum value for zero-counted arrays.
153 enum MAP_x = MAP_X - 1;
155 // The number of tiles on the map.
156 enum NUMTILES = MAP_Y * MAP_X;
158 // The number of reserved lines at the top of the display.
160 // The message buffer appears at the top of the display. The number of lines
161 // it takes up is listed here as `RESERVED_LINES`. Map display functions use
162 // this value to offset the y coordinate of the draw functions.
163 enum RESERVED_LINES = MESSAGE_BUFFER_LINES;
165 // An alias for `RESERVED_LINES`
166 // TODO: Try to render this alias unnecessary.
167 enum Y_OFFSET = RESERVED_LINES;
169 // include the utility file
170 public import util;
172 // SECTION 4: ////////////////////////////////////////////////////////////////
173 // Global inclusion of all header files not yet included //
174 //////////////////////////////////////////////////////////////////////////////
176 public import cheats;
177 public import dice;
178 public import color;
179 public import colors;
180 public import sym;
181 public import tsyms;
182 public import tflags;
183 public import tile;
184 public import iflags;
185 public import item;
186 public import inven;
187 public import monst;
188 public import you;
189 public import map;
190 public import mapgen;
191 public import mapalgo;
192 public import fov;
193 public import msg;
194 public import iomain;
195 public import iocurses;
196 public import ioterm;
197 public import moves;
198 public import keymaps;
199 public import mov;
200 public import savefile;