From 0a9e0809989dc9239bfb6b3b333fa0e0e4531548 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 23 Dec 2020 15:03:26 +0100 Subject: [PATCH] Remove trailing spaces --- examples/Makefile | 16 +++---- src/core.c | 120 +++++++++++++++++++++++----------------------- src/models.c | 32 ++++++------- src/raudio.c | 18 +++---- src/raylib.h | 11 ++--- src/rmem.h | 6 +-- src/shapes.c | 4 +- src/text.c | 10 ++-- src/textures.c | 8 ++-- src/utils.c | 8 ++-- 10 files changed, 116 insertions(+), 117 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 6bcbdb08e..88ec0091f 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -293,7 +293,7 @@ LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) # resource file contains windows executable icon and properties - LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data + LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data # -Wl,--subsystem,windows hides the console window ifeq ($(BUILD_MODE), RELEASE) LDFLAGS += -Wl,--subsystem,windows @@ -350,7 +350,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),OSX) # Libraries for OSX 10.9 desktop compiling # NOTE: Required packages: libopenal-dev libegl1-mesa-dev - LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo + LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo endif ifeq ($(PLATFORM_OS),BSD) # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling @@ -423,7 +423,7 @@ SHAPES = \ shapes/shapes_draw_ring \ shapes/shapes_draw_circle_sector \ shapes/shapes_draw_rectangle_rounded - + TEXTURES = \ textures/textures_logo_raylib \ textures/textures_mouse_painting \ @@ -444,7 +444,7 @@ TEXTURES = \ textures/textures_bunnymark \ textures/textures_blend_modes \ textures/textures_draw_tiled - + TEXT = \ text/text_raylib_fonts \ text/text_font_spritefont \ @@ -456,7 +456,7 @@ TEXT = \ text/text_writing_anim \ text/text_rectangle_bounds \ text/text_unicode - + MODELS = \ models/models_animation \ models/models_billboard \ @@ -474,7 +474,7 @@ MODELS = \ models/models_yaw_pitch_roll \ models/models_heightmap \ models/models_waving_cubes - + SHADERS = \ shaders/shaders_model_shader \ shaders/shaders_shapes_textures \ @@ -493,14 +493,14 @@ SHADERS = \ shaders/shaders_rlgl_mesh_instanced \ shaders/shaders_multi_sample2d \ shaders/shaders_rlgl_mesh_instanced - + AUDIO = \ audio/audio_module_playing \ audio/audio_music_stream \ audio/audio_raw_stream \ audio/audio_sound_loading \ audio/audio_multichannel_sound - + PHYSICS = \ physics/physics_demo \ physics/physics_friction \ diff --git a/src/core.c b/src/core.c index 95ee53bfb..52967a78d 100644 --- a/src/core.c +++ b/src/core.c @@ -312,9 +312,9 @@ #endif // Flags operation macros -#define FLAG_SET(n, f) ((n) |= (f)) -#define FLAG_CLEAR(n, f) ((n) &= ~(f)) -#define FLAG_TOGGLE(n, f) ((n) ^= (f)) +#define FLAG_SET(n, f) ((n) |= (f)) +#define FLAG_CLEAR(n, f) ((n) &= ~(f)) +#define FLAG_TOGGLE(n, f) ((n) ^= (f)) #define FLAG_CHECK(n, f) ((n) & (f)) //---------------------------------------------------------------------------------- @@ -410,13 +410,13 @@ typedef struct CoreData { int exitKey; // Default exit key char currentKeyState[512]; // Registers current frame key state char previousKeyState[512]; // Registers previous frame key state - + int keyPressedQueue[MAX_KEY_PRESSED_QUEUE]; // Input keys queue int keyPressedQueueCount; // Input keys queue count int charPressedQueue[MAX_CHAR_PRESSED_QUEUE]; // Input characters queue int charPressedQueueCount; // Input characters queue count - + #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) int defaultMode; // Default keyboard mode struct termios defaultSettings; // Default keyboard settings @@ -1043,8 +1043,8 @@ void ToggleFullscreen(void) else glfwSetWindowMonitor(CORE.Window.handle, NULL, CORE.Window.position.x, CORE.Window.position.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); CORE.Window.fullscreen = !CORE.Window.fullscreen; // Toggle fullscreen flag - CORE.Window.flags ^= FLAG_FULLSCREEN_MODE; - + CORE.Window.flags ^= FLAG_FULLSCREEN_MODE; + #endif #if defined(PLATFORM_WEB) /* @@ -1134,24 +1134,24 @@ void SetWindowState(unsigned int flags) glfwSwapInterval(1); CORE.Window.flags |= FLAG_VSYNC_HINT; } - + // State change: FLAG_FULLSCREEN_MODE if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) != (flags & FLAG_FULLSCREEN_MODE)) { ToggleFullscreen(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_RESIZABLE - if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0)) { #if defined(PLATFORM_DESKTOP) glfwSetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE, GLFW_TRUE); CORE.Window.flags |= FLAG_WINDOW_RESIZABLE; #endif } - + // State change: FLAG_WINDOW_UNDECORATED - if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED)) + if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED)) { #if defined(PLATFORM_DESKTOP) glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_FALSE); @@ -1160,35 +1160,35 @@ void SetWindowState(unsigned int flags) } // State change: FLAG_WINDOW_HIDDEN - if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) != (flags & FLAG_WINDOW_HIDDEN)) && ((flags & FLAG_WINDOW_HIDDEN) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) != (flags & FLAG_WINDOW_HIDDEN)) && ((flags & FLAG_WINDOW_HIDDEN) > 0)) { glfwHideWindow(CORE.Window.handle); CORE.Window.flags |= FLAG_WINDOW_HIDDEN; } - + // State change: FLAG_WINDOW_MINIMIZED if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) != (flags & FLAG_WINDOW_MINIMIZED)) && ((flags & FLAG_WINDOW_MINIMIZED) > 0)) { - //GLFW_ICONIFIED + //GLFW_ICONIFIED MinimizeWindow(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_MAXIMIZED if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) != (flags & FLAG_WINDOW_MAXIMIZED)) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0)) { //GLFW_MAXIMIZED MaximizeWindow(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_UNFOCUSED - if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0)) { #if defined(PLATFORM_DESKTOP) glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_FALSE); CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED; #endif } - + // State change: FLAG_WINDOW_TOPMOST if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0)) { @@ -1197,33 +1197,33 @@ void SetWindowState(unsigned int flags) CORE.Window.flags |= FLAG_WINDOW_TOPMOST; #endif } - + // State change: FLAG_WINDOW_ALWAYS_RUN - if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) != (flags & FLAG_WINDOW_ALWAYS_RUN)) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) != (flags & FLAG_WINDOW_ALWAYS_RUN)) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)) { CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN; } - + // The following states can not be changed after window creation - + // State change: FLAG_WINDOW_TRANSPARENT if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only by configured before window initialization"); } - + // State change: FLAG_WINDOW_HIGHDPI if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: High DPI can only by configured before window initialization"); } - + // State change: FLAG_MSAA_4X_HINT if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: MSAA can only by configured before window initialization"); } - + // State change: FLAG_INTERLACED_HINT if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0)) { @@ -1243,13 +1243,13 @@ void ClearWindowState(unsigned int flags) glfwSwapInterval(0); CORE.Window.flags &= ~FLAG_VSYNC_HINT; } - + // State change: FLAG_FULLSCREEN_MODE if (((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) && ((flags & FLAG_FULLSCREEN_MODE) > 0)) { ToggleFullscreen(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_RESIZABLE if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0)) { @@ -1258,9 +1258,9 @@ void ClearWindowState(unsigned int flags) CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE; #endif } - + // State change: FLAG_WINDOW_UNDECORATED - if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0)) { #if defined(PLATFORM_DESKTOP) glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_TRUE); @@ -1269,33 +1269,33 @@ void ClearWindowState(unsigned int flags) } // State change: FLAG_WINDOW_HIDDEN - if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) && ((flags & FLAG_WINDOW_HIDDEN) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) && ((flags & FLAG_WINDOW_HIDDEN) > 0)) { glfwShowWindow(CORE.Window.handle); CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN; } - + // State change: FLAG_WINDOW_MINIMIZED if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((flags & FLAG_WINDOW_MINIMIZED) > 0)) { RestoreWindow(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_MAXIMIZED if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0)) { RestoreWindow(); // NOTE: Window state flag updated inside function } - + // State change: FLAG_WINDOW_UNFOCUSED - if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0)) { #if defined(PLATFORM_DESKTOP) glfwSetWindowAttrib(CORE.Window.handle, GLFW_FOCUS_ON_SHOW, GLFW_TRUE); CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED; #endif } - + // State change: FLAG_WINDOW_TOPMOST if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0)) { @@ -1304,33 +1304,33 @@ void ClearWindowState(unsigned int flags) CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST; #endif } - + // State change: FLAG_WINDOW_ALWAYS_RUN - if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) > 0) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)) + if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) > 0) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0)) { CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN; } - + // The following states can not be changed after window creation - + // State change: FLAG_WINDOW_TRANSPARENT if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only by configured before window initialization"); } - + // State change: FLAG_WINDOW_HIGHDPI if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: High DPI can only by configured before window initialization"); } - + // State change: FLAG_MSAA_4X_HINT if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0)) { TRACELOG(LOG_WARNING, "WINDOW: MSAA can only by configured before window initialization"); } - + // State change: FLAG_INTERLACED_HINT if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0)) { @@ -1475,7 +1475,7 @@ Vector2 GetMonitorPosition(int monitor) { int x, y; glfwGetMonitorPos(monitors[monitor], &x, &y); - + return (Vector2){ (float)x, (float)y }; } else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor"); @@ -2542,7 +2542,7 @@ unsigned char *DecompressData(unsigned char *compData, int compDataLength, int * bool SaveStorageValue(unsigned int position, int value) { bool success = false; - + #if defined(SUPPORT_DATA_STORAGE) char path[512] = { 0 }; #if defined(PLATFORM_ANDROID) @@ -2737,7 +2737,7 @@ int GetKeyPressed(void) value = CORE.Input.Keyboard.keyPressedQueue[0]; // Shift elements 1 step toward the head. - for (int i = 0; i < (CORE.Input.Keyboard.keyPressedQueueCount - 1); i++) + for (int i = 0; i < (CORE.Input.Keyboard.keyPressedQueueCount - 1); i++) CORE.Input.Keyboard.keyPressedQueue[i] = CORE.Input.Keyboard.keyPressedQueue[i + 1]; // Reset last character in the queue @@ -2759,7 +2759,7 @@ int GetCharPressed(void) value = CORE.Input.Keyboard.charPressedQueue[0]; // Shift elements 1 step toward the head. - for (int i = 0; i < (CORE.Input.Keyboard.charPressedQueueCount - 1); i++) + for (int i = 0; i < (CORE.Input.Keyboard.charPressedQueueCount - 1); i++) CORE.Input.Keyboard.charPressedQueue[i] = CORE.Input.Keyboard.charPressedQueue[i + 1]; // Reset last character in the queue @@ -3170,13 +3170,13 @@ static bool InitGraphicsDevice(int width, int height) if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Visible window else glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); // Window initially hidden - + if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // Border and buttons on Window else glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); // Decorated window if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // Resizable window else glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // Avoid window being resizable - + // Disable FLAG_WINDOW_MINIMIZED, not supported on initialization if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; @@ -3185,7 +3185,7 @@ static bool InitGraphicsDevice(int width, int height) if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE); else glfwWindowHint(GLFW_FOCUSED, GLFW_TRUE); - + if ((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) glfwWindowHint(GLFW_FLOATING, GLFW_TRUE); else glfwWindowHint(GLFW_FLOATING, GLFW_FALSE); @@ -3335,7 +3335,7 @@ static bool InitGraphicsDevice(int width, int height) TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height); TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y); } - + // Set window callback events glfwSetWindowSizeCallback(CORE.Window.handle, WindowSizeCallback); // NOTE: Resizing not allowed by default! #if !defined(PLATFORM_WEB) @@ -3810,7 +3810,7 @@ static bool InitGraphicsDevice(int width, int height) TRACELOG(LOG_WARNING, "DISPLAY: Failed to get EGL config attribute: 0x%x", eglGetError()); continue; } - + if (GBM_FORMAT_ARGB8888 == id) { TRACELOG(LOG_TRACE, "DISPLAY: using EGL config %d", i); @@ -3960,7 +3960,7 @@ static bool InitGraphicsDevice(int width, int height) int fbHeight = CORE.Window.render.height; #if defined(PLATFORM_DESKTOP) - if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) + if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { glfwGetFramebufferSize(CORE.Window.handle, &fbWidth, &fbHeight); @@ -4054,13 +4054,13 @@ static void SetupFramebuffer(int width, int height) { // Required screen size is smaller than display size TRACELOG(LOG_INFO, "DISPLAY: Upscaling required: Screen size (%ix%i) smaller than display size (%ix%i)", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height); - + if ((CORE.Window.screen.width == 0) || (CORE.Window.screen.height == 0)) { CORE.Window.screen.width = CORE.Window.display.width; CORE.Window.screen.height = CORE.Window.display.height; } - + // Upscaling to fit display with border-bars float displayRatio = (float)CORE.Window.display.width/(float)CORE.Window.display.height; float screenRatio = (float)CORE.Window.screen.width/(float)CORE.Window.screen.height; @@ -4562,9 +4562,9 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i if (gifRecording) { gifRecording = false; - + MsfGifResult result = msf_gif_end(&gifState); - + char path[512] = { 0 }; #if defined(PLATFORM_ANDROID) strcpy(path, CORE.Android.internalDataPath); @@ -4572,7 +4572,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i #else strcpy(path, TextFormat("./screenrec%03i.gif", screenshotCounter)); #endif - + SaveFileData(path, result.data, (unsigned int)result.dataSize); msf_gif_free(result); @@ -4610,7 +4610,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i // to work properly with our implementation (IsKeyDown/IsKeyUp checks) if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0; else CORE.Input.Keyboard.currentKeyState[key] = 1; - + // Check if there is space available in the key queue if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_RELEASE)) { @@ -5912,7 +5912,7 @@ void UWPKeyDownEvent(int key, bool down, bool controlKey) if (gifRecording) { gifRecording = false; - + MsfGifResult result = msf_gif_end(&gifState); SaveFileData(TextFormat("%s/screenrec%03i.gif", CORE.UWP.internalDataPath, screenshotCounter), result.data, result.dataSize); diff --git a/src/models.c b/src/models.c index b1ef9f8a2..de29585ab 100644 --- a/src/models.c +++ b/src/models.c @@ -792,9 +792,9 @@ void UnloadModel(Model model) // Unload materials maps and params // NOTE: As the user could be sharing shaders and textures between models, - // we don't unload the material but just free it's maps and params, + // we don't unload the material but just free it's maps and params, // the user is responsible for freeing models shaders and textures - for (int i = 0; i < model.materialCount; i++) + for (int i = 0; i < model.materialCount; i++) { RL_FREE(model.materials[i].maps); RL_FREE(model.materials[i].params); @@ -817,9 +817,9 @@ void UnloadModelKeepMeshes(Model model) { // Unload materials maps and params // NOTE: As the user could be sharing shaders and textures between models, - // we don't unload the material but just free it's maps and params, + // we don't unload the material but just free it's maps and params, // the user is responsible for freeing models shaders and textures - for (int i = 0; i < model.materialCount; i++) + for (int i = 0; i < model.materialCount; i++) { RL_FREE(model.materials[i].maps); RL_FREE(model.materials[i].params); @@ -860,7 +860,7 @@ void UnloadMesh(Mesh mesh) bool ExportMesh(Mesh mesh, const char *fileName) { bool success = false; - + if (IsFileExtension(fileName, ".obj")) { // Estimated data size, it should be enough... @@ -919,7 +919,7 @@ bool ExportMesh(Mesh mesh, const char *fileName) { // TODO: Support additional file formats to export mesh vertex data } - + return success; } @@ -1310,9 +1310,9 @@ bool IsModelAnimationValid(Model model, ModelAnimation anim) Mesh GenMeshPoly(int sides, float radius) { Mesh mesh = { 0 }; - + if (sides < 3) return mesh; - + mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); int vertexCount = sides*3; @@ -1681,7 +1681,7 @@ par_shapes_mesh* par_shapes_create_icosahedron(); // 20 sides polyhedron RLAPI Mesh GenMeshSphere(float radius, int rings, int slices) { Mesh mesh = { 0 }; - + if ((rings >= 3) && (slices >= 3)) { mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); @@ -1725,11 +1725,11 @@ RLAPI Mesh GenMeshSphere(float radius, int rings, int slices) RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices) { Mesh mesh = { 0 }; - + if ((rings >= 3) && (slices >= 3)) { if (radius < 0.0f) radius = 0.0f; - + mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); par_shapes_mesh *sphere = par_shapes_create_hemisphere(slices, rings); @@ -1771,7 +1771,7 @@ RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices) Mesh GenMeshCylinder(float radius, float height, int slices) { Mesh mesh = { 0 }; - + if (slices >= 3) { mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); @@ -1836,7 +1836,7 @@ Mesh GenMeshCylinder(float radius, float height, int slices) Mesh GenMeshTorus(float radius, float size, int radSeg, int sides) { Mesh mesh = { 0 }; - + if ((sides >= 3) && (radSeg >= 3)) { mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); @@ -1884,7 +1884,7 @@ Mesh GenMeshTorus(float radius, float size, int radSeg, int sides) Mesh GenMeshKnot(float radius, float size, int radSeg, int sides) { Mesh mesh = { 0 }; - + if ((sides >= 3) && (radSeg >= 3)) { mesh.vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); @@ -3054,7 +3054,7 @@ static Model LoadOBJ(const char *fileName) model.materialCount = materialCount; model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material)); TraceLog(LOG_INFO, "MODEL: model has %i material meshes", materialCount); - } + } else { model.meshCount = 1; @@ -3104,7 +3104,7 @@ static Model LoadOBJ(const char *fileName) { int mm = attrib.material_ids[af]; // mesh material for this face if (mm == -1) { mm = 0; } // no material object.. - + // Get indices for the face tinyobj_vertex_index_t idx0 = attrib.faces[3 * af + 0]; tinyobj_vertex_index_t idx1 = attrib.faces[3 * af + 1]; diff --git a/src/raudio.c b/src/raudio.c index c840bb61b..660d438d5 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -640,7 +640,7 @@ void SetAudioBufferPitch(AudioBuffer *buffer, float pitch) // - lower pitches make it slower ma_uint32 outputSampleRate = (ma_uint32)((float)buffer->converter.config.sampleRateOut/pitch); ma_data_converter_set_rate(&buffer->converter, buffer->converter.config.sampleRateIn, outputSampleRate); - + buffer->pitch = pitch; } } @@ -827,7 +827,7 @@ bool ExportWave(Wave wave, const char *fileName) if (success) TRACELOG(LOG_INFO, "FILEIO: [%s] Wave data exported successfully", fileName); else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export wave data", fileName); - + return success; } @@ -835,7 +835,7 @@ bool ExportWave(Wave wave, const char *fileName) bool ExportWaveAsCode(Wave wave, const char *fileName) { bool success = false; - + #ifndef TEXT_BYTES_PER_LINE #define TEXT_BYTES_PER_LINE 20 #endif @@ -882,7 +882,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName) success = SaveFileText(fileName, txtData); RL_FREE(txtData); - + return success; } @@ -1087,7 +1087,7 @@ float *LoadWaveSamples(Wave wave) float *samples = (float *)RL_MALLOC(wave.sampleCount*sizeof(float)); // NOTE: sampleCount is the total number of interlaced samples (including channels) - + for (unsigned int i = 0; i < wave.sampleCount; i++) { if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 127)/256.0f; @@ -1149,7 +1149,7 @@ Music LoadMusicStream(const char *fileName) // OGG bit rate defaults to 16 bit, it's enough for compressed format music.stream = InitAudioStream(info.sample_rate, 16, info.channels); - + // WARNING: It seems this function returns length in frames, not samples, so we multiply by channels music.sampleCount = (unsigned int)stb_vorbis_stream_length_in_samples((stb_vorbis *)music.ctxData)*info.channels; music.looping = true; // Looping enabled by default @@ -1953,7 +1953,7 @@ static Wave LoadWAV(const unsigned char *fileData, unsigned int fileSize) static int SaveWAV(Wave wave, const char *fileName) { int success = false; - + drwav wav = { 0 }; drwav_data_format format = { 0 }; format.container = drwav_container_riff; @@ -1967,9 +1967,9 @@ static int SaveWAV(Wave wave, const char *fileName) success = drwav_init_memory_write(&wav, &fileData, &fileDataSize, &format, NULL); if (success) success = (int)drwav_write_pcm_frames(&wav, wave.sampleCount/wave.channels, wave.data); drwav_result result = drwav_uninit(&wav); - + if (result == DRWAV_SUCCESS) success = SaveFileData(fileName, fileData, (unsigned int)fileDataSize); - + drwav_free(fileData, NULL); return success; diff --git a/src/raylib.h b/src/raylib.h index bfa7c20d0..11fb337b6 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1021,7 +1021,7 @@ RLAPI bool IsKeyReleased(int key); // Detect if a key RLAPI bool IsKeyUp(int key); // Detect if a key is NOT being pressed RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC) RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued -RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued +RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued // Input-related functions: gamepads RLAPI bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available @@ -1090,10 +1090,10 @@ RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Colo RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version) RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out -RLAPI void DrawLineStrip(Vector2 *points, int pointsCount, Color color); // Draw lines sequence +RLAPI void DrawLineStrip(Vector2 *points, int pointsCount, Color color); // Draw lines sequence RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle -RLAPI void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw a piece of a circle -RLAPI void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw circle sector outline +RLAPI void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw a piece of a circle +RLAPI void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw circle sector outline RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline @@ -1114,7 +1114,7 @@ RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Co RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!) -RLAPI void DrawTriangleFan(Vector2 *points, int pointsCount, Color color); // Draw a triangle fan defined by points (first vertex is the center) +RLAPI void DrawTriangleFan(Vector2 *points, int pointsCount, Color color); // Draw a triangle fan defined by points (first vertex is the center) RLAPI void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color); // Draw a triangle strip defined by points RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides @@ -1260,7 +1260,6 @@ RLAPI Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int chars RLAPI void UnloadFontData(CharInfo *chars, int charsCount); // Unload font chars info data (RAM) RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM) - // Text drawing functions RLAPI void DrawFPS(int posX, int posY); // Shows current FPS RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) diff --git a/src/rmem.h b/src/rmem.h index 76c6645ff..dbf417fe6 100644 --- a/src/rmem.h +++ b/src/rmem.h @@ -236,7 +236,7 @@ static MemNode *__RemoveMemNode(AllocList *const list, MemNode *const node) if (list->head != NULL) list->head->prev = NULL; else list->tail = NULL; } - + if (node->next != NULL) node->next->prev = node->prev; else { @@ -534,7 +534,7 @@ ObjPool CreateObjPool(const size_t objsize, const size_t len) objpool.objSize = aligned_size; objpool.memSize = objpool.freeBlocks = len; objpool.mem = ( uintptr_t )buf; - + for (size_t i=0; i fmaxf(startPos2.x, endPos2.x)) return false; if (yi < fminf(startPos1.y, endPos1.y) || yi > fmaxf(startPos1.y, endPos1.y)) return false; if (yi < fminf(startPos2.y, endPos2.y) || yi > fmaxf(startPos2.y, endPos2.y)) return false; - + if (collisionPoint != 0) { collisionPoint->x = xi; collisionPoint->y = yi; } - + return true; } diff --git a/src/text.c b/src/text.c index a2be06216..3cc20d212 100644 --- a/src/text.c +++ b/src/text.c @@ -499,7 +499,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int if (font.chars != NULL) { font.charsPadding = FONT_TTF_DEFAULT_CHARS_PADDING; - + Image atlas = GenImageFontAtlas(font.chars, &font.recs, font.charsCount, font.baseSize, font.charsPadding, 0); font.texture = LoadTextureFromImage(atlas); @@ -795,7 +795,7 @@ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **charRecs, int charsCo void UnloadFontData(CharInfo *chars, int charsCount) { for (int i = 0; i < charsCount; i++) UnloadImage(chars[i].image); - + RL_FREE(chars); } @@ -847,7 +847,7 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor // Character destination rectangle on screen - // NOTE: We consider charsPadding on drawing + // NOTE: We consider charsPadding on drawing Rectangle dstRec = { position.x + font.chars[index].offsetX*scaleFactor - (float)font.charsPadding*scaleFactor, position.y + font.chars[index].offsetY*scaleFactor - (float)font.charsPadding*scaleFactor, (font.recs[index].width + 2.0f*font.charsPadding)*scaleFactor, @@ -855,9 +855,9 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz // Character source rectangle from font texture atlas // NOTE: We consider chars padding when drawing, it could be required for outline/glow shader effects - Rectangle srcRec = { font.recs[index].x - (float)font.charsPadding, font.recs[index].y - (float)font.charsPadding, + Rectangle srcRec = { font.recs[index].x - (float)font.charsPadding, font.recs[index].y - (float)font.charsPadding, font.recs[index].width + 2.0f*font.charsPadding, font.recs[index].height + 2.0f*font.charsPadding }; - + // Draw the character texture on the screen DrawTexturePro(font.texture, srcRec, dstRec, (Vector2){ 0, 0 }, 0.0f, tint); } diff --git a/src/textures.c b/src/textures.c index 17ed07cf1..8b9d38cdb 100644 --- a/src/textures.c +++ b/src/textures.c @@ -445,7 +445,7 @@ bool ExportImage(Image image, const char *fileName) if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image exported successfully", fileName); else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image", fileName); - + return success; } @@ -453,7 +453,7 @@ bool ExportImage(Image image, const char *fileName) bool ExportImageAsCode(Image image, const char *fileName) { bool success = false; - + #ifndef TEXT_BYTES_PER_LINE #define TEXT_BYTES_PER_LINE 20 #endif @@ -495,7 +495,7 @@ bool ExportImageAsCode(Image image, const char *fileName) success = SaveFileText(fileName, txtData); RL_FREE(txtData); - + return success; } @@ -2172,7 +2172,7 @@ Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount) UnloadImageColors(pixels); } - + *colorsCount = palCount; return palette; diff --git a/src/utils.c b/src/utils.c index 2326c9e21..b9e24b026 100644 --- a/src/utils.c +++ b/src/utils.c @@ -225,7 +225,7 @@ void UnloadFileData(unsigned char *data) bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) { bool success = false; - + if (fileName != NULL) { FILE *file = fopen(fileName, "wb"); @@ -244,7 +244,7 @@ bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open file", fileName); } else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid"); - + return success; } @@ -302,7 +302,7 @@ void UnloadFileText(unsigned char *text) bool SaveFileText(const char *fileName, char *text) { bool success = false; - + if (fileName != NULL) { FILE *file = fopen(fileName, "wt"); @@ -320,7 +320,7 @@ bool SaveFileText(const char *fileName, char *text) else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open text file", fileName); } else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid"); - + return success; }