Refactor all #define SUPPORT_* into a config.h
That way, a user needs only to touch a single file to configure what features raylib is built with. Include guards are left out intentionally, because config.h should only be included in source files, not headers. Later on, config.h can also define the raylib version (#461).
This commit is contained in:
parent
d88523f03a
commit
1841afad11
12
src/audio.c
12
src/audio.c
@ -11,7 +11,7 @@
|
||||
* - Manage raw audio context
|
||||
*
|
||||
* CONFIGURATION:
|
||||
*
|
||||
*
|
||||
* #define AUDIO_STANDALONE
|
||||
* Define to use the module as standalone library (independently of raylib).
|
||||
* Required types and functions are defined in the same module.
|
||||
@ -24,7 +24,7 @@
|
||||
* #define SUPPORT_FILEFORMAT_XM
|
||||
* #define SUPPORT_FILEFORMAT_MOD
|
||||
* #define SUPPORT_FILEFORMAT_FLAC
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* supported by default, to remove support, just comment unrequired #define in this module
|
||||
*
|
||||
* LIMITATIONS (only OpenAL Soft):
|
||||
@ -72,13 +72,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default configuration flags (supported features)
|
||||
//-------------------------------------------------
|
||||
#define SUPPORT_FILEFORMAT_WAV
|
||||
#define SUPPORT_FILEFORMAT_OGG
|
||||
#define SUPPORT_FILEFORMAT_XM
|
||||
#define SUPPORT_FILEFORMAT_MOD
|
||||
//-------------------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(USE_OPENAL_BACKEND)
|
||||
#define USE_MINI_AL 1 // Set to 1 to use mini_al; 0 to use OpenAL.
|
||||
|
74
src/config.h
Normal file
74
src/config.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* Edit to control what features raylib is compiled with. */
|
||||
|
||||
// text.c
|
||||
/* Default font is loaded on window initialization to be available for the user to render simple text. NOTE: If enabled, uses external module functions to load default raylib font (module: text) */
|
||||
#define SUPPORT_DEFAULT_FONT 1
|
||||
/* Selected desired fileformats to be supported for loading. */
|
||||
#define SUPPORT_FILEFORMAT_FNT 1
|
||||
#define SUPPORT_FILEFORMAT_TTF 1
|
||||
|
||||
// textures.c
|
||||
/* Selecte desired fileformats to be supported for image data loading. */
|
||||
#define SUPPORT_FILEFORMAT_PNG 1
|
||||
#define SUPPORT_FILEFORMAT_DDS 1
|
||||
#define SUPPORT_FILEFORMAT_HDR 1
|
||||
#define SUPPORT_FILEFORMAT_KTX 1
|
||||
#define SUPPORT_FILEFORMAT_ASTC 1
|
||||
/* #undef SUPPORT_FILEFORMAT_BMP */
|
||||
/* #undef SUPPORT_FILEFORMAT_TGA */
|
||||
/* #undef SUPPORT_FILEFORMAT_JPG */
|
||||
/* #undef SUPPORT_FILEFORMAT_GIF */
|
||||
/* #undef SUPPORT_FILEFORMAT_PSD */
|
||||
/* #undef SUPPORT_FILEFORMAT_PKM */
|
||||
/* #undef SUPPORT_FILEFORMAT_PVR */
|
||||
|
||||
/* Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT() */
|
||||
#define SUPPORT_IMAGE_MANIPULATION 1
|
||||
|
||||
/* Support proedural image generation functionality (gradient, spot, perlin-noise, cellular) */
|
||||
#define SUPPORT_IMAGE_GENERATION 1
|
||||
|
||||
// rlgl.c
|
||||
/* Support VR simulation functionality (stereo rendering) */
|
||||
#define SUPPORT_VR_SIMULATOR 1
|
||||
/* Include stereo rendering distortion shader (shader_distortion.h) */
|
||||
#define SUPPORT_DISTORTION_SHADER 1
|
||||
|
||||
// core.c
|
||||
/* Camera module is included (camera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital */
|
||||
#define SUPPORT_CAMERA_SYSTEM 1
|
||||
/* Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag */
|
||||
#define SUPPORT_GESTURES_SYSTEM 1
|
||||
/* Mouse gestures are directly mapped like touches and processed by gestures system. */
|
||||
#define SUPPORT_MOUSE_GESTURES 1
|
||||
/* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used */
|
||||
#define SUPPORT_BUSY_WAIT_LOOP 1
|
||||
/* Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() */
|
||||
#define SUPPORT_GIF_RECORDING 1
|
||||
|
||||
// audio.c
|
||||
/* Desired fileformats to be supported for loading. */
|
||||
#define SUPPORT_FILEFORMAT_WAV 1
|
||||
#define SUPPORT_FILEFORMAT_OGG 1
|
||||
#define SUPPORT_FILEFORMAT_XM 1
|
||||
#define SUPPORT_FILEFORMAT_MOD 1
|
||||
/* #undef SUPPORT_FILEFORMAT_FLAC */
|
||||
|
||||
// models.c
|
||||
/* Selected desired fileformats to be supported for loading. */
|
||||
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||
#define SUPPORT_FILEFORMAT_MTL 1
|
||||
|
||||
/* Support procedural mesh generation functions, uses external par_shapes.h library
|
||||
* NOTE: Some generated meshes DO NOT include generated texture coordinates
|
||||
*/
|
||||
#define SUPPORT_MESH_GENERATION 1
|
||||
|
||||
// utils.c
|
||||
/* Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown */
|
||||
#define SUPPORT_TRACELOG 1
|
||||
|
||||
/* Support saving image data as PNG fileformat. NOTE: Requires stb_image_write library */
|
||||
#define SUPPORT_SAVE_PNG 1
|
||||
/* Support saving image data as PMP fileformat. NOTE: Requires stb_image_write library */
|
||||
/* #undef SUPPORT_SAVE_BMP */
|
12
src/core.c
12
src/core.c
@ -48,7 +48,7 @@
|
||||
* Mouse gestures are directly mapped like touches and processed by gestures system.
|
||||
*
|
||||
* #define SUPPORT_BUSY_WAIT_LOOP
|
||||
* Use busy wait loop for timming sync, if not defined, a high-resolution timer is setup and used
|
||||
* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
|
||||
*
|
||||
* #define SUPPORT_GIF_RECORDING
|
||||
* Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
|
||||
@ -81,15 +81,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default configuration flags (supported features)
|
||||
//-------------------------------------------------
|
||||
#define SUPPORT_DEFAULT_FONT
|
||||
#define SUPPORT_MOUSE_GESTURES
|
||||
#define SUPPORT_CAMERA_SYSTEM
|
||||
#define SUPPORT_GESTURES_SYSTEM
|
||||
#define SUPPORT_BUSY_WAIT_LOOP
|
||||
#define SUPPORT_GIF_RECORDING
|
||||
//-------------------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
|
@ -36,12 +36,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default configuration flags (supported features)
|
||||
//-------------------------------------------------
|
||||
#define SUPPORT_FILEFORMAT_OBJ
|
||||
#define SUPPORT_FILEFORMAT_MTL
|
||||
#define SUPPORT_MESH_GENERATION
|
||||
//-------------------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
|
@ -54,11 +54,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default configuration flags (supported features)
|
||||
//-------------------------------------------------
|
||||
#define SUPPORT_VR_SIMULATOR
|
||||
#define SUPPORT_DISTORTION_SHADER
|
||||
//-------------------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#include "rlgl.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* #define RLGL_STANDALONE
|
||||
* Use rlgl as standalone library (no raylib dependency)
|
||||
*
|
||||
* #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING
|
||||
* #define SUPPORT_VR_SIMULATOR
|
||||
* Support VR simulation functionality (stereo rendering)
|
||||
*
|
||||
* #define SUPPORT_DISTORTION_SHADER
|
||||
@ -496,4 +496,4 @@ void TraceLog(int msgType, const char *text, ...); // Show trace log messag
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RLGL_H
|
||||
#endif // RLGL_H
|
||||
|
@ -4,12 +4,6 @@
|
||||
*
|
||||
* CONFIGURATION:
|
||||
*
|
||||
* #define SUPPORT_QUADS_ONLY
|
||||
* Draw shapes using only QUADS, vertex are accumulated in QUADS arrays (like textures)
|
||||
*
|
||||
* #define SUPPORT_TRIANGLES_ONLY
|
||||
* Draw shapes using only TRIANGLES, vertex are accumulated in TRIANGLES arrays
|
||||
*
|
||||
* #define USE_DEFAULT_FONT_TEXTURE
|
||||
* Draw rectangle shapes using font texture white character instead of default white texture
|
||||
* Allows drawing rectangles and text with a single draw call, very useful for GUI systems!
|
||||
@ -36,7 +30,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#define USE_DEFAULT_FONT_TEXTURE
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_FNT
|
||||
* #define SUPPORT_FILEFORMAT_TTF
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* supported by default, to remove support, just comment unrequired #define in this module
|
||||
*
|
||||
* #define SUPPORT_DEFAULT_FONT
|
||||
@ -36,12 +36,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default supported features
|
||||
//-------------------------------------
|
||||
#define SUPPORT_DEFAULT_FONT
|
||||
#define SUPPORT_FILEFORMAT_FNT
|
||||
#define SUPPORT_FILEFORMAT_TTF
|
||||
//-------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
|
@ -52,17 +52,7 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
// Default configuration flags (supported features)
|
||||
//-------------------------------------------------
|
||||
#define SUPPORT_FILEFORMAT_PNG
|
||||
#define SUPPORT_FILEFORMAT_DDS
|
||||
#define SUPPORT_FILEFORMAT_HDR
|
||||
#define SUPPORT_FILEFORMAT_KTX
|
||||
#define SUPPORT_FILEFORMAT_ASTC
|
||||
#define SUPPORT_IMAGE_MANIPULATION
|
||||
#define SUPPORT_IMAGE_GENERATION
|
||||
//-------------------------------------------------
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#define SUPPORT_TRACELOG // Output tracelog messages
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h" // WARNING: Required for: LogType enum
|
||||
#include "utils.h"
|
||||
|
@ -32,7 +32,9 @@
|
||||
#include <android/asset_manager.h> // Required for: AAssetManager
|
||||
#endif
|
||||
|
||||
#define SUPPORT_SAVE_PNG
|
||||
#ifndef SUPPORT_SAVE_PNG
|
||||
#define SUPPORT_SAVE_PNG 1
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Some basic Defines
|
||||
@ -74,4 +76,4 @@ FILE *android_fopen(const char *fileName, const char *mode); // Replacement f
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // UTILS_H
|
||||
#endif // UTILS_H
|
||||
|
Loading…
Reference in New Issue
Block a user