diff options
| author | raysan5 <[email protected]> | 2021-07-09 17:36:20 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2021-07-09 17:36:20 +0200 |
| commit | 5ed814e950e5017d9f70274e8555b6e28ebf6808 (patch) | |
| tree | c9f0c27dae750b2246b8ac309e3313516572b61a /src | |
| parent | 2156cd4a84fa61003be5cd70f1fac18521515c15 (diff) | |
| download | raylib-5ed814e950e5017d9f70274e8555b6e28ebf6808.tar.gz raylib-5ed814e950e5017d9f70274e8555b6e28ebf6808.zip | |
Minor tweaks and comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 47 | ||||
| -rw-r--r-- | src/raudio.c | 12 | ||||
| -rw-r--r-- | src/raymath.h | 2 | ||||
| -rw-r--r-- | src/rlgl.h | 2 | ||||
| -rw-r--r-- | src/shapes.c | 2 | ||||
| -rw-r--r-- | src/utils.h | 2 |
6 files changed, 34 insertions, 33 deletions
@@ -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 <stdlib.h> // Required for: srand(), rand(), atexit() @@ -179,7 +180,7 @@ #include <direct.h> // Required for: _getch(), _chdir() #define GETCWD _getcwd // NOTE: MSDN recommends not to use getcwd(), chdir() #define CHDIR _chdir - #include <io.h> // Required for _access() [Used in FileExists()] + #include <io.h> // Required for: _access() [Used in FileExists()] #else #include <unistd.h> // Required for: getch(), chdir() (POSIX), access() #define GETCWD getcwd @@ -220,9 +221,9 @@ #endif #if defined(PLATFORM_ANDROID) - //#include <android/sensor.h> // Android sensors functions (accelerometer, gyroscope, light...) - #include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others - #include <android_native_app_glue.h> // Defines basic app state struct and manages activity + //#include <android/sensor.h> // Required for: Android sensors functions (accelerometer, gyroscope, light...) + #include <android/window.h> // Required for: AWINDOW_FLAG_FULLSCREEN definition and others + #include <android_native_app_glue.h> // Required for: android_app struct and activity management #include <EGL/egl.h> // Native platform windowing system interface //#include <GLES2/gl2.h> // OpenGL ES 2.0 library (not required in this module, only in rlgl) @@ -235,7 +236,7 @@ #include <pthread.h> // POSIX threads management (inputs reading) #include <dirent.h> // POSIX directory browsing - #include <sys/ioctl.h> // UNIX System call for device-specific input/output operations - ioctl() + #include <sys/ioctl.h> // Required for: ioctl() - UNIX System call for device-specific input/output operations #include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition #include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...) #include <linux/joystick.h> // 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 <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX - #include <emscripten/emscripten.h> // Emscripten library - LLVM to JavaScript compiler + #include <emscripten/emscripten.h> // Emscripten functionality for C #include <emscripten/html5.h> // 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 b5c2477f..8f6d32e0 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -128,7 +128,7 @@ // Type required before windows.h inclusion typedef struct tagMSG *LPMSG; -#include <windows.h> +#include <windows.h> // Windows functionality (miniaudio) // Type required by some unused function... typedef struct tagBITMAPINFOHEADER { @@ -145,9 +145,9 @@ typedef struct tagBITMAPINFOHEADER { DWORD biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER; -#include <objbase.h> -#include <mmreg.h> -#include <mmsystem.h> +#include <objbase.h> // Component Object Model (COM) header +#include <mmreg.h> // Windows Multimedia, defines some WAVE structs +#include <mmsystem.h> // 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 <stdlib.h> // 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 55ca14e8..ea888cf0 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) @@ -645,7 +645,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #if defined(GRAPHICS_API_OPENGL_11) #if defined(__APPLE__) #include <OpenGL/gl.h> // OpenGL 1.1 library for OSX - #include <OpenGL/glext.h> + #include <OpenGL/glext.h> // 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 98852bc8..6f8ae649 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 3d7a3798..50f70420 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 |
