diff --git a/src/core.c b/src/core.c index 98ed82e70..457d3b723 100644 --- a/src/core.c +++ b/src/core.c @@ -119,15 +119,15 @@ #include "config.h" // Defines module configuration flags #endif -#include "utils.h" // Required for: TRACELOG macros +#include "utils.h" // TRACELOG macros #if (defined(__linux__) || defined(PLATFORM_WEB)) && _POSIX_C_SOURCE < 199309L #undef _POSIX_C_SOURCE - #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext. + #define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext. #endif -#define RAYMATH_IMPLEMENTATION // Define external out-of-line implementation of raymath here -#include "raymath.h" // Required for: Vector3 and Matrix functions +#define RAYMATH_IMPLEMENTATION // Define external out-of-line implementation +#include "raymath.h" // Vector3, Quaternion and Matrix functionality #define RLGL_IMPLEMENTATION #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2 @@ -143,19 +143,20 @@ #endif #if defined(SUPPORT_GIF_RECORDING) - //#define MSF_GIF_MALLOC RL_MALLOC - //#define MSF_GIF_FREE RL_FREE + #define MSF_GIF_MALLOC(contextPointer, newSize) RL_MALLOC(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_IMPL - #include "external/msf_gif.h" // Support GIF recording + #include "external/msf_gif.h" // GIF recording functionality #endif #if defined(SUPPORT_COMPRESSION_API) #define SINFL_IMPLEMENTATION - #include "external/sinfl.h" + #include "external/sinfl.h" // Deflate (RFC 1951) decompressor #define SDEFL_IMPLEMENTATION - #include "external/sdefl.h" + #include "external/sdefl.h" // Deflate (RFC 1951) compressor #endif #include // Required for: srand(), rand(), atexit() @@ -179,7 +180,7 @@ #include // Required for: _getch(), _chdir() #define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir() #define CHDIR _chdir - #include // Required for _access() [Used in FileExists()] + #include // Required for: _access() [Used in FileExists()] #else #include // Required for: getch(), chdir() (POSIX), access() #define GETCWD getcwd @@ -220,9 +221,9 @@ #endif #if defined(PLATFORM_ANDROID) - //#include // Android sensors functions (accelerometer, gyroscope, light...) - #include // Defines AWINDOW_FLAG_FULLSCREEN and others - #include // Defines basic app state struct and manages activity + //#include // Required for: Android sensors functions (accelerometer, gyroscope, light...) + #include // Required for: AWINDOW_FLAG_FULLSCREEN definition and others + #include // Required for: android_app struct and activity management #include // Native platform windowing system interface //#include // OpenGL ES 2.0 library (not required in this module, only in rlgl) @@ -235,7 +236,7 @@ #include // POSIX threads management (inputs reading) #include // POSIX directory browsing - #include // UNIX System call for device-specific input/output operations - ioctl() + #include // Required for: ioctl() - UNIX System call for device-specific input/output operations #include // Linux: KDSKBMODE, K_MEDIUMRAM constants definition #include // Linux: Keycodes constants definition (KEY_A, ...) #include // Linux: Joystick support library @@ -256,10 +257,10 @@ #if defined(PLATFORM_WEB) #define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL) - #include "GLFW/glfw3.h" // GLFW3 library: Windows, OpenGL context and Input management + #include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management #include // Required for: timespec, nanosleep(), select() - POSIX - #include // Emscripten library - LLVM to JavaScript compiler + #include // Emscripten functionality for C #include // Emscripten HTML5 library #endif @@ -655,7 +656,7 @@ static void PlayAutomationEvent(unsigned int frame); // Play frame events #if defined(_WIN32) // NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required) -void __stdcall Sleep(unsigned long msTimeout); // Required for WaitTime() +void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime() #endif //---------------------------------------------------------------------------------- @@ -808,11 +809,9 @@ void InitWindow(int width, int height, const char *title) #endif #if defined(PLATFORM_WEB) - // Check fullscreen change events(note this is done on the window since most - // browsers don't support this on #canvas) + // Check fullscreen change events(note this is done on the window since most browsers don't support this on #canvas) emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 1, EmscriptenResizeCallback); - // Check Resize event (note this is done on the window since most browsers - // don't support this on #canvas) + // Check Resize event (note this is done on the window since most browsers don't support this on #canvas) emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 1, EmscriptenResizeCallback); // Trigger this once to get initial window sizing EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL); @@ -4794,7 +4793,7 @@ EM_JS(int, GetCanvasHeight, (), { return canvas.clientHeight; }); static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *e, void *userData) { // Don't resize non-resizeable windows - if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) return true; + if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) return 1; // This event is called whenever the window changes sizes, // so the size of the canvas object is explicitly retrieved below @@ -4808,13 +4807,15 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent * CORE.Window.currentFbo.height = height; CORE.Window.resizedLastFrame = true; - if (IsWindowFullscreen()) return true; + if (IsWindowFullscreen()) return 1; // Set current screen size CORE.Window.screen.width = width; CORE.Window.screen.height = height; // NOTE: Postprocessing texture is not scaled to new size + + return 0; } #endif diff --git a/src/raudio.c b/src/raudio.c index b5c2477f9..8f6d32e0a 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -128,7 +128,7 @@ // Type required before windows.h inclusion typedef struct tagMSG *LPMSG; -#include +#include // Windows functionality (miniaudio) // Type required by some unused function... typedef struct tagBITMAPINFOHEADER { @@ -145,9 +145,9 @@ typedef struct tagBITMAPINFOHEADER { DWORD biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER; -#include -#include -#include +#include // Component Object Model (COM) header +#include // Windows Multimedia, defines some WAVE structs +#include // Windows Multimedia, used by Windows GDI, defines DIBINDEX macro // Some required types defined for MSVC/TinyC compiler #if defined(_MSC_VER) || defined(__TINYC__) @@ -164,7 +164,7 @@ typedef struct tagBITMAPINFOHEADER { #define MA_NO_MP3 #define MINIAUDIO_IMPLEMENTATION //#define MA_DEBUG_OUTPUT -#include "external/miniaudio.h" // miniaudio library +#include "external/miniaudio.h" // Audio device initialization and management #undef PlaySound // Win32 API: windows.h > mmsystem.h defines PlaySound macro #include // Required for: malloc(), free() @@ -539,7 +539,7 @@ AudioBuffer *LoadAudioBuffer(ma_format format, ma_uint32 channels, ma_uint32 sam // Audio data runs through a format converter ma_data_converter_config converterConfig = ma_data_converter_config_init(format, AUDIO_DEVICE_FORMAT, channels, AUDIO_DEVICE_CHANNELS, sampleRate, AUDIO.System.device.sampleRate); - converterConfig.resampling.allowDynamicSampleRate = true; // Required for pitch shifting + converterConfig.resampling.allowDynamicSampleRate = true; // Pitch shifting ma_result result = ma_data_converter_init(&converterConfig, &audioBuffer->converter); diff --git a/src/raymath.h b/src/raymath.h index 55ca14e80..ea888cf01 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -46,7 +46,7 @@ //#define RAYMATH_HEADER_ONLY // NOTE: To compile functions as static inline, uncomment this line #ifndef RAYMATH_STANDALONE - #include "raylib.h" // Required for structs: Vector3, Matrix + #include "raylib.h" // Required for: Vector3, Matrix structs definition #endif #if defined(RAYMATH_IMPLEMENTATION) && defined(RAYMATH_HEADER_ONLY) diff --git a/src/rlgl.h b/src/rlgl.h index 6bdb0324e..a2d890e60 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -645,7 +645,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #if defined(GRAPHICS_API_OPENGL_11) #if defined(__APPLE__) #include // OpenGL 1.1 library for OSX - #include + #include // OpenGL extensions library #else // APIENTRY for OpenGL function pointer declarations is required #ifndef APIENTRY diff --git a/src/shapes.c b/src/shapes.c index 98852bc8c..6f8ae6490 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -1721,7 +1721,7 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2) //---------------------------------------------------------------------------------- // Cubic easing in-out -// NOTE: Required for DrawLineBezier() +// NOTE: Used by DrawLineBezier() only static float EaseCubicInOut(float t, float b, float c, float d) { if ((t /= 0.5f*d) < 1) return 0.5f*c*t*t*t + b; diff --git a/src/utils.h b/src/utils.h index 3d7a3798e..50f704201 100644 --- a/src/utils.h +++ b/src/utils.h @@ -69,7 +69,7 @@ extern "C" { // Prevents name mangling of functions //---------------------------------------------------------------------------------- #if defined(PLATFORM_ANDROID) void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initialize asset manager from android app -FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only! +FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only! #endif #ifdef __cplusplus