REVIEWED: Examples comments, consistent code sections

This commit is contained in:
Ray
2025-09-02 12:10:16 +02:00
parent 864459cbd2
commit b6ae380260
26 changed files with 131 additions and 94 deletions

View File

@@ -24,6 +24,18 @@
#define EMOJI_PER_WIDTH 8
#define EMOJI_PER_HEIGHT 4
//--------------------------------------------------------------------------------------
// Global variables
//--------------------------------------------------------------------------------------
// Arrays that holds the random emojis
struct {
int index; // Index inside `emojiCodepoints`
int message; // Message index
Color color; // Emoji color
} emoji[EMOJI_PER_WIDTH*EMOJI_PER_HEIGHT] = { 0 };
static int hovered = -1, selected = -1;
// String containing 180 emoji codepoints separated by a '\0' char
const char *const emojiCodepoints = "\xF0\x9F\x8C\x80\x00\xF0\x9F\x98\x80\x00\xF0\x9F\x98\x82\x00\xF0\x9F\xA4\xA3\x00\xF0\x9F\x98\x83\x00\xF0\x9F\x98\x86\x00\xF0\x9F\x98\x89\x00"
"\xF0\x9F\x98\x8B\x00\xF0\x9F\x98\x8E\x00\xF0\x9F\x98\x8D\x00\xF0\x9F\x98\x98\x00\xF0\x9F\x98\x97\x00\xF0\x9F\x98\x99\x00\xF0\x9F\x98\x9A\x00\xF0\x9F\x99\x82\x00"
@@ -133,25 +145,13 @@ struct {
};
//--------------------------------------------------------------------------------------
// Module functions declaration
// Module Functions Declaration
//--------------------------------------------------------------------------------------
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
//--------------------------------------------------------------------------------------
// Global variables
//--------------------------------------------------------------------------------------
// Arrays that holds the random emojis
struct {
int index; // Index inside `emojiCodepoints`
int message; // Message index
Color color; // Emoji color
} emoji[EMOJI_PER_WIDTH*EMOJI_PER_HEIGHT] = { 0 };
static int hovered = -1, selected = -1;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -329,7 +329,7 @@ static void RandomizeEmoji(void)
}
//--------------------------------------------------------------------------------------
// Module functions definition
// Module Functions Definition
//--------------------------------------------------------------------------------------
// Draw text using font inside rectangle limits