feat(fixLib): fix release raylib

This commit is contained in:
Arthur Bichara 2025-01-17 17:30:47 +01:00
commit 2f5406bbd9

View file

@ -40,7 +40,7 @@ typedef struct LightInfo {
Vector2 position; // Light position
RenderTexture mask; // Alpha mask for the light
float outerRadius; // The distance the light touches
Rectangle bounds; // A cached rectangle of the light bounds to help with culling
rayRectangle bounds; // A cached rayRectangle of the light bounds to help with culling
ShadowGeometry shadows[MAX_SHADOWS];
int shadowCount;
@ -137,7 +137,7 @@ void SetupLight(int slot, float x, float y, float radius)
}
// See if a light needs to update it's mask
bool UpdateLight(int slot, Rectangle* boxes, int count)
bool UpdateLight(int slot, rayRectangle* boxes, int count)
{
if (!lights[slot].active || !lights[slot].dirty) return false;
@ -192,17 +192,17 @@ bool UpdateLight(int slot, Rectangle* boxes, int count)
}
// Set up some boxes
void SetupBoxes(Rectangle *boxes, int *count)
void SetupBoxes(rayRectangle *boxes, int *count)
{
boxes[0] = (Rectangle){ 150,80, 40, 40 };
boxes[1] = (Rectangle){ 1200, 700, 40, 40 };
boxes[2] = (Rectangle){ 200, 600, 40, 40 };
boxes[3] = (Rectangle){ 1000, 50, 40, 40 };
boxes[4] = (Rectangle){ 500, 350, 40, 40 };
boxes[0] = (rayRectangle){ 150,80, 40, 40 };
boxes[1] = (rayRectangle){ 1200, 700, 40, 40 };
boxes[2] = (rayRectangle){ 200, 600, 40, 40 };
boxes[3] = (rayRectangle){ 1000, 50, 40, 40 };
boxes[4] = (rayRectangle){ 500, 350, 40, 40 };
for (int i = 5; i < MAX_BOXES; i++)
{
boxes[i] = (Rectangle){(float)GetRandomValue(0,GetScreenWidth()), (float)GetRandomValue(0,GetScreenHeight()), (float)GetRandomValue(10,100), (float)GetRandomValue(10,100) };
boxes[i] = (rayRectangle){(float)GetRandomValue(0,GetScreenWidth()), (float)GetRandomValue(0,GetScreenHeight()), (float)GetRandomValue(10,100), (float)GetRandomValue(10,100) };
}
*count = MAX_BOXES;
@ -222,7 +222,7 @@ int main(void)
// Initialize our 'world' of boxes
int boxCount = 0;
Rectangle boxes[MAX_BOXES] = { 0 };
rayRectangle boxes[MAX_BOXES] = { 0 };
SetupBoxes(boxes, &boxCount);
// Create a checkerboard ground texture
@ -282,7 +282,7 @@ int main(void)
// Merge in all the light masks
for (int i = 0; i < MAX_LIGHTS; i++)
{
if (lights[i].active) DrawTextureRec(lights[i].mask.texture, (Rectangle){ 0, 0, (float)GetScreenWidth(), -(float)GetScreenHeight() }, Vector2Zero(), WHITE);
if (lights[i].active) DrawTextureRec(lights[i].mask.texture, (rayRectangle){ 0, 0, (float)GetScreenWidth(), -(float)GetScreenHeight() }, Vector2Zero(), WHITE);
}
rlDrawRenderBatchActive();
@ -300,10 +300,10 @@ int main(void)
ClearBackground(BLACK);
// Draw the tile background
DrawTextureRec(backgroundTexture, (Rectangle){ 0, 0, (float)GetScreenWidth(), (float)GetScreenHeight() }, Vector2Zero(), WHITE);
DrawTextureRec(backgroundTexture, (rayRectangle){ 0, 0, (float)GetScreenWidth(), (float)GetScreenHeight() }, Vector2Zero(), WHITE);
// Overlay the shadows from all the lights
DrawTextureRec(lightMask.texture, (Rectangle){ 0, 0, (float)GetScreenWidth(), -(float)GetScreenHeight() }, Vector2Zero(), ColorAlpha(WHITE, showLines? 0.75f : 1.0f));
DrawTextureRec(lightMask.texture, (rayRectangle){ 0, 0, (float)GetScreenWidth(), -(float)GetScreenHeight() }, Vector2Zero(), ColorAlpha(WHITE, showLines? 0.75f : 1.0f));
// Draw the lights
for (int i = 0; i < MAX_LIGHTS; i++)
@ -320,9 +320,9 @@ int main(void)
for (int b = 0; b < boxCount; b++)
{
if (CheckCollisionRecs(boxes[b],lights[0].bounds)) DrawRectangleRec(boxes[b], PURPLE);
if (CheckCollisionRecs(boxes[b],lights[0].bounds)) DrawrayRectangleRec(boxes[b], PURPLE);
DrawRectangleLines((int)boxes[b].x, (int)boxes[b].y, (int)boxes[b].width, (int)boxes[b].height, DARKBLUE);
DrawrayRectangleLines((int)boxes[b].x, (int)boxes[b].y, (int)boxes[b].width, (int)boxes[b].height, DARKBLUE);
}
DrawText("(F1) Hide Shadow Volumes", 10, 50, 10, GREEN);
@ -349,7 +349,7 @@ int main(void)
if (lights[i].active) UnloadRenderTexture(lights[i].mask);
}
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;