From d4382f4a52e7631bf02ff8073ed24b282596ce0a Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 18 Feb 2022 20:30:46 +0100 Subject: [PATCH] Removed trailing spaces --- src/raudio.c | 4 +- src/rcore.c | 36 ++++++++-------- src/rmodels.c | 20 ++++----- src/rshapes.c | 20 ++++----- src/rtext.c | 6 +-- src/rtextures.c | 14 +++--- src/shell.html | 112 ++++++++++++++++++++++++------------------------ 7 files changed, 106 insertions(+), 106 deletions(-) diff --git a/src/raudio.c b/src/raudio.c index 5abb1d05c..2d41b2385 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -664,7 +664,7 @@ void SetAudioBufferPitch(AudioBuffer *buffer, float pitch) // Set pan for an audio buffer void SetAudioBufferPan(AudioBuffer *buffer, float pan) { - if (pan < 0.0f) pan = 0.0f; + if (pan < 0.0f) pan = 0.0f; else if (pan > 1.0f) pan = 1.0f; if (buffer != NULL) buffer->pan = pan; @@ -998,7 +998,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName) success = SaveFileText(fileName, txtData); RL_FREE(txtData); - + if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Wave as code exported successfully", fileName); else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export wave as code", fileName); diff --git a/src/rcore.c b/src/rcore.c index 44d65c7b7..2b0164ee2 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -722,7 +722,7 @@ struct android_app *GetAndroidApp(void) void InitWindow(int width, int height, const char *title) { TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION); - + TRACELOG(LOG_INFO, "Supported raylib modules:"); TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)"); TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)"); @@ -731,12 +731,12 @@ void InitWindow(int width, int height, const char *title) #else TRACELOG(LOG_INFO, " > rshapes:... not loaded (optional)"); #endif -#if defined(SUPPORT_MODULE_RTEXTURES) +#if defined(SUPPORT_MODULE_RTEXTURES) TRACELOG(LOG_INFO, " > rtextures:. loaded (optional)"); #else TRACELOG(LOG_INFO, " > rtextures:. not loaded (optional)"); -#endif -#if defined(SUPPORT_MODULE_RTEXT) +#endif +#if defined(SUPPORT_MODULE_RTEXT) TRACELOG(LOG_INFO, " > rtext:..... loaded (optional)"); #else TRACELOG(LOG_INFO, " > rtext:..... not loaded (optional)"); @@ -746,7 +746,7 @@ void InitWindow(int width, int height, const char *title) #else TRACELOG(LOG_INFO, " > rmodels:... not loaded (optional)"); #endif -#if defined(SUPPORT_MODULE_RAUDIO) +#if defined(SUPPORT_MODULE_RAUDIO) TRACELOG(LOG_INFO, " > raudio:.... loaded (optional)"); #else TRACELOG(LOG_INFO, " > raudio:.... not loaded (optional)"); @@ -890,7 +890,7 @@ void InitWindow(int width, int height, const char *title) //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); - + // Support keyboard events -> Not used, GLFW.JS takes care of that //emscripten_set_keypress_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback); //emscripten_set_keydown_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback); @@ -1276,7 +1276,7 @@ void ToggleFullscreen(void) int width, height; emscripten_get_canvas_element_size("#canvas", &width, &height); TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height); - + CORE.Window.fullscreen = false; // Toggle fullscreen flag CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; } @@ -2750,7 +2750,7 @@ void TakeScreenshot(const char *fileName) char path[2048] = { 0 }; strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName)); - + ExportImage(image, path); // WARNING: Module required: rtextures RL_FREE(imgData); @@ -2798,7 +2798,7 @@ bool FileExists(const char *fileName) // NOTE: Alternatively, stat() can be used instead of access() //#include - //struct stat statbuf; + //struct stat statbuf; //if (stat(filename, &statbuf) == 0) result = true; return result; @@ -2856,9 +2856,9 @@ bool DirectoryExists(const char *dirPath) int GetFileLength(const char *fileName) { int size = 0; - + FILE *file = fopen(fileName, "rb"); - + if (file != NULL) { fseek(file, 0L, SEEK_END); @@ -3093,7 +3093,7 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount) if (dir != NULL) // It's a directory { // Count files - while ((entity = readdir(dir)) != NULL) counter++; + while ((entity = readdir(dir)) != NULL) counter++; dirFileCount = counter; *fileCount = dirFileCount; @@ -3101,7 +3101,7 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount) // Memory allocation for dirFileCount dirFilesPath = (char **)RL_MALLOC(dirFileCount*sizeof(char *)); for (int i = 0; i < dirFileCount; i++) dirFilesPath[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char)); - + // Reset our position in the directory to the beginning rewinddir(dir); @@ -4162,7 +4162,7 @@ static bool InitGraphicsDevice(int width, int height) glfwSwapInterval(1); TRACELOG(LOG_INFO, "DISPLAY: Trying to enable VSYNC"); } - + int fbWidth = CORE.Window.screen.width; int fbHeight = CORE.Window.screen.height; @@ -4187,7 +4187,7 @@ static bool InitGraphicsDevice(int width, int height) CORE.Window.render.height = fbHeight; CORE.Window.currentFbo.width = fbWidth; CORE.Window.currentFbo.height = fbHeight; - + TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully"); TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height); TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height); @@ -4601,7 +4601,7 @@ static bool InitGraphicsDevice(int width, int height) CORE.Window.render.height = CORE.Window.screen.height; CORE.Window.currentFbo.width = CORE.Window.render.width; CORE.Window.currentFbo.height = CORE.Window.render.height; - + TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully"); TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height); TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height); @@ -4940,7 +4940,7 @@ void PollInputEvents(void) // Register previous touch states for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i]; - + // Reset touch positions // TODO: It resets on PLATFORM_WEB the mouse position and not filled again until a move-event, // so, if mouse is not moved it returns a (0, 0) position... this behaviour should be reviewed! @@ -5224,7 +5224,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = key; CORE.Input.Keyboard.keyPressedQueueCount++; } - + // Check the exit key to set close window if ((key == CORE.Input.Keyboard.exitKey) && (action == GLFW_PRESS)) glfwSetWindowShouldClose(CORE.Window.handle, GLFW_TRUE); diff --git a/src/rmodels.c b/src/rmodels.c index c15c4c07b..223414cde 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -1692,7 +1692,7 @@ bool ExportMesh(Mesh mesh, const char *fileName) { for (int i = 0, v = 0; i < mesh.triangleCount; i++, v += 3) { - byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", + byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", mesh.indices[v] + 1, mesh.indices[v] + 1, mesh.indices[v] + 1, mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1, mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1); @@ -4543,7 +4543,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat cgltf_options options = { 0 }; cgltf_result result = cgltf_load_buffer_base64(&options, outSize, cgltfImage->uri + i + 1, &data); - + if (result == cgltf_result_success) { image = LoadImageFromMemory(".png", (unsigned char *)data, outSize); @@ -4571,12 +4571,12 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat // Check mime_type for image: (cgltfImage->mime_type == "image/png") // NOTE: Detected that some models define mime_type as "image\\/png" - if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) || + if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) || (strcmp(cgltfImage->mime_type, "image/png") == 0)) image = LoadImageFromMemory(".png", data, (int)cgltfImage->buffer_view->size); else if ((strcmp(cgltfImage->mime_type, "image\\/jpeg") == 0) || (strcmp(cgltfImage->mime_type, "image/jpeg") == 0)) image = LoadImageFromMemory(".jpg", data, (int)cgltfImage->buffer_view->size); else TRACELOG(LOG_WARNING, "MODEL: glTF image data MIME type not recognized", TextFormat("%s/%s", texPath, cgltfImage->uri)); - + RL_FREE(data); } @@ -4637,7 +4637,7 @@ static Model LoadGLTF(const char *fileName) cgltf_options options = { 0 }; cgltf_data *data = NULL; cgltf_result result = cgltf_parse(&options, fileData, dataSize, &data); - + if (result == cgltf_result_success) { if (data->file_type == cgltf_file_type_glb) TRACELOG(LOG_INFO, "MODEL: [%s] Model basic data (glb) loaded successfully", fileName); @@ -4665,7 +4665,7 @@ static Model LoadGLTF(const char *fileName) for (int i = 0; i < model.meshCount; i++) model.meshes[i].vboId = (unsigned int*)RL_CALLOC(MAX_MESH_VERTEX_BUFFERS, sizeof(unsigned int)); // NOTE: We keep an extra slot for default material, in case some mesh requires it - model.materialCount = (int)data->materials_count + 1; + model.materialCount = (int)data->materials_count + 1; model.materials = RL_CALLOC(model.materialCount, sizeof(Material)); model.materials[0] = LoadMaterialDefault(); // Load default material (index: 0) @@ -4708,8 +4708,8 @@ static Model LoadGLTF(const char *fileName) model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTextureFromImage(imMetallicRoughness); UnloadImage(imMetallicRoughness); } - - // Load metallic/roughness material properties + + // Load metallic/roughness material properties float roughness = data->materials[i].pbr_metallic_roughness.roughness_factor; model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].value = roughness; @@ -4757,7 +4757,7 @@ static Model LoadGLTF(const char *fileName) } } - // Other possible materials not supported by raylib pipeline: + // Other possible materials not supported by raylib pipeline: // has_clearcoat, has_transmission, has_volume, has_ior, has specular, has_sheen } @@ -4787,7 +4787,7 @@ static Model LoadGLTF(const char *fileName) if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec3)) { - // Init raylib mesh vertices to copy glTF attribute data + // Init raylib mesh vertices to copy glTF attribute data model.meshes[meshIndex].vertexCount = (int)attribute->count; model.meshes[meshIndex].vertices = RL_MALLOC(attribute->count*3*sizeof(float)); diff --git a/src/rshapes.c b/src/rshapes.c index d93b4db6f..79631d622 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -6,12 +6,12 @@ * Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS. * Some functions implement two drawing options: TRIANGLES and QUADS, by default TRIANGLES * are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define -* -* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a +* +* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a * user-provided texture with SetShapesTexture(), the pourpouse of this implementation * is allowing to reduce draw calls when combined with a texture-atlas. * -* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one +* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one * white character of default font [rtext], this way, raylib text and shapes can be draw with * a single draw call and it also allows users to configure it the same way with their own fonts. * @@ -723,7 +723,7 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color rlCheckRenderBatchLimit(4); rlSetTexture(texShapes.id); - + rlBegin(RL_QUADS); rlNormal3f(0.0f, 0.0f, 1.0f); @@ -742,13 +742,13 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color rlVertex2f(topRight.x, topRight.y); rlEnd(); - + rlSetTexture(0); #else rlCheckRenderBatchLimit(6); rlBegin(RL_TRIANGLES); - + rlColor4ub(color.r, color.g, color.b, color.a); rlVertex2f(topLeft.x, topLeft.y); @@ -1609,7 +1609,7 @@ bool CheckCollisionPointRec(Vector2 point, Rectangle rec) bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius) { bool collision = false; - + collision = CheckCollisionCircles(point, 0, center, radius); return collision; @@ -1681,7 +1681,7 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec) (dy - rec.height/2.0f)*(dy - rec.height/2.0f); collision = (cornerDistanceSq <= (radius*radius)); - + return collision; } @@ -1695,10 +1695,10 @@ bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, if (fabsf(div) >= FLT_EPSILON) { collision = true; - + float xi = ((startPos2.x - endPos2.x)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.x - endPos1.x)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div; float yi = ((startPos2.y - endPos2.y)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.y - endPos1.y)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div; - + if (((fabsf(startPos1.x - endPos1.x) > FLT_EPSILON) && (xi < fminf(startPos1.x, endPos1.x) || (xi > fmaxf(startPos1.x, endPos1.x)))) || ((fabsf(startPos2.x - endPos2.x) > FLT_EPSILON) && (xi < fminf(startPos2.x, endPos2.x) || (xi > fmaxf(startPos2.x, endPos2.x)))) || ((fabsf(startPos1.y - endPos1.y) > FLT_EPSILON) && (yi < fminf(startPos1.y, endPos1.y) || (yi > fmaxf(startPos1.y, endPos1.y)))) || diff --git a/src/rtext.c b/src/rtext.c index a62f0d834..0a8af79e1 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -825,7 +825,7 @@ void UnloadFont(Font font) bool ExportFontAsCode(Font font, const char *fileName) { bool success = false; - + #ifndef TEXT_BYTES_PER_LINE #define TEXT_BYTES_PER_LINE 20 #endif @@ -865,7 +865,7 @@ bool ExportFontAsCode(Font font, const char *fileName) Image image = LoadImageFromTexture(font.texture); if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) TRACELOG(LOG_WARNING, "Font export as code: Font image format is not GRAY+ALPHA!"); int imageDataSize = GetPixelDataSize(image.width, image.height, image.format); - + // Image data is usually GRAYSCALE + ALPHA and can be reduced to GRAYSCALE //ImageFormat(&image, PIXELFORMAT_UNCOMPRESSED_GRAYSCALE); @@ -874,7 +874,7 @@ bool ExportFontAsCode(Font font, const char *fileName) // WARNING: Data is compressed using raylib CompressData() DEFLATE, // it requires to be decompressed with raylib DecompressData(), that requires // compiling raylib with SUPPORT_COMPRESSION_API config flag enabled - + // Compress font image data int compDataSize = 0; unsigned char *compData = CompressData(image.data, imageDataSize, &compDataSize); diff --git a/src/rtextures.c b/src/rtextures.c index 12732274f..c4cf1903e 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -133,7 +133,7 @@ #if defined(SUPPORT_FILEFORMAT_QOI) #define QOI_MALLOC RL_MALLOC #define QOI_FREE RL_FREE - + #define QOI_IMPLEMENTATION #include "external/qoi.h" #endif @@ -375,7 +375,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i } #endif #if defined(SUPPORT_FILEFORMAT_QOI) - else if (strcmp(fileType, ".qoi") == 0) + else if (strcmp(fileType, ".qoi") == 0) { qoi_desc desc = { 0 }; image.data = qoi_decode(fileData, dataSize, &desc, 4); @@ -500,7 +500,7 @@ bool ExportImage(Image image, const char *fileName) else if (IsFileExtension(fileName, ".tga")) success = stbi_write_tga(fileName, image.width, image.height, channels, imgData); #endif #if defined(SUPPORT_FILEFORMAT_JPG) - else if (IsFileExtension(fileName, ".jpg") || + else if (IsFileExtension(fileName, ".jpg") || IsFileExtension(fileName, ".jpeg")) success = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100 #endif #if defined(SUPPORT_FILEFORMAT_QOI) @@ -510,11 +510,11 @@ bool ExportImage(Image image, const char *fileName) if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3; else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4; else TRACELOG(LOG_WARNING, "IMAGE: Image pixel format must be R8G8B8 or R8G8B8A8"); - + if ((channels == 3) || (channels == 4)) { qoi_desc desc = { 0 }; - desc.width = image.width; + desc.width = image.width; desc.height = image.height; desc.channels = channels; desc.colorspace = QOI_SRGB; @@ -2771,7 +2771,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color // [x] Consider fast path: same src/dst format with no alpha -> direct line copy // [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend() // [ ] Support f32bit channels drawing - + // TODO: Support PIXELFORMAT_UNCOMPRESSED_R32, PIXELFORMAT_UNCOMPRESSED_R32G32B32, PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 Color colSrc, colDst, blend; @@ -2954,7 +2954,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) ImageFormat(&faces, image.format); // NOTE: Image formating does not work with compressed textures - + for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE); } diff --git a/src/shell.html b/src/shell.html index 333f6528f..3ab8c3a30 100644 --- a/src/shell.html +++ b/src/shell.html @@ -3,14 +3,14 @@ - + raylib web game - + - + @@ -26,30 +26,30 @@ - + - +