2018-06-10 23:58:31 +00:00
// Hyperbolic Rogue -- set compiler flags, and include all the required system headers
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
2019-08-10 11:43:24 +00:00
/** \file sysconfig.h
* \ brief set compiler flags , and include all the required system headers
*/
2018-06-10 23:58:31 +00:00
# ifdef MAC
# define ISMAC 1
# endif
# ifdef LINUX
# define ISLINUX 1
# endif
# ifdef WINDOWS
# define ISWINDOWS 1
2020-01-18 16:21:33 +00:00
# define _WIN32_WINNT 0x0501
2018-06-10 23:58:31 +00:00
# endif
// OS settings
# ifndef ISMAC
# define ISMAC 0
# endif
# ifndef ISLINUX
# define ISLINUX 0
# endif
# ifndef ISWINDOWS
# define ISWINDOWS 0
# endif
# ifndef ISPANDORA
# define ISPANDORA 0
# endif
# ifndef ISIOS
# define ISIOS 0
# endif
# ifndef ISANDROID
# define ISANDROID 0
# endif
2019-02-08 23:18:56 +00:00
# ifndef ISSTEAM
# define ISSTEAM 0
# endif
2018-06-10 23:58:31 +00:00
# ifndef ISWEB
# define ISWEB 0
# endif
# ifndef ISFAKEMOBILE
# define ISFAKEMOBILE 0
# endif
# define ISMOBILE (ISIOS || ISANDROID || ISFAKEMOBILE)
# define ISMOBWEB (ISMOBILE || ISWEB)
# ifndef ISMINI
# define ISMINI 0
# endif
# ifndef CAP_XGD
# define CAP_XGD (ISANDROID || ISFAKEMOBILE)
# endif
2020-01-16 15:39:18 +00:00
# ifndef CAP_THREAD
# define CAP_THREAD (!ISMOBILE && !ISWEB)
# endif
2020-02-15 13:10:49 +00:00
# ifndef CAP_ZLIB
2020-03-07 11:21:25 +00:00
# define CAP_ZLIB 1
2020-02-15 13:10:49 +00:00
# endif
2020-07-04 22:53:02 +00:00
# ifndef CAP_GMP
# define CAP_GMP 0
# endif
2018-06-10 23:58:31 +00:00
# define CAP_FRAMELIMIT (!ISMOBWEB)
2019-02-08 23:18:56 +00:00
# if ISMOBILE
2018-06-10 23:58:31 +00:00
# define EXTERNALFONT
# endif
2019-02-08 23:18:56 +00:00
# ifndef NOLICENSE
# define NOLICENSE ISSTEAM
# endif
2020-05-03 18:56:41 +00:00
# ifndef CAP_VERTEXBUFFER
# define CAP_VERTEXBUFFER (ISWEB)
# endif
2019-02-08 23:18:56 +00:00
# ifndef CAP_SHADER
# define CAP_SHADER CAP_GL
2018-06-10 23:58:31 +00:00
# endif
2019-07-12 21:16:54 +00:00
# ifndef CAP_NOSHADER
# define CAP_NOSHADER (!ISMOBILE && !ISWEB)
# endif
2018-09-10 15:58:36 +00:00
# ifndef CAP_ANIMATIONS
2019-02-17 17:50:56 +00:00
# define CAP_ANIMATIONS (!ISMINI)
2018-09-10 15:58:36 +00:00
# endif
2019-02-08 23:18:56 +00:00
# ifndef CAP_FILES
2019-02-17 17:50:56 +00:00
# define CAP_FILES (!ISMINI)
2019-02-08 23:18:56 +00:00
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_INV
2019-02-17 17:50:56 +00:00
# define CAP_INV (!ISMINI)
2018-06-10 23:58:31 +00:00
# endif
# ifndef CAP_ANDROIDSHARE
# define CAP_ANDROIDSHARE (ISANDROID)
# endif
# ifndef CAP_SDL
# define CAP_SDL (!ISMOBILE)
# endif
2018-06-17 03:32:09 +00:00
# ifndef CAP_COMPASS
2018-06-10 23:58:31 +00:00
# define CAP_COMPASS ISMOBILE
# endif
# ifndef CAP_SDLGFX
# define CAP_SDLGFX (CAP_SDL && !ISWEB)
# endif
# ifndef CAP_GL
# define CAP_GL (ISMOBILE || CAP_SDL)
# endif
# ifndef CAP_AUDIO
# define CAP_AUDIO ((ISMOBILE || CAP_SDL) && !ISWEB && !ISMINI)
# endif
# define CAP_GLORNOT (CAP_GL && !ISWEB && !ISIOS)
2019-11-30 14:05:13 +00:00
# ifndef CAP_DAILY
2018-06-10 23:58:31 +00:00
# if ISSTEAM
# define CAP_DAILY 1
# endif
2019-11-30 14:05:13 +00:00
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_DAILY
# define CAP_DAILY 0
# endif
# ifndef CAP_CERTIFY
# define CAP_CERTIFY 0
# endif
# ifndef CAP_RUG
# define CAP_RUG (!ISMINI && CAP_GL)
# endif
# ifndef CAP_SURFACE
# define CAP_SURFACE CAP_RUG
# endif
2020-05-03 18:56:41 +00:00
# ifndef CAP_KUEN_MAP
# define CAP_KUEN_MAP 0
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_EDIT
2020-09-21 10:04:23 +00:00
# define CAP_EDIT (CAP_FILES && !ISMINI)
2018-06-10 23:58:31 +00:00
# endif
2018-12-13 12:33:08 +00:00
# ifndef CAP_SHOT
# define CAP_SHOT (CAP_FILES && (CAP_SVG || CAP_PNG))
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_ODS
# define CAP_ODS 0
# endif
2020-05-22 12:30:45 +00:00
# ifndef CAP_VIDEO
# define CAP_VIDEO (CAP_SHOT && ISLINUX && CAP_SDL)
# endif
2020-02-15 13:10:49 +00:00
# ifndef MAXMDIM
# define MAXMDIM 4
# endif
2020-11-01 16:37:51 +00:00
# ifndef CAP_MDIM_FIXED
# define CAP_MDIM_FIXED 0
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_TEXTURE
# define CAP_TEXTURE (CAP_GL && (CAP_PNG || CAP_SDL_IMG) && !ISMINI)
# endif
# ifndef CAP_MODEL
2020-07-03 12:42:33 +00:00
# define CAP_MODEL (!ISMOBWEB && !ISMINI && CAP_SDL)
2018-06-10 23:58:31 +00:00
# endif
# ifndef CAP_SAVE
# define CAP_SAVE (CAP_FILES && !ISWEB && !ISMINI)
# endif
# ifndef CAP_CONFIG
# define CAP_CONFIG (CAP_FILES && !ISWEB && !ISMINI)
# endif
# ifndef CAP_TRANS
# define CAP_TRANS (!ISWEB && !ISMINI)
# endif
# ifndef CAP_TOUR
2020-10-11 23:28:50 +00:00
# define CAP_TOUR (!ISMINI)
2018-06-10 23:58:31 +00:00
# endif
# ifndef CAP_ROGUEVIZ
# define CAP_ROGUEVIZ 0
# endif
# ifndef CAP_PROFILING
# define CAP_PROFILING 0
# endif
# define PSEUDOKEY_WHEELDOWN 2501
# define PSEUDOKEY_WHEELUP 2502
# define PSEUDOKEY_RELEASE 2503
2020-11-19 17:20:06 +00:00
# define PSEUDOKEY_EXIT 2504
# define PSEUDOKEY_MENU 2505
2018-06-10 23:58:31 +00:00
# ifndef CAP_PNG
# define CAP_PNG (!ISMOBWEB)
# endif
# ifndef CAP_ORIENTATION
2020-05-03 18:56:41 +00:00
# define CAP_ORIENTATION (ISMOBILE || ISWEB)
2018-06-10 23:58:31 +00:00
# endif
2019-06-28 07:47:10 +00:00
# ifndef CAP_MOUSEGRAB
# define CAP_MOUSEGRAB (!ISMOBILE)
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_COMMANDLINE
# define CAP_COMMANDLINE (!ISMOBILE)
# endif
# define CAP_SDLAUDIO (CAP_SDL && CAP_AUDIO)
# ifndef CAP_SVG
2019-02-17 17:50:56 +00:00
# define CAP_SVG (CAP_FILES && !ISMOBILE && !ISMINI)
2018-06-10 23:58:31 +00:00
# endif
2020-04-15 09:49:29 +00:00
# ifndef CAP_WRL
2020-04-16 19:00:28 +00:00
# define CAP_WRL (CAP_FILES && !ISMOBILE && !ISMINI && !ISWEB)
2020-04-15 09:49:29 +00:00
# endif
2018-06-10 23:58:31 +00:00
# ifndef CAP_POLY
# define CAP_POLY (CAP_SDLGFX || CAP_GL || CAP_SVG)
# endif
2019-02-27 22:42:11 +00:00
# ifndef CAP_SHAPES
# define CAP_SHAPES 1
# endif
2018-06-10 23:58:31 +00:00
# define CAP_QUEUE CAP_POLY
# define CAP_CURVE CAP_POLY
# ifndef CAP_SDLJOY
# define CAP_SDLJOY (CAP_SDL && !ISWEB)
# endif
# ifndef CAP_SDL_IMG
# define CAP_SDL_IMG 0
# endif
# ifndef CAP_SDLTTF
# define CAP_SDLTTF (CAP_SDL && !ISMOBILE && !ISWEB)
# endif
# define CAP_GLFONT (CAP_GL && !ISMOBILE)
# ifndef CAP_TABFONT
# define CAP_TABFONT (ISWEB)
# endif
# ifndef CAP_CREATEFONT
# define CAP_CREATEFONT 0
# endif
# ifndef CAP_FIXEDSIZE
# define CAP_FIXEDSIZE (CAP_CREATEFONT || CAP_TABFONT ? 36 : 0)
# endif
# ifndef CAP_SHMUP
2020-10-11 23:28:50 +00:00
# define CAP_SHMUP (!ISWEB)
2018-06-10 23:58:31 +00:00
# endif
# ifndef CAP_BITFIELD
# define CAP_BITFIELD (!ISWEB)
# endif
# ifndef CAP_ACHIEVE
2019-02-08 23:18:56 +00:00
# define CAP_ACHIEVE ISSTEAM
2018-06-10 23:58:31 +00:00
# endif
# ifndef CAP_SHMUP_GOOD
# define CAP_SHMUP_GOOD (!ISMOBWEB)
# endif
2018-10-25 00:43:14 +00:00
# ifndef CAP_COMPLEX2
2019-02-17 17:59:08 +00:00
# define CAP_COMPLEX2 (!ISMINI)
2018-10-25 00:43:14 +00:00
# endif
2018-11-17 18:30:50 +00:00
# ifndef CAP_RACING
2019-02-17 17:59:08 +00:00
# define CAP_RACING (!ISMOBWEB && !ISMINI)
2018-11-17 18:30:50 +00:00
# endif
2020-11-19 17:20:06 +00:00
# ifndef CAP_VR
2020-11-22 16:41:30 +00:00
# define CAP_VR (ISSTEAM && !ISMAC)
2020-11-19 17:20:06 +00:00
# endif
2019-04-29 11:48:09 +00:00
# ifndef CAP_LEGACY
# define CAP_LEGACY 0
# endif
2018-06-10 23:58:31 +00:00
# if ISMOBILE
2019-01-24 13:52:11 +00:00
# define EXTRALICENSE "\n\nHyperRogue soundtrack under the Creative Commons BY-SA 3.0 license, http: //creativecommons.org/licenses/by-sa/3.0/\nCrossroads, Graveyard, Land of Eternal Motion, Hall of Mirrors, Hell, R'Lyeh, Living Caves, Jungle, Desert, Icy Lands by Shawn Parrotte (http://www.shawnparrotte.com)\nCaribbean, Ivory Tower, Ocean, Palace by Will Savino (http://www.willsavino.net/)\n\n\n";
2018-06-10 23:58:31 +00:00
# undef XEXTRALICENSE
# endif
# ifndef HYPERPATH
# define HYPERPATH ""
# endif
2018-06-27 10:12:48 +00:00
# if ISWINDOWS
# define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h>
# define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h>
2018-07-07 17:24:11 +00:00
# define NOMINMAX // avoid "min" and "max" macros in <windows.h>
2018-06-27 10:12:48 +00:00
# endif
2018-06-10 23:58:31 +00:00
# include <stdio.h>
# if CAP_SDL
# include <SDL/SDL.h>
# if !ISMAC
# undef main
# endif
# if CAP_SDLAUDIO
# include <SDL/SDL_mixer.h>
# endif
# if CAP_SDLTTF
# include <SDL/SDL_ttf.h>
# endif
# if CAP_SDLGFX
# include <SDL/SDL_gfxPrimitives.h>
# endif
# elif !ISFAKEMOBILE
# define SDLK_F1 (123001)
# define SDLK_F2 (123002)
# define SDLK_F3 (123003)
# define SDLK_F4 (123004)
# define SDLK_F5 (123005)
# define SDLK_F6 (123006)
# define SDLK_F7 (123007)
# define SDLK_F8 (123008)
# define SDLK_F9 (123009)
# define SDLK_F10 (123010)
# define SDLK_ESCAPE (123099)
# define SDLK_F12 (123012)
# define SDLK_HOME (123013)
# define SDLK_LEFT (123014)
# define SDLK_RIGHT (123015)
# define SDLK_END (123016)
# define MIX_MAX_VOLUME 128
# define SDLK_UP (123021)
# define SDLK_DOWN (123022)
# define SDLK_PAGEUP (123023)
# define SDLK_PAGEDOWN (123024)
# define SDLK_RETURN (123025)
# define SDLK_KP1 (123031)
# define SDLK_KP2 (123032)
# define SDLK_KP3 (123033)
# define SDLK_KP4 (123034)
# define SDLK_KP5 (123035)
# define SDLK_KP6 (123036)
# define SDLK_KP7 (123037)
# define SDLK_KP8 (123038)
# define SDLK_KP9 (123039)
# define SDLK_KP_PERIOD (123051)
# define SDLK_KP_MINUS (123053)
# define SDLK_DELETE (123052)
# define SDLK_DELETE (123052)
# define SDLK_KP_ENTER (123054)
# define SDLK_BACKSPACE (123055)
2018-12-15 14:17:06 +00:00
# define FAKE_SDL
2018-06-10 23:58:31 +00:00
typedef int SDL_Event ;
typedef unsigned int Uint32 ;
# endif
# if ISWEB
extern " C " {
Uint8 * SDL_GetKeyState ( void * ) ;
}
// inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
# endif
# ifndef CAP_GLEW
# define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX && !ISWEB)
# endif
2020-10-11 23:28:50 +00:00
# if ISWEB
# define GLES_ONLY
# endif
2020-07-03 12:42:33 +00:00
# if CAP_GL
2018-06-10 23:58:31 +00:00
# if CAP_GLEW
# include <GL/glew.h>
# else
# define GL_GLEXT_PROTOTYPES 1
# if ISMAC
2020-02-16 15:10:50 +00:00
# define GL_SILENCE_DEPRECATION 1
2018-06-10 23:58:31 +00:00
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# include <OpenGL/glext.h>
# elif ISIOS
// already included
# elif ISANDROID
# include <GLES/gl.h>
# include <GLES/glext.h>
# include <GLES2/gl2.h>
# include <GLES3/gl3.h>
# define GLES_ONLY
# else
# include <GL/gl.h>
# include <GL/glu.h>
# include <GL/glext.h>
# endif
# endif
2020-07-03 12:42:33 +00:00
# else
typedef int GLint ;
typedef unsigned GLuint ;
# endif
2018-06-10 23:58:31 +00:00
# include <functional>
# include <memory>
# include <cmath>
# include <time.h>
# include <vector>
# include <algorithm>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <string>
2020-04-19 12:00:15 +00:00
# include <cassert>
2018-06-10 23:58:31 +00:00
# include <map>
# include <queue>
2020-03-23 18:45:59 +00:00
# include <sstream>
2018-06-10 23:58:31 +00:00
# include <stdexcept>
# include <array>
# include <set>
# include <random>
2018-06-12 21:10:20 +00:00
# include <complex>
2019-06-13 17:19:15 +00:00
# include <new>
2020-05-31 15:31:16 +00:00
# include <limits.h>
2018-06-10 23:58:31 +00:00
2020-11-19 17:20:06 +00:00
# if CAP_VR
2020-11-22 16:41:30 +00:00
# ifdef __MINGW32__
# include "openvr_mingw.hpp"
# else
2020-11-19 17:20:06 +00:00
# include "openvr.h"
# endif
2020-11-22 16:41:30 +00:00
# endif
2020-11-19 17:20:06 +00:00
2020-05-22 12:30:45 +00:00
# if CAP_VIDEO
# include <sys/wait.h>
# endif
2020-02-15 13:10:49 +00:00
# if CAP_ZLIB
2020-01-25 23:30:13 +00:00
# include <zlib.h>
2020-02-15 13:10:49 +00:00
# endif
2020-01-25 23:30:13 +00:00
2020-10-11 23:28:50 +00:00
# if ISWEB
# include <emscripten.h>
# include <emscripten/html5.h>
# endif
2020-07-04 22:53:02 +00:00
# if CAP_GMP
# include <gmpxx.h>
# endif
2020-01-16 15:39:18 +00:00
# if CAP_THREAD
2020-03-08 10:57:51 +00:00
# if OLD_MINGW
2020-01-16 17:11:59 +00:00
# include "mingw.thread.h"
# include "mingw.mutex.h"
2020-01-28 15:10:35 +00:00
# include "mingw.condition_variable.h"
2020-01-16 17:11:59 +00:00
# else
2020-01-16 15:39:18 +00:00
# include <thread>
# include <mutex>
2020-01-28 15:10:35 +00:00
# include <condition_variable>
2020-01-16 15:39:18 +00:00
# endif
2020-01-16 17:11:59 +00:00
# endif
2020-01-16 15:39:18 +00:00
2018-06-12 21:10:20 +00:00
# include <stdint.h>
# if ISWINDOWS
# include "direntx.h"
# else
# include <dirent.h>
# endif
# if CAP_TEXTURE
# if CAP_SDL_IMG
# include <SDL/SDL_image.h>
# elif CAP_PNG
# include <png.h>
# endif
# endif
2019-02-27 22:42:11 +00:00
# if CAP_FILES
2018-06-12 21:10:20 +00:00
# include <unistd.h>
# include <sys/types.h>
2018-11-24 20:24:27 +00:00
# include <sys/stat.h>
2018-06-12 21:10:20 +00:00
# endif
# if CAP_TIMEOFDAY
# include <sys/time.h>
# endif
# ifdef BACKTRACE
# include <execinfo.h>
# endif
2018-06-10 23:58:31 +00:00
# if CAP_SDL
union SDL_Event ;
# endif
2018-06-27 10:12:48 +00:00
# if ISWINDOWS
# undef hyper // avoid "hyper" typedef in <_mingw.h>
# endif
2018-09-04 21:27:27 +00:00
# ifndef MINIMIZE_GL_CALLS
# ifdef EMSCRIPTEN
# define MINIMIZE_GL_CALLS 1
# else
# define MINIMIZE_GL_CALLS 0
# endif
# endif
2019-02-17 17:28:20 +00:00
# ifndef CAP_GEOMETRY
# define CAP_GEOMETRY (!(ISMINI))
# endif
# ifndef CAP_IRR
# define CAP_IRR CAP_GEOMETRY
# endif
# ifndef CAP_GP
# define CAP_GP CAP_GEOMETRY
# endif
# ifndef CAP_ARCM
# define CAP_ARCM CAP_GEOMETRY
# endif
# ifndef CAP_CRYSTAL
# define CAP_CRYSTAL CAP_GEOMETRY
# endif
2019-08-09 23:07:39 +00:00
# ifndef CAP_HISTORY
# define CAP_HISTORY 1
# endif
2019-02-17 17:28:20 +00:00
# ifndef CAP_BT
# define CAP_BT CAP_GEOMETRY
# endif
2019-02-17 17:43:39 +00:00
# ifndef CAP_STARTANIM
# define CAP_STARTANIM (!(ISMINI))
# endif
2019-09-13 15:45:31 +00:00
# ifndef CAP_SOLV
# define CAP_SOLV (MAXMDIM >= 4 && !ISWEB)
# endif
2019-02-17 17:33:15 +00:00
# ifndef CAP_FIELD
# define CAP_FIELD (!(ISMINI))
# endif
2019-03-11 17:50:03 +00:00
2020-03-21 09:49:07 +00:00
# ifndef CAP_RAY
2020-10-15 14:37:43 +00:00
# define CAP_RAY (MAXMDIM >= 4 && CAP_GL)
2020-03-21 09:49:07 +00:00
# endif
2019-06-28 07:48:34 +00:00
# ifndef CAP_MEMORY_RESERVE
2019-07-12 21:19:22 +00:00
# define CAP_MEMORY_RESERVE (!ISMOBILE && !ISWEB)
2019-06-28 07:48:34 +00:00
# endif
2019-03-11 17:50:03 +00:00
# undef TRANSPARENT