Renamed some static functions for more consistent naming
This commit is contained in:
parent
6575d31379
commit
913f185f82
2 changed files with 14 additions and 16 deletions
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
static void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // 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 rectangle limits
|
||||||
static void DrawTextRecEx(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 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
|
||||||
|
|
||||||
// Main entry point
|
// Main entry point
|
||||||
int main(void)
|
int main(void)
|
||||||
|
@ -92,14 +92,12 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawRectangleLinesEx(container, 3, borderColor); // Draw container border
|
DrawRectangleLinesEx(container, 3, borderColor); // Draw container border
|
||||||
|
|
||||||
// Draw text in container (add some padding)
|
// Draw text in container (add some padding)
|
||||||
DrawTextRec(font, text,
|
DrawTextBoxed(font, text, (Rectangle){ container.x + 4, container.y + 4, container.width - 4, container.height - 4 }, 20.0f, 2.0f, wordWrap, GRAY);
|
||||||
(Rectangle){ 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
|
DrawRectangleRec(resizer, borderColor); // Draw the resize box
|
||||||
|
|
||||||
// Draw bottom info
|
// Draw bottom info
|
||||||
DrawRectangle(0, screenHeight - 54, screenWidth, 54, GRAY);
|
DrawRectangle(0, screenHeight - 54, screenWidth, 54, GRAY);
|
||||||
|
@ -130,13 +128,13 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw text using font inside rectangle limits
|
// Draw text using font inside rectangle limits
|
||||||
static void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
|
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
|
||||||
{
|
{
|
||||||
DrawTextRecEx(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
|
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw text using font inside rectangle limits with support for text selection
|
// Draw text using font inside rectangle limits with support for text selection
|
||||||
static void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
|
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)
|
||||||
{
|
{
|
||||||
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,8 @@ struct {
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
static void RandomizeEmoji(void); // Fills the emoji array with random emojis
|
static void RandomizeEmoji(void); // Fills the emoji array with random emojis
|
||||||
|
|
||||||
static void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // 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 rectangle limits
|
||||||
static void DrawTextRecEx(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 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
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Global variables
|
// Global variables
|
||||||
|
@ -273,7 +273,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// Draw the main text message
|
// Draw the main text message
|
||||||
Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
|
Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
|
||||||
DrawTextRec(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE);
|
DrawTextBoxed(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE);
|
||||||
|
|
||||||
// Draw the info text below the main message
|
// Draw the info text below the main message
|
||||||
int size = (int)strlen(messages[message].text);
|
int size = (int)strlen(messages[message].text);
|
||||||
|
@ -329,13 +329,13 @@ static void RandomizeEmoji(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw text using font inside rectangle limits
|
// Draw text using font inside rectangle limits
|
||||||
static void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
|
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
|
||||||
{
|
{
|
||||||
DrawTextRecEx(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
|
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw text using font inside rectangle limits with support for text selection
|
// Draw text using font inside rectangle limits with support for text selection
|
||||||
static void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
|
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)
|
||||||
{
|
{
|
||||||
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue