Update C sources

This commit is contained in:
Milan Nikolic 2023-11-12 11:58:48 +01:00
parent 0d91e92a2f
commit 3c5dec7f24
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
6 changed files with 71 additions and 37 deletions

View file

@ -1106,12 +1106,11 @@ void PollInputEvents(void)
// Reset keys/chars pressed registered
CORE.Input.Keyboard.keyPressedQueueCount = 0;
CORE.Input.Keyboard.charPressedQueueCount = 0;
// Reset key repeats
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
// Reset last gamepad button/axis registered state
CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN
//CORE.Input.Gamepad.axisCount = 0;
// Keyboard/Mouse input polling (automatically managed by GLFW3 through callback)
// Register previous keys states
@ -1225,7 +1224,7 @@ void PollInputEvents(void)
CORE.Window.resizedLastFrame = false;
if (CORE.Window.eventWaiting) glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks)
else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) -> Update keys state
// While window minimized, stop loop execution
while (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)) glfwWaitEvents();

View file

@ -1,6 +1,6 @@
/**********************************************************************************************
*
* raylib v4.6-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
*
* FEATURES:
* - NO external dependencies, all required libraries included with raylib

View file

@ -658,6 +658,7 @@ void InitWindow(int width, int height, const char *title)
#endif
CORE.Time.frameCounter = 0;
CORE.Window.shouldClose = false;
// Initialize random seed
SetRandomSeed((unsigned int)time(NULL));
@ -864,6 +865,10 @@ void EndDrawing(void)
}
#endif
#if defined(SUPPORT_AUTOMATION_EVENTS)
if (automationEventRecording) RecordAutomationEvent(); // Event recording
#endif
#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL)
SwapScreenBuffer(); // Copy back buffer to front buffer (screen)
@ -927,10 +932,6 @@ void EndDrawing(void)
}
#endif // SUPPORT_SCREEN_CAPTURE
#if defined(SUPPORT_AUTOMATION_EVENTS)
if (automationEventRecording) RecordAutomationEvent(); // Event recording
#endif
CORE.Time.frameCounter++;
}
@ -1093,19 +1094,19 @@ void BeginScissorMode(int x, int y, int width, int height)
rlEnableScissorTest();
#if defined(__APPLE__)
if (CORE.Window.usingFbo)
if (!CORE.Window.usingFbo)
{
Vector2 scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(GetScreenHeight()*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y));
}
#else
if (CORE.Window.usingFbo && ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0))
if (!CORE.Window.usingFbo && ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0))
{
Vector2 scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y));
}
#endif
else
else
{
rlScissor(x, CORE.Window.currentFbo.height - (y + height), width, height);
}
@ -1588,8 +1589,8 @@ int GetFPS(void)
average = 0;
last = 0;
index = 0;
for (int i = 0; i < FPS_CAPTURE_FRAMES_COUNT; i++)
history[i] = 0;
for (int i = 0; i < FPS_CAPTURE_FRAMES_COUNT; i++) history[i] = 0;
}
if (fpsFrame == 0) return 0;
@ -1720,7 +1721,7 @@ int GetRandomValue(int min, int max)
int *LoadRandomSequence(unsigned int count, int min, int max)
{
int *values = NULL;
#if defined(SUPPORT_RPRAND_GENERATOR)
values = rprand_load_sequence(count, min, max);
#else
@ -2582,8 +2583,11 @@ void PlayAutomationEvent(AutomationEvent event)
case INPUT_KEY_UP: CORE.Input.Keyboard.currentKeyState[event.params[0]] = false; break; // param[0]: key
case INPUT_KEY_DOWN: { // param[0]: key
CORE.Input.Keyboard.currentKeyState[event.params[0]] = true;
if (CORE.Input.Keyboard.previousKeyState[event.params[0]] == false) {
if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) {
if (CORE.Input.Keyboard.previousKeyState[event.params[0]] == false)
{
if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE)
{
// Add character to the queue
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = event.params[0];
CORE.Input.Keyboard.keyPressedQueueCount++;

View file

@ -59,7 +59,7 @@
* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance
* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
*
* When loading a shader, the following vertex attribute and uniform
* When loading a shader, the following vertex attributes and uniform
* location names are tried to be set automatically:
*
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
@ -67,6 +67,7 @@
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
@ -1064,7 +1065,7 @@ static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
static void rlLoadShaderDefault(void); // Load default shader
static void rlUnloadShaderDefault(void); // Unload default shader
#if defined(RLGL_SHOW_GL_DETAILS_INFO)
static char *rlGetCompressedFormatName(int format); // Get compressed format official GL identifier name
static const char *rlGetCompressedFormatName(int format); // Get compressed format official GL identifier name
#endif // RLGL_SHOW_GL_DETAILS_INFO
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
@ -4689,7 +4690,7 @@ static void rlUnloadShaderDefault(void)
#if defined(RLGL_SHOW_GL_DETAILS_INFO)
// Get compressed format official GL identifier name
static char *rlGetCompressedFormatName(int format)
static const char *rlGetCompressedFormatName(int format)
{
switch (format)
{