Selaa lähdekoodia

Review code formatting

Ray 4 vuotta sitten
vanhempi
commit
b188008a1c
6 muutettua tiedostoa jossa 28 lisäystä ja 24 poistoa
  1. 1 1
      src/core.c
  2. 7 7
      src/models.c
  3. 7 7
      src/raudio.c
  4. 1 1
      src/raylib.h
  5. 11 7
      src/shapes.c
  6. 1 1
      src/text.c

+ 1 - 1
src/core.c

@@ -6288,7 +6288,7 @@ bool UWPIsConfigured()
 }
 }
 
 
 // UWP function handlers get/set
 // UWP function handlers get/set
-void UWPSetDataPath(const char* path) { CORE.UWP.internalDataPath = path; }
+void UWPSetDataPath(const char *path) { CORE.UWP.internalDataPath = path; }
 UWPQueryTimeFunc UWPGetQueryTimeFunc(void) { return uwpQueryTimeFunc; }
 UWPQueryTimeFunc UWPGetQueryTimeFunc(void) { return uwpQueryTimeFunc; }
 void UWPSetQueryTimeFunc(UWPQueryTimeFunc func) { uwpQueryTimeFunc = func; }
 void UWPSetQueryTimeFunc(UWPQueryTimeFunc func) { uwpQueryTimeFunc = func; }
 UWPSleepFunc UWPGetSleepFunc(void) { return uwpSleepFunc; }
 UWPSleepFunc UWPGetSleepFunc(void) { return uwpSleepFunc; }

+ 7 - 7
src/models.c

@@ -117,11 +117,11 @@ static ModelAnimation *LoadIQMModelAnimations(const char *fileName, int *animCou
 #if defined(SUPPORT_FILEFORMAT_GLTF)
 #if defined(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 *LoadGLTFModelAnimations(const char *fileName, int *animCount);    // Load GLTF animation data
 static ModelAnimation *LoadGLTFModelAnimations(const char *fileName, int *animCount);    // Load GLTF animation data
-static void LoadGLTFModelIndices(Model* model, cgltf_accessor* indexAccessor, int primitiveIndex);
-static void BindGLTFPrimitiveToBones(Model* model, const cgltf_data* data, int primitiveIndex);
-static void LoadGLTFBoneAttribute(Model* model, cgltf_accessor* jointsAccessor, const cgltf_data* data, int primitiveIndex);
-static void LoadGLTFMaterial(Model* model, const char* fileName, const cgltf_data* data);
-static void InitGLTFBones(Model* model, const cgltf_data* data);
+static void LoadGLTFModelIndices(Model *model, cgltf_accessor *indexAccessor, int primitiveIndex);
+static void BindGLTFPrimitiveToBones(Model *model, const cgltf_data *data, int primitiveIndex);
+static void LoadGLTFBoneAttribute(Model *model, cgltf_accessor *jointsAccessor, const cgltf_data *data, int primitiveIndex);
+static void LoadGLTFMaterial(Model *model, const char *fileName, const cgltf_data *data);
+static void InitGLTFBones(Model *model, const cgltf_data *data);
 #endif
 #endif
 
 
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
@@ -3773,7 +3773,7 @@ static Model LoadIQM(const char *fileName)
 }
 }
 
 
 // Load IQM animation data
 // Load IQM animation data
-static ModelAnimation* LoadIQMModelAnimations(const char* fileName, int* animCount)
+static ModelAnimation* LoadIQMModelAnimations(const char *fileName, int *animCount)
 {
 {
 #define IQM_MAGIC       "INTERQUAKEMODEL"   // IQM file magic number
 #define IQM_MAGIC       "INTERQUAKEMODEL"   // IQM file magic number
 #define IQM_VERSION     2                   // only IQM version 2 supported
 #define IQM_VERSION     2                   // only IQM version 2 supported
@@ -4574,7 +4574,7 @@ static void LoadGLTFBoneAttribute(Model *model, cgltf_accessor *jointsAccessor,
     else if (jointsAccessor->component_type == cgltf_component_type_r_8u)
     else if (jointsAccessor->component_type == cgltf_component_type_r_8u)
     {
     {
         model->meshes[primitiveIndex].boneIds = RL_MALLOC(jointsAccessor->count*4*sizeof(int));
         model->meshes[primitiveIndex].boneIds = RL_MALLOC(jointsAccessor->count*4*sizeof(int));
-        unsigned char* bones = RL_MALLOC(jointsAccessor->count*4*sizeof(unsigned char));
+        unsigned char *bones = RL_MALLOC(jointsAccessor->count*4*sizeof(unsigned char));
 
 
         for (unsigned int a = 0; a < jointsAccessor->count; a++)
         for (unsigned int a = 0; a < jointsAccessor->count; a++)
         {
         {

+ 7 - 7
src/raudio.c

@@ -1311,7 +1311,7 @@ Music LoadMusicStream(const char *fileName)
 }
 }
 
 
 // extension including period ".mod"
 // extension including period ".mod"
-Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize)
+Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int dataSize)
 {
 {
     Music music = { 0 };
     Music music = { 0 };
     bool musicLoaded = false;
     bool musicLoaded = false;
@@ -1325,7 +1325,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
     {
     {
         drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
         drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
 
 
-        bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
+        bool success = drwav_init_memory(ctxWav, (const void *)data, dataSize, NULL);
 
 
         music.ctxType = MUSIC_AUDIO_WAV;
         music.ctxType = MUSIC_AUDIO_WAV;
         music.ctxData = ctxWav;
         music.ctxData = ctxWav;
@@ -1383,7 +1383,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
         // Open ogg audio stream
         // Open ogg audio stream
         music.ctxType = MUSIC_AUDIO_OGG;
         music.ctxType = MUSIC_AUDIO_OGG;
         //music.ctxData = stb_vorbis_open_filename(fileName, NULL, NULL);
         //music.ctxData = stb_vorbis_open_filename(fileName, NULL, NULL);
-        music.ctxData = stb_vorbis_open_memory((const unsigned char*)data, dataSize, NULL, NULL);
+        music.ctxData = stb_vorbis_open_memory((const unsigned char *)data, dataSize, NULL, NULL);
 
 
         if (music.ctxData != NULL)
         if (music.ctxData != NULL)
         {
         {
@@ -1403,7 +1403,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
     else if (TextIsEqual(fileExtLower, ".xm"))
     else if (TextIsEqual(fileExtLower, ".xm"))
     {
     {
         jar_xm_context_t *ctxXm = NULL;
         jar_xm_context_t *ctxXm = NULL;
-        int result = jar_xm_create_context_safe(&ctxXm, (const char*)data, dataSize, AUDIO.System.device.sampleRate);
+        int result = jar_xm_create_context_safe(&ctxXm, (const char *)data, dataSize, AUDIO.System.device.sampleRate);
         if (result == 0)    // XM AUDIO.System.context created successfully
         if (result == 0)    // XM AUDIO.System.context created successfully
         {
         {
             music.ctxType = MUSIC_MODULE_XM;
             music.ctxType = MUSIC_MODULE_XM;
@@ -1660,17 +1660,17 @@ void UpdateMusicStream(Music music)
                 {
                 {
                 case ma_format_f32:
                 case ma_format_f32:
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
-                    jar_xm_generate_samples((jar_xm_context_t*)music.ctxData, (float*)pcm, samplesCount/2);
+                    jar_xm_generate_samples((jar_xm_context_t*)music.ctxData, (float *)pcm, samplesCount/2);
                     break;
                     break;
 
 
                 case ma_format_s16:
                 case ma_format_s16:
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
-                    jar_xm_generate_samples_16bit((jar_xm_context_t*)music.ctxData, (short*)pcm, samplesCount/2);
+                    jar_xm_generate_samples_16bit((jar_xm_context_t*)music.ctxData, (short *)pcm, samplesCount/2);
                     break;
                     break;
 
 
                 case ma_format_u8:
                 case ma_format_u8:
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
                     // NOTE: Internally this function considers 2 channels generation, so samplesCount/2
-                    jar_xm_generate_samples_8bit((jar_xm_context_t*)music.ctxData, (char*)pcm, samplesCount/2);
+                    jar_xm_generate_samples_8bit((jar_xm_context_t*)music.ctxData, (char *)pcm, samplesCount/2);
                     break;
                     break;
                 }
                 }
 
 

+ 1 - 1
src/raylib.h

@@ -1499,7 +1499,7 @@ RLAPI void UnloadWaveSamples(float *samples);                         // Unload
 
 
 // Music management functions
 // Music management functions
 RLAPI Music LoadMusicStream(const char *fileName);                    // Load music stream from file
 RLAPI Music LoadMusicStream(const char *fileName);                    // Load music stream from file
-RLAPI Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize); // Load music stream from data
+RLAPI Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int dataSize); // Load music stream from data
 RLAPI void UnloadMusicStream(Music music);                            // Unload music stream
 RLAPI void UnloadMusicStream(Music music);                            // Unload music stream
 RLAPI void PlayMusicStream(Music music);                              // Start music playing
 RLAPI void PlayMusicStream(Music music);                              // Start music playing
 RLAPI bool IsMusicStreamPlaying(Music music);                         // Check if music is playing
 RLAPI bool IsMusicStreamPlaying(Music music);                         // Check if music is playing

+ 11 - 7
src/shapes.c

@@ -122,15 +122,19 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
 // Draw a line defining thickness
 // Draw a line defining thickness
 void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
 void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
 {
 {
-    Vector2 delta = {endPos.x-startPos.x, endPos.y-startPos.y};
-    float   length = sqrtf(delta.x*delta.x + delta.y*delta.y);
+    Vector2 delta = { endPos.x - startPos.x, endPos.y - startPos.y };
+    float length = sqrtf(delta.x*delta.x + delta.y*delta.y);
 
 
-    if (length > 0  &&  thick > 0)
+    if ((length > 0) && (thick > 0))
     {
     {
-        float   scale = thick/(2*length);
-        Vector2 radius = {-scale*delta.y, scale*delta.x};
-        Vector2 strip[] = {{startPos.x-radius.x, startPos.y-radius.y}, {startPos.x+radius.x, startPos.y+radius.y},
-                           {endPos.x-radius.x, endPos.y-radius.y}, {endPos.x+radius.x, endPos.y+radius.y}};
+        float scale = thick/(2*length);
+        Vector2 radius = { -scale*delta.y, scale*delta.x };
+        Vector2 strip[4] = {
+            { startPos.x - radius.x, startPos.y - radius.y }, 
+            { startPos.x + radius.x, startPos.y + radius.y },
+            { endPos.x - radius.x, endPos.y - radius.y }, 
+            { endPos.x + radius.x, endPos.y + radius.y }
+        };
 
 
         DrawTriangleStrip(strip, 4, color);
         DrawTriangleStrip(strip, 4, color);
     }
     }

+ 1 - 1
src/text.c

@@ -1176,7 +1176,7 @@ const char *TextFormat(const char *text, ...)
 
 
     // We create an array of buffers so strings don't expire until MAX_TEXTFORMAT_BUFFERS invocations
     // We create an array of buffers so strings don't expire until MAX_TEXTFORMAT_BUFFERS invocations
     static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = { 0 };
     static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = { 0 };
-    static int  index = 0;
+    static int index = 0;
 
 
     char *currentBuffer = buffers[index];
     char *currentBuffer = buffers[index];
     memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH);   // Clear buffer before using
     memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH);   // Clear buffer before using