Merge pull request #735 from RobLoach/patch-1
Fix clang++ compilation errors
This commit is contained in:
commit
30c025f913
38
src/core.c
38
src/core.c
@ -778,7 +778,7 @@ void SetWindowIcon(Image image)
|
|||||||
icon[0].pixels = (unsigned char *)imicon.data;
|
icon[0].pixels = (unsigned char *)imicon.data;
|
||||||
|
|
||||||
// NOTE 1: We only support one image icon
|
// NOTE 1: We only support one image icon
|
||||||
// NOTE 2: The specified image data is copied before this function returns
|
// NOTE 2: The specified image data is copied before this function returns
|
||||||
glfwSetWindowIcon(window, 1, icon);
|
glfwSetWindowIcon(window, 1, icon);
|
||||||
|
|
||||||
// TODO: Support multi-image icons --> image.mipmaps
|
// TODO: Support multi-image icons --> image.mipmaps
|
||||||
@ -1448,11 +1448,11 @@ Vector3 ColorToHSV(Color color)
|
|||||||
// Returns a Color from HSV values
|
// Returns a Color from HSV values
|
||||||
// Implementation reference: https://en.wikipedia.org/wiki/HSL_and_HSV#Alternative_HSV_conversion
|
// Implementation reference: https://en.wikipedia.org/wiki/HSL_and_HSV#Alternative_HSV_conversion
|
||||||
// NOTE: Color->HSV->Color conversion will not yield exactly the same color due to rounding errors
|
// NOTE: Color->HSV->Color conversion will not yield exactly the same color due to rounding errors
|
||||||
Color ColorFromHSV(Vector3 hsv)
|
Color ColorFromHSV(Vector3 hsv)
|
||||||
{
|
{
|
||||||
Color color = { 0, 0, 0, 255 };
|
Color color = { 0, 0, 0, 255 };
|
||||||
float h = hsv.x, s = hsv.y, v = hsv.z;
|
float h = hsv.x, s = hsv.y, v = hsv.z;
|
||||||
|
|
||||||
// Red channel
|
// Red channel
|
||||||
float k = fmod((5.0f + h/60.0f), 6);
|
float k = fmod((5.0f + h/60.0f), 6);
|
||||||
float t = 4.0f - k;
|
float t = 4.0f - k;
|
||||||
@ -1468,7 +1468,7 @@ Color ColorFromHSV(Vector3 hsv)
|
|||||||
k = (k < 1) ? k : 1;
|
k = (k < 1) ? k : 1;
|
||||||
k = (k > 0) ? k : 0;
|
k = (k > 0) ? k : 0;
|
||||||
color.g = (v - v*s*k)*255;
|
color.g = (v - v*s*k)*255;
|
||||||
|
|
||||||
// Blue channel
|
// Blue channel
|
||||||
k = fmod((1.0f + h/60.0f), 6);
|
k = fmod((1.0f + h/60.0f), 6);
|
||||||
t = 4.0f - k;
|
t = 4.0f - k;
|
||||||
@ -1476,7 +1476,7 @@ Color ColorFromHSV(Vector3 hsv)
|
|||||||
k = (k < 1) ? k : 1;
|
k = (k < 1) ? k : 1;
|
||||||
k = (k > 0) ? k : 0;
|
k = (k > 0) ? k : 0;
|
||||||
color.b = (v - v*s*k)*255;
|
color.b = (v - v*s*k)*255;
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,7 +1533,7 @@ void TakeScreenshot(const char *fileName)
|
|||||||
{
|
{
|
||||||
unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight);
|
unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight);
|
||||||
Image image = { imgData, renderWidth, renderHeight, 1, UNCOMPRESSED_R8G8B8A8 };
|
Image image = { imgData, renderWidth, renderHeight, 1, UNCOMPRESSED_R8G8B8A8 };
|
||||||
|
|
||||||
char path[512] = { 0 };
|
char path[512] = { 0 };
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
strcpy(path, internalDataPath);
|
strcpy(path, internalDataPath);
|
||||||
@ -1542,10 +1542,10 @@ void TakeScreenshot(const char *fileName)
|
|||||||
#else
|
#else
|
||||||
strcpy(path, fileName);
|
strcpy(path, fileName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ExportImage(image, path);
|
ExportImage(image, path);
|
||||||
free(imgData);
|
free(imgData);
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
// Download file from MEMFS (emscripten memory filesystem)
|
// Download file from MEMFS (emscripten memory filesystem)
|
||||||
// SaveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
// SaveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
||||||
@ -1642,7 +1642,7 @@ const char *GetFileNameWithoutExt(const char *filePath)
|
|||||||
|
|
||||||
// Try to allocate new string, same size as original
|
// Try to allocate new string, same size as original
|
||||||
// NOTE: By default strlen() does not count the '\0' character
|
// NOTE: By default strlen() does not count the '\0' character
|
||||||
if ((result = malloc(strlen(filePath) + 1)) == NULL) return NULL;
|
if ((result = (char *)malloc(strlen(filePath) + 1)) == NULL) return NULL;
|
||||||
|
|
||||||
strcpy(result, filePath); // Make a copy of the string
|
strcpy(result, filePath); // Make a copy of the string
|
||||||
|
|
||||||
@ -1877,15 +1877,15 @@ int StorageLoadValue(int position)
|
|||||||
// CHECK: https://github.com/raysan5/raylib/issues/686
|
// CHECK: https://github.com/raysan5/raylib/issues/686
|
||||||
void OpenURL(const char *url)
|
void OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
// Small security check trying to avoid (partially) malicious code...
|
// Small security check trying to avoid (partially) malicious code...
|
||||||
// sorry for the inconvenience when you hit this point...
|
// sorry for the inconvenience when you hit this point...
|
||||||
if (strchr(url, '\'') != NULL)
|
if (strchr(url, '\'') != NULL)
|
||||||
{
|
{
|
||||||
TraceLog(LOG_WARNING, "Provided URL does not seem to be valid.");
|
TraceLog(LOG_WARNING, "Provided URL does not seem to be valid.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *cmd = calloc(strlen(url) + 10, sizeof(char));
|
char *cmd = (char *)calloc(strlen(url) + 10, sizeof(char));
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
sprintf(cmd, "explorer '%s'", url);
|
sprintf(cmd, "explorer '%s'", url);
|
||||||
@ -3230,7 +3230,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
|||||||
{
|
{
|
||||||
GifEnd();
|
GifEnd();
|
||||||
gifRecording = false;
|
gifRecording = false;
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
// Download file from MEMFS (emscripten memory filesystem)
|
// Download file from MEMFS (emscripten memory filesystem)
|
||||||
// SaveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
// SaveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
||||||
@ -3243,7 +3243,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
|||||||
{
|
{
|
||||||
gifRecording = true;
|
gifRecording = true;
|
||||||
gifFramesCounter = 0;
|
gifFramesCounter = 0;
|
||||||
|
|
||||||
char path[512] = { 0 };
|
char path[512] = { 0 };
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
strcpy(path, internalDataPath);
|
strcpy(path, internalDataPath);
|
||||||
@ -3835,7 +3835,7 @@ static void InitKeyboard(void)
|
|||||||
tcsetattr(STDIN_FILENO, TCSANOW, &keyboardNewSettings);
|
tcsetattr(STDIN_FILENO, TCSANOW, &keyboardNewSettings);
|
||||||
|
|
||||||
// NOTE: Reading directly from stdin will give chars already key-mapped by kernel to ASCII or UNICODE
|
// NOTE: Reading directly from stdin will give chars already key-mapped by kernel to ASCII or UNICODE
|
||||||
|
|
||||||
// Save old keyboard mode to restore it at the end
|
// Save old keyboard mode to restore it at the end
|
||||||
if (ioctl(STDIN_FILENO, KDGKBMODE, &defaultKeyboardMode) < 0)
|
if (ioctl(STDIN_FILENO, KDGKBMODE, &defaultKeyboardMode) < 0)
|
||||||
{
|
{
|
||||||
@ -3868,10 +3868,10 @@ static void ProcessKeyboard(void)
|
|||||||
|
|
||||||
// Read availables keycodes from stdin
|
// Read availables keycodes from stdin
|
||||||
bufferByteCount = read(STDIN_FILENO, keysBuffer, MAX_KEYBUFFER_SIZE); // POSIX system call
|
bufferByteCount = read(STDIN_FILENO, keysBuffer, MAX_KEYBUFFER_SIZE); // POSIX system call
|
||||||
|
|
||||||
// Reset pressed keys array (it will be filled below)
|
// Reset pressed keys array (it will be filled below)
|
||||||
for (int i = 0; i < 512; i++) currentKeyState[i] = 0;
|
for (int i = 0; i < 512; i++) currentKeyState[i] = 0;
|
||||||
|
|
||||||
// Fill all read bytes (looking for keys)
|
// Fill all read bytes (looking for keys)
|
||||||
for (int i = 0; i < bufferByteCount; i++)
|
for (int i = 0; i < bufferByteCount; i++)
|
||||||
{
|
{
|
||||||
@ -3944,7 +3944,7 @@ static void ProcessKeyboard(void)
|
|||||||
currentKeyState[(int)keysBuffer[i] - 32] = 1;
|
currentKeyState[(int)keysBuffer[i] - 32] = 1;
|
||||||
}
|
}
|
||||||
else currentKeyState[(int)keysBuffer[i]] = 1;
|
else currentKeyState[(int)keysBuffer[i]] = 1;
|
||||||
|
|
||||||
lastKeyPressed = keysBuffer[i]; // Register last key pressed
|
lastKeyPressed = keysBuffer[i]; // Register last key pressed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user