summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2021-06-10 18:00:44 +0200
committerRay <[email protected]>2021-06-10 18:00:44 +0200
commitb188008a1c746abf1c086a00708a447c1abbb19b (patch)
treea838d6b606d86275e904cd036b4d2ae312c06d27 /src
parent7bc2e922c9a04e9a1bb54088522e0f318feeb17c (diff)
downloadraylib-b188008a1c746abf1c086a00708a447c1abbb19b.tar.gz
raylib-b188008a1c746abf1c086a00708a447c1abbb19b.zip
Review code formatting
Diffstat (limited to 'src')
-rw-r--r--src/core.c2
-rw-r--r--src/models.c14
-rw-r--r--src/raudio.c14
-rw-r--r--src/raylib.h2
-rw-r--r--src/shapes.c18
-rw-r--r--src/text.c2
6 files changed, 28 insertions, 24 deletions
diff --git a/src/core.c b/src/core.c
index 62a9777d..50749704 100644
--- a/src/core.c
+++ b/src/core.c
@@ -6288,7 +6288,7 @@ bool UWPIsConfigured()
}
// 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; }
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func) { uwpQueryTimeFunc = func; }
UWPSleepFunc UWPGetSleepFunc(void) { return uwpSleepFunc; }
diff --git a/src/models.c b/src/models.c
index 0db2f789..e927fa56 100644
--- a/src/models.c
+++ b/src/models.c
@@ -117,11 +117,11 @@ static ModelAnimation *LoadIQMModelAnimations(const char *fileName, int *animCou
#if defined(SUPPORT_FILEFORMAT_GLTF)
static Model LoadGLTF(const char *fileName); // Load GLTF mesh 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
//----------------------------------------------------------------------------------
@@ -3773,7 +3773,7 @@ static Model LoadIQM(const char *fileName)
}
// 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_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)
{
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++)
{
diff --git a/src/raudio.c b/src/raudio.c
index 6be1960c..1ff956a1 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1311,7 +1311,7 @@ Music LoadMusicStream(const char *fileName)
}
// 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 };
bool musicLoaded = false;
@@ -1325,7 +1325,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
{
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.ctxData = ctxWav;
@@ -1383,7 +1383,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
// Open ogg audio stream
music.ctxType = MUSIC_AUDIO_OGG;
//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)
{
@@ -1403,7 +1403,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
else if (TextIsEqual(fileExtLower, ".xm"))
{
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
{
music.ctxType = MUSIC_MODULE_XM;
@@ -1660,17 +1660,17 @@ void UpdateMusicStream(Music music)
{
case ma_format_f32:
// 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;
case ma_format_s16:
// 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;
case ma_format_u8:
// 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;
}
diff --git a/src/raylib.h b/src/raylib.h
index fd3366b0..cedf4f5d 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1499,7 +1499,7 @@ RLAPI void UnloadWaveSamples(float *samples); // Unload
// Music management functions
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 PlayMusicStream(Music music); // Start music playing
RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
diff --git a/src/shapes.c b/src/shapes.c
index 5ed7acbb..5acd9810 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -122,15 +122,19 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
// Draw a line defining thickness
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);
}
diff --git a/src/text.c b/src/text.c
index 6f56c895..9a42796e 100644
--- a/src/text.c
+++ b/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
static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = { 0 };
- static int index = 0;
+ static int index = 0;
char *currentBuffer = buffers[index];
memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using