mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-21 04:59:17 -05:00
Compare commits
4 Commits
63e4fd838d
...
de7fc12be0
| Author | SHA1 | Date | |
|---|---|---|---|
| de7fc12be0 | |||
| 8a2da96eed | |||
| af37fa2a96 | |||
| d0a6892989 |
@ -100,7 +100,7 @@
|
|||||||
#include <unistd.h> // Required for: usleep()
|
#include <unistd.h> // Required for: usleep()
|
||||||
|
|
||||||
//#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: Fails due to type redefinition
|
//#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: Fails due to type redefinition
|
||||||
void *glfwGetCocoaWindow(GLFWwindow* handle);
|
void *glfwGetCocoaWindow(GLFWwindow *handle);
|
||||||
#include "GLFW/glfw3native.h" // Required for: glfwGetCocoaWindow()
|
#include "GLFW/glfw3native.h" // Required for: glfwGetCocoaWindow()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -224,8 +224,8 @@ void ToggleFullscreen(void)
|
|||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
Vector2 scaleDpi = GetWindowScaleDPI();
|
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||||
CORE.Window.screen.width = (unsigned int)(CORE.Window.screen.width * scaleDpi.x);
|
CORE.Window.screen.width = (unsigned int)(CORE.Window.screen.width*scaleDpi.x);
|
||||||
CORE.Window.screen.height = (unsigned int)(CORE.Window.screen.height * scaleDpi.y);
|
CORE.Window.screen.height = (unsigned int)(CORE.Window.screen.height*scaleDpi.y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -303,8 +303,8 @@ void ToggleBorderlessWindowed(void)
|
|||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||||
{
|
{
|
||||||
Vector2 scaleDpi = GetWindowScaleDPI();
|
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||||
CORE.Window.screen.width = (unsigned int)(CORE.Window.screen.width * scaleDpi.x);
|
CORE.Window.screen.width = (unsigned int)(CORE.Window.screen.width*scaleDpi.x);
|
||||||
CORE.Window.screen.height = (unsigned int)(CORE.Window.screen.height * scaleDpi.y);
|
CORE.Window.screen.height = (unsigned int)(CORE.Window.screen.height*scaleDpi.y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -323,7 +323,7 @@ Uint8 SDL_EventState(Uint32 type, int state)
|
|||||||
return stateBefore;
|
return stateBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_GetCurrentDisplayMode_Adapter(SDL_DisplayID displayID, SDL_DisplayMode* mode)
|
void SDL_GetCurrentDisplayMode_Adapter(SDL_DisplayID displayID, SDL_DisplayMode *mode)
|
||||||
{
|
{
|
||||||
const SDL_DisplayMode *currentMode = SDL_GetCurrentDisplayMode(displayID);
|
const SDL_DisplayMode *currentMode = SDL_GetCurrentDisplayMode(displayID);
|
||||||
|
|
||||||
|
|||||||
39
src/rcore.c
39
src/rcore.c
@ -3831,7 +3831,6 @@ void PlayAutomationEvent(AutomationEvent event)
|
|||||||
// Check if a key has been pressed once
|
// Check if a key has been pressed once
|
||||||
bool IsKeyPressed(int key)
|
bool IsKeyPressed(int key)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
if ((key > 0) && (key < MAX_KEYBOARD_KEYS))
|
if ((key > 0) && (key < MAX_KEYBOARD_KEYS))
|
||||||
@ -3973,8 +3972,10 @@ bool IsGamepadButtonPressed(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.previousButtonState[gamepad][button] == 0) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) pressed = true;
|
{
|
||||||
|
if ((CORE.Input.Gamepad.previousButtonState[gamepad][button] == 0) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) pressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -3984,8 +3985,10 @@ bool IsGamepadButtonDown(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) down = true;
|
{
|
||||||
|
if (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1) down = true;
|
||||||
|
}
|
||||||
|
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
@ -3995,8 +3998,10 @@ bool IsGamepadButtonReleased(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.previousButtonState[gamepad][button] == 1) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) released = true;
|
{
|
||||||
|
if ((CORE.Input.Gamepad.previousButtonState[gamepad][button] == 1) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) released = true;
|
||||||
|
}
|
||||||
|
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
@ -4006,8 +4011,10 @@ bool IsGamepadButtonUp(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) up = true;
|
{
|
||||||
|
if (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0) up = true;
|
||||||
|
}
|
||||||
|
|
||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
@ -4053,10 +4060,13 @@ bool IsMouseButtonPressed(int button)
|
|||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK))
|
||||||
|
{
|
||||||
if ((CORE.Input.Mouse.currentButtonState[button] == 1) && (CORE.Input.Mouse.previousButtonState[button] == 0)) pressed = true;
|
if ((CORE.Input.Mouse.currentButtonState[button] == 1) && (CORE.Input.Mouse.previousButtonState[button] == 0)) pressed = true;
|
||||||
|
|
||||||
// Map touches to mouse buttons checking
|
// Map touches to mouse buttons checking
|
||||||
if ((CORE.Input.Touch.currentTouchState[button] == 1) && (CORE.Input.Touch.previousTouchState[button] == 0)) pressed = true;
|
if ((CORE.Input.Touch.currentTouchState[button] == 1) && (CORE.Input.Touch.previousTouchState[button] == 0)) pressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -4066,10 +4076,13 @@ bool IsMouseButtonDown(int button)
|
|||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
||||||
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK))
|
||||||
|
{
|
||||||
if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true;
|
if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true;
|
||||||
|
|
||||||
// NOTE: Touches are considered like mouse buttons
|
// NOTE: Touches are considered like mouse buttons
|
||||||
if (CORE.Input.Touch.currentTouchState[button] == 1) down = true;
|
if (CORE.Input.Touch.currentTouchState[button] == 1) down = true;
|
||||||
|
}
|
||||||
|
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
@ -4079,10 +4092,13 @@ bool IsMouseButtonReleased(int button)
|
|||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
||||||
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK))
|
||||||
|
{
|
||||||
if ((CORE.Input.Mouse.currentButtonState[button] == 0) && (CORE.Input.Mouse.previousButtonState[button] == 1)) released = true;
|
if ((CORE.Input.Mouse.currentButtonState[button] == 0) && (CORE.Input.Mouse.previousButtonState[button] == 1)) released = true;
|
||||||
|
|
||||||
// Map touches to mouse buttons checking
|
// Map touches to mouse buttons checking
|
||||||
if ((CORE.Input.Touch.currentTouchState[button] == 0) && (CORE.Input.Touch.previousTouchState[button] == 1)) released = true;
|
if ((CORE.Input.Touch.currentTouchState[button] == 0) && (CORE.Input.Touch.previousTouchState[button] == 1)) released = true;
|
||||||
|
}
|
||||||
|
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
@ -4092,10 +4108,13 @@ bool IsMouseButtonUp(int button)
|
|||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
||||||
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK))
|
||||||
|
{
|
||||||
if (CORE.Input.Mouse.currentButtonState[button] == 0) up = true;
|
if (CORE.Input.Mouse.currentButtonState[button] == 0) up = true;
|
||||||
|
|
||||||
// NOTE: Touches are considered like mouse buttons
|
// NOTE: Touches are considered like mouse buttons
|
||||||
if (CORE.Input.Touch.currentTouchState[button] == 0) up = true;
|
if (CORE.Input.Touch.currentTouchState[button] == 0) up = true;
|
||||||
|
}
|
||||||
|
|
||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
@ -4104,6 +4123,7 @@ bool IsMouseButtonUp(int button)
|
|||||||
int GetMouseX(void)
|
int GetMouseX(void)
|
||||||
{
|
{
|
||||||
int mouseX = (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x);
|
int mouseX = (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x);
|
||||||
|
|
||||||
return mouseX;
|
return mouseX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4111,6 +4131,7 @@ int GetMouseX(void)
|
|||||||
int GetMouseY(void)
|
int GetMouseY(void)
|
||||||
{
|
{
|
||||||
int mouseY = (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y);
|
int mouseY = (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y);
|
||||||
|
|
||||||
return mouseY;
|
return mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6517,7 +6517,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform* root = &animations[i].framePoses[j][0];
|
Transform *root = &animations[i].framePoses[j][0];
|
||||||
root->rotation = QuaternionMultiply(worldTransform.rotation, root->rotation);
|
root->rotation = QuaternionMultiply(worldTransform.rotation, root->rotation);
|
||||||
root->scale = Vector3Multiply(root->scale, worldTransform.scale);
|
root->scale = Vector3Multiply(root->scale, worldTransform.scale);
|
||||||
root->translation = Vector3Multiply(root->translation, worldTransform.scale);
|
root->translation = Vector3Multiply(root->translation, worldTransform.scale);
|
||||||
|
|||||||
@ -3625,7 +3625,7 @@ void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw circle within an image
|
// Draw circle within an image
|
||||||
void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color)
|
void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = radius;
|
int y = radius;
|
||||||
@ -3649,7 +3649,7 @@ void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color col
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw circle within an image (Vector version)
|
// Draw circle within an image (Vector version)
|
||||||
void ImageDrawCircleV(Image* dst, Vector2 center, int radius, Color color)
|
void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color)
|
||||||
{
|
{
|
||||||
ImageDrawCircle(dst, (int)center.x, (int)center.y, radius, color);
|
ImageDrawCircle(dst, (int)center.x, (int)center.y, radius, color);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,7 @@ static void ExportParsedData(const char *fileName, int format); // Export parsed
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc > 1) ProcessCommandLine(argc, argv);
|
if (argc > 1) ProcessCommandLine(argc, argv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user