mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-25 13:48:27 -04:00
Compare commits
5 Commits
d224912bd5
...
patch-1
| Author | SHA1 | Date | |
|---|---|---|---|
| 46b9579f0c | |||
| 8eb613e50a | |||
| 89b4fbd298 | |||
| 93e64f2210 | |||
| a9a0c046f1 |
@ -9,10 +9,10 @@ IDE | Platform(s) | Source | Example(s)
|
|||||||
[CMake](https://cmake.org/) | Windows, Linux, macOS, Web | ✔️ | ✔️
|
[CMake](https://cmake.org/) | Windows, Linux, macOS, Web | ✔️ | ✔️
|
||||||
[CodeBlocks](http://www.codeblocks.org/) | Windows, Linux, macOS | ❌ | ✔️
|
[CodeBlocks](http://www.codeblocks.org/) | Windows, Linux, macOS | ❌ | ✔️
|
||||||
[Geany](https://www.geany.org/) | Windows, Linux | ✔️ | ✔️
|
[Geany](https://www.geany.org/) | Windows, Linux | ✔️ | ✔️
|
||||||
[Notepad++](https://notepad-plus-plus.org/) | Windows | ✔️ | ✔️
|
[Notepad++](https://notepad-plus-plus.org/) | Windows Web | ✔️ | ✔️
|
||||||
[SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️
|
[SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️
|
||||||
[VS2019](https://www.visualstudio.com) | Windows | ✔️ | ✔️
|
[VS2022](https://www.visualstudio.com) | Windows | ✔️ | ✔️
|
||||||
[VSCode](https://code.visualstudio.com/) | Windows, macOS | ❌ | ✔️
|
[VSCode](https://code.visualstudio.com/) | Windows, Linux, macOS | ❌ | ✔️
|
||||||
[Zig](https://ziglang.org) | Windows, Linux, macOS, Web | ✔️ | ✔️
|
[Zig](https://ziglang.org) | Windows, Linux, macOS, Web | ✔️ | ✔️
|
||||||
scripts | Windows, Linux, macOS | ✔️ | ✔️
|
scripts | Windows, Linux, macOS | ✔️ | ✔️
|
||||||
|
|
||||||
|
|||||||
@ -1325,7 +1325,7 @@ void PollInputEvents(void)
|
|||||||
// Register previous gamepad states
|
// Register previous gamepad states
|
||||||
for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++) CORE.Input.Gamepad.previousButtonState[i][k] = CORE.Input.Gamepad.currentButtonState[i][k];
|
for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++) CORE.Input.Gamepad.previousButtonState[i][k] = CORE.Input.Gamepad.currentButtonState[i][k];
|
||||||
|
|
||||||
// Get current gamepad state
|
// Get current gamepad state using internal GLFW mapping, instead of the immediate joystick API
|
||||||
// NOTE: There is no callback available, getting it manually
|
// NOTE: There is no callback available, getting it manually
|
||||||
GLFWgamepadstate state = { 0 };
|
GLFWgamepadstate state = { 0 };
|
||||||
int result = glfwGetGamepadState(i, &state); // This remaps all gamepads so they have their buttons mapped like an xbox controller
|
int result = glfwGetGamepadState(i, &state); // This remaps all gamepads so they have their buttons mapped like an xbox controller
|
||||||
|
|||||||
@ -1507,8 +1507,16 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
|
|||||||
{
|
{
|
||||||
switch (eventType)
|
switch (eventType)
|
||||||
{
|
{
|
||||||
case EMSCRIPTEN_EVENT_MOUSEENTER: CORE.Input.Mouse.cursorOnScreen = true; break;
|
case EMSCRIPTEN_EVENT_MOUSEENTER: {
|
||||||
case EMSCRIPTEN_EVENT_MOUSELEAVE: CORE.Input.Mouse.cursorOnScreen = false; break;
|
// NOTE: Mouse position updated by EmscriptenMouseMoveCallback(),
|
||||||
|
// EmscriptenPointerlockCallback(), and EmscriptenTouchCallback()
|
||||||
|
CORE.Input.Mouse.cursorOnScreen = true;
|
||||||
|
} break;
|
||||||
|
case EMSCRIPTEN_EVENT_MOUSELEAVE:
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.cursorOnScreen = false;
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ 0 };
|
||||||
|
} break;
|
||||||
case EMSCRIPTEN_EVENT_MOUSEDOWN:
|
case EMSCRIPTEN_EVENT_MOUSEDOWN:
|
||||||
{
|
{
|
||||||
// NOTE: Emscripten and raylib buttons indices are not aligned
|
// NOTE: Emscripten and raylib buttons indices are not aligned
|
||||||
|
|||||||
@ -5237,7 +5237,7 @@ static int rlGetPixelDataSize(int width, int height, int format)
|
|||||||
{
|
{
|
||||||
int blockWidth = (width + 3)/4;
|
int blockWidth = (width + 3)/4;
|
||||||
int blockHeight = (height + 3)/4;
|
int blockHeight = (height + 3)/4;
|
||||||
unsigned long long dataSizeBytes = blockWidth*blockHeight*8;
|
unsigned long long dataSizeBytes = (unsigned long long)blockWidth*blockHeight*8;
|
||||||
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -5248,7 +5248,7 @@ static int rlGetPixelDataSize(int width, int height, int format)
|
|||||||
{
|
{
|
||||||
int blockWidth = (width + 3)/4;
|
int blockWidth = (width + 3)/4;
|
||||||
int blockHeight = (height + 3)/4;
|
int blockHeight = (height + 3)/4;
|
||||||
unsigned long long dataSizeBytes = blockWidth*blockHeight*16;
|
unsigned long long dataSizeBytes = (unsigned long long)blockWidth*blockHeight*16;
|
||||||
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -5256,7 +5256,7 @@ static int rlGetPixelDataSize(int width, int height, int format)
|
|||||||
{
|
{
|
||||||
int blockWidth = (width + 3)/4;
|
int blockWidth = (width + 3)/4;
|
||||||
int blockHeight = (height + 3)/4;
|
int blockHeight = (height + 3)/4;
|
||||||
unsigned long long dataSizeBytes = blockWidth*blockHeight*4;
|
unsigned long long dataSizeBytes = (unsigned long long)blockWidth*blockHeight*4;
|
||||||
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -5267,7 +5267,7 @@ static int rlGetPixelDataSize(int width, int height, int format)
|
|||||||
if ((format >= RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) &&
|
if ((format >= RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) &&
|
||||||
(format <= RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16))
|
(format <= RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16))
|
||||||
{
|
{
|
||||||
unsigned long long dataSizeBytes = (width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
|
unsigned long long dataSizeBytes = ((unsigned long long)width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
|
||||||
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
if (dataSizeBytes < INT_MAX) dataSize = (int)dataSizeBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2014,7 +2014,7 @@ char *TextInsertAlloc(const char *text, const char *insert, int position)
|
|||||||
|
|
||||||
for (int i = 0; i < position; i++) result[i] = text[i];
|
for (int i = 0; i < position; i++) result[i] = text[i];
|
||||||
for (int i = position; i < (insertLen + position); i++) result[i] = insert[i - position];
|
for (int i = position; i < (insertLen + position); i++) result[i] = insert[i - position];
|
||||||
for (int i = (insertLen + position); i < (textLen + insertLen + position); i++) result[i] = text[i - insertLen];
|
for (int i = (insertLen + position); i < (textLen + insertLen); i++) result[i] = text[i - insertLen];
|
||||||
|
|
||||||
result[textLen + insertLen] = '\0'; // Add EOL
|
result[textLen + insertLen] = '\0'; // Add EOL
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2693,8 +2693,9 @@ void ImageRotate(Image *image, int degrees)
|
|||||||
int width = (int)(fabsf(image->width*cosRadius) + fabsf(image->height*sinRadius));
|
int width = (int)(fabsf(image->width*cosRadius) + fabsf(image->height*sinRadius));
|
||||||
int height = (int)(fabsf(image->height*cosRadius) + fabsf(image->width*sinRadius));
|
int height = (int)(fabsf(image->height*cosRadius) + fabsf(image->width*sinRadius));
|
||||||
|
|
||||||
int bytesPerPixel = GetPixelDataSize(width, height, image->format);
|
int dataSize = GetPixelDataSize(width, height, image->format);
|
||||||
unsigned char *rotatedData = (unsigned char *)RL_CALLOC(bytesPerPixel, 1);
|
int bytesPerPixel = GetPixelDataSize(1, 1, image->format);
|
||||||
|
unsigned char *rotatedData = (unsigned char *)RL_CALLOC(dataSize, 1);
|
||||||
|
|
||||||
if (rotatedData != NULL)
|
if (rotatedData != NULL)
|
||||||
{
|
{
|
||||||
@ -5514,7 +5515,7 @@ int GetPixelDataSize(int width, int height, int format)
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long dataSizeBytes = (width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
|
unsigned long long dataSizeBytes = ((unsigned long long)width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
|
||||||
|
|
||||||
if (dataSizeBytes < INT_MAX)
|
if (dataSizeBytes < INT_MAX)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user