Formatting tweaks
This commit is contained in:
parent
d27709b1f2
commit
a9ab516dae
5 changed files with 19 additions and 19 deletions
|
@ -1068,7 +1068,7 @@ static void UnloadWave(Wave wave)
|
||||||
const char *GetExtension(const char *fileName)
|
const char *GetExtension(const char *fileName)
|
||||||
{
|
{
|
||||||
const char *dot = strrchr(fileName, '.');
|
const char *dot = strrchr(fileName, '.');
|
||||||
if(!dot || dot == fileName) return "";
|
if (!dot || dot == fileName) return "";
|
||||||
return (dot + 1);
|
return (dot + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,7 +1083,7 @@ void TraceLog(int msgType, const char *text, ...)
|
||||||
traceDebugMsgs = 0;
|
traceDebugMsgs = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(msgType)
|
switch (msgType)
|
||||||
{
|
{
|
||||||
case INFO: fprintf(stdout, "INFO: "); break;
|
case INFO: fprintf(stdout, "INFO: "); break;
|
||||||
case ERROR: fprintf(stdout, "ERROR: "); break;
|
case ERROR: fprintf(stdout, "ERROR: "); break;
|
||||||
|
|
|
@ -2451,7 +2451,7 @@ static EM_BOOL EmscriptenInputCallback(int eventType, const EmscriptenTouchEvent
|
||||||
printf("%s, numTouches: %d %s%s%s%s\n", emscripten_event_type_to_string(eventType), event->numTouches,
|
printf("%s, numTouches: %d %s%s%s%s\n", emscripten_event_type_to_string(eventType), event->numTouches,
|
||||||
event->ctrlKey ? " CTRL" : "", event->shiftKey ? " SHIFT" : "", event->altKey ? " ALT" : "", event->metaKey ? " META" : "");
|
event->ctrlKey ? " CTRL" : "", event->shiftKey ? " SHIFT" : "", event->altKey ? " ALT" : "", event->metaKey ? " META" : "");
|
||||||
|
|
||||||
for(int i = 0; i < event->numTouches; ++i)
|
for (int i = 0; i < event->numTouches; ++i)
|
||||||
{
|
{
|
||||||
const EmscriptenTouchPoint *t = &event->touches[i];
|
const EmscriptenTouchPoint *t = &event->touches[i];
|
||||||
|
|
||||||
|
|
12
src/models.c
12
src/models.c
|
@ -270,25 +270,25 @@ void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float hei
|
||||||
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
|
||||||
// Back Face
|
// Back Face
|
||||||
rlNormal3f( 0.0f, 0.0f,-1.0f); // Normal Pointing Away From Viewer
|
rlNormal3f(0.0f, 0.0f,-1.0f); // Normal Pointing Away From Viewer
|
||||||
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
|
||||||
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Left Of The Texture and Quad
|
||||||
// Top Face
|
// Top Face
|
||||||
rlNormal3f( 0.0f, 1.0f, 0.0f); // Normal Pointing Up
|
rlNormal3f(0.0f, 1.0f, 0.0f); // Normal Pointing Up
|
||||||
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Bottom Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Bottom Left Of The Texture and Quad
|
||||||
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Bottom Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Bottom Right Of The Texture and Quad
|
||||||
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
||||||
// Bottom Face
|
// Bottom Face
|
||||||
rlNormal3f( 0.0f,-1.0f, 0.0f); // Normal Pointing Down
|
rlNormal3f(0.0f,-1.0f, 0.0f); // Normal Pointing Down
|
||||||
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Right Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Top Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Top Left Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Left Of The Texture and Quad
|
||||||
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Right Of The Texture and Quad
|
||||||
// Right face
|
// Right face
|
||||||
rlNormal3f( 1.0f, 0.0f, 0.0f); // Normal Pointing Right
|
rlNormal3f(1.0f, 0.0f, 0.0f); // Normal Pointing Right
|
||||||
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
|
||||||
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
|
||||||
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
|
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
|
||||||
|
@ -1905,14 +1905,14 @@ static Mesh LoadOBJ(const char *fileName)
|
||||||
}
|
}
|
||||||
else if (dataType == 'n') // Read normals
|
else if (dataType == 'n') // Read normals
|
||||||
{
|
{
|
||||||
fscanf(objFile, "%f %f %f", &midNormals[countNormals].x, &midNormals[countNormals].y, &midNormals[countNormals].z );
|
fscanf(objFile, "%f %f %f", &midNormals[countNormals].x, &midNormals[countNormals].y, &midNormals[countNormals].z);
|
||||||
countNormals++;
|
countNormals++;
|
||||||
|
|
||||||
fscanf(objFile, "%c", &dataType);
|
fscanf(objFile, "%c", &dataType);
|
||||||
}
|
}
|
||||||
else // Read vertex
|
else // Read vertex
|
||||||
{
|
{
|
||||||
fscanf(objFile, "%f %f %f", &midVertices[countVertex].x, &midVertices[countVertex].y, &midVertices[countVertex].z );
|
fscanf(objFile, "%f %f %f", &midVertices[countVertex].x, &midVertices[countVertex].y, &midVertices[countVertex].z);
|
||||||
countVertex++;
|
countVertex++;
|
||||||
|
|
||||||
fscanf(objFile, "%c", &dataType);
|
fscanf(objFile, "%c", &dataType);
|
||||||
|
|
18
src/text.c
18
src/text.c
|
@ -319,7 +319,7 @@ void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, float
|
||||||
// NOTE: Some ugly hacks are made to support Latin-1 Extended characters directly
|
// NOTE: Some ugly hacks are made to support Latin-1 Extended characters directly
|
||||||
// written in C code files (codified by default as UTF-8)
|
// written in C code files (codified by default as UTF-8)
|
||||||
|
|
||||||
for(int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
// TODO: Right now we are supposing characters that follow a continous order and start at FONT_FIRST_CHAR,
|
// TODO: Right now we are supposing characters that follow a continous order and start at FONT_FIRST_CHAR,
|
||||||
// this sytem can be improved to support any characters order and init value...
|
// this sytem can be improved to support any characters order and init value...
|
||||||
|
@ -514,9 +514,9 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar)
|
||||||
Color *pixels = GetImageData(image);
|
Color *pixels = GetImageData(image);
|
||||||
|
|
||||||
// Parse image data to get charSpacing and lineSpacing
|
// Parse image data to get charSpacing and lineSpacing
|
||||||
for(y = 0; y < image.height; y++)
|
for (y = 0; y < image.height; y++)
|
||||||
{
|
{
|
||||||
for(x = 0; x < image.width; x++)
|
for (x = 0; x < image.width; x++)
|
||||||
{
|
{
|
||||||
if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
|
if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar)
|
||||||
int charHeight = 0;
|
int charHeight = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
while(!COLOR_EQUAL(pixels[(lineSpacing + j)*image.width + charSpacing], key)) j++;
|
while (!COLOR_EQUAL(pixels[(lineSpacing + j)*image.width + charSpacing], key)) j++;
|
||||||
|
|
||||||
charHeight = j;
|
charHeight = j;
|
||||||
|
|
||||||
|
@ -539,9 +539,9 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar)
|
||||||
int xPosToRead = charSpacing;
|
int xPosToRead = charSpacing;
|
||||||
|
|
||||||
// Parse image data to get rectangle sizes
|
// Parse image data to get rectangle sizes
|
||||||
while((lineSpacing + lineToRead * (charHeight + lineSpacing)) < image.height)
|
while ((lineSpacing + lineToRead * (charHeight + lineSpacing)) < image.height)
|
||||||
{
|
{
|
||||||
while((xPosToRead < image.width) &&
|
while ((xPosToRead < image.width) &&
|
||||||
!COLOR_EQUAL((pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead]), key))
|
!COLOR_EQUAL((pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead]), key))
|
||||||
{
|
{
|
||||||
tempCharValues[index] = firstChar + index;
|
tempCharValues[index] = firstChar + index;
|
||||||
|
@ -552,7 +552,7 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar)
|
||||||
|
|
||||||
int charWidth = 0;
|
int charWidth = 0;
|
||||||
|
|
||||||
while(!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
|
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
|
||||||
|
|
||||||
tempCharRecs[index].width = charWidth;
|
tempCharRecs[index].width = charWidth;
|
||||||
|
|
||||||
|
@ -648,11 +648,11 @@ static SpriteFont LoadRBMF(const char *fileName)
|
||||||
|
|
||||||
rbmfFileData = (unsigned int *)malloc(numPixelBits * sizeof(unsigned int));
|
rbmfFileData = (unsigned int *)malloc(numPixelBits * sizeof(unsigned int));
|
||||||
|
|
||||||
for(int i = 0; i < numPixelBits; i++) fread(&rbmfFileData[i], sizeof(unsigned int), 1, rbmfFile);
|
for (int i = 0; i < numPixelBits; i++) fread(&rbmfFileData[i], sizeof(unsigned int), 1, rbmfFile);
|
||||||
|
|
||||||
rbmfCharWidthData = (unsigned char *)malloc(spriteFont.numChars * sizeof(unsigned char));
|
rbmfCharWidthData = (unsigned char *)malloc(spriteFont.numChars * sizeof(unsigned char));
|
||||||
|
|
||||||
for(int i = 0; i < spriteFont.numChars; i++) fread(&rbmfCharWidthData[i], sizeof(unsigned char), 1, rbmfFile);
|
for (int i = 0; i < spriteFont.numChars; i++) fread(&rbmfCharWidthData[i], sizeof(unsigned char), 1, rbmfFile);
|
||||||
|
|
||||||
// Re-construct image from rbmfFileData
|
// Re-construct image from rbmfFileData
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
|
|
|
@ -1612,7 +1612,7 @@ static Image LoadDDS(const char *fileName)
|
||||||
|
|
||||||
image.mipmaps = header.mipmapCount;
|
image.mipmaps = header.mipmapCount;
|
||||||
|
|
||||||
switch(header.ddspf.fourCC)
|
switch (header.ddspf.fourCC)
|
||||||
{
|
{
|
||||||
case FOURCC_DXT1:
|
case FOURCC_DXT1:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue