Corrected some issues to compile with MSC

This commit is contained in:
raysan5 2016-07-29 13:17:50 +02:00
parent a422e39492
commit a008d49230
3 changed files with 43 additions and 10 deletions

View File

@ -78,6 +78,10 @@
#define JAR_MOD_IMPLEMENTATION
#include "external/jar_mod.h" // MOD loading functions
#ifdef _MSC_VER
#undef bool
#endif
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------

View File

@ -1435,7 +1435,7 @@ static void jar_xm_volume_slide(jar_xm_channel_context_t* ch, uint8_t rawval) {
}
}
static float jar_xm_envelope_lerp(jar_xm_envelope_point_t* restrict a, jar_xm_envelope_point_t* restrict b, uint16_t pos) {
static float jar_xm_envelope_lerp(jar_xm_envelope_point_t* a, jar_xm_envelope_point_t* b, uint16_t pos) {
/* Linear interpolation between two envelope points */
if(pos <= a->frame) return a->value;
else if(pos >= b->frame) return b->value;

View File

@ -415,14 +415,14 @@ void rlMatrixMode(int mode)
}
}
void rlFrustum(double left, double right, double bottom, double top, double near, double far)
void rlFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
{
glFrustum(left, right, bottom, top, near, far);
glFrustum(left, right, bottom, top, zNear, zFar);
}
void rlOrtho(double left, double right, double bottom, double top, double near, double far)
void rlOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
{
glOrtho(left, right, bottom, top, near, far);
glOrtho(left, right, bottom, top, zNear, zFar);
}
void rlPushMatrix(void) { glPushMatrix(); }
@ -1056,8 +1056,13 @@ void rlglInit(int width, int height)
// We get a list of available extensions and we check for some of them (compressed textures)
// NOTE: We don't need to check again supported extensions but we do (GLAD already dealt with that)
glGetIntegerv(GL_NUM_EXTENSIONS, &numExt);
const char *extList[numExt];
#ifdef _MSC_VER
const char **extList = malloc(sizeof(const char *)*numExt);
#else
const char *extList[numExt];
#endif
for (int i = 0; i < numExt; i++) extList[i] = (char *)glGetStringi(GL_EXTENSIONS, i);
#elif defined(GRAPHICS_API_OPENGL_ES2)
@ -1137,6 +1142,10 @@ void rlglInit(int width, int height)
if (strcmp(extList[i], (const char *)"GL_KHR_texture_compression_astc_hdr") == 0) texCompASTCSupported = true;
}
#ifdef _MSC_VER
free(extList);
#endif
#if defined(GRAPHICS_API_OPENGL_ES2)
if (vaoSupported) TraceLog(INFO, "[EXTENSION] VAO extension detected, VAO functions initialized successfully");
else TraceLog(WARNING, "[EXTENSION] VAO extension not found, VAO usage not supported");
@ -2891,11 +2900,18 @@ static unsigned int LoadShaderProgram(const char *vShaderStr, const char *fShade
glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &maxLength);
#ifdef _MSC_VER
char *log = malloc(maxLength);
#else
char log[maxLength];
#endif
glGetShaderInfoLog(vertexShader, maxLength, &length, log);
TraceLog(INFO, "%s", log);
#ifdef _MSC_VER
free(log);
#endif
}
else TraceLog(INFO, "[VSHDR ID %i] Vertex shader compiled successfully", vertexShader);
@ -2912,11 +2928,18 @@ static unsigned int LoadShaderProgram(const char *vShaderStr, const char *fShade
glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &maxLength);
#ifdef _MSC_VER
char *log = malloc(maxLength);
#else
char log[maxLength];
#endif
glGetShaderInfoLog(fragmentShader, maxLength, &length, log);
TraceLog(INFO, "%s", log);
#ifdef _MSC_VER
free(log);
#endif
}
else TraceLog(INFO, "[FSHDR ID %i] Fragment shader compiled successfully", fragmentShader);
@ -2950,12 +2973,18 @@ static unsigned int LoadShaderProgram(const char *vShaderStr, const char *fShade
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
#ifdef _MSC_VER
char *log = malloc(maxLength);
#else
char log[maxLength];
#endif
glGetProgramInfoLog(program, maxLength, &length, log);
TraceLog(INFO, "%s", log);
#ifdef _MSC_VER
free(log);
#endif
glDeleteProgram(program);
program = 0;