feat(fixLib): fix release raylib

This commit is contained in:
Arthur Bichara 2025-01-17 17:30:47 +01:00
commit 2f5406bbd9
12 changed files with 1840 additions and 1840 deletions

View file

@ -94,7 +94,7 @@ int main(void)
ClearBackground(RAYWHITE);
DrawRectangle(0, 0, GetScreenWidth(), 70, BLACK);
DrawrayRectangle(0, 0, GetScreenWidth(), 70, BLACK);
DrawText(TextFormat("Total codepoints contained in provided text: %i", codepointCount), 10, 10, 20, GREEN);
DrawText(TextFormat("Total codepoints required for font atlas (duplicates excluded): %i", codepointsNoDupsCount), 10, 40, 20, GREEN);
@ -102,7 +102,7 @@ int main(void)
{
// Draw generated font texture atlas containing provided codepoints
DrawTexture(font.texture, 150, 100, BLACK);
DrawRectangleLines(150, 100, font.texture.width, font.texture.height, BLACK);
DrawrayRectangleLines(150, 100, font.texture.width, font.texture.height, BLACK);
}
else
{
@ -120,7 +120,7 @@ int main(void)
//--------------------------------------------------------------------------------------
UnloadFont(font); // Unload font
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -441,7 +441,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadFont(font);
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
@ -458,14 +458,14 @@ static void DrawTextCodepoint3D(Font font, int codepoint, Vector3 position, floa
int index = GetGlyphIndex(font, codepoint);
float scale = fontSize/(float)font.baseSize;
// Character destination rectangle on screen
// Character destination rayRectangle on screen
// NOTE: We consider charsPadding on drawing
position.x += (float)(font.glyphs[index].offsetX - font.glyphPadding)/(float)font.baseSize*scale;
position.z += (float)(font.glyphs[index].offsetY - font.glyphPadding)/(float)font.baseSize*scale;
// Character source rectangle from font texture atlas
// Character source rayRectangle from font texture atlas
// NOTE: We consider chars padding when drawing, it could be required for outline/glow shader effects
Rectangle srcRec = { font.recs[index].x - (float)font.glyphPadding, font.recs[index].y - (float)font.glyphPadding,
rayRectangle srcRec = { font.recs[index].x - (float)font.glyphPadding, font.recs[index].y - (float)font.glyphPadding,
font.recs[index].width + 2.0f*font.glyphPadding, font.recs[index].height + 2.0f*font.glyphPadding };
float width = (float)(font.recs[index].width + 2.0f*font.glyphPadding)/(float)font.baseSize*scale;

View file

@ -111,9 +111,9 @@ int main(void)
DrawTextEx(font, msg, fontPosition, fontSize, 0, BLACK);
// TODO: It seems texSize measurement is not accurate due to chars offsets...
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
//DrawrayRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
DrawrayRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
DrawText(TextFormat("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
DrawText(TextFormat("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
@ -130,7 +130,7 @@ int main(void)
//--------------------------------------------------------------------------------------
UnloadFont(font); // Font unloading
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -91,7 +91,7 @@ int main(void)
UnloadFont(fontBm); // AngelCode Font unloading
UnloadFont(fontTtf); // TTF Font unloading
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -139,7 +139,7 @@ int main(void)
UnloadShader(shader); // Unload SDF shader
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -5,9 +5,9 @@
* NOTE: Sprite fonts should be generated following this conventions:
*
* - Characters must be ordered starting with character 32 (Space)
* - Every character must be contained within the same Rectangle height
* - Every character must be contained within the same rayRectangle height
* - Every character and every line must be separated by the same distance (margin/padding)
* - Rectangles must be defined by a MAGENTA color background
* - rayRectangles must be defined by a MAGENTA color background
*
* Following those constraints, a font can be provided just by an image,
* this is quite handy to avoid additional font descriptor files (like BMFonts use).
@ -84,7 +84,7 @@ int main(void)
UnloadFont(font2); // Font unloading
UnloadFont(font3); // Font unloading
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -60,7 +60,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -30,7 +30,7 @@ int main(void)
char name[MAX_INPUT_CHARS + 1] = "\0"; // NOTE: One extra space required for null terminator char '\0'
int letterCount = 0;
Rectangle textBox = { screenWidth/2.0f - 100, 180, 225, 50 };
rayRectangle textBox = { screenWidth/2.0f - 100, 180, 225, 50 };
bool mouseOnText = false;
int framesCounter = 0;
@ -89,9 +89,9 @@ int main(void)
DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, GRAY);
DrawRectangleRec(textBox, LIGHTGRAY);
if (mouseOnText) DrawRectangleLines((int)textBox.x, (int)textBox.y, (int)textBox.width, (int)textBox.height, RED);
else DrawRectangleLines((int)textBox.x, (int)textBox.y, (int)textBox.width, (int)textBox.height, DARKGRAY);
DrawrayRectangleRec(textBox, LIGHTGRAY);
if (mouseOnText) DrawrayRectangleLines((int)textBox.x, (int)textBox.y, (int)textBox.width, (int)textBox.height, RED);
else DrawrayRectangleLines((int)textBox.x, (int)textBox.y, (int)textBox.width, (int)textBox.height, DARKGRAY);
DrawText(name, (int)textBox.x + 5, (int)textBox.y + 8, 40, MAROON);
@ -113,7 +113,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -103,7 +103,7 @@ int main(void)
// Fonts unloading
for (int i = 0; i < MAX_FONTS; i++) UnloadFont(fonts[i]);
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

View file

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [text] example - Rectangle bounds
* raylib [text] example - rayRectangle bounds
*
* Example originally created with raylib 2.5, last time updated with raylib 4.0
*
@ -15,8 +15,8 @@
#include "raylib.h"
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxed(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rayRectangle limits
static void DrawTextBoxedSelectable(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rayRectangle limits with support for text selection
//------------------------------------------------------------------------------------
// Program main entry point
@ -28,7 +28,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - draw text inside a rectangle");
InitWindow(screenWidth, screenHeight, "raylib [text] example - draw text inside a rayRectangle");
const char text[] = "Text cannot escape\tthis container\t...word wrap also works when active so here's \
a long text for testing.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \
@ -37,10 +37,10 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
bool resizing = false;
bool wordWrap = true;
Rectangle container = { 25.0f, 25.0f, screenWidth - 50.0f, screenHeight - 250.0f };
Rectangle resizer = { container.x + container.width - 17, container.y + container.height - 17, 14, 14 };
rayRectangle container = { 25.0f, 25.0f, screenWidth - 50.0f, screenHeight - 250.0f };
rayRectangle resizer = { container.x + container.width - 17, container.y + container.height - 17, 14, 14 };
// Minimum width and heigh for the container rectangle
// Minimum width and heigh for the container rayRectangle
const float minWidth = 60;
const float minHeight = 60;
const float maxWidth = screenWidth - 50.0f;
@ -83,7 +83,7 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mouse, resizer)) resizing = true;
}
// Move resizer rectangle properly
// Move resizer rayRectangle properly
resizer.x = container.x + container.width - 17;
resizer.y = container.y + container.height - 17;
@ -96,16 +96,16 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
ClearBackground(RAYWHITE);
DrawRectangleLinesEx(container, 3, borderColor); // Draw container border
DrawrayRectangleLinesEx(container, 3, borderColor); // Draw container border
// Draw text in container (add some padding)
DrawTextBoxed(font, text, (Rectangle){ container.x + 4, container.y + 4, container.width - 4, container.height - 4 }, 20.0f, 2.0f, wordWrap, GRAY);
DrawTextBoxed(font, text, (rayRectangle){ container.x + 4, container.y + 4, container.width - 4, container.height - 4 }, 20.0f, 2.0f, wordWrap, GRAY);
DrawRectangleRec(resizer, borderColor); // Draw the resize box
DrawrayRectangleRec(resizer, borderColor); // Draw the resize box
// Draw bottom info
DrawRectangle(0, screenHeight - 54, screenWidth, 54, GRAY);
DrawRectangleRec((Rectangle){ 382.0f, screenHeight - 34.0f, 12.0f, 12.0f }, MAROON);
DrawrayRectangle(0, screenHeight - 54, screenWidth, 54, GRAY);
DrawrayRectangleRec((rayRectangle){ 382.0f, screenHeight - 34.0f, 12.0f, 12.0f }, MAROON);
DrawText("Word Wrap: ", 313, screenHeight-115, 20, BLACK);
if (wordWrap) DrawText("ON", 447, screenHeight - 115, 20, RED);
@ -121,7 +121,7 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
@ -131,21 +131,21 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
// Module functions definition
//--------------------------------------------------------------------------------------
// Draw text using font inside rectangle limits
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
// Draw text using font inside rayRectangle limits
static void DrawTextBoxed(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
{
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
}
// Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
// Draw text using font inside rayRectangle limits with support for text selection
static void DrawTextBoxedSelectable(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
{
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
float textOffsetY = 0; // Offset between lines (on line break '\n')
float textOffsetX = 0.0f; // Offset X to next character to draw
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
float scaleFactor = fontSize/(float)font.baseSize; // Character rayRectangle scaling factor
// Word/character wrapping mechanism variables
enum { MEASURE_STATE = 0, DRAW_STATE = 1 };
@ -231,14 +231,14 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
textOffsetX = 0;
}
// When text overflows rectangle height limit, just stop drawing
// When text overflows rayRectangle height limit, just stop drawing
if ((textOffsetY + font.baseSize*scaleFactor) > rec.height) break;
// Draw selection background
bool isGlyphSelected = false;
if ((selectStart >= 0) && (k >= selectStart) && (k < (selectStart + selectLength)))
{
DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint);
DrawrayRectangleRec((rayRectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint);
isGlyphSelected = true;
}

View file

@ -135,8 +135,8 @@ struct {
//--------------------------------------------------------------------------------------
static void RandomizeEmoji(void); // Fills the emoji array with random emojis
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxed(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rayRectangle limits
static void DrawTextBoxedSelectable(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rayRectangle limits with support for text selection
//--------------------------------------------------------------------------------------
// Global variables
@ -210,7 +210,7 @@ int main(void)
for (int i = 0; i < SIZEOF(emoji); ++i)
{
const char *txt = &emojiCodepoints[emoji[i].index];
Rectangle emojiRect = { position.x, position.y, (float)fontEmoji.baseSize, (float)fontEmoji.baseSize };
rayRectangle emojiRect = { position.x, position.y, (float)fontEmoji.baseSize, (float)fontEmoji.baseSize };
if (!CheckCollisionPointRec(mouse, emojiRect))
{
@ -246,7 +246,7 @@ int main(void)
if (sz.x > 300) { sz.y *= sz.x/300; sz.x = 300; }
else if (sz.x < 160) sz.x = 160;
Rectangle msgRect = { selectedPos.x - 38.8f, selectedPos.y, 2 * horizontalPadding + sz.x, 2 * verticalPadding + sz.y };
rayRectangle msgRect = { selectedPos.x - 38.8f, selectedPos.y, 2 * horizontalPadding + sz.x, 2 * verticalPadding + sz.y };
msgRect.y -= msgRect.height;
// Coordinates for the chat bubble triangle
@ -270,11 +270,11 @@ int main(void)
if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
// Draw chat bubble
DrawRectangleRec(msgRect, emoji[selected].color);
DrawrayRectangleRec(msgRect, emoji[selected].color);
DrawTriangle(a, b, c, emoji[selected].color);
// Draw the main text message
Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
rayRectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
DrawTextBoxed(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE);
// Draw the info text below the main message
@ -301,7 +301,7 @@ int main(void)
UnloadFont(fontAsian); // Unload font resource
UnloadFont(fontEmoji); // Unload font resource
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
@ -330,21 +330,21 @@ static void RandomizeEmoji(void)
// Module functions definition
//--------------------------------------------------------------------------------------
// Draw text using font inside rectangle limits
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
// Draw text using font inside rayRectangle limits
static void DrawTextBoxed(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
{
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
}
// Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
// Draw text using font inside rayRectangle limits with support for text selection
static void DrawTextBoxedSelectable(Font font, const char *text, rayRectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
{
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
float textOffsetY = 0.0f; // Offset between lines (on line break '\n')
float textOffsetX = 0.0f; // Offset X to next character to draw
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
float scaleFactor = fontSize/(float)font.baseSize; // Character rayRectangle scaling factor
// Word/character wrapping mechanism variables
enum { MEASURE_STATE = 0, DRAW_STATE = 1 };
@ -430,14 +430,14 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
textOffsetX = 0;
}
// When text overflows rectangle height limit, just stop drawing
// When text overflows rayRectangle height limit, just stop drawing
if ((textOffsetY + font.baseSize*scaleFactor) > rec.height) break;
// Draw selection background
bool isGlyphSelected = false;
if ((selectStart >= 0) && (k >= selectStart) && (k < (selectStart + selectLength)))
{
DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint);
DrawrayRectangleRec((rayRectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint);
isGlyphSelected = true;
}

View file

@ -60,7 +60,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
rayCloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;