Make all the defines in config.h be override-able by the build system

This commit is contained in:
Jeffery Myers 2024-11-29 12:07:43 -08:00
parent 58fe34d9cc
commit f25c35648c
17 changed files with 645 additions and 349 deletions

View File

@ -61,7 +61,7 @@ void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float rou
const Vector2 centers[4] = { point[8], point[9], point[10], point[11] }; const Vector2 centers[4] = { point[8], point[9], point[10], point[11] };
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f }; const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f };
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();

View File

@ -32,52 +32,107 @@
// Module selection - Some modules could be avoided // Module selection - Some modules could be avoided
// Mandatory modules: rcore, rlgl, utils // Mandatory modules: rcore, rlgl, utils
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef SUPPORT_MODULE_RSHAPES
#define SUPPORT_MODULE_RSHAPES 1 #define SUPPORT_MODULE_RSHAPES 1
#endif
#ifndef SUPPORT_MODULE_RTEXTURES
#define SUPPORT_MODULE_RTEXTURES 1 #define SUPPORT_MODULE_RTEXTURES 1
#endif
#ifndef SUPPORT_MODULE_RTEXT
#define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures #define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures
#endif
#ifndef SUPPORT_MODULE_RMODELS
#define SUPPORT_MODULE_RMODELS 1 #define SUPPORT_MODULE_RMODELS 1
#endif
#ifndef SUPPORT_MODULE_RAUDIO
#define SUPPORT_MODULE_RAUDIO 1 #define SUPPORT_MODULE_RAUDIO 1
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rcore - Configuration Flags // Module: rcore - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Camera module is included (rcamera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital // Camera module is included (rcamera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital
#ifndef SUPPORT_CAMERA_SYSTEM
#define SUPPORT_CAMERA_SYSTEM 1 #define SUPPORT_CAMERA_SYSTEM 1
#endif
// Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag // Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag
#ifndef SUPPORT_GESTURES_SYSTEM
#define SUPPORT_GESTURES_SYSTEM 1 #define SUPPORT_GESTURES_SYSTEM 1
#endif
// Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64 // Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64
#ifndef SUPPORT_RPRAND_GENERATOR
#define SUPPORT_RPRAND_GENERATOR 1 #define SUPPORT_RPRAND_GENERATOR 1
#endif
// Mouse gestures are directly mapped like touches and processed by gestures system // Mouse gestures are directly mapped like touches and processed by gestures system
#ifndef SUPPORT_MOUSE_GESTURES
#define SUPPORT_MOUSE_GESTURES 1 #define SUPPORT_MOUSE_GESTURES 1
#endif
// Reconfigure standard input to receive key inputs, works with SSH connection. // Reconfigure standard input to receive key inputs, works with SSH connection.
#ifndef SUPPORT_SSH_KEYBOARD_RPI
#define SUPPORT_SSH_KEYBOARD_RPI 1 #define SUPPORT_SSH_KEYBOARD_RPI 1
#endif
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions. // Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often. // However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
#ifndef SUPPORT_WINMM_HIGHRES_TIMER
#define SUPPORT_WINMM_HIGHRES_TIMER 1 #define SUPPORT_WINMM_HIGHRES_TIMER 1
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used #endif
//#define SUPPORT_BUSY_WAIT_LOOP 1
// Use busy wait loop for timing sync, if 0, a high-resolution timer is set up and used (Default off)
#ifndef SUPPORT_BUSY_WAIT_LOOP
#define SUPPORT_BUSY_WAIT_LOOP 0
#endif
// Use a partial-busy wait loop, in this case frame sleeps for most of the time, but then runs a busy loop at the end for accuracy // Use a partial-busy wait loop, in this case frame sleeps for most of the time, but then runs a busy loop at the end for accuracy
#ifndef SUPPORT_PARTIALBUSY_WAIT_LOOP
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 1 #define SUPPORT_PARTIALBUSY_WAIT_LOOP 1
#endif
// Allow automatic screen capture of current screen pressing F12, defined in KeyCallback() // Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
#ifndef SUPPORT_SCREEN_CAPTURE
#define SUPPORT_SCREEN_CAPTURE 1 #define SUPPORT_SCREEN_CAPTURE 1
#endif
// Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback() // Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
#ifndef SUPPORT_GIF_RECORDING
#define SUPPORT_GIF_RECORDING 1 #define SUPPORT_GIF_RECORDING 1
#endif
// Support CompressData() and DecompressData() functions // Support CompressData() and DecompressData() functions
#ifndef SUPPORT_COMPRESSION_API
#define SUPPORT_COMPRESSION_API 1 #define SUPPORT_COMPRESSION_API 1
#endif
// Support automatic generated events, loading and recording of those events when required // Support automatic generated events, loading and recording of those events when required
#ifndef SUPPORT_AUTOMATION_EVENTS
#define SUPPORT_AUTOMATION_EVENTS 1 #define SUPPORT_AUTOMATION_EVENTS 1
// Support custom frame control, only for advanced users #endif
// Support custom frame control, only for advanced users (Default off)
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents() // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
// Enabling this flag allows manual control of the frame processes, use at your own risk // Enabling this flag allows manual control of the frame processes, use at your own risk
//#define SUPPORT_CUSTOM_FRAME_CONTROL 1 #ifndef SUPPORT_CUSTOM_FRAME_CONTROL
#define SUPPORT_CUSTOM_FRAME_CONTROL 0
#endif
// Support for clipboard image loading // Support for clipboard image loading
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows) // NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
#ifndef SUPPORT_CLIPBOARD_IMAGE
#define SUPPORT_CLIPBOARD_IMAGE 1 #define SUPPORT_CLIPBOARD_IMAGE 1
#endif
// NOTE: Clipboard image loading requires support for some image file formats // NOTE: Clipboard image loading requires support for some image file formats
// TODO: Those defines should probably be removed from here, I prefer to let the user manage them // TODO: Those defines should probably be removed from here, I prefer to let the user manage them
#if defined(SUPPORT_CLIPBOARD_IMAGE)
#if SUPPORT_CLIPBOARD_IMAGE
#ifndef SUPPORT_MODULE_RTEXTURES #ifndef SUPPORT_MODULE_RTEXTURES
#define SUPPORT_MODULE_RTEXTURES 1 #define SUPPORT_MODULE_RTEXTURES 1
#endif #endif
@ -95,25 +150,59 @@
#endif #endif
#endif #endif
// rcore: Configuration values // rcore: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef MAX_FILEPATH_CAPACITY
#define MAX_FILEPATH_CAPACITY 8192 // Maximum file paths capacity #define MAX_FILEPATH_CAPACITY 8192 // Maximum file paths capacity
#endif
#ifndef MAX_FILEPATH_LENGTH
#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value) #define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
#endif
#ifndef MAX_KEYBOARD_KEYS
#define MAX_KEYBOARD_KEYS 512 // Maximum number of keyboard keys supported #define MAX_KEYBOARD_KEYS 512 // Maximum number of keyboard keys supported
#endif
#ifndef MAX_MOUSE_BUTTONS
#define MAX_MOUSE_BUTTONS 8 // Maximum number of mouse buttons supported #define MAX_MOUSE_BUTTONS 8 // Maximum number of mouse buttons supported
#endif
#ifndef MAX_GAMEPADS
#define MAX_GAMEPADS 4 // Maximum number of gamepads supported #define MAX_GAMEPADS 4 // Maximum number of gamepads supported
#endif
#ifndef MAX_GAMEPAD_AXIS
#define MAX_GAMEPAD_AXIS 8 // Maximum number of axis supported (per gamepad) #define MAX_GAMEPAD_AXIS 8 // Maximum number of axis supported (per gamepad)
#endif
#ifndef MAX_GAMEPAD_BUTTONS
#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad) #define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
#endif
#ifndef MAX_GAMEPAD_VIBRATION_TIME
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds #define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds
#endif
#ifndef MAX_TOUCH_POINTS
#define MAX_TOUCH_POINTS 8 // Maximum number of touch points supported #define MAX_TOUCH_POINTS 8 // Maximum number of touch points supported
#endif
#ifndef MAX_KEY_PRESSED_QUEUE
#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue #define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
#endif
#ifndef MAX_CHAR_PRESSED_QUEUE
#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue #define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
#endif
#ifndef MAX_DECOMPRESSION_SIZE
#define MAX_DECOMPRESSION_SIZE 64 // Max size allocated for decompression in MB #define MAX_DECOMPRESSION_SIZE 64 // Max size allocated for decompression in MB
#endif
#ifndef MAX_AUTOMATION_EVENTS
#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record #define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rlgl - Configuration values // Module: rlgl - Configuration values
@ -125,31 +214,75 @@
// Show OpenGL extensions and capabilities detailed logs on init // Show OpenGL extensions and capabilities detailed logs on init
//#define RLGL_SHOW_GL_DETAILS_INFO 1 //#define RLGL_SHOW_GL_DETAILS_INFO 1
#ifndef RL_SUPPORT_MESH_GPU_SKINNING
#define RL_SUPPORT_MESH_GPU_SKINNING 1 // GPU skinning, comment if your GPU does not support more than 8 VBOs #define RL_SUPPORT_MESH_GPU_SKINNING 1 // GPU skinning, comment if your GPU does not support more than 8 VBOs
#endif
//#define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 4096 // Default internal render batch elements limits #ifndef RL_DEFAULT_BATCH_BUFFERS
#define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
#endif
#ifndef RL_DEFAULT_BATCH_DRAWCALLS
#define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
#endif
#ifndef RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS
#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
#endif
#ifndef RL_MAX_MATRIX_STACK_SIZE
#define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
#endif
#ifndef RL_MAX_SHADER_LOCATIONS
#define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
#endif
#ifndef RL_CULL_DISTANCE_NEAR
#define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance
#endif
#ifndef RL_CULL_DISTANCE_FAR
#define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
#endif
// Default shader vertex attribute locations // Default shader vertex attribute locations
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
#if defined(RL_SUPPORT_MESH_GPU_SKINNING) #endif
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8 #if RL_SUPPORT_MESH_GPU_SKINNING
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
#endif
#endif #endif
// Default shader vertex attribute names to set location points // Default shader vertex attribute names to set location points
@ -161,140 +294,303 @@
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix #endif
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rshapes - Configuration Flags // Module: rshapes - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Use QUADS instead of TRIANGLES for drawing when possible // Use QUADS instead of TRIANGLES for drawing when possible
// Some lines-based shapes could still use lines // Some lines-based shapes could still use lines
#ifndef SUPPORT_QUADS_DRAW_MODE
#define SUPPORT_QUADS_DRAW_MODE 1 #define SUPPORT_QUADS_DRAW_MODE 1
#endif
// rshapes: Configuration values // rshapes: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef SPLINE_SEGMENT_DIVISIONS
#define SPLINE_SEGMENT_DIVISIONS 24 // Spline segments subdivisions #define SPLINE_SEGMENT_DIVISIONS 24 // Spline segments subdivisions
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rtextures - Configuration Flags // Module: rtextures - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Selecte desired fileformats to be supported for image data loading // Select desired fileformats to be supported for image data loading
#ifndef SUPPORT_FILEFORMAT_PNG
#define SUPPORT_FILEFORMAT_PNG 1 #define SUPPORT_FILEFORMAT_PNG 1
//#define SUPPORT_FILEFORMAT_BMP 1 #endif
//#define SUPPORT_FILEFORMAT_TGA 1
//#define SUPPORT_FILEFORMAT_JPG 1 #ifndef SUPPORT_FILEFORMAT_BMP
#define SUPPORT_FILEFORMAT_BMP 0
#endif
#ifndef SUPPORT_FILEFORMAT_TGA
#define SUPPORT_FILEFORMAT_TGA 0
#endif
#ifndef SUPPORT_FILEFORMAT_JPG
#define SUPPORT_FILEFORMAT_JPG 0
#endif
#ifndef SUPPORT_FILEFORMAT_GIF
#define SUPPORT_FILEFORMAT_GIF 1 #define SUPPORT_FILEFORMAT_GIF 1
#endif
#ifndef SUPPORT_FILEFORMAT_QOI
#define SUPPORT_FILEFORMAT_QOI 1 #define SUPPORT_FILEFORMAT_QOI 1
//#define SUPPORT_FILEFORMAT_PSD 1 #endif
#ifndef SUPPORT_FILEFORMAT_PSD
#define SUPPORT_FILEFORMAT_PSD 0
#endif
#ifndef SUPPORT_FILEFORMAT_DDS
#define SUPPORT_FILEFORMAT_DDS 1 #define SUPPORT_FILEFORMAT_DDS 1
//#define SUPPORT_FILEFORMAT_HDR 1 #endif
//#define SUPPORT_FILEFORMAT_PIC 1
//#define SUPPORT_FILEFORMAT_KTX 1 #ifndef SUPPORT_FILEFORMAT_HDR
//#define SUPPORT_FILEFORMAT_ASTC 1 #define SUPPORT_FILEFORMAT_HDR 0
//#define SUPPORT_FILEFORMAT_PKM 1 #endif
//#define SUPPORT_FILEFORMAT_PVR 1
#ifndef SUPPORT_FILEFORMAT_PIC
#define SUPPORT_FILEFORMAT_PIC 0
#endif
#ifndef SUPPORT_FILEFORMAT_KTX
#define SUPPORT_FILEFORMAT_KTX 0
#endif
#ifndef SUPPORT_FILEFORMAT_ASTC
#define SUPPORT_FILEFORMAT_ASTC 0
#endif
#ifndef SUPPORT_FILEFORMAT_PNM
#define SUPPORT_FILEFORMAT_PNM 0
#endif
#ifndef SUPPORT_FILEFORMAT_PVR
#define SUPPORT_FILEFORMAT_PVR 0
#endif
// Support image export functionality (.png, .bmp, .tga, .jpg, .qoi) // Support image export functionality (.png, .bmp, .tga, .jpg, .qoi)
#ifndef SUPPORT_IMAGE_EXPORT
#define SUPPORT_IMAGE_EXPORT 1 #define SUPPORT_IMAGE_EXPORT 1
#endif
// Support procedural image generation functionality (gradient, spot, perlin-noise, cellular) // Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)
#ifndef SUPPORT_IMAGE_GENERATION
#define SUPPORT_IMAGE_GENERATION 1 #define SUPPORT_IMAGE_GENERATION 1
#endif
// Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... // Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
// If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT() // If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT()
#ifndef SUPPORT_IMAGE_MANIPULATION
#define SUPPORT_IMAGE_MANIPULATION 1 #define SUPPORT_IMAGE_MANIPULATION 1
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rtext - Configuration Flags // Module: rtext - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Default font is loaded on window initialization to be available for the user to render simple text // 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 // NOTE: If enabled, uses external module functions to load default raylib font
#ifndef SUPPORT_DEFAULT_FONT
#define SUPPORT_DEFAULT_FONT 1 #define SUPPORT_DEFAULT_FONT 1
#endif
// Selected desired font fileformats to be supported for loading // Selected desired font fileformats to be supported for loading
#ifndef SUPPORT_FILEFORMAT_TTF
#define SUPPORT_FILEFORMAT_TTF 1 #define SUPPORT_FILEFORMAT_TTF 1
#endif
#ifndef SUPPORT_FILEFORMAT_FNT
#define SUPPORT_FILEFORMAT_FNT 1 #define SUPPORT_FILEFORMAT_FNT 1
//#define SUPPORT_FILEFORMAT_BDF 1 #endif
#ifndef SUPPORT_FILEFORMAT_BDF
#define SUPPORT_FILEFORMAT_BDF 0
#endif
// Support text management functions // Support text management functions
// If not defined, still some functions are supported: TextLength(), TextFormat() // If not defined, still some functions are supported: TextLength(), TextFormat()
#ifndef SUPPORT_TEXT_MANIPULATION
#define SUPPORT_TEXT_MANIPULATION 1 #define SUPPORT_TEXT_MANIPULATION 1
#endif
// On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle // On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle
// at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow // at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
// drawing text and shapes with a single draw call [SetShapesTexture()]. // drawing text and shapes with a single draw call [SetShapesTexture()].
#ifndef SUPPORT_FONT_ATLAS_WHITE_REC
#define SUPPORT_FONT_ATLAS_WHITE_REC 1 #define SUPPORT_FONT_ATLAS_WHITE_REC 1
#endif
// rtext: Configuration values // rtext: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions: // Size of internal static buffers used on some functions:
// TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit() // TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
#define MAX_TEXTSPLIT_COUNT 128 // Maximum number of substrings to split: TextSplit() #ifndef MAX_TEXT_BUFFER_LENGTH
#define MAX_TEXT_BUFFER_LENGTH 1024
#endif
// Maximum number of substrings to split: TextSplit()
#ifndef MAX_TEXTSPLIT_COUNT
#define MAX_TEXTSPLIT_COUNT 128
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rmodels - Configuration Flags // Module: rmodels - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Selected desired model fileformats to be supported for loading // Selected desired model fileformats to be supported for loading
#ifndef SUPPORT_FILEFORMAT_OBJ
#define SUPPORT_FILEFORMAT_OBJ 1 #define SUPPORT_FILEFORMAT_OBJ 1
#endif
#ifndef SUPPORT_FILEFORMAT_MTL
#define SUPPORT_FILEFORMAT_MTL 1 #define SUPPORT_FILEFORMAT_MTL 1
#endif
#ifndef SUPPORT_FILEFORMAT_IQM
#define SUPPORT_FILEFORMAT_IQM 1 #define SUPPORT_FILEFORMAT_IQM 1
#endif
#ifndef SUPPORT_FILEFORMAT_GLTF
#define SUPPORT_FILEFORMAT_GLTF 1 #define SUPPORT_FILEFORMAT_GLTF 1
#endif
#ifndef SUPPORT_FILEFORMAT_VOX
#define SUPPORT_FILEFORMAT_VOX 1 #define SUPPORT_FILEFORMAT_VOX 1
#endif
#ifndef SUPPORT_FILEFORMAT_M3D
#define SUPPORT_FILEFORMAT_M3D 1 #define SUPPORT_FILEFORMAT_M3D 1
#endif
// Support procedural mesh generation functions, uses external par_shapes.h library // Support procedural mesh generation functions, uses external par_shapes.h library
// NOTE: Some generated meshes DO NOT include generated texture coordinates // NOTE: Some generated meshes DO NOT include generated texture coordinates
#ifndef SUPPORT_MESH_GENERATION
#define SUPPORT_MESH_GENERATION 1 #define SUPPORT_MESH_GENERATION 1
#endif
// rmodels: Configuration values // rmodels: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef MAX_MATERIAL_MAPS
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported #define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
#endif
#ifdef RL_SUPPORT_MESH_GPU_SKINNING #ifndef MAX_MESH_VERTEX_BUFFERS
#if RL_SUPPORT_MESH_GPU_SKINNING
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh #define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
#else #else
#define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh #define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh
#endif #endif
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: raudio - Configuration Flags // Module: raudio - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Desired audio fileformats to be supported for loading // Desired audio fileformats to be supported for loading
#ifndef SUPPORT_FILEFORMAT_WAV
#define SUPPORT_FILEFORMAT_WAV 1 #define SUPPORT_FILEFORMAT_WAV 1
#endif
#ifndef SUPPORT_FILEFORMAT_OGG
#define SUPPORT_FILEFORMAT_OGG 1 #define SUPPORT_FILEFORMAT_OGG 1
#endif
#ifndef SUPPORT_FILEFORMAT_MP3
#define SUPPORT_FILEFORMAT_MP3 1 #define SUPPORT_FILEFORMAT_MP3 1
#endif
#ifndef SUPPORT_FILEFORMAT_QOA
#define SUPPORT_FILEFORMAT_QOA 1 #define SUPPORT_FILEFORMAT_QOA 1
//#define SUPPORT_FILEFORMAT_FLAC 1 #endif
#ifndef SUPPORT_FILEFORMAT_FLAC
#define SUPPORT_FILEFORMAT_FLAC 0
#endif
#ifndef SUPPORT_FILEFORMAT_XM
#define SUPPORT_FILEFORMAT_XM 1 #define SUPPORT_FILEFORMAT_XM 1
#endif
#ifndef SUPPORT_FILEFORMAT_MOD
#define SUPPORT_FILEFORMAT_MOD 1 #define SUPPORT_FILEFORMAT_MOD 1
#endif
// raudio: Configuration values // raudio: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef AUDIO_DEVICE_FORMAT
#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit) #define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo #endif
#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
#ifndef AUDIO_DEVICE_CHANNELS
#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
#endif
#ifndef AUDIO_DEVICE_SAMPLE_RATE
#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
#endif
#ifndef MAX_AUDIO_BUFFER_POOL_CHANNELS
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels #define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
#endif
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: utils - Configuration Flags // Module: utils - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Standard file io library (stdio.h) included // Standard file io library (stdio.h) included
#ifndef SUPPORT_STANDARD_FILEIO
#define SUPPORT_STANDARD_FILEIO 1 #define SUPPORT_STANDARD_FILEIO 1
#endif
// Show TRACELOG() output messages // Show TRACELOG() output messages
// NOTE: By default LOG_DEBUG traces not shown // NOTE: By default LOG_DEBUG traces not shown
#ifndef SUPPORT_TRACELOG
#define SUPPORT_TRACELOG 1 #define SUPPORT_TRACELOG 1
//#define SUPPORT_TRACELOG_DEBUG 1 #endif
#ifndef SUPPORT_TRACELOG_DEBUG
#define SUPPORT_TRACELOG_DEBUG 0
#endif
// utils: Configuration values // utils: Configuration values
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#ifndef MAX_TRACELOG_MSG_LENGTH
#define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message #define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
#endif
#endif // CONFIG_H #endif // CONFIG_H

View File

@ -653,7 +653,7 @@ const char *GetKeyName(int key)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -1007,11 +1007,11 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
// Initialize hi-res timer // Initialize hi-res timer
InitTimer(); InitTimer();
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_MODULE_RTEXT && SUPPORT_DEFAULT_FONT
// Load default font // Load default font
// WARNING: External function: Module required: rtext // WARNING: External function: Module required: rtext
LoadFontDefault(); LoadFontDefault();
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
// Set font white rectangle for shapes drawing, so shapes and text can be batched together // Set font white rectangle for shapes drawing, so shapes and text can be batched together
// WARNING: rshapes module is required, if not available, default internal white rectangle is used // WARNING: rshapes module is required, if not available, default internal white rectangle is used
Rectangle rec = GetFontDefault().recs[95]; Rectangle rec = GetFontDefault().recs[95];
@ -1027,7 +1027,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
} }
#endif #endif
#else #else
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
// Set default texture and rectangle to be used for shapes drawing // Set default texture and rectangle to be used for shapes drawing
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8 // NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
@ -1286,7 +1286,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
int32_t action = AMotionEvent_getAction(event); int32_t action = AMotionEvent_getAction(event);
unsigned int flags = action & AMOTION_EVENT_ACTION_MASK; unsigned int flags = action & AMOTION_EVENT_ACTION_MASK;
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };
gestureEvent.pointCount = CORE.Input.Touch.pointCount; gestureEvent.pointCount = CORE.Input.Touch.pointCount;

View File

@ -64,7 +64,7 @@
#define GLFW_NATIVE_INCLUDE_NONE // To avoid some symbols re-definition in windows.h #define GLFW_NATIVE_INCLUDE_NONE // To avoid some symbols re-definition in windows.h
#include "GLFW/glfw3native.h" #include "GLFW/glfw3native.h"
#if defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) #if SUPPORT_WINMM_HIGHRES_TIMER && !SUPPORT_BUSY_WAIT_LOOP
// NOTE: Those functions require linking with winmm library // NOTE: Those functions require linking with winmm library
//#pragma warning(disable: 4273) //#pragma warning(disable: 4273)
__declspec(dllimport) unsigned int __stdcall timeEndPeriod(unsigned int uPeriod); __declspec(dllimport) unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
@ -972,7 +972,7 @@ Image GetClipboardImage(void)
{ {
Image image = { 0 }; Image image = { 0 };
#if defined(SUPPORT_CLIPBOARD_IMAGE) #if SUPPORT_CLIPBOARD_IMAGE
#if defined(_WIN32) #if defined(_WIN32)
unsigned long long int dataSize = 0; unsigned long long int dataSize = 0;
void *fileData = NULL; void *fileData = NULL;
@ -1122,7 +1122,7 @@ const char *GetKeyName(int key)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -1693,7 +1693,7 @@ void ClosePlatform(void)
glfwDestroyWindow(platform.handle); glfwDestroyWindow(platform.handle);
glfwTerminate(); glfwTerminate();
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) #if defined(_WIN32) && SUPPORT_WINMM_HIGHRES_TIMER && !SUPPORT_BUSY_WAIT_LOOP
timeEndPeriod(1); // Restore time period timeEndPeriod(1); // Restore time period
#endif #endif
} }
@ -1838,7 +1838,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
CORE.Input.Mouse.currentButtonState[button] = action; CORE.Input.Mouse.currentButtonState[button] = action;
CORE.Input.Touch.currentTouchState[button] = action; CORE.Input.Touch.currentTouchState[button] = action;
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) #if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };
@ -1873,7 +1873,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
CORE.Input.Mouse.currentPosition.y = (float)y; CORE.Input.Mouse.currentPosition.y = (float)y;
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition; CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) #if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };

View File

@ -664,7 +664,7 @@ const char *GetClipboardText(void)
return RGFW_readClipboard(NULL); return RGFW_readClipboard(NULL);
} }
#if defined(SUPPORT_CLIPBOARD_IMAGE) #if SUPPORT_CLIPBOARD_IMAGE
#if defined(_WIN32) #if defined(_WIN32)
#define WIN32_CLIPBOARD_IMPLEMENTATION #define WIN32_CLIPBOARD_IMPLEMENTATION
#define WINUSER_ALREADY_INCLUDED #define WINUSER_ALREADY_INCLUDED
@ -679,7 +679,7 @@ Image GetClipboardImage(void)
{ {
Image image = { 0 }; Image image = { 0 };
#if defined(SUPPORT_CLIPBOARD_IMAGE) #if SUPPORT_CLIPBOARD_IMAGE
#if defined(_WIN32) #if defined(_WIN32)
unsigned long long int dataSize = 0; unsigned long long int dataSize = 0;
void *fileData = NULL; void *fileData = NULL;
@ -858,7 +858,7 @@ char RSGL_keystrToChar(const char *str)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -1203,7 +1203,7 @@ void PollInputEvents(void)
default: break; default: break;
} }
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
if (touchAction > -1) if (touchAction > -1)
{ {
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures

View File

@ -1107,7 +1107,7 @@ Image GetClipboardImage(void)
{ {
Image image = { 0 }; Image image = { 0 };
#if defined(SUPPORT_CLIPBOARD_IMAGE) #if SUPPORT_CLIPBOARD_IMAGE
// Let's hope compiler put these arrays in static memory // Let's hope compiler put these arrays in static memory
const char *imageFormats[] = { const char *imageFormats[] = {
"image/bmp", "image/bmp",
@ -1311,7 +1311,7 @@ static void UpdateTouchPointsSDL(SDL_TouchFingerEvent event)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -1737,7 +1737,7 @@ void PollInputEvents(void)
default: break; default: break;
} }
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
if (touchAction > -1) if (touchAction > -1)
{ {
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures
@ -1939,7 +1939,7 @@ int InitPlatform(void)
// NOTE: No need to call InitTimer(), let SDL manage it internally // NOTE: No need to call InitTimer(), let SDL manage it internally
CORE.Time.previous = GetTime(); // Get time as double CORE.Time.previous = GetTime(); // Get time as double
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) #if defined(_WIN32) && SUPPORT_WINMM_HIGHRES_TIMER && !SUPPORT_BUSY_WAIT_LOOP
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1"); // SDL equivalent of timeBeginPeriod() and timeEndPeriod() SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1"); // SDL equivalent of timeBeginPeriod() and timeEndPeriod()
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -220,7 +220,7 @@ static const short linuxToRaylibMap[KEYMAP_SIZE] = {
int InitPlatform(void); // Initialize platform (graphics, inputs and more) int InitPlatform(void); // Initialize platform (graphics, inputs and more)
void ClosePlatform(void); // Close platform void ClosePlatform(void); // Close platform
#if defined(SUPPORT_SSH_KEYBOARD_RPI) #if SUPPORT_SSH_KEYBOARD_RPI
static void InitKeyboard(void); // Initialize raw keyboard system static void InitKeyboard(void); // Initialize raw keyboard system
static void RestoreKeyboard(void); // Restore keyboard system static void RestoreKeyboard(void); // Restore keyboard system
static void ProcessKeyboard(void); // Process keyboard events static void ProcessKeyboard(void); // Process keyboard events
@ -648,7 +648,7 @@ const char *GetKeyName(int key)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -671,7 +671,7 @@ void PollInputEvents(void)
PollKeyboardEvents(); PollKeyboardEvents();
#if defined(SUPPORT_SSH_KEYBOARD_RPI) #if SUPPORT_SSH_KEYBOARD_RPI
// NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here. // NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here.
// stdin reading is still used for legacy purposes, it allows keyboard input trough SSH console // stdin reading is still used for legacy purposes, it allows keyboard input trough SSH console
if (!platform.eventKeyboardMode) ProcessKeyboard(); if (!platform.eventKeyboardMode) ProcessKeyboard();
@ -1070,7 +1070,7 @@ int InitPlatform(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
InitEvdevInput(); // Evdev inputs initialization InitEvdevInput(); // Evdev inputs initialization
#if defined(SUPPORT_SSH_KEYBOARD_RPI) #if SUPPORT_SSH_KEYBOARD_RPI
InitKeyboard(); // Keyboard init (stdin) InitKeyboard(); // Keyboard init (stdin)
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1174,7 +1174,7 @@ void ClosePlatform(void)
} }
} }
#if defined(SUPPORT_SSH_KEYBOARD_RPI) #if SUPPORT_SSH_KEYBOARD_RPI
// Initialize Keyboard system (using standard input) // Initialize Keyboard system (using standard input)
static void InitKeyboard(void) static void InitKeyboard(void)
{ {
@ -1593,7 +1593,7 @@ static void PollKeyboardEvents(void)
// Check if the event is a key event // Check if the event is a key event
if (event.type != EV_KEY) continue; if (event.type != EV_KEY) continue;
#if defined(SUPPORT_SSH_KEYBOARD_RPI) #if SUPPORT_SSH_KEYBOARD_RPI
// If the event was a key, we know a working keyboard is connected, so disable the SSH keyboard // If the event was a key, we know a working keyboard is connected, so disable the SSH keyboard
platform.eventKeyboardMode = true; platform.eventKeyboardMode = true;
#endif #endif
@ -1836,7 +1836,7 @@ static void PollMouseEvents(void)
if (CORE.Input.Touch.position[i].x >= 0) CORE.Input.Touch.pointCount++; if (CORE.Input.Touch.position[i].x >= 0) CORE.Input.Touch.pointCount++;
} }
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
if (touchAction > -1) if (touchAction > -1)
{ {
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };

View File

@ -404,7 +404,7 @@ const char *GetKeyName(int key)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();

View File

@ -968,7 +968,7 @@ const char *GetKeyName(int key)
// Register all input events // Register all input events
void PollInputEvents(void) void PollInputEvents(void)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// NOTE: Gestures update must be called every frame to reset gestures correctly // NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame // because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures(); UpdateGestures();
@ -1534,7 +1534,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
CORE.Input.Mouse.currentButtonState[button] = action; CORE.Input.Mouse.currentButtonState[button] = action;
CORE.Input.Touch.currentTouchState[button] = action; CORE.Input.Touch.currentTouchState[button] = action;
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) #if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };
@ -1575,7 +1575,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition; CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
} }
#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES) #if SUPPORT_GESTURES_SYSTEM && SUPPORT_MOUSE_GESTURES
// Process mouse events as touches to be able to use mouse-gestures // Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };
@ -1768,7 +1768,7 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
CORE.Input.Mouse.currentPosition.y = CORE.Input.Touch.position[0].y; CORE.Input.Mouse.currentPosition.y = CORE.Input.Touch.position[0].y;
} }
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
GestureEvent gestureEvent = {0}; GestureEvent gestureEvent = {0};
gestureEvent.pointCount = CORE.Input.Touch.pointCount; gestureEvent.pointCount = CORE.Input.Touch.pointCount;

View File

@ -81,7 +81,7 @@
#include "utils.h" // Required for: fopen() Android mapping #include "utils.h" // Required for: fopen() Android mapping
#endif #endif
#if defined(SUPPORT_MODULE_RAUDIO) #if SUPPORT_MODULE_RAUDIO
#if defined(_WIN32) #if defined(_WIN32)
// To avoid conflicting windows.h symbols with raylib, some flags are defined // To avoid conflicting windows.h symbols with raylib, some flags are defined
@ -204,7 +204,7 @@ typedef struct tagBITMAPINFOHEADER {
#endif #endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
#define DRWAV_MALLOC RL_MALLOC #define DRWAV_MALLOC RL_MALLOC
#define DRWAV_REALLOC RL_REALLOC #define DRWAV_REALLOC RL_REALLOC
#define DRWAV_FREE RL_FREE #define DRWAV_FREE RL_FREE
@ -213,12 +213,12 @@ typedef struct tagBITMAPINFOHEADER {
#include "external/dr_wav.h" // WAV loading functions #include "external/dr_wav.h" // WAV loading functions
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
// TODO: Remap stb_vorbis malloc()/free() calls to RL_MALLOC/RL_FREE // TODO: Remap stb_vorbis malloc()/free() calls to RL_MALLOC/RL_FREE
#include "external/stb_vorbis.c" // OGG loading functions #include "external/stb_vorbis.c" // OGG loading functions
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
#define DRMP3_MALLOC RL_MALLOC #define DRMP3_MALLOC RL_MALLOC
#define DRMP3_REALLOC RL_REALLOC #define DRMP3_REALLOC RL_REALLOC
#define DRMP3_FREE RL_FREE #define DRMP3_FREE RL_FREE
@ -227,7 +227,7 @@ typedef struct tagBITMAPINFOHEADER {
#include "external/dr_mp3.h" // MP3 loading functions #include "external/dr_mp3.h" // MP3 loading functions
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
#define QOA_MALLOC RL_MALLOC #define QOA_MALLOC RL_MALLOC
#define QOA_FREE RL_FREE #define QOA_FREE RL_FREE
@ -247,7 +247,7 @@ typedef struct tagBITMAPINFOHEADER {
#endif #endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
#define DRFLAC_MALLOC RL_MALLOC #define DRFLAC_MALLOC RL_MALLOC
#define DRFLAC_REALLOC RL_REALLOC #define DRFLAC_REALLOC RL_REALLOC
#define DRFLAC_FREE RL_FREE #define DRFLAC_FREE RL_FREE
@ -257,7 +257,7 @@ typedef struct tagBITMAPINFOHEADER {
#include "external/dr_flac.h" // FLAC loading functions #include "external/dr_flac.h" // FLAC loading functions
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
#define JARXM_MALLOC RL_MALLOC #define JARXM_MALLOC RL_MALLOC
#define JARXM_FREE RL_FREE #define JARXM_FREE RL_FREE
@ -274,7 +274,7 @@ typedef struct tagBITMAPINFOHEADER {
#endif #endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
#define JARMOD_MALLOC RL_MALLOC #define JARMOD_MALLOC RL_MALLOC
#define JARMOD_FREE RL_FREE #define JARMOD_FREE RL_FREE
@ -789,7 +789,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
Wave wave = { 0 }; Wave wave = { 0 };
if (false) { } if (false) { }
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0)) else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0))
{ {
drwav wav = { 0 }; drwav wav = { 0 };
@ -811,7 +811,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
drwav_uninit(&wav); drwav_uninit(&wav);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0)) else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0))
{ {
stb_vorbis *oggData = stb_vorbis_open_memory((unsigned char *)fileData, dataSize, NULL, NULL); stb_vorbis *oggData = stb_vorbis_open_memory((unsigned char *)fileData, dataSize, NULL, NULL);
@ -833,7 +833,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
else TRACELOG(LOG_WARNING, "WAVE: Failed to load OGG data"); else TRACELOG(LOG_WARNING, "WAVE: Failed to load OGG data");
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0)) else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0))
{ {
drmp3_config config = { 0 }; drmp3_config config = { 0 };
@ -853,7 +853,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
else if ((strcmp(fileType, ".qoa") == 0) || (strcmp(fileType, ".QOA") == 0)) else if ((strcmp(fileType, ".qoa") == 0) || (strcmp(fileType, ".QOA") == 0))
{ {
qoa_desc qoa = { 0 }; qoa_desc qoa = { 0 };
@ -872,7 +872,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
else if ((strcmp(fileType, ".flac") == 0) || (strcmp(fileType, ".FLAC") == 0)) else if ((strcmp(fileType, ".flac") == 0) || (strcmp(fileType, ".FLAC") == 0))
{ {
unsigned long long int totalFrameCount = 0; unsigned long long int totalFrameCount = 0;
@ -1049,7 +1049,7 @@ bool ExportWave(Wave wave, const char *fileName)
bool success = false; bool success = false;
if (false) { } if (false) { }
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
else if (IsFileExtension(fileName, ".wav")) else if (IsFileExtension(fileName, ".wav"))
{ {
drwav wav = { 0 }; drwav wav = { 0 };
@ -1072,7 +1072,7 @@ bool ExportWave(Wave wave, const char *fileName)
drwav_free(fileData, NULL); drwav_free(fileData, NULL);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
else if (IsFileExtension(fileName, ".qoa")) else if (IsFileExtension(fileName, ".qoa"))
{ {
if (wave.sampleSize == 16) if (wave.sampleSize == 16)
@ -1329,7 +1329,7 @@ Music LoadMusicStream(const char *fileName)
bool musicLoaded = false; bool musicLoaded = false;
if (false) { } if (false) { }
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
else if (IsFileExtension(fileName, ".wav")) else if (IsFileExtension(fileName, ".wav"))
{ {
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav)); drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
@ -1353,7 +1353,7 @@ Music LoadMusicStream(const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
else if (IsFileExtension(fileName, ".ogg")) else if (IsFileExtension(fileName, ".ogg"))
{ {
// Open ogg audio stream // Open ogg audio stream
@ -1379,7 +1379,7 @@ Music LoadMusicStream(const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
else if (IsFileExtension(fileName, ".mp3")) else if (IsFileExtension(fileName, ".mp3"))
{ {
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3)); drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
@ -1400,7 +1400,7 @@ Music LoadMusicStream(const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
else if (IsFileExtension(fileName, ".qoa")) else if (IsFileExtension(fileName, ".qoa"))
{ {
qoaplay_desc *ctxQoa = qoaplay_open(fileName); qoaplay_desc *ctxQoa = qoaplay_open(fileName);
@ -1419,7 +1419,7 @@ Music LoadMusicStream(const char *fileName)
else{} //No uninit required else{} //No uninit required
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
else if (IsFileExtension(fileName, ".flac")) else if (IsFileExtension(fileName, ".flac"))
{ {
drflac *ctxFlac = drflac_open_file(fileName, NULL); drflac *ctxFlac = drflac_open_file(fileName, NULL);
@ -1441,7 +1441,7 @@ Music LoadMusicStream(const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
else if (IsFileExtension(fileName, ".xm")) else if (IsFileExtension(fileName, ".xm"))
{ {
jar_xm_context_t *ctxXm = NULL; jar_xm_context_t *ctxXm = NULL;
@ -1470,7 +1470,7 @@ Music LoadMusicStream(const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
else if (IsFileExtension(fileName, ".mod")) else if (IsFileExtension(fileName, ".mod"))
{ {
jar_mod_context_t *ctxMod = RL_CALLOC(1, sizeof(jar_mod_context_t)); jar_mod_context_t *ctxMod = RL_CALLOC(1, sizeof(jar_mod_context_t));
@ -1521,7 +1521,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
bool musicLoaded = false; bool musicLoaded = false;
if (false) { } if (false) { }
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0)) else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0))
{ {
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav)); drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
@ -1546,7 +1546,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0)) else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0))
{ {
// Open ogg audio stream // Open ogg audio stream
@ -1572,7 +1572,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0)) else if ((strcmp(fileType, ".mp3") == 0) || (strcmp(fileType, ".MP3") == 0))
{ {
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3)); drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
@ -1594,7 +1594,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
else if ((strcmp(fileType, ".qoa") == 0) || (strcmp(fileType, ".QOA") == 0)) else if ((strcmp(fileType, ".qoa") == 0) || (strcmp(fileType, ".QOA") == 0))
{ {
qoaplay_desc *ctxQoa = NULL; qoaplay_desc *ctxQoa = NULL;
@ -1617,7 +1617,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
else{} //No uninit required else{} //No uninit required
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
else if ((strcmp(fileType, ".flac") == 0) || (strcmp(fileType, ".FLAC") == 0)) else if ((strcmp(fileType, ".flac") == 0) || (strcmp(fileType, ".FLAC") == 0))
{ {
drflac *ctxFlac = drflac_open_memory((const void*)data, dataSize, NULL); drflac *ctxFlac = drflac_open_memory((const void*)data, dataSize, NULL);
@ -1639,7 +1639,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
else if ((strcmp(fileType, ".xm") == 0) || (strcmp(fileType, ".XM") == 0)) else if ((strcmp(fileType, ".xm") == 0) || (strcmp(fileType, ".XM") == 0))
{ {
jar_xm_context_t *ctxXm = NULL; jar_xm_context_t *ctxXm = NULL;
@ -1668,7 +1668,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
else if ((strcmp(fileType, ".mod") == 0) || (strcmp(fileType, ".MOD") == 0)) else if ((strcmp(fileType, ".mod") == 0) || (strcmp(fileType, ".MOD") == 0))
{ {
jar_mod_context_t *ctxMod = (jar_mod_context_t *)RL_MALLOC(sizeof(jar_mod_context_t)); jar_mod_context_t *ctxMod = (jar_mod_context_t *)RL_MALLOC(sizeof(jar_mod_context_t));
@ -1744,25 +1744,25 @@ void UnloadMusicStream(Music music)
if (music.ctxData != NULL) if (music.ctxData != NULL)
{ {
if (false) { } if (false) { }
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
else if (music.ctxType == MUSIC_AUDIO_WAV) drwav_uninit((drwav *)music.ctxData); else if (music.ctxType == MUSIC_AUDIO_WAV) drwav_uninit((drwav *)music.ctxData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData); else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
else if (music.ctxType == MUSIC_AUDIO_MP3) { drmp3_uninit((drmp3 *)music.ctxData); RL_FREE(music.ctxData); } else if (music.ctxType == MUSIC_AUDIO_MP3) { drmp3_uninit((drmp3 *)music.ctxData); RL_FREE(music.ctxData); }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData); else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
else if (music.ctxType == MUSIC_AUDIO_FLAC) drflac_free((drflac *)music.ctxData, NULL); else if (music.ctxType == MUSIC_AUDIO_FLAC) drflac_free((drflac *)music.ctxData, NULL);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData); else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
else if (music.ctxType == MUSIC_MODULE_MOD) { jar_mod_unload((jar_mod_context_t *)music.ctxData); RL_FREE(music.ctxData); } else if (music.ctxType == MUSIC_MODULE_MOD) { jar_mod_unload((jar_mod_context_t *)music.ctxData); RL_FREE(music.ctxData); }
#endif #endif
} }
@ -1793,25 +1793,25 @@ void StopMusicStream(Music music)
switch (music.ctxType) switch (music.ctxType)
{ {
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
case MUSIC_AUDIO_WAV: drwav_seek_to_first_pcm_frame((drwav *)music.ctxData); break; case MUSIC_AUDIO_WAV: drwav_seek_to_first_pcm_frame((drwav *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
case MUSIC_AUDIO_OGG: stb_vorbis_seek_start((stb_vorbis *)music.ctxData); break; case MUSIC_AUDIO_OGG: stb_vorbis_seek_start((stb_vorbis *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
case MUSIC_AUDIO_MP3: drmp3_seek_to_start_of_stream((drmp3 *)music.ctxData); break; case MUSIC_AUDIO_MP3: drmp3_seek_to_start_of_stream((drmp3 *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
case MUSIC_AUDIO_QOA: qoaplay_rewind((qoaplay_desc *)music.ctxData); break; case MUSIC_AUDIO_QOA: qoaplay_rewind((qoaplay_desc *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
case MUSIC_AUDIO_FLAC: drflac__seek_to_first_frame((drflac *)music.ctxData); break; case MUSIC_AUDIO_FLAC: drflac__seek_to_first_frame((drflac *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
case MUSIC_MODULE_XM: jar_xm_reset((jar_xm_context_t *)music.ctxData); break; case MUSIC_MODULE_XM: jar_xm_reset((jar_xm_context_t *)music.ctxData); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
case MUSIC_MODULE_MOD: jar_mod_seek_start((jar_mod_context_t *)music.ctxData); break; case MUSIC_MODULE_MOD: jar_mod_seek_start((jar_mod_context_t *)music.ctxData); break;
#endif #endif
default: break; default: break;
@ -1828,16 +1828,16 @@ void SeekMusicStream(Music music, float position)
switch (music.ctxType) switch (music.ctxType)
{ {
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
case MUSIC_AUDIO_WAV: drwav_seek_to_pcm_frame((drwav *)music.ctxData, positionInFrames); break; case MUSIC_AUDIO_WAV: drwav_seek_to_pcm_frame((drwav *)music.ctxData, positionInFrames); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
case MUSIC_AUDIO_OGG: stb_vorbis_seek_frame((stb_vorbis *)music.ctxData, positionInFrames); break; case MUSIC_AUDIO_OGG: stb_vorbis_seek_frame((stb_vorbis *)music.ctxData, positionInFrames); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame((drmp3 *)music.ctxData, positionInFrames); break; case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame((drmp3 *)music.ctxData, positionInFrames); break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
case MUSIC_AUDIO_QOA: case MUSIC_AUDIO_QOA:
{ {
int qoaFrame = positionInFrames/QOA_FRAME_LEN; int qoaFrame = positionInFrames/QOA_FRAME_LEN;
@ -1847,7 +1847,7 @@ void SeekMusicStream(Music music, float position)
positionInFrames = ((qoaplay_desc *)music.ctxData)->sample_position; positionInFrames = ((qoaplay_desc *)music.ctxData)->sample_position;
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
case MUSIC_AUDIO_FLAC: drflac_seek_to_pcm_frame((drflac *)music.ctxData, positionInFrames); break; case MUSIC_AUDIO_FLAC: drflac_seek_to_pcm_frame((drflac *)music.ctxData, positionInFrames); break;
#endif #endif
default: break; default: break;
@ -1896,7 +1896,7 @@ void UpdateMusicStream(Music music)
switch (music.ctxType) switch (music.ctxType)
{ {
#if defined(SUPPORT_FILEFORMAT_WAV) #if SUPPORT_FILEFORMAT_WAV
case MUSIC_AUDIO_WAV: case MUSIC_AUDIO_WAV:
{ {
if (music.stream.sampleSize == 16) if (music.stream.sampleSize == 16)
@ -1923,7 +1923,7 @@ void UpdateMusicStream(Music music)
} }
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if SUPPORT_FILEFORMAT_OGG
case MUSIC_AUDIO_OGG: case MUSIC_AUDIO_OGG:
{ {
while (true) while (true)
@ -1936,7 +1936,7 @@ void UpdateMusicStream(Music music)
} }
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MP3) #if SUPPORT_FILEFORMAT_MP3
case MUSIC_AUDIO_MP3: case MUSIC_AUDIO_MP3:
{ {
while (true) while (true)
@ -1949,7 +1949,7 @@ void UpdateMusicStream(Music music)
} }
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOA) #if SUPPORT_FILEFORMAT_QOA
case MUSIC_AUDIO_QOA: case MUSIC_AUDIO_QOA:
{ {
unsigned int frameCountRead = qoaplay_decode((qoaplay_desc *)music.ctxData, (float *)AUDIO.System.pcmBuffer, framesToStream); unsigned int frameCountRead = qoaplay_decode((qoaplay_desc *)music.ctxData, (float *)AUDIO.System.pcmBuffer, framesToStream);
@ -1966,7 +1966,7 @@ void UpdateMusicStream(Music music)
*/ */
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FLAC) #if SUPPORT_FILEFORMAT_FLAC
case MUSIC_AUDIO_FLAC: case MUSIC_AUDIO_FLAC:
{ {
while (true) while (true)
@ -1979,7 +1979,7 @@ void UpdateMusicStream(Music music)
} }
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
case MUSIC_MODULE_XM: case MUSIC_MODULE_XM:
{ {
// NOTE: Internally we consider 2 channels generation, so sampleCount/2 // NOTE: Internally we consider 2 channels generation, so sampleCount/2
@ -1990,7 +1990,7 @@ void UpdateMusicStream(Music music)
} break; } break;
#endif #endif
#if defined(SUPPORT_FILEFORMAT_MOD) #if SUPPORT_FILEFORMAT_MOD
case MUSIC_MODULE_MOD: case MUSIC_MODULE_MOD:
{ {
// NOTE: 3rd parameter (nbsample) specify the number of stereo 16bits samples you want, so sampleCount/2 // NOTE: 3rd parameter (nbsample) specify the number of stereo 16bits samples you want, so sampleCount/2
@ -2061,7 +2061,7 @@ float GetMusicTimePlayed(Music music)
float secondsPlayed = 0.0f; float secondsPlayed = 0.0f;
if (music.stream.buffer != NULL) if (music.stream.buffer != NULL)
{ {
#if defined(SUPPORT_FILEFORMAT_XM) #if SUPPORT_FILEFORMAT_XM
if (music.ctxType == MUSIC_MODULE_XM) if (music.ctxType == MUSIC_MODULE_XM)
{ {
uint64_t framesPlayed = 0; uint64_t framesPlayed = 0;

View File

@ -116,17 +116,17 @@
#define RAYMATH_IMPLEMENTATION #define RAYMATH_IMPLEMENTATION
#include "raymath.h" // Vector2, Vector3, Quaternion and Matrix functionality #include "raymath.h" // Vector2, Vector3, Quaternion and Matrix functionality
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
#define RGESTURES_IMPLEMENTATION #define RGESTURES_IMPLEMENTATION
#include "rgestures.h" // Gestures detection functionality #include "rgestures.h" // Gestures detection functionality
#endif #endif
#if defined(SUPPORT_CAMERA_SYSTEM) #if SUPPORT_CAMERA_SYSTEM
#define RCAMERA_IMPLEMENTATION #define RCAMERA_IMPLEMENTATION
#include "rcamera.h" // Camera system functionality #include "rcamera.h" // Camera system functionality
#endif #endif
#if defined(SUPPORT_GIF_RECORDING) #if SUPPORT_GIF_RECORDING
#define MSF_GIF_MALLOC(contextPointer, newSize) RL_MALLOC(newSize) #define MSF_GIF_MALLOC(contextPointer, newSize) RL_MALLOC(newSize)
#define MSF_GIF_REALLOC(contextPointer, oldMemory, oldSize, newSize) RL_REALLOC(oldMemory, newSize) #define MSF_GIF_REALLOC(contextPointer, oldMemory, oldSize, newSize) RL_REALLOC(oldMemory, newSize)
#define MSF_GIF_FREE(contextPointer, oldMemory, oldSize) RL_FREE(oldMemory) #define MSF_GIF_FREE(contextPointer, oldMemory, oldSize) RL_FREE(oldMemory)
@ -135,7 +135,7 @@
#include "external/msf_gif.h" // GIF recording functionality #include "external/msf_gif.h" // GIF recording functionality
#endif #endif
#if defined(SUPPORT_COMPRESSION_API) #if SUPPORT_COMPRESSION_API
#define SINFL_IMPLEMENTATION #define SINFL_IMPLEMENTATION
#define SINFL_NO_SIMD #define SINFL_NO_SIMD
#include "external/sinfl.h" // Deflate (RFC 1951) decompressor #include "external/sinfl.h" // Deflate (RFC 1951) decompressor
@ -144,7 +144,7 @@
#include "external/sdefl.h" // Deflate (RFC 1951) compressor #include "external/sdefl.h" // Deflate (RFC 1951) compressor
#endif #endif
#if defined(SUPPORT_RPRAND_GENERATOR) #if SUPPORT_RPRAND_GENERATOR
#define RPRAND_IMPLEMENTATION #define RPRAND_IMPLEMENTATION
#include "external/rprand.h" #include "external/rprand.h"
#endif #endif
@ -377,17 +377,17 @@ CoreData CORE = { 0 }; // Global CORE state context
// NOTE: Useful to allow Texture, RenderTexture, Font.texture, Mesh.vaoId/vboId, Shader loading // NOTE: Useful to allow Texture, RenderTexture, Font.texture, Mesh.vaoId/vboId, Shader loading
bool isGpuReady = false; bool isGpuReady = false;
#if defined(SUPPORT_SCREEN_CAPTURE) #if SUPPORT_SCREEN_CAPTURE
static int screenshotCounter = 0; // Screenshots counter static int screenshotCounter = 0; // Screenshots counter
#endif #endif
#if defined(SUPPORT_GIF_RECORDING) #if SUPPORT_GIF_RECORDING
static unsigned int gifFrameCounter = 0; // GIF frames counter static unsigned int gifFrameCounter = 0; // GIF frames counter
static bool gifRecording = false; // GIF recording state static bool gifRecording = false; // GIF recording state
static MsfGifState gifState = { 0 }; // MSGIF context state static MsfGifState gifState = { 0 }; // MSGIF context state
#endif #endif
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
// Automation events type // Automation events type
typedef enum AutomationEventType { typedef enum AutomationEventType {
EVENT_NONE = 0, EVENT_NONE = 0,
@ -480,7 +480,7 @@ static bool automationEventRecording = false; // Recording automat
// NOTE: Those functions are common for all platforms! // NOTE: Those functions are common for all platforms!
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_MODULE_RTEXT && SUPPORT_DEFAULT_FONT
extern void LoadFontDefault(void); // [Module: text] Loads default font on InitWindow() extern void LoadFontDefault(void); // [Module: text] Loads default font on InitWindow()
extern void UnloadFontDefault(void); // [Module: text] Unloads default font from GPU memory extern void UnloadFontDefault(void); // [Module: text] Unloads default font from GPU memory
#endif #endif
@ -495,7 +495,7 @@ static void SetupViewport(int width, int height); // Set viewport for
static void ScanDirectoryFiles(const char *basePath, FilePathList *list, const char *filter); // Scan all files and directories in a base path static void ScanDirectoryFiles(const char *basePath, FilePathList *list, const char *filter); // Scan all files and directories in a base path
static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *list, const char *filter); // Scan all files and directories recursively from a base path static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *list, const char *filter); // Scan all files and directories recursively from a base path
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
static void RecordAutomationEvent(void); // Record frame events (to internal events array) static void RecordAutomationEvent(void); // Record frame events (to internal events array)
#endif #endif
@ -504,7 +504,7 @@ static void RecordAutomationEvent(void); // Record frame events (to internal eve
void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime() void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime()
#endif #endif
#if !defined(SUPPORT_MODULE_RTEXT) #if !SUPPORT_MODULE_RTEXT
const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed'
#endif // !SUPPORT_MODULE_RTEXT #endif // !SUPPORT_MODULE_RTEXT
@ -513,18 +513,18 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
#endif #endif
// We're using `#pragma message` because `#warning` is not adopted by MSVC. // We're using `#pragma message` because `#warning` is not adopted by MSVC.
#if defined(SUPPORT_CLIPBOARD_IMAGE) #if SUPPORT_CLIPBOARD_IMAGE
#if !defined(SUPPORT_MODULE_RTEXTURES) #if !SUPPORT_MODULE_RTEXTURES
#pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly") #pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly")
#endif #endif
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows // It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
#if !defined(SUPPORT_FILEFORMAT_BMP) && defined(_WIN32) #if !SUPPORT_FILEFORMAT_BMP && defined(_WIN32)
#pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows") #pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows")
#endif #endif
// From what I've tested applications on Wayland saves images on clipboard as PNG. // From what I've tested applications on Wayland saves images on clipboard as PNG.
#if (!defined(SUPPORT_FILEFORMAT_PNG) || !defined(SUPPORT_FILEFORMAT_JPG)) && !defined(_WIN32) #if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32)
#pragma message ("Warning: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG") #pragma message ("Warning: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG")
#endif #endif
@ -626,27 +626,27 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_INFO, "Supported raylib modules:"); TRACELOG(LOG_INFO, "Supported raylib modules:");
TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)"); TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)");
TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)"); TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)");
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
TRACELOG(LOG_INFO, " > rshapes:... loaded (optional)"); TRACELOG(LOG_INFO, " > rshapes:... loaded (optional)");
#else #else
TRACELOG(LOG_INFO, " > rshapes:... not loaded (optional)"); TRACELOG(LOG_INFO, " > rshapes:... not loaded (optional)");
#endif #endif
#if defined(SUPPORT_MODULE_RTEXTURES) #if SUPPORT_MODULE_RTEXTURES
TRACELOG(LOG_INFO, " > rtextures:. loaded (optional)"); TRACELOG(LOG_INFO, " > rtextures:. loaded (optional)");
#else #else
TRACELOG(LOG_INFO, " > rtextures:. not loaded (optional)"); TRACELOG(LOG_INFO, " > rtextures:. not loaded (optional)");
#endif #endif
#if defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RTEXT
TRACELOG(LOG_INFO, " > rtext:..... loaded (optional)"); TRACELOG(LOG_INFO, " > rtext:..... loaded (optional)");
#else #else
TRACELOG(LOG_INFO, " > rtext:..... not loaded (optional)"); TRACELOG(LOG_INFO, " > rtext:..... not loaded (optional)");
#endif #endif
#if defined(SUPPORT_MODULE_RMODELS) #if SUPPORT_MODULE_RMODELS
TRACELOG(LOG_INFO, " > rmodels:... loaded (optional)"); TRACELOG(LOG_INFO, " > rmodels:... loaded (optional)");
#else #else
TRACELOG(LOG_INFO, " > rmodels:... not loaded (optional)"); TRACELOG(LOG_INFO, " > rmodels:... not loaded (optional)");
#endif #endif
#if defined(SUPPORT_MODULE_RAUDIO) #if SUPPORT_MODULE_RAUDIO
TRACELOG(LOG_INFO, " > raudio:.... loaded (optional)"); TRACELOG(LOG_INFO, " > raudio:.... loaded (optional)");
#else #else
TRACELOG(LOG_INFO, " > raudio:.... not loaded (optional)"); TRACELOG(LOG_INFO, " > raudio:.... not loaded (optional)");
@ -679,12 +679,12 @@ void InitWindow(int width, int height, const char *title)
// Setup default viewport // Setup default viewport
SetupViewport(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height); SetupViewport(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
#if defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RTEXT
#if defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_DEFAULT_FONT
// Load default font // Load default font
// WARNING: External function: Module required: rtext // WARNING: External function: Module required: rtext
LoadFontDefault(); LoadFontDefault();
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
// Set font white rectangle for shapes drawing, so shapes and text can be batched together // Set font white rectangle for shapes drawing, so shapes and text can be batched together
// WARNING: rshapes module is required, if not available, default internal white rectangle is used // WARNING: rshapes module is required, if not available, default internal white rectangle is used
Rectangle rec = GetFontDefault().recs[95]; Rectangle rec = GetFontDefault().recs[95];
@ -701,7 +701,7 @@ void InitWindow(int width, int height, const char *title)
#endif #endif
#endif #endif
#else #else
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
// Set default texture and rectangle to be used for shapes drawing // Set default texture and rectangle to be used for shapes drawing
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8 // NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
@ -721,7 +721,7 @@ void InitWindow(int width, int height, const char *title)
// Close window and unload OpenGL context // Close window and unload OpenGL context
void CloseWindow(void) void CloseWindow(void)
{ {
#if defined(SUPPORT_GIF_RECORDING) #if SUPPORT_GIF_RECORDING
if (gifRecording) if (gifRecording)
{ {
MsfGifResult result = msf_gif_end(&gifState); MsfGifResult result = msf_gif_end(&gifState);
@ -730,7 +730,7 @@ void CloseWindow(void)
} }
#endif #endif
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_MODULE_RTEXT && SUPPORT_DEFAULT_FONT
UnloadFontDefault(); // WARNING: Module required: rtext UnloadFontDefault(); // WARNING: Module required: rtext
#endif #endif
@ -888,7 +888,7 @@ void EndDrawing(void)
{ {
rlDrawRenderBatchActive(); // Update and draw internal render batch rlDrawRenderBatchActive(); // Update and draw internal render batch
#if defined(SUPPORT_GIF_RECORDING) #if SUPPORT_GIF_RECORDING
// Draw record indicator // Draw record indicator
if (gifRecording) if (gifRecording)
{ {
@ -916,7 +916,7 @@ void EndDrawing(void)
RL_FREE(screenData); // Free image data RL_FREE(screenData); // Free image data
} }
#if defined(SUPPORT_MODULE_RSHAPES) && defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RSHAPES && SUPPORT_MODULE_RTEXT
// Display the recording indicator every half-second // Display the recording indicator every half-second
if ((int)(GetTime()/0.5)%2 == 1) if ((int)(GetTime()/0.5)%2 == 1)
{ {
@ -929,11 +929,11 @@ void EndDrawing(void)
} }
#endif #endif
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
if (automationEventRecording) RecordAutomationEvent(); // Event recording if (automationEventRecording) RecordAutomationEvent(); // Event recording
#endif #endif
#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL) #if !SUPPORT_CUSTOM_FRAME_CONTROL
SwapScreenBuffer(); // Copy back buffer to front buffer (screen) SwapScreenBuffer(); // Copy back buffer to front buffer (screen)
// Frame time control system // Frame time control system
@ -958,10 +958,10 @@ void EndDrawing(void)
PollInputEvents(); // Poll user events (before next frame update) PollInputEvents(); // Poll user events (before next frame update)
#endif #endif
#if defined(SUPPORT_SCREEN_CAPTURE) #if SUPPORT_SCREEN_CAPTURE
if (IsKeyPressed(KEY_F12)) if (IsKeyPressed(KEY_F12))
{ {
#if defined(SUPPORT_GIF_RECORDING) #if SUPPORT_GIF_RECORDING
if (IsKeyDown(KEY_LEFT_CONTROL)) if (IsKeyDown(KEY_LEFT_CONTROL))
{ {
if (gifRecording) if (gifRecording)
@ -1656,7 +1656,7 @@ int GetFPS(void)
{ {
int fps = 0; int fps = 0;
#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL) #if !SUPPORT_CUSTOM_FRAME_CONTROL
#define FPS_CAPTURE_FRAMES_COUNT 30 // 30 captures #define FPS_CAPTURE_FRAMES_COUNT 30 // 30 captures
#define FPS_AVERAGE_TIME_SECONDS 0.5f // 500 milliseconds #define FPS_AVERAGE_TIME_SECONDS 0.5f // 500 milliseconds
#define FPS_STEP (FPS_AVERAGE_TIME_SECONDS/FPS_CAPTURE_FRAMES_COUNT) #define FPS_STEP (FPS_AVERAGE_TIME_SECONDS/FPS_CAPTURE_FRAMES_COUNT)
@ -1716,14 +1716,14 @@ void WaitTime(double seconds)
{ {
if (seconds < 0) return; // Security check if (seconds < 0) return; // Security check
#if defined(SUPPORT_BUSY_WAIT_LOOP) || defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) #if SUPPORT_BUSY_WAIT_LOOP || SUPPORT_PARTIALBUSY_WAIT_LOOP
double destinationTime = GetTime() + seconds; double destinationTime = GetTime() + seconds;
#endif #endif
#if defined(SUPPORT_BUSY_WAIT_LOOP) #if SUPPORT_BUSY_WAIT_LOOP
while (GetTime() < destinationTime) { } while (GetTime() < destinationTime) { }
#else #else
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) #if SUPPORT_PARTIALBUSY_WAIT_LOOP
double sleepSeconds = seconds - seconds*0.05; // NOTE: We reserve a percentage of the time for busy waiting double sleepSeconds = seconds - seconds*0.05; // NOTE: We reserve a percentage of the time for busy waiting
#else #else
double sleepSeconds = seconds; double sleepSeconds = seconds;
@ -1747,7 +1747,7 @@ void WaitTime(double seconds)
usleep(sleepSeconds*1000000.0); usleep(sleepSeconds*1000000.0);
#endif #endif
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) #if SUPPORT_PARTIALBUSY_WAIT_LOOP
while (GetTime() < destinationTime) { } while (GetTime() < destinationTime) { }
#endif #endif
#endif #endif
@ -1763,7 +1763,7 @@ void WaitTime(double seconds)
// Set the seed for the random number generator // Set the seed for the random number generator
void SetRandomSeed(unsigned int seed) void SetRandomSeed(unsigned int seed)
{ {
#if defined(SUPPORT_RPRAND_GENERATOR) #if SUPPORT_RPRAND_GENERATOR
rprand_set_seed(seed); rprand_set_seed(seed);
#else #else
srand(seed); srand(seed);
@ -1782,7 +1782,7 @@ int GetRandomValue(int min, int max)
min = tmp; min = tmp;
} }
#if defined(SUPPORT_RPRAND_GENERATOR) #if SUPPORT_RPRAND_GENERATOR
value = rprand_get_value(min, max); value = rprand_get_value(min, max);
#else #else
// WARNING: Ranges higher than RAND_MAX will return invalid results // WARNING: Ranges higher than RAND_MAX will return invalid results
@ -1804,7 +1804,7 @@ int *LoadRandomSequence(unsigned int count, int min, int max)
{ {
int *values = NULL; int *values = NULL;
#if defined(SUPPORT_RPRAND_GENERATOR) #if SUPPORT_RPRAND_GENERATOR
values = rprand_load_sequence(count, min, max); values = rprand_load_sequence(count, min, max);
#else #else
if (count > ((unsigned int)abs(max - min) + 1)) return values; // Security check if (count > ((unsigned int)abs(max - min) + 1)) return values; // Security check
@ -1841,7 +1841,7 @@ int *LoadRandomSequence(unsigned int count, int min, int max)
// Unload random values sequence // Unload random values sequence
void UnloadRandomSequence(int *sequence) void UnloadRandomSequence(int *sequence)
{ {
#if defined(SUPPORT_RPRAND_GENERATOR) #if SUPPORT_RPRAND_GENERATOR
rprand_unload_sequence(sequence); rprand_unload_sequence(sequence);
#else #else
RL_FREE(sequence); RL_FREE(sequence);
@ -1852,7 +1852,7 @@ void UnloadRandomSequence(int *sequence)
// NOTE: Provided fileName should not contain paths, saving to working directory // NOTE: Provided fileName should not contain paths, saving to working directory
void TakeScreenshot(const char *fileName) void TakeScreenshot(const char *fileName)
{ {
#if defined(SUPPORT_MODULE_RTEXTURES) #if SUPPORT_MODULE_RTEXTURES
// Security check to (partially) avoid malicious code // Security check to (partially) avoid malicious code
if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; } if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; }
@ -1918,7 +1918,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
if (fileExt != NULL) if (fileExt != NULL)
{ {
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION) #if SUPPORT_MODULE_RTEXT && SUPPORT_TEXT_MANIPULATION
int extCount = 0; int extCount = 0;
const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
@ -2466,7 +2466,7 @@ unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDa
unsigned char *compData = NULL; unsigned char *compData = NULL;
#if defined(SUPPORT_COMPRESSION_API) #if SUPPORT_COMPRESSION_API
// Compress data and generate a valid DEFLATE stream // Compress data and generate a valid DEFLATE stream
struct sdefl *sdefl = RL_CALLOC(1, sizeof(struct sdefl)); // WARNING: Possible stack overflow, struct sdefl is almost 1MB struct sdefl *sdefl = RL_CALLOC(1, sizeof(struct sdefl)); // WARNING: Possible stack overflow, struct sdefl is almost 1MB
int bounds = sdefl_bound(dataSize); int bounds = sdefl_bound(dataSize);
@ -2486,7 +2486,7 @@ unsigned char *DecompressData(const unsigned char *compData, int compDataSize, i
{ {
unsigned char *data = NULL; unsigned char *data = NULL;
#if defined(SUPPORT_COMPRESSION_API) #if SUPPORT_COMPRESSION_API
// Decompress data from a valid DEFLATE stream // Decompress data from a valid DEFLATE stream
data = (unsigned char *)RL_CALLOC(MAX_DECOMPRESSION_SIZE*1024*1024, 1); data = (unsigned char *)RL_CALLOC(MAX_DECOMPRESSION_SIZE*1024*1024, 1);
int length = sinflate(data, MAX_DECOMPRESSION_SIZE*1024*1024, compData, compDataSize); int length = sinflate(data, MAX_DECOMPRESSION_SIZE*1024*1024, compData, compDataSize);
@ -2872,7 +2872,7 @@ AutomationEventList LoadAutomationEventList(const char *fileName)
list.events = (AutomationEvent *)RL_CALLOC(MAX_AUTOMATION_EVENTS, sizeof(AutomationEvent)); list.events = (AutomationEvent *)RL_CALLOC(MAX_AUTOMATION_EVENTS, sizeof(AutomationEvent));
list.capacity = MAX_AUTOMATION_EVENTS; list.capacity = MAX_AUTOMATION_EVENTS;
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
if (fileName == NULL) TRACELOG(LOG_INFO, "AUTOMATION: New empty events list loaded successfully"); if (fileName == NULL) TRACELOG(LOG_INFO, "AUTOMATION: New empty events list loaded successfully");
else else
{ {
@ -2946,7 +2946,7 @@ AutomationEventList LoadAutomationEventList(const char *fileName)
// Unload automation events list from file // Unload automation events list from file
void UnloadAutomationEventList(AutomationEventList list) void UnloadAutomationEventList(AutomationEventList list)
{ {
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
RL_FREE(list.events); RL_FREE(list.events);
#endif #endif
} }
@ -2956,7 +2956,7 @@ bool ExportAutomationEventList(AutomationEventList list, const char *fileName)
{ {
bool success = false; bool success = false;
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
// Export events as binary file // Export events as binary file
// TODO: Save to memory buffer and SaveFileData() // TODO: Save to memory buffer and SaveFileData()
/* /*
@ -3005,7 +3005,7 @@ bool ExportAutomationEventList(AutomationEventList list, const char *fileName)
// Setup automation event list to record to // Setup automation event list to record to
void SetAutomationEventList(AutomationEventList *list) void SetAutomationEventList(AutomationEventList *list)
{ {
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
currentEventList = list; currentEventList = list;
#endif #endif
} }
@ -3019,7 +3019,7 @@ void SetAutomationEventBaseFrame(int frame)
// Start recording automation events (AutomationEventList must be set) // Start recording automation events (AutomationEventList must be set)
void StartAutomationEventRecording(void) void StartAutomationEventRecording(void)
{ {
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
automationEventRecording = true; automationEventRecording = true;
#endif #endif
} }
@ -3027,7 +3027,7 @@ void StartAutomationEventRecording(void)
// Stop recording automation events // Stop recording automation events
void StopAutomationEventRecording(void) void StopAutomationEventRecording(void)
{ {
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
automationEventRecording = false; automationEventRecording = false;
#endif #endif
} }
@ -3035,7 +3035,7 @@ void StopAutomationEventRecording(void)
// Play a recorded automation event // Play a recorded automation event
void PlayAutomationEvent(AutomationEvent event) void PlayAutomationEvent(AutomationEvent event)
{ {
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
// WARNING: When should event be played? After/before/replace PollInputEvents()? -> Up to the user! // WARNING: When should event be played? After/before/replace PollInputEvents()? -> Up to the user!
if (!automationEventRecording) // TODO: Allow recording events while playing? if (!automationEventRecording) // TODO: Allow recording events while playing?
@ -3084,7 +3084,7 @@ void PlayAutomationEvent(AutomationEvent event)
{ {
CORE.Input.Gamepad.axisState[event.params[0]][event.params[1]] = ((float)event.params[2]/32768.0f); CORE.Input.Gamepad.axisState[event.params[0]][event.params[1]] = ((float)event.params[2]/32768.0f);
} break; } break;
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
case INPUT_GESTURE: GESTURES.current = event.params[0]; break; // param[0]: gesture (enum Gesture) -> rgestures.h: GESTURES.current case INPUT_GESTURE: GESTURES.current = event.params[0]; break; // param[0]: gesture (enum Gesture) -> rgestures.h: GESTURES.current
#endif #endif
// Window event // Window event
@ -3094,7 +3094,7 @@ void PlayAutomationEvent(AutomationEvent event)
case WINDOW_RESIZE: SetWindowSize(event.params[0], event.params[1]); break; case WINDOW_RESIZE: SetWindowSize(event.params[0], event.params[1]); break;
// Custom event // Custom event
#if defined(SUPPORT_SCREEN_CAPTURE) #if SUPPORT_SCREEN_CAPTURE
case ACTION_TAKE_SCREENSHOT: case ACTION_TAKE_SCREENSHOT:
{ {
TakeScreenshot(TextFormat("screenshot%03i.png", screenshotCounter)); TakeScreenshot(TextFormat("screenshot%03i.png", screenshotCounter));
@ -3516,7 +3516,7 @@ void InitTimer(void)
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often // However, it can also reduce overall system performance, because the thread scheduler switches tasks more often
// High resolutions can also prevent the CPU power management system from entering power-saving modes // High resolutions can also prevent the CPU power management system from entering power-saving modes
// Setting a higher resolution does not improve the accuracy of the high-resolution performance counter // Setting a higher resolution does not improve the accuracy of the high-resolution performance counter
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_DESKTOP_SDL) #if defined(_WIN32) && SUPPORT_WINMM_HIGHRES_TIMER && !SUPPORT_BUSY_WAIT_LOOP && !defined(PLATFORM_DESKTOP_SDL)
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms) timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
#endif #endif
@ -3762,7 +3762,7 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *fi
else TRACELOG(LOG_WARNING, "FILEIO: Directory cannot be opened (%s)", basePath); else TRACELOG(LOG_WARNING, "FILEIO: Directory cannot be opened (%s)", basePath);
} }
#if defined(SUPPORT_AUTOMATION_EVENTS) #if SUPPORT_AUTOMATION_EVENTS
// Automation event recording // Automation event recording
// NOTE: Recording is by default done at EndDrawing(), before PollInputEvents() // NOTE: Recording is by default done at EndDrawing(), before PollInputEvents()
static void RecordAutomationEvent(void) static void RecordAutomationEvent(void)
@ -4007,7 +4007,7 @@ static void RecordAutomationEvent(void)
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#if defined(SUPPORT_GESTURES_SYSTEM) #if SUPPORT_GESTURES_SYSTEM
// Gestures input currentEventList->events recording // Gestures input currentEventList->events recording
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
if (GESTURES.current != GESTURE_NONE) if (GESTURES.current != GESTURE_NONE)
@ -4029,7 +4029,7 @@ static void RecordAutomationEvent(void)
} }
#endif #endif
#if !defined(SUPPORT_MODULE_RTEXT) #if !SUPPORT_MODULE_RTEXT
// Formatting of text with variables to 'embed' // Formatting of text with variables to 'embed'
// WARNING: String returned will expire after this function is called MAX_TEXTFORMAT_BUFFERS times // WARNING: String returned will expire after this function is called MAX_TEXTFORMAT_BUFFERS times
const char *TextFormat(const char *text, ...) const char *TextFormat(const char *text, ...)

View File

@ -47,7 +47,7 @@
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags
#endif #endif
#if defined(SUPPORT_MODULE_RMODELS) #if SUPPORT_MODULE_RMODELS
#include "utils.h" // Required for: TRACELOG(), LoadFileData(), LoadFileText(), SaveFileText() #include "utils.h" // Required for: TRACELOG(), LoadFileData(), LoadFileText(), SaveFileText()
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
@ -58,7 +58,7 @@
#include <string.h> // Required for: memcmp(), strlen(), strncpy() #include <string.h> // Required for: memcmp(), strlen(), strncpy()
#include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf() #include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf()
#if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL) #if SUPPORT_FILEFORMAT_OBJ || SUPPORT_FILEFORMAT_MTL
#define TINYOBJ_MALLOC RL_MALLOC #define TINYOBJ_MALLOC RL_MALLOC
#define TINYOBJ_CALLOC RL_CALLOC #define TINYOBJ_CALLOC RL_CALLOC
#define TINYOBJ_REALLOC RL_REALLOC #define TINYOBJ_REALLOC RL_REALLOC
@ -68,7 +68,7 @@
#include "external/tinyobj_loader_c.h" // OBJ/MTL file formats loading #include "external/tinyobj_loader_c.h" // OBJ/MTL file formats loading
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_GLTF
#define CGLTF_MALLOC RL_MALLOC #define CGLTF_MALLOC RL_MALLOC
#define CGLTF_FREE RL_FREE #define CGLTF_FREE RL_FREE
@ -76,7 +76,7 @@
#include "external/cgltf.h" // glTF file format loading #include "external/cgltf.h" // glTF file format loading
#endif #endif
#if defined(SUPPORT_FILEFORMAT_VOX) #if SUPPORT_FILEFORMAT_VOX
#define VOX_MALLOC RL_MALLOC #define VOX_MALLOC RL_MALLOC
#define VOX_CALLOC RL_CALLOC #define VOX_CALLOC RL_CALLOC
#define VOX_REALLOC RL_REALLOC #define VOX_REALLOC RL_REALLOC
@ -86,8 +86,8 @@
#include "external/vox_loader.h" // VOX file format loading (MagikaVoxel) #include "external/vox_loader.h" // VOX file format loading (MagikaVoxel)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_M3D) #if SUPPORT_FILEFORMAT_M3D
#define M3D_MALLOC RL_MALLOC #define M3D_MALLOC RL_MALLOC
#define M3D_REALLOC RL_REALLOC #define M3D_REALLOC RL_REALLOC
#define M3D_FREE RL_FREE #define M3D_FREE RL_FREE
@ -95,7 +95,7 @@
#include "external/m3d.h" // Model3D file format loading #include "external/m3d.h" // Model3D file format loading
#endif #endif
#if defined(SUPPORT_MESH_GENERATION) #if SUPPORT_MESH_GENERATION
#define PAR_MALLOC(T, N) ((T*)RL_MALLOC(N*sizeof(T))) #define PAR_MALLOC(T, N) ((T*)RL_MALLOC(N*sizeof(T)))
#define PAR_CALLOC(T, N) ((T*)RL_CALLOC(N*sizeof(T), 1)) #define PAR_CALLOC(T, N) ((T*)RL_CALLOC(N*sizeof(T), 1))
#define PAR_REALLOC(T, BUF, N) ((T*)RL_REALLOC(BUF, sizeof(T)*(N))) #define PAR_REALLOC(T, BUF, N) ((T*)RL_REALLOC(BUF, sizeof(T)*(N)))
@ -146,25 +146,25 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_OBJ) #if SUPPORT_FILEFORMAT_OBJ
static Model LoadOBJ(const char *fileName); // Load OBJ mesh data static Model LoadOBJ(const char *fileName); // Load OBJ mesh data
#endif #endif
#if defined(SUPPORT_FILEFORMAT_IQM) #if SUPPORT_FILEFORMAT_IQM
static Model LoadIQM(const char *fileName); // Load IQM mesh data static Model LoadIQM(const char *fileName); // Load IQM mesh data
static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCount); // Load IQM animation data static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCount); // Load IQM animation data
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_GLTF
static Model LoadGLTF(const char *fileName); // Load GLTF mesh data static Model LoadGLTF(const char *fileName); // Load GLTF mesh data
static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCount); // Load GLTF animation data static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCount); // Load GLTF animation data
#endif #endif
#if defined(SUPPORT_FILEFORMAT_VOX) #if SUPPORT_FILEFORMAT_VOX
static Model LoadVOX(const char *filename); // Load VOX mesh data static Model LoadVOX(const char *filename); // Load VOX mesh data
#endif #endif
#if defined(SUPPORT_FILEFORMAT_M3D) #if SUPPORT_FILEFORMAT_M3D
static Model LoadM3D(const char *filename); // Load M3D mesh data static Model LoadM3D(const char *filename); // Load M3D mesh data
static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCount); // Load M3D animation data static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCount); // Load M3D animation data
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL) #if SUPPORT_FILEFORMAT_OBJ || SUPPORT_FILEFORMAT_MTL
static void ProcessMaterialsOBJ(Material *rayMaterials, tinyobj_material_t *materials, int materialCount); // Process obj materials static void ProcessMaterialsOBJ(Material *rayMaterials, tinyobj_material_t *materials, int materialCount); // Process obj materials
#endif #endif
@ -1091,19 +1091,19 @@ Model LoadModel(const char *fileName)
{ {
Model model = { 0 }; Model model = { 0 };
#if defined(SUPPORT_FILEFORMAT_OBJ) #if SUPPORT_FILEFORMAT_OBJ
if (IsFileExtension(fileName, ".obj")) model = LoadOBJ(fileName); if (IsFileExtension(fileName, ".obj")) model = LoadOBJ(fileName);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_IQM) #if SUPPORT_FILEFORMAT_IQM
if (IsFileExtension(fileName, ".iqm")) model = LoadIQM(fileName); if (IsFileExtension(fileName, ".iqm")) model = LoadIQM(fileName);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_GLTF
if (IsFileExtension(fileName, ".gltf") || IsFileExtension(fileName, ".glb")) model = LoadGLTF(fileName); if (IsFileExtension(fileName, ".gltf") || IsFileExtension(fileName, ".glb")) model = LoadGLTF(fileName);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_VOX) #if SUPPORT_FILEFORMAT_VOX
if (IsFileExtension(fileName, ".vox")) model = LoadVOX(fileName); if (IsFileExtension(fileName, ".vox")) model = LoadVOX(fileName);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_M3D) #if SUPPORT_FILEFORMAT_M3D
if (IsFileExtension(fileName, ".m3d")) model = LoadM3D(fileName); if (IsFileExtension(fileName, ".m3d")) model = LoadM3D(fileName);
#endif #endif
@ -2111,7 +2111,7 @@ bool ExportMeshAsCode(Mesh mesh, const char *fileName)
return success; return success;
} }
#if defined(SUPPORT_FILEFORMAT_OBJ) || defined(SUPPORT_FILEFORMAT_MTL) #if SUPPORT_FILEFORMAT_OBJ || SUPPORT_FILEFORMAT_MTL
// Process obj materials // Process obj materials
static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, int materialCount) static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, int materialCount)
{ {
@ -2155,7 +2155,7 @@ Material *LoadMaterials(const char *fileName, int *materialCount)
// TODO: Support IQM and GLTF for materials parsing // TODO: Support IQM and GLTF for materials parsing
#if defined(SUPPORT_FILEFORMAT_MTL) #if SUPPORT_FILEFORMAT_MTL
if (IsFileExtension(fileName, ".mtl")) if (IsFileExtension(fileName, ".mtl"))
{ {
tinyobj_material_t *mats = NULL; tinyobj_material_t *mats = NULL;
@ -2248,13 +2248,13 @@ ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount)
{ {
ModelAnimation *animations = NULL; ModelAnimation *animations = NULL;
#if defined(SUPPORT_FILEFORMAT_IQM) #if SUPPORT_FILEFORMAT_IQM
if (IsFileExtension(fileName, ".iqm")) animations = LoadModelAnimationsIQM(fileName, animCount); if (IsFileExtension(fileName, ".iqm")) animations = LoadModelAnimationsIQM(fileName, animCount);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_M3D) #if SUPPORT_FILEFORMAT_M3D
if (IsFileExtension(fileName, ".m3d")) animations = LoadModelAnimationsM3D(fileName, animCount); if (IsFileExtension(fileName, ".m3d")) animations = LoadModelAnimationsM3D(fileName, animCount);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_GLTF
if (IsFileExtension(fileName, ".gltf;.glb")) animations = LoadModelAnimationsGLTF(fileName, animCount); if (IsFileExtension(fileName, ".gltf;.glb")) animations = LoadModelAnimationsGLTF(fileName, animCount);
#endif #endif
@ -2402,7 +2402,7 @@ bool IsModelAnimationValid(Model model, ModelAnimation anim)
return result; return result;
} }
#if defined(SUPPORT_MESH_GENERATION) #if SUPPORT_MESH_GENERATION
// Generate polygonal mesh // Generate polygonal mesh
Mesh GenMeshPoly(int sides, float radius) Mesh GenMeshPoly(int sides, float radius)
{ {
@ -4157,7 +4157,7 @@ RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Ve
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Definition // Module specific Functions Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_IQM) || defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_IQM || SUPPORT_FILEFORMAT_GLTF
// Build pose from parent joints // Build pose from parent joints
// NOTE: Required for animations loading (required by IQM and GLTF) // NOTE: Required for animations loading (required by IQM and GLTF)
static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform *transforms) static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform *transforms)
@ -4180,7 +4180,7 @@ static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OBJ) #if SUPPORT_FILEFORMAT_OBJ
// Load OBJ mesh data // Load OBJ mesh data
// //
// Keep the following information in mind when reading this // Keep the following information in mind when reading this
@ -4425,7 +4425,7 @@ static Model LoadOBJ(const char *fileName)
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_IQM) #if SUPPORT_FILEFORMAT_IQM
// Load IQM mesh data // Load IQM mesh data
static Model LoadIQM(const char *fileName) static Model LoadIQM(const char *fileName)
{ {
@ -5043,7 +5043,7 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCou
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GLTF) #if SUPPORT_FILEFORMAT_GLTF
// Load file data callback for cgltf // Load file data callback for cgltf
static cgltf_result LoadFileGLTFCallback(const struct cgltf_memory_options *memoryOptions, const struct cgltf_file_options *fileOptions, const char *path, cgltf_size *size, void **data) static cgltf_result LoadFileGLTFCallback(const struct cgltf_memory_options *memoryOptions, const struct cgltf_file_options *fileOptions, const char *path, cgltf_size *size, void **data)
{ {
@ -6219,7 +6219,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_VOX) #if SUPPORT_FILEFORMAT_VOX
// Load VOX (MagicaVoxel) mesh data // Load VOX (MagicaVoxel) mesh data
static Model LoadVOX(const char *fileName) static Model LoadVOX(const char *fileName)
{ {
@ -6329,7 +6329,7 @@ static Model LoadVOX(const char *fileName)
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_M3D) #if SUPPORT_FILEFORMAT_M3D
// Hook LoadFileData()/UnloadFileData() calls to M3D loaders // Hook LoadFileData()/UnloadFileData() calls to M3D loaders
unsigned char *m3d_loaderhook(char *fn, unsigned int *len) { return LoadFileData((const char *)fn, (int *)len); } unsigned char *m3d_loaderhook(char *fn, unsigned int *len) { return LoadFileData((const char *)fn, (int *)len); }
void m3d_freehook(void *data) { UnloadFileData((unsigned char *)data); } void m3d_freehook(void *data) { UnloadFileData((unsigned char *)data); }

View File

@ -51,7 +51,7 @@
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags
#endif #endif
#if defined(SUPPORT_MODULE_RSHAPES) #if SUPPORT_MODULE_RSHAPES
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
@ -132,7 +132,7 @@ void DrawPixel(int posX, int posY, Color color)
// Draw a pixel (Vector version) // Draw a pixel (Vector version)
void DrawPixelV(Vector2 position, Color color) void DrawPixelV(Vector2 position, Color color)
{ {
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -310,7 +310,7 @@ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endA
float stepLength = (endAngle - startAngle)/(float)segments; float stepLength = (endAngle - startAngle)/(float)segments;
float angle = startAngle; float angle = startAngle;
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -538,7 +538,7 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startA
float stepLength = (endAngle - startAngle)/(float)segments; float stepLength = (endAngle - startAngle)/(float)segments;
float angle = startAngle; float angle = startAngle;
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -718,7 +718,7 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
bottomRight.y = y + (dx + rec.width)*sinRotation + (dy + rec.height)*cosRotation; bottomRight.y = y + (dx + rec.width)*sinRotation + (dy + rec.height)*cosRotation;
} }
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -825,7 +825,7 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
rlEnd(); rlEnd();
/* /*
// Previous implementation, it has issues... but it does not require view matrix... // Previous implementation, it has issues... but it does not require view matrix...
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
DrawRectangle(posX, posY, width, 1, color); DrawRectangle(posX, posY, width, 1, color);
DrawRectangle(posX + width - 1, posY + 1, 1, height - 2, color); DrawRectangle(posX + width - 1, posY + 1, 1, height - 2, color);
DrawRectangle(posX, posY + height - 1, width, 1, color); DrawRectangle(posX, posY + height - 1, width, 1, color);
@ -935,7 +935,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
const Vector2 centers[4] = { point[8], point[9], point[10], point[11] }; const Vector2 centers[4] = { point[8], point[9], point[10], point[11] };
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f }; const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f };
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -1178,7 +1178,7 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
if (lineThick > 1) if (lineThick > 1)
{ {
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -1354,7 +1354,7 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
// NOTE: Vertex must be provided in counter-clockwise order // NOTE: Vertex must be provided in counter-clockwise order
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
{ {
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -1469,7 +1469,7 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col
float centralAngle = rotation*DEG2RAD; float centralAngle = rotation*DEG2RAD;
float angleStep = 360.0f/(float)sides*DEG2RAD; float angleStep = 360.0f/(float)sides*DEG2RAD;
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();
@ -1538,7 +1538,7 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
float exteriorAngle = 360.0f/(float)sides*DEG2RAD; float exteriorAngle = 360.0f/(float)sides*DEG2RAD;
float innerRadius = radius - (lineThick*cosf(DEG2RAD*exteriorAngle/2.0f)); float innerRadius = radius - (lineThick*cosf(DEG2RAD*exteriorAngle/2.0f));
#if defined(SUPPORT_QUADS_DRAW_MODE) #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);
Rectangle shapeRect = GetShapesTextureRectangle(); Rectangle shapeRect = GetShapesTextureRectangle();

View File

@ -60,7 +60,7 @@
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags
#endif #endif
#if defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RTEXT
#include "utils.h" // Required for: LoadFile*() #include "utils.h" // Required for: LoadFile*()
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro() #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro()
@ -71,7 +71,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()] #include <stdarg.h> // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()]
#include <ctype.h> // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()] #include <ctype.h> // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()]
#if defined(SUPPORT_FILEFORMAT_TTF) || defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_TTF || SUPPORT_FILEFORMAT_BDF
#if defined(__GNUC__) // GCC and Clang #if defined(__GNUC__) // GCC and Clang
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
@ -87,7 +87,7 @@
#endif #endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_TTF) #if SUPPORT_FILEFORMAT_TTF
#if defined(__GNUC__) // GCC and Clang #if defined(__GNUC__) // GCC and Clang
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
@ -125,7 +125,7 @@
// Global variables // Global variables
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
extern bool isGpuReady; extern bool isGpuReady;
#if defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_DEFAULT_FONT
// Default font provided by raylib // Default font provided by raylib
// NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core] // NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core]
static Font defaultFont = { 0 }; static Font defaultFont = { 0 };
@ -139,15 +139,15 @@ static Font defaultFont = { 0 };
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_FNT) #if SUPPORT_FILEFORMAT_FNT
static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file) static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_BDF
static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize); static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize);
#endif #endif
static int textLineSpacing = 2; // Text vertical line spacing in pixels (between lines) static int textLineSpacing = 2; // Text vertical line spacing in pixels (between lines)
#if defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_DEFAULT_FONT
extern void LoadFontDefault(void); extern void LoadFontDefault(void);
extern void UnloadFontDefault(void); extern void UnloadFontDefault(void);
#endif #endif
@ -155,7 +155,7 @@ extern void UnloadFontDefault(void);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Functions Definition // Module Functions Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_DEFAULT_FONT
// Load raylib default font // Load raylib default font
extern void LoadFontDefault(void) extern void LoadFontDefault(void)
{ {
@ -318,7 +318,7 @@ extern void UnloadFontDefault(void)
// Get the default font, useful to be used with extended parameters // Get the default font, useful to be used with extended parameters
Font GetFontDefault() Font GetFontDefault()
{ {
#if defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_DEFAULT_FONT
return defaultFont; return defaultFont;
#else #else
Font font = { 0 }; Font font = { 0 };
@ -345,15 +345,15 @@ Font LoadFont(const char *fileName)
Font font = { 0 }; Font font = { 0 };
#if defined(SUPPORT_FILEFORMAT_TTF) #if SUPPORT_FILEFORMAT_TTF
if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
else else
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FNT) #if SUPPORT_FILEFORMAT_FNT
if (IsFileExtension(fileName, ".fnt")) font = LoadBMFont(fileName); if (IsFileExtension(fileName, ".fnt")) font = LoadBMFont(fileName);
else else
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_BDF
if (IsFileExtension(fileName, ".bdf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); if (IsFileExtension(fileName, ".bdf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
else else
#endif #endif
@ -535,7 +535,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
font.glyphCount = (codepointCount > 0)? codepointCount : 95; font.glyphCount = (codepointCount > 0)? codepointCount : 95;
font.glyphPadding = 0; font.glyphPadding = 0;
#if defined(SUPPORT_FILEFORMAT_TTF) #if SUPPORT_FILEFORMAT_TTF
if (TextIsEqual(fileExtLower, ".ttf") || if (TextIsEqual(fileExtLower, ".ttf") ||
TextIsEqual(fileExtLower, ".otf")) TextIsEqual(fileExtLower, ".otf"))
{ {
@ -543,7 +543,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
} }
else else
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_BDF
if (TextIsEqual(fileExtLower, ".bdf")) if (TextIsEqual(fileExtLower, ".bdf"))
{ {
font.glyphs = LoadFontDataBDF(fileData, dataSize, codepoints, font.glyphCount, &font.baseSize); font.glyphs = LoadFontDataBDF(fileData, dataSize, codepoints, font.glyphCount, &font.baseSize);
@ -554,7 +554,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
font.glyphs = NULL; font.glyphs = NULL;
} }
#if defined(SUPPORT_FILEFORMAT_TTF) || defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_TTF || SUPPORT_FILEFORMAT_BDF
if (font.glyphs != NULL) if (font.glyphs != NULL)
{ {
font.glyphPadding = FONT_TTF_DEFAULT_CHARS_PADDING; font.glyphPadding = FONT_TTF_DEFAULT_CHARS_PADDING;
@ -614,7 +614,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
GlyphInfo *chars = NULL; GlyphInfo *chars = NULL;
#if defined(SUPPORT_FILEFORMAT_TTF) #if SUPPORT_FILEFORMAT_TTF
// Load font data (including pixel data) from TTF memory file // Load font data (including pixel data) from TTF memory file
// NOTE: Loaded information should be enough to generate font image atlas, using any packaging method // NOTE: Loaded information should be enough to generate font image atlas, using any packaging method
if (fileData != NULL) if (fileData != NULL)
@ -734,7 +734,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
// Generate image font atlas using chars info // Generate image font atlas using chars info
// NOTE: Packing method: 0-Default, 1-Skyline // NOTE: Packing method: 0-Default, 1-Skyline
#if defined(SUPPORT_FILEFORMAT_TTF) || defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_TTF || SUPPORT_FILEFORMAT_BDF
Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod) Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod)
{ {
Image atlas = { 0 }; Image atlas = { 0 };
@ -901,7 +901,7 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
RL_FREE(context); RL_FREE(context);
} }
#if defined(SUPPORT_FONT_ATLAS_WHITE_REC) #if SUPPORT_FONT_ATLAS_WHITE_REC
// Add a 3x3 white rectangle at the bottom-right corner of the generated atlas, // Add a 3x3 white rectangle at the bottom-right corner of the generated atlas,
// useful to use as the white texture to draw shapes with raylib, using this rectangle // useful to use as the white texture to draw shapes with raylib, using this rectangle
// shapes and text can be backed into a single draw call: SetShapesTexture() // shapes and text can be backed into a single draw call: SetShapesTexture()
@ -1487,7 +1487,7 @@ float TextToFloat(const char *text)
return value*sign; return value*sign;
} }
#if defined(SUPPORT_TEXT_MANIPULATION) #if SUPPORT_TEXT_MANIPULATION
// Copy one string to another, returns bytes copied // Copy one string to another, returns bytes copied
int TextCopy(char *dst, const char *src) int TextCopy(char *dst, const char *src)
{ {
@ -2136,7 +2136,7 @@ int GetCodepointPrevious(const char *text, int *codepointSize)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Definition // Module specific Functions Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_FNT) || defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_FNT || SUPPORT_FILEFORMAT_BDF
// Read a line from memory // Read a line from memory
// REQUIRES: memcpy() // REQUIRES: memcpy()
// NOTE: Returns the number of bytes read // NOTE: Returns the number of bytes read
@ -2150,7 +2150,7 @@ static int GetLine(const char *origin, char *buffer, int maxLength)
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FNT) #if SUPPORT_FILEFORMAT_FNT
// Load a BMFont file (AngelCode font file) // Load a BMFont file (AngelCode font file)
// REQUIRES: strstr(), sscanf(), strrchr(), memcpy() // REQUIRES: strstr(), sscanf(), strrchr(), memcpy()
static Font LoadBMFont(const char *fileName) static Font LoadBMFont(const char *fileName)
@ -2320,7 +2320,7 @@ static Font LoadBMFont(const char *fileName)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BDF) #if SUPPORT_FILEFORMAT_BDF
// Convert hexadecimal to decimal (single digit) // Convert hexadecimal to decimal (single digit)
static unsigned char HexToInt(char hex) static unsigned char HexToInt(char hex)

View File

@ -68,7 +68,7 @@
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags
#endif #endif
#if defined(SUPPORT_MODULE_RTEXTURES) #if SUPPORT_MODULE_RTEXTURES
#include "utils.h" // Required for: TRACELOG() #include "utils.h" // Required for: TRACELOG()
#include "rlgl.h" // OpenGL abstraction layer to multiple versions #include "rlgl.h" // OpenGL abstraction layer to multiple versions
@ -79,47 +79,47 @@
#include <stdio.h> // Required for: sprintf() [Used in ExportImageAsCode()] #include <stdio.h> // Required for: sprintf() [Used in ExportImageAsCode()]
// Support only desired texture formats on stb_image // Support only desired texture formats on stb_image
#if !defined(SUPPORT_FILEFORMAT_BMP) #if !SUPPORT_FILEFORMAT_BMP
#define STBI_NO_BMP #define STBI_NO_BMP
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_PNG) #if !SUPPORT_FILEFORMAT_PNG
#define STBI_NO_PNG #define STBI_NO_PNG
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_TGA) #if !SUPPORT_FILEFORMAT_TGA
#define STBI_NO_TGA #define STBI_NO_TGA
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_JPG) #if !SUPPORT_FILEFORMAT_JPG
#define STBI_NO_JPEG // Image format .jpg and .jpeg #define STBI_NO_JPEG // Image format .jpg and .jpeg
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_PSD) #if !SUPPORT_FILEFORMAT_PSD
#define STBI_NO_PSD #define STBI_NO_PSD
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_GIF) #if !SUPPORT_FILEFORMAT_GIF
#define STBI_NO_GIF #define STBI_NO_GIF
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_PIC) #if !SUPPORT_FILEFORMAT_PIC
#define STBI_NO_PIC #define STBI_NO_PIC
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_HDR) #if !SUPPORT_FILEFORMAT_HDR
#define STBI_NO_HDR #define STBI_NO_HDR
#endif #endif
#if !defined(SUPPORT_FILEFORMAT_PNM) #if !SUPPORT_FILEFORMAT_PNM
#define STBI_NO_PNM #define STBI_NO_PNM
#endif #endif
#if defined(SUPPORT_FILEFORMAT_DDS) #if SUPPORT_FILEFORMAT_DDS
#define RL_GPUTEX_SUPPORT_DDS #define RL_GPUTEX_SUPPORT_DDS
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PKM) #if SUPPORT_FILEFORMAT_PNM
#define RL_GPUTEX_SUPPORT_PKM #define RL_GPUTEX_SUPPORT_PKM
#endif #endif
#if defined(SUPPORT_FILEFORMAT_KTX) #if SUPPORT_FILEFORMAT_KTX
#define RL_GPUTEX_SUPPORT_KTX #define RL_GPUTEX_SUPPORT_KTX
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PVR) #if SUPPORT_FILEFORMAT_PVR
#define RL_GPUTEX_SUPPORT_PVR #define RL_GPUTEX_SUPPORT_PVR
#endif #endif
#if defined(SUPPORT_FILEFORMAT_ASTC) #if SUPPORT_FILEFORMAT_ASTC
#define RL_GPUTEX_SUPPORT_ASTC #define RL_GPUTEX_SUPPORT_ASTC
#endif #endif
@ -128,15 +128,15 @@
#define STBI_NO_SIMD #define STBI_NO_SIMD
#endif #endif
#if (defined(SUPPORT_FILEFORMAT_BMP) || \ #if (SUPPORT_FILEFORMAT_BMP || \
defined(SUPPORT_FILEFORMAT_PNG) || \ SUPPORT_FILEFORMAT_PNG || \
defined(SUPPORT_FILEFORMAT_TGA) || \ SUPPORT_FILEFORMAT_TGA || \
defined(SUPPORT_FILEFORMAT_JPG) || \ SUPPORT_FILEFORMAT_JPG || \
defined(SUPPORT_FILEFORMAT_PSD) || \ SUPPORT_FILEFORMAT_PSD || \
defined(SUPPORT_FILEFORMAT_GIF) || \ SUPPORT_FILEFORMAT_GIF || \
defined(SUPPORT_FILEFORMAT_HDR) || \ SUPPORT_FILEFORMAT_HDR || \
defined(SUPPORT_FILEFORMAT_PIC) || \ SUPPORT_FILEFORMAT_PIC || \
defined(SUPPORT_FILEFORMAT_PNM)) SUPPORT_FILEFORMAT_PNM)
#if defined(__GNUC__) // GCC and Clang #if defined(__GNUC__) // GCC and Clang
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -158,11 +158,11 @@
#endif #endif
#endif #endif
#if (defined(SUPPORT_FILEFORMAT_DDS) || \ #if (SUPPORT_FILEFORMAT_DDS || \
defined(SUPPORT_FILEFORMAT_PKM) || \ SUPPORT_FILEFORMAT_PNM || \
defined(SUPPORT_FILEFORMAT_KTX) || \ SUPPORT_FILEFORMAT_KTX || \
defined(SUPPORT_FILEFORMAT_PVR) || \ SUPPORT_FILEFORMAT_PVR || \
defined(SUPPORT_FILEFORMAT_ASTC)) SUPPORT_FILEFORMAT_ASTC)
#if defined(__GNUC__) // GCC and Clang #if defined(__GNUC__) // GCC and Clang
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -178,7 +178,7 @@
#endif #endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOI) #if SUPPORT_FILEFORMAT_QOI
#define QOI_MALLOC RL_MALLOC #define QOI_MALLOC RL_MALLOC
#define QOI_FREE RL_FREE #define QOI_FREE RL_FREE
@ -196,7 +196,7 @@
#endif #endif
#if defined(SUPPORT_IMAGE_EXPORT) #if SUPPORT_IMAGE_EXPORT
#define STBIW_MALLOC RL_MALLOC #define STBIW_MALLOC RL_MALLOC
#define STBIW_FREE RL_FREE #define STBIW_FREE RL_FREE
#define STBIW_REALLOC RL_REALLOC #define STBIW_REALLOC RL_REALLOC
@ -205,7 +205,7 @@
#include "external/stb_image_write.h" // Required for: stbi_write_*() #include "external/stb_image_write.h" // Required for: stbi_write_*()
#endif #endif
#if defined(SUPPORT_IMAGE_GENERATION) #if SUPPORT_IMAGE_GENERATION
#define STB_PERLIN_IMPLEMENTATION #define STB_PERLIN_IMPLEMENTATION
#include "external/stb_perlin.h" // Required for: stb_perlin_fbm_noise3 #include "external/stb_perlin.h" // Required for: stb_perlin_fbm_noise3
#endif #endif
@ -267,15 +267,15 @@ Image LoadImage(const char *fileName)
{ {
Image image = { 0 }; Image image = { 0 };
#if defined(SUPPORT_FILEFORMAT_PNG) || \ #if SUPPORT_FILEFORMAT_PNG || \
defined(SUPPORT_FILEFORMAT_BMP) || \ SUPPORT_FILEFORMAT_BMP || \
defined(SUPPORT_FILEFORMAT_TGA) || \ SUPPORT_FILEFORMAT_TGA || \
defined(SUPPORT_FILEFORMAT_JPG) || \ SUPPORT_FILEFORMAT_JPG || \
defined(SUPPORT_FILEFORMAT_GIF) || \ SUPPORT_FILEFORMAT_GIF || \
defined(SUPPORT_FILEFORMAT_PIC) || \ SUPPORT_FILEFORMAT_PIC || \
defined(SUPPORT_FILEFORMAT_HDR) || \ SUPPORT_FILEFORMAT_HDR || \
defined(SUPPORT_FILEFORMAT_PNM) || \ SUPPORT_FILEFORMAT_PNM || \
defined(SUPPORT_FILEFORMAT_PSD) SUPPORT_FILEFORMAT_PSD
#define STBI_REQUIRED #define STBI_REQUIRED
#endif #endif
@ -337,7 +337,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
Image image = { 0 }; Image image = { 0 };
int frameCount = 0; int frameCount = 0;
#if defined(SUPPORT_FILEFORMAT_GIF) #if SUPPORT_FILEFORMAT_GIF
if (IsFileExtension(fileName, ".gif")) if (IsFileExtension(fileName, ".gif"))
{ {
int dataSize = 0; int dataSize = 0;
@ -382,7 +382,7 @@ Image LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileDat
// Security check for input data // Security check for input data
if ((fileType == NULL) || (fileData == NULL) || (dataSize == 0)) return image; if ((fileType == NULL) || (fileData == NULL) || (dataSize == 0)) return image;
#if defined(SUPPORT_FILEFORMAT_GIF) #if SUPPORT_FILEFORMAT_GIF
if ((strcmp(fileType, ".gif") == 0) || (strcmp(fileType, ".GIF") == 0)) if ((strcmp(fileType, ".gif") == 0) || (strcmp(fileType, ".GIF") == 0))
{ {
if (fileData != NULL) if (fileData != NULL)
@ -429,30 +429,30 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
} }
if ((false) if ((false)
#if defined(SUPPORT_FILEFORMAT_PNG) #if SUPPORT_FILEFORMAT_PNG
|| (strcmp(fileType, ".png") == 0) || (strcmp(fileType, ".PNG") == 0) || (strcmp(fileType, ".png") == 0) || (strcmp(fileType, ".PNG") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BMP) #if SUPPORT_FILEFORMAT_BMP
|| (strcmp(fileType, ".bmp") == 0) || (strcmp(fileType, ".BMP") == 0) || (strcmp(fileType, ".bmp") == 0) || (strcmp(fileType, ".BMP") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_TGA) #if SUPPORT_FILEFORMAT_TGA
|| (strcmp(fileType, ".tga") == 0) || (strcmp(fileType, ".TGA") == 0) || (strcmp(fileType, ".tga") == 0) || (strcmp(fileType, ".TGA") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_JPG) #if SUPPORT_FILEFORMAT_JPG
|| (strcmp(fileType, ".jpg") == 0) || (strcmp(fileType, ".jpeg") == 0) || (strcmp(fileType, ".jpg") == 0) || (strcmp(fileType, ".jpeg") == 0)
|| (strcmp(fileType, ".JPG") == 0) || (strcmp(fileType, ".JPEG") == 0) || (strcmp(fileType, ".JPG") == 0) || (strcmp(fileType, ".JPEG") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_GIF) #if SUPPORT_FILEFORMAT_GIF
|| (strcmp(fileType, ".gif") == 0) || (strcmp(fileType, ".GIF") == 0) || (strcmp(fileType, ".gif") == 0) || (strcmp(fileType, ".GIF") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PIC) #if SUPPORT_FILEFORMAT_PIC
|| (strcmp(fileType, ".pic") == 0) || (strcmp(fileType, ".PIC") == 0) || (strcmp(fileType, ".pic") == 0) || (strcmp(fileType, ".PIC") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PNM) #if SUPPORT_FILEFORMAT_PNM
|| (strcmp(fileType, ".ppm") == 0) || (strcmp(fileType, ".pgm") == 0) || (strcmp(fileType, ".ppm") == 0) || (strcmp(fileType, ".pgm") == 0)
|| (strcmp(fileType, ".PPM") == 0) || (strcmp(fileType, ".PGM") == 0) || (strcmp(fileType, ".PPM") == 0) || (strcmp(fileType, ".PGM") == 0)
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PSD) #if SUPPORT_FILEFORMAT_PSD
|| (strcmp(fileType, ".psd") == 0) || (strcmp(fileType, ".PSD") == 0) || (strcmp(fileType, ".psd") == 0) || (strcmp(fileType, ".PSD") == 0)
#endif #endif
) )
@ -477,7 +477,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
} }
#endif #endif
} }
#if defined(SUPPORT_FILEFORMAT_HDR) #if SUPPORT_FILEFORMAT_HDR
else if ((strcmp(fileType, ".hdr") == 0) || (strcmp(fileType, ".HDR") == 0)) else if ((strcmp(fileType, ".hdr") == 0) || (strcmp(fileType, ".HDR") == 0))
{ {
#if defined(STBI_REQUIRED) #if defined(STBI_REQUIRED)
@ -500,7 +500,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
#endif #endif
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOI) #if SUPPORT_FILEFORMAT_QOI
else if ((strcmp(fileType, ".qoi") == 0) || (strcmp(fileType, ".QOI") == 0)) else if ((strcmp(fileType, ".qoi") == 0) || (strcmp(fileType, ".QOI") == 0))
{ {
if (fileData != NULL) if (fileData != NULL)
@ -514,31 +514,31 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_DDS) #if SUPPORT_FILEFORMAT_DDS
else if ((strcmp(fileType, ".dds") == 0) || (strcmp(fileType, ".DDS") == 0)) else if ((strcmp(fileType, ".dds") == 0) || (strcmp(fileType, ".DDS") == 0))
{ {
image.data = rl_load_dds_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps); image.data = rl_load_dds_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PKM) #if SUPPORT_FILEFORMAT_PKM
else if ((strcmp(fileType, ".pkm") == 0) || (strcmp(fileType, ".PKM") == 0)) else if ((strcmp(fileType, ".pkm") == 0) || (strcmp(fileType, ".PKM") == 0))
{ {
image.data = rl_load_pkm_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps); image.data = rl_load_pkm_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_KTX) #if SUPPORT_FILEFORMAT_KTX
else if ((strcmp(fileType, ".ktx") == 0) || (strcmp(fileType, ".KTX") == 0)) else if ((strcmp(fileType, ".ktx") == 0) || (strcmp(fileType, ".KTX") == 0))
{ {
image.data = rl_load_ktx_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps); image.data = rl_load_ktx_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_PVR) #if SUPPORT_FILEFORMAT_PVR
else if ((strcmp(fileType, ".pvr") == 0) || (strcmp(fileType, ".PVR") == 0)) else if ((strcmp(fileType, ".pvr") == 0) || (strcmp(fileType, ".PVR") == 0))
{ {
image.data = rl_load_pvr_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps); image.data = rl_load_pvr_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps);
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_ASTC) #if SUPPORT_FILEFORMAT_ASTC
else if ((strcmp(fileType, ".astc") == 0) || (strcmp(fileType, ".ASTC") == 0)) else if ((strcmp(fileType, ".astc") == 0) || (strcmp(fileType, ".ASTC") == 0))
{ {
image.data = rl_load_astc_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps); image.data = rl_load_astc_from_memory(fileData, dataSize, &image.width, &image.height, &image.format, &image.mipmaps);
@ -628,7 +628,7 @@ bool ExportImage(Image image, const char *fileName)
// Security check for input data // Security check for input data
if ((image.width == 0) || (image.height == 0) || (image.data == NULL)) return result; if ((image.width == 0) || (image.height == 0) || (image.data == NULL)) return result;
#if defined(SUPPORT_IMAGE_EXPORT) #if SUPPORT_IMAGE_EXPORT
int channels = 4; int channels = 4;
bool allocatedData = false; bool allocatedData = false;
unsigned char *imgData = (unsigned char *)image.data; unsigned char *imgData = (unsigned char *)image.data;
@ -644,7 +644,7 @@ bool ExportImage(Image image, const char *fileName)
allocatedData = true; allocatedData = true;
} }
#if defined(SUPPORT_FILEFORMAT_PNG) #if SUPPORT_FILEFORMAT_PNG
if (IsFileExtension(fileName, ".png")) if (IsFileExtension(fileName, ".png"))
{ {
int dataSize = 0; int dataSize = 0;
@ -655,17 +655,17 @@ bool ExportImage(Image image, const char *fileName)
#else #else
if (false) { } if (false) { }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_BMP) #if SUPPORT_FILEFORMAT_BMP
else if (IsFileExtension(fileName, ".bmp")) result = stbi_write_bmp(fileName, image.width, image.height, channels, imgData); else if (IsFileExtension(fileName, ".bmp")) result = stbi_write_bmp(fileName, image.width, image.height, channels, imgData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_TGA) #if SUPPORT_FILEFORMAT_TGA
else if (IsFileExtension(fileName, ".tga")) result = stbi_write_tga(fileName, image.width, image.height, channels, imgData); else if (IsFileExtension(fileName, ".tga")) result = stbi_write_tga(fileName, image.width, image.height, channels, imgData);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_JPG) #if SUPPORT_FILEFORMAT_JPG
else if (IsFileExtension(fileName, ".jpg") || else if (IsFileExtension(fileName, ".jpg") ||
IsFileExtension(fileName, ".jpeg")) result = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100 IsFileExtension(fileName, ".jpeg")) result = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100
#endif #endif
#if defined(SUPPORT_FILEFORMAT_QOI) #if SUPPORT_FILEFORMAT_QOI
else if (IsFileExtension(fileName, ".qoi")) else if (IsFileExtension(fileName, ".qoi"))
{ {
channels = 0; channels = 0;
@ -685,7 +685,7 @@ bool ExportImage(Image image, const char *fileName)
} }
} }
#endif #endif
#if defined(SUPPORT_FILEFORMAT_KTX) #if SUPPORT_FILEFORMAT_KTX
else if (IsFileExtension(fileName, ".ktx")) else if (IsFileExtension(fileName, ".ktx"))
{ {
result = rl_save_ktx(fileName, image.data, image.width, image.height, image.format, image.mipmaps); result = rl_save_ktx(fileName, image.data, image.width, image.height, image.format, image.mipmaps);
@ -716,7 +716,7 @@ unsigned char *ExportImageToMemory(Image image, const char *fileType, int *dataS
// Security check for input data // Security check for input data
if ((image.width == 0) || (image.height == 0) || (image.data == NULL)) return NULL; if ((image.width == 0) || (image.height == 0) || (image.data == NULL)) return NULL;
#if defined(SUPPORT_IMAGE_EXPORT) #if SUPPORT_IMAGE_EXPORT
int channels = 4; int channels = 4;
if (image.format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) channels = 1; if (image.format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) channels = 1;
@ -724,7 +724,7 @@ unsigned char *ExportImageToMemory(Image image, const char *fileType, int *dataS
else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3; else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3;
else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4; else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4;
#if defined(SUPPORT_FILEFORMAT_PNG) #if SUPPORT_FILEFORMAT_PNG
if ((strcmp(fileType, ".png") == 0) || (strcmp(fileType, ".PNG") == 0)) if ((strcmp(fileType, ".png") == 0) || (strcmp(fileType, ".PNG") == 0))
{ {
fileData = stbi_write_png_to_mem((const unsigned char *)image.data, image.width*channels, image.width, image.height, channels, dataSize); fileData = stbi_write_png_to_mem((const unsigned char *)image.data, image.width*channels, image.width, image.height, channels, dataSize);
@ -741,7 +741,7 @@ bool ExportImageAsCode(Image image, const char *fileName)
{ {
bool success = false; bool success = false;
#if defined(SUPPORT_IMAGE_EXPORT) #if SUPPORT_IMAGE_EXPORT
#ifndef TEXT_BYTES_PER_LINE #ifndef TEXT_BYTES_PER_LINE
#define TEXT_BYTES_PER_LINE 20 #define TEXT_BYTES_PER_LINE 20
@ -814,7 +814,7 @@ Image GenImageColor(int width, int height, Color color)
return image; return image;
} }
#if defined(SUPPORT_IMAGE_GENERATION) #if SUPPORT_IMAGE_GENERATION
// Generate image: linear gradient // Generate image: linear gradient
// The direction value specifies the direction of the gradient (in degrees) // The direction value specifies the direction of the gradient (in degrees)
// with 0 being vertical (from top to bottom), 90 being horizontal (from left to right) // with 0 being vertical (from top to bottom), 90 being horizontal (from left to right)
@ -1449,7 +1449,7 @@ void ImageFormat(Image *image, int newFormat)
if (image->mipmaps > 1) if (image->mipmaps > 1)
{ {
image->mipmaps = 1; image->mipmaps = 1;
#if defined(SUPPORT_IMAGE_MANIPULATION) #if SUPPORT_IMAGE_MANIPULATION
if (image->data != NULL) ImageMipmaps(image); if (image->data != NULL) ImageMipmaps(image);
#endif #endif
} }
@ -1462,7 +1462,7 @@ void ImageFormat(Image *image, int newFormat)
Image ImageText(const char *text, int fontSize, Color color) Image ImageText(const char *text, int fontSize, Color color)
{ {
Image imText = { 0 }; Image imText = { 0 };
#if defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RTEXT
int defaultFontSize = 10; // Default Font chars height in pixel int defaultFontSize = 10; // Default Font chars height in pixel
if (fontSize < defaultFontSize) fontSize = defaultFontSize; if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = fontSize/defaultFontSize; int spacing = fontSize/defaultFontSize;
@ -1479,7 +1479,7 @@ Image ImageText(const char *text, int fontSize, Color color)
Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint)
{ {
Image imText = { 0 }; Image imText = { 0 };
#if defined(SUPPORT_MODULE_RTEXT) #if SUPPORT_MODULE_RTEXT
int size = (int)strlen(text); // Get size in bytes of text int size = (int)strlen(text); // Get size in bytes of text
int textOffsetX = 0; // Image drawing position X int textOffsetX = 0; // Image drawing position X
@ -1869,7 +1869,7 @@ void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, i
} }
} }
#if defined(SUPPORT_IMAGE_MANIPULATION) #if SUPPORT_IMAGE_MANIPULATION
// Convert image to POT (power-of-two) // Convert image to POT (power-of-two)
// NOTE: It could be useful on OpenGL ES 2.0 (RPI, HTML5) // NOTE: It could be useful on OpenGL ES 2.0 (RPI, HTML5)
void ImageToPOT(Image *image, Color fill) void ImageToPOT(Image *image, Color fill)
@ -4068,7 +4068,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
// Draw text (default font) within an image (destination) // Draw text (default font) within an image (destination)
void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color)
{ {
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) #if SUPPORT_MODULE_RTEXT && SUPPORT_DEFAULT_FONT
// Make sure default font is loaded to be used on image text drawing // Make sure default font is loaded to be used on image text drawing
if (GetFontDefault().texture.id == 0) LoadFontDefault(); if (GetFontDefault().texture.id == 0) LoadFontDefault();

View File

@ -104,7 +104,7 @@ void SetTraceLogLevel(int logType) { logTypeLevel = logType; }
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
void TraceLog(int logType, const char *text, ...) void TraceLog(int logType, const char *text, ...)
{ {
#if defined(SUPPORT_TRACELOG) #if SUPPORT_TRACELOG
// Message has level below current threshold, don't emit // Message has level below current threshold, don't emit
if (logType < logTypeLevel) return; if (logType < logTypeLevel) return;
@ -191,7 +191,7 @@ unsigned char *LoadFileData(const char *fileName, int *dataSize)
data = loadFileData(fileName, dataSize); data = loadFileData(fileName, dataSize);
return data; return data;
} }
#if defined(SUPPORT_STANDARD_FILEIO) #if SUPPORT_STANDARD_FILEIO
FILE *file = fopen(fileName, "rb"); FILE *file = fopen(fileName, "rb");
if (file != NULL) if (file != NULL)
@ -261,7 +261,7 @@ bool SaveFileData(const char *fileName, void *data, int dataSize)
{ {
return saveFileData(fileName, data, dataSize); return saveFileData(fileName, data, dataSize);
} }
#if defined(SUPPORT_STANDARD_FILEIO) #if SUPPORT_STANDARD_FILEIO
FILE *file = fopen(fileName, "wb"); FILE *file = fopen(fileName, "wb");
if (file != NULL) if (file != NULL)
@ -353,7 +353,7 @@ char *LoadFileText(const char *fileName)
text = loadFileText(fileName); text = loadFileText(fileName);
return text; return text;
} }
#if defined(SUPPORT_STANDARD_FILEIO) #if SUPPORT_STANDARD_FILEIO
FILE *file = fopen(fileName, "rt"); FILE *file = fopen(fileName, "rt");
if (file != NULL) if (file != NULL)
@ -415,7 +415,7 @@ bool SaveFileText(const char *fileName, char *text)
{ {
return saveFileText(fileName, text); return saveFileText(fileName, text);
} }
#if defined(SUPPORT_STANDARD_FILEIO) #if SUPPORT_STANDARD_FILEIO
FILE *file = fopen(fileName, "wt"); FILE *file = fopen(fileName, "wt");
if (file != NULL) if (file != NULL)

View File

@ -32,10 +32,10 @@
#include <android/asset_manager.h> // Required for: AAssetManager #include <android/asset_manager.h> // Required for: AAssetManager
#endif #endif
#if defined(SUPPORT_TRACELOG) #if SUPPORT_TRACELOG
#define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__) #define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
#if defined(SUPPORT_TRACELOG_DEBUG) #if SUPPORT_TRACELOG_DEBUG
#define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__) #define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__)
#else #else
#define TRACELOGD(...) (void)0 #define TRACELOGD(...) (void)0