Compare commits

...

5 Commits

Author SHA1 Message Date
Ray
bbba3d0802 REXM: ADDED: Web platform logs automated reports -WIP- 2025-11-17 19:40:55 +01:00
Ray
cde917c63c REXM: ADDED: Build check warnings logs 2025-11-17 19:40:23 +01:00
Ray
a590126351 Updated some examples 2025-11-17 19:20:45 +01:00
Ray
063986fdae Updated solution 2025-11-17 19:20:23 +01:00
Ray
a235cd6a18 Update raygui.h 2025-11-17 19:20:12 +01:00
9 changed files with 215 additions and 128 deletions

View File

@ -17,11 +17,11 @@
#include "raylib.h" #include "raylib.h"
#include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen() #include <stdio.h> // Required for: printf(), vprintf(), fprintf()
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime() #include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
// Custom logging function // Custom logging function
void CustomLog(int msgType, const char *text, va_list args) void CustomTraceLog(int msgType, const char *text, va_list args)
{ {
char timeStr[64] = { 0 }; char timeStr[64] = { 0 };
time_t now = time(NULL); time_t now = time(NULL);
@ -54,7 +54,7 @@ int main(void)
const int screenHeight = 450; const int screenHeight = 450;
// Set custom logger // Set custom logger
SetTraceLogCallback(CustomLog); SetTraceLogCallback(CustomTraceLog);
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging"); InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");

View File

@ -20,9 +20,7 @@
#define RAYGUI_IMPLEMENTATION #define RAYGUI_IMPLEMENTATION
#include "raygui.h" // Required for GUI controls #include "raygui.h" // Required for GUI controls
#include <string.h> // Required for: strcpy() #define MAX_FILEPATH_SIZE 1024
#define MAX_FILEPATH_SIZE 2048
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
@ -53,12 +51,10 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (btnBackPressed) if (btnBackPressed)
{ {
strcpy(directory, GetPrevDirectoryPath(directory)); TextCopy(directory, GetPrevDirectoryPath(directory));
UnloadDirectoryFiles(files); UnloadDirectoryFiles(files);
files = LoadDirectoryFiles(directory); files = LoadDirectoryFiles(directory);
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@ -68,7 +64,7 @@ int main(void)
DrawText(directory, 100, 40, 20, DARKGRAY); DrawText(directory, 100, 40, 20, DARKGRAY);
btnBackPressed = GuiButton((Rectangle){ 40.0f, 40.0f, 20, 20 }, "<"); btnBackPressed = GuiButton((Rectangle){ 40.0f, 38.0f, 48, 24 }, "<");
for (int i = 0; i < (int)files.count; i++) for (int i = 0; i < (int)files.count; i++)
{ {
@ -78,7 +74,7 @@ int main(void)
{ {
if (GuiButton((Rectangle){0.0f, 85.0f + 40.0f*(float)i, screenWidth, 40}, "")) if (GuiButton((Rectangle){0.0f, 85.0f + 40.0f*(float)i, screenWidth, 40}, ""))
{ {
strcpy(directory, files.paths[i]); TextCopy(directory, files.paths[i]);
UnloadDirectoryFiles(files); UnloadDirectoryFiles(files);
files = LoadDirectoryFiles(directory); files = LoadDirectoryFiles(directory);
continue; continue;

View File

@ -118,4 +118,6 @@ int main(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0;
} }

View File

@ -22,9 +22,9 @@
#define GESTURE_LOG_SIZE 20 #define GESTURE_LOG_SIZE 20
#define MAX_TOUCH_COUNT 32 #define MAX_TOUCH_COUNT 32
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------
// Module Functions Declaration // Module Functions Declaration
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------
static char const *GetGestureName(int gesture); // Get text string for gesture value static char const *GetGestureName(int gesture); // Get text string for gesture value
static Color GetGestureColor(int gesture); // Get color for gesture value static Color GetGestureColor(int gesture); // Get color for gesture value

View File

@ -40,14 +40,8 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_H)) if (IsKeyPressed(KEY_H))
{ {
if (IsCursorHidden()) if (IsCursorHidden()) ShowCursor();
{ else HideCursor();
ShowCursor();
}
else
{
HideCursor();
}
} }
ballPosition = GetMousePosition(); ballPosition = GetMousePosition();

View File

@ -77,7 +77,7 @@
* *
* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; * static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)];
* *
* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB * guiStyle size is by default: 16*(16 + 8) = 384 int = 384*4 bytes = 1536 bytes = 1.5 KB
* *
* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style * Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style
* used for all controls, when any of those base values is set, it is automatically populated to all * used for all controls, when any of those base values is set, it is automatically populated to all
@ -141,7 +141,7 @@
* Draw text bounds rectangles for debug * Draw text bounds rectangles for debug
* *
* VERSIONS HISTORY: * VERSIONS HISTORY:
* 5.0-dev (2025) Current dev version... * 5.0 (xx-Nov-2025) ADDED: Support up to 32 controls (v500)
* ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes * ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes
* ADDED: GuiValueBoxFloat() * ADDED: GuiValueBoxFloat()
* ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP * ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP
@ -271,7 +271,7 @@
* 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria
* *
* DEPENDENCIES: * DEPENDENCIES:
* raylib 5.0 - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing * raylib 5.6-dev - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing
* *
* STANDALONE MODE: * STANDALONE MODE:
* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled * By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled
@ -1010,28 +1010,28 @@ typedef enum {
ICON_SLICING = 231, ICON_SLICING = 231,
ICON_MANUAL_CONTROL = 232, ICON_MANUAL_CONTROL = 232,
ICON_COLLISION = 233, ICON_COLLISION = 233,
ICON_234 = 234, ICON_CIRCLE_ADD = 234,
ICON_235 = 235, ICON_CIRCLE_ADD_FILL = 235,
ICON_236 = 236, ICON_CIRCLE_WARNING = 236,
ICON_237 = 237, ICON_CIRCLE_WARNING_FILL = 237,
ICON_238 = 238, ICON_BOX_MORE = 238,
ICON_239 = 239, ICON_BOX_MORE_FILL = 239,
ICON_240 = 240, ICON_BOX_MINUS = 240,
ICON_241 = 241, ICON_BOX_MINUS_FILL = 241,
ICON_242 = 242, ICON_UNION = 242,
ICON_243 = 243, ICON_INTERSECTION = 243,
ICON_244 = 244, ICON_DIFFERENCE = 244,
ICON_245 = 245, ICON_SPHERE = 245,
ICON_246 = 246, ICON_CYLINDER = 246,
ICON_247 = 247, ICON_CONE = 247,
ICON_248 = 248, ICON_ELLIPSOID = 248,
ICON_249 = 249, ICON_CAPSULE = 249,
ICON_250 = 250, ICON_250 = 250,
ICON_251 = 251, ICON_251 = 251,
ICON_252 = 252, ICON_252 = 252,
ICON_253 = 253, ICON_253 = 253,
ICON_254 = 254, ICON_254 = 254,
ICON_255 = 255, ICON_255 = 255
} GuiIconName; } GuiIconName;
#endif #endif
@ -1078,7 +1078,7 @@ typedef enum {
// Check if two rectangles are equal, used to validate a slider bounds as an id // Check if two rectangles are equal, used to validate a slider bounds as an id
#ifndef CHECK_BOUNDS_ID #ifndef CHECK_BOUNDS_ID
#define CHECK_BOUNDS_ID(src, dst) ((src.x == dst.x) && (src.y == dst.y) && (src.width == dst.width) && (src.height == dst.height)) #define CHECK_BOUNDS_ID(src, dst) (((int)src.x == (int)dst.x) && ((int)src.y == (int)dst.y) && ((int)src.width == (int)dst.width) && ((int)src.height == (int)dst.height))
#endif #endif
#if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) #if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS)
@ -1341,22 +1341,22 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] =
0x7fe00000, 0x402e4020, 0x43ce5e0a, 0x40504078, 0x438e4078, 0x402e5e0a, 0x7fe04020, 0x00000000, // ICON_SLICING 0x7fe00000, 0x402e4020, 0x43ce5e0a, 0x40504078, 0x438e4078, 0x402e5e0a, 0x7fe04020, 0x00000000, // ICON_SLICING
0x00000000, 0x40027ffe, 0x47c24002, 0x55425d42, 0x55725542, 0x50125552, 0x10105016, 0x00001ff0, // ICON_MANUAL_CONTROL 0x00000000, 0x40027ffe, 0x47c24002, 0x55425d42, 0x55725542, 0x50125552, 0x10105016, 0x00001ff0, // ICON_MANUAL_CONTROL
0x7ffe0000, 0x43c24002, 0x48124422, 0x500a500a, 0x500a500a, 0x44224812, 0x400243c2, 0x00007ffe, // ICON_COLLISION 0x7ffe0000, 0x43c24002, 0x48124422, 0x500a500a, 0x500a500a, 0x44224812, 0x400243c2, 0x00007ffe, // ICON_COLLISION
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_234 0x03c00000, 0x10080c30, 0x21842184, 0x4ff24182, 0x41824ff2, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_ADD
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_235 0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x700e7e7e, 0x7e7e700e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_ADD_FILL
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_236 0x03c00000, 0x10080c30, 0x21842184, 0x41824182, 0x40024182, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_WARNING
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_237 0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x7e7e7e7e, 0x7ffe7e7e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_WARNING_FILL
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_238 0x00000000, 0x10041ffc, 0x10841004, 0x13e41084, 0x10841084, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MORE
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_239 0x00000000, 0x1ffc1ffc, 0x1f7c1ffc, 0x1c1c1f7c, 0x1f7c1f7c, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MORE_FILL
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_240 0x00000000, 0x1ffc1ffc, 0x1ffc1ffc, 0x1c1c1ffc, 0x1ffc1ffc, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_241 0x00000000, 0x10041ffc, 0x10041004, 0x13e41004, 0x10041004, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS_FILL
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_242 0x07fe0000, 0x055606aa, 0x7ff606aa, 0x55766eba, 0x55766eaa, 0x55606ffe, 0x55606aa0, 0x00007fe0, // ICON_UNION
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_243 0x07fe0000, 0x04020402, 0x7fe20402, 0x456246a2, 0x456246a2, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_INTERSECTION
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_244 0x07fe0000, 0x055606aa, 0x7ff606aa, 0x4436442a, 0x4436442a, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_DIFFERENCE
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_245 0x03c00000, 0x10080c30, 0x20042004, 0x60064002, 0x47e2581a, 0x20042004, 0x0c301008, 0x000003c0, // ICON_SPHERE
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_246 0x03e00000, 0x08080410, 0x0c180808, 0x08080be8, 0x08080808, 0x08080808, 0x04100808, 0x000003e0, // ICON_CYLINDER
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_247 0x00800000, 0x01400140, 0x02200220, 0x04100410, 0x08080808, 0x1c1c13e4, 0x08081004, 0x000007f0, // ICON_CONE
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_248 0x00000000, 0x07e00000, 0x20841918, 0x40824082, 0x40824082, 0x19182084, 0x000007e0, 0x00000000, // ICON_ELLIPSOID
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_249 0x00000000, 0x00000000, 0x20041ff8, 0x40024002, 0x40024002, 0x1ff82004, 0x00000000, 0x00000000, // ICON_CAPSULE
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252
@ -1743,7 +1743,7 @@ int GuiPanel(Rectangle bounds, const char *text)
// NOTE: Using GuiToggle() for the TABS // NOTE: Using GuiToggle() for the TABS
int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) int GuiTabBar(Rectangle bounds, const char **text, int count, int *active)
{ {
#define RAYGUI_TABBAR_ITEM_WIDTH 160 #define RAYGUI_TABBAR_ITEM_WIDTH 148
int result = -1; int result = -1;
//GuiState state = guiState; //GuiState state = guiState;
@ -1776,12 +1776,12 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active)
if (i == (*active)) if (i == (*active))
{ {
toggle = true; toggle = true;
GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); GuiToggle(tabBounds, text[i], &toggle);
} }
else else
{ {
toggle = false; toggle = false;
GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); GuiToggle(tabBounds, text[i], &toggle);
if (toggle) *active = i; if (toggle) *active = i;
} }
@ -2590,7 +2590,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
int pasteLength = 0; int pasteLength = 0;
int pasteCodepoint; int pasteCodepoint;
int pasteCodepointSize; int pasteCodepointSize;
// Count how many codepoints to copy, stopping at the first unwanted control character // Count how many codepoints to copy, stopping at the first unwanted control character
while (true) while (true)
{ {
@ -2599,7 +2599,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break; if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break;
pasteLength += pasteCodepointSize; pasteLength += pasteCodepointSize;
} }
if (pasteLength > 0) if (pasteLength > 0)
{ {
// Move forward data from cursor position // Move forward data from cursor position
@ -2662,7 +2662,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
while (offset < textLength) while (offset < textLength)
{ {
if (!isspace(nextCodepoint & 0xff)) break; if (!isspace(nextCodepoint & 0xff)) break;
offset += nextCodepointSize; offset += nextCodepointSize;
accCodepointSize += nextCodepointSize; accCodepointSize += nextCodepointSize;
nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
@ -2673,11 +2673,11 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
textLength -= accCodepointSize; textLength -= accCodepointSize;
} }
else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger))) else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger)))
{ {
// Delete single codepoint from text, after current cursor position // Delete single codepoint from text, after current cursor position
int nextCodepointSize = 0; int nextCodepointSize = 0;
GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize);
@ -2704,7 +2704,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
offset -= prevCodepointSize; offset -= prevCodepointSize;
accCodepointSize += prevCodepointSize; accCodepointSize += prevCodepointSize;
} }
// Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace) // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace)
// Not using isalnum() since it only works on ASCII characters // Not using isalnum() since it only works on ASCII characters
bool puctuation = ispunct(prevCodepoint & 0xff); bool puctuation = ispunct(prevCodepoint & 0xff);
@ -2723,11 +2723,11 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
textLength -= accCodepointSize; textLength -= accCodepointSize;
textBoxCursorIndex -= accCodepointSize; textBoxCursorIndex -= accCodepointSize;
} }
else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger))) else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger)))
{ {
// Delete single codepoint from text, before current cursor position // Delete single codepoint from text, before current cursor position
int prevCodepointSize = 0; int prevCodepointSize = 0;
GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize);
@ -3026,14 +3026,14 @@ int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int
// NOTE: Requires static variables: frameCounter // NOTE: Requires static variables: frameCounter
int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
{ {
#if !defined(RAYGUI_VALUEBOX_MAX_CHARS) //#if !defined(RAYGUI_VALUEBOX_MAX_CHARS)
#define RAYGUI_VALUEBOX_MAX_CHARS 32 #define RAYGUI_VALUEBOX_MAX_CHARS 32
#endif //#endif
int result = 0; int result = 0;
GuiState state = guiState; GuiState state = guiState;
char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = { 0 };
snprintf(textValue, RAYGUI_VALUEBOX_MAX_CHARS + 1, "%i", *value); snprintf(textValue, RAYGUI_VALUEBOX_MAX_CHARS + 1, "%i", *value);
Rectangle textBounds = { 0 }; Rectangle textBounds = { 0 };
@ -3051,7 +3051,6 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode)
{ {
Vector2 mousePoint = GetMousePosition(); Vector2 mousePoint = GetMousePosition();
bool valueHasChanged = false; bool valueHasChanged = false;
if (editMode) if (editMode)
@ -3070,7 +3069,7 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
keyCount--; keyCount--;
valueHasChanged = true; valueHasChanged = true;
} }
else if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS -1) else if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS)
{ {
if (keyCount == 0) if (keyCount == 0)
{ {
@ -3087,30 +3086,26 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
} }
} }
// Only allow keys in range [48..57] // Add new digit to text value
if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) if ((keyCount < RAYGUI_VALUEBOX_MAX_CHARS) && (GuiGetTextWidth(textValue) < bounds.width))
{ {
if (GuiGetTextWidth(textValue) < bounds.width) int key = GetCharPressed();
// Only allow keys in range [48..57]
if ((key >= 48) && (key <= 57))
{ {
int key = GetCharPressed(); textValue[keyCount] = (char)key;
if ((key >= 48) && (key <= 57)) keyCount++;
{ valueHasChanged = true;
textValue[keyCount] = (char)key;
keyCount++;
valueHasChanged = true;
}
} }
} }
// Delete text // Delete text
if (keyCount > 0) if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE))
{ {
if (IsKeyPressed(KEY_BACKSPACE)) keyCount--;
{ textValue[keyCount] = '\0';
keyCount--; valueHasChanged = true;
textValue[keyCount] = '\0';
valueHasChanged = true;
}
} }
if (valueHasChanged) *value = TextToInteger(textValue); if (valueHasChanged) *value = TextToInteger(textValue);
@ -3224,9 +3219,9 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float
textValue[1] = '\0'; textValue[1] = '\0';
keyCount++; keyCount++;
} }
for (int i = keyCount; i > -1; i--) textValue[i + 1] = textValue[i]; for (int i = keyCount; i > -1; i--) textValue[i + 1] = textValue[i];
textValue[0] = '-'; textValue[0] = '-';
keyCount++; keyCount++;
valueHasChanged = true; valueHasChanged = true;

View File

@ -51,7 +51,7 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{6B1A933E-71B8-4C1F-9E79-02D98830E671}</ProjectGuid> <ProjectGuid>{4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>textures_screen_buffer</RootNamespace> <RootNamespace>textures_screen_buffer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>

View File

@ -409,7 +409,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_viewport_scaling", "ex
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_compute_hash", "examples\core_compute_hash.vcxproj", "{6C897101-BE52-4387-8AA2-062123A76BA1}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_compute_hash", "examples\core_compute_hash.vcxproj", "{6C897101-BE52-4387-8AA2-062123A76BA1}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_screen_buffer", "examples\textures_screen_buffer.vcxproj", "{6B1A933E-71B8-4C1F-9E79-02D98830E671}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_screen_buffer", "examples\textures_screen_buffer.vcxproj", "{4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -5081,30 +5081,30 @@ Global
{6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x64.Build.0 = Release|x64 {6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x64.Build.0 = Release|x64
{6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x86.ActiveCfg = Release|Win32 {6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x86.ActiveCfg = Release|Win32
{6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x86.Build.0 = Release|Win32 {6C897101-BE52-4387-8AA2-062123A76BA1}.Release|x86.Build.0 = Release|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|ARM64.ActiveCfg = Debug|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|ARM64.ActiveCfg = Debug|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|ARM64.Build.0 = Debug|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|ARM64.Build.0 = Debug|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|x64.ActiveCfg = Debug|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|x64.ActiveCfg = Debug|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|x64.Build.0 = Debug|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|x64.Build.0 = Debug|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|x86.ActiveCfg = Debug|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|x86.ActiveCfg = Debug|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Debug|x86.Build.0 = Debug|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Debug|x86.Build.0 = Debug|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|x64.Build.0 = Release.DLL|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|x64.Build.0 = Release.DLL|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release.DLL|x86.Build.0 = Release.DLL|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release.DLL|x86.Build.0 = Release.DLL|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|ARM64.ActiveCfg = Release|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|ARM64.ActiveCfg = Release|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|ARM64.Build.0 = Release|ARM64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|ARM64.Build.0 = Release|ARM64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|x64.ActiveCfg = Release|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|x64.ActiveCfg = Release|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|x64.Build.0 = Release|x64 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|x64.Build.0 = Release|x64
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|x86.ActiveCfg = Release|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|x86.ActiveCfg = Release|Win32
{6B1A933E-71B8-4C1F-9E79-02D98830E671}.Release|x86.Build.0 = Release|Win32 {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -5272,7 +5272,7 @@ Global
{C54703BF-D68A-480D-BE27-49B62E45D582} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} {C54703BF-D68A-480D-BE27-49B62E45D582} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9}
{9CD8BCAD-F212-4BCC-BA98-899743CE3279} = {CC132A4D-D081-4C26-BFB9-AB11984054F8} {9CD8BCAD-F212-4BCC-BA98-899743CE3279} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
{0981CA28-E4A5-4DF1-987F-A41D09131EFC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {0981CA28-E4A5-4DF1-987F-A41D09131EFC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
{6B1A933E-71B8-4C1F-9E79-02D98830E671} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {6B1A933E-71B8-4C1F-9E79-02D98830E671} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
{6BFF72EA-7362-4A3B-B6E5-9A3655BBBDA3} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} {6BFF72EA-7362-4A3B-B6E5-9A3655BBBDA3} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9}
{6777EC3C-077C-42FC-B4AD-B799CE55CCE4} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} {6777EC3C-077C-42FC-B4AD-B799CE55CCE4} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A}
{A61DAD9C-271C-4E95-81AA-DB4CD58564D4} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {A61DAD9C-271C-4E95-81AA-DB4CD58564D4} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
@ -5311,7 +5311,7 @@ Global
{666346D7-C84B-498D-AE17-53B20C62DB1A} = {278D8859-20B1-428F-8448-064F46E1F021} {666346D7-C84B-498D-AE17-53B20C62DB1A} = {278D8859-20B1-428F-8448-064F46E1F021}
{AD66AA6A-1E36-4FF0-8670-4F9834BCDB91} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {AD66AA6A-1E36-4FF0-8670-4F9834BCDB91} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
{6C897101-BE52-4387-8AA2-062123A76BA1} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {6C897101-BE52-4387-8AA2-062123A76BA1} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
{6B1A933E-71B8-4C1F-9E79-02D98830E671} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} {4E9D2828-EE83-40C8-97E0-137EEDFBAAAD} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29} SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}

View File

@ -94,8 +94,9 @@ typedef struct {
// Automated testing data // Automated testing data
typedef struct { typedef struct {
int warnings; // Warnings counter int buildwarns; // Example building warnings count (by GCC compiler)
int status; // Testing status result flags int warnings; // Example run output log warnings count
int status; // Example run testing status flags (>0 = FAILS)
} rlExampleTesting; } rlExampleTesting;
// Validation status for a single example // Validation status for a single example
@ -1455,6 +1456,21 @@ int main(int argc, char *argv[])
rlExampleTesting *testing = (rlExampleTesting *)RL_CALLOC(exBuildListCount, sizeof(rlExampleTesting)); rlExampleTesting *testing = (rlExampleTesting *)RL_CALLOC(exBuildListCount, sizeof(rlExampleTesting));
#if defined(_WIN32)
// Set required environment variables
//putenv(TextFormat("RAYLIB_DIR=%s\\..", exBasePath));
//_putenv("PATH=%PATH%;C:\\raylib\\w64devkit\\bin");
//putenv("MAKE=mingw32-make");
//ChangeDirectory(exBasePath);
//_putenv("MAKE_PATH=C:\\raylib\\w64devkit\\bin");
//_putenv("EMSDK_PATH = C:\\raylib\\emsdk");
//_putenv("PYTHON_PATH=$(EMSDK_PATH)\\python\\3.9.2-nuget_64bit");
//_putenv("NODE_PATH=$(EMSDK_PATH)\\node\\20.18.0_64bit\\bin");
//_putenv("PATH=%PATH%;$(MAKE_PATH);$(EMSDK_PATH);$(NODE_PATH);$(PYTHON_PATH)");
_putenv("PATH=%PATH%;C:\\raylib\\w64devkit\\bin;C:\\raylib\\emsdk\\python\\3.9.2-nuget_64bit;C:\\raylib\\emsdk\\node\\20.18.0_64bit\\bin");
#endif
for (int i = 0; i < exBuildListCount; i++) for (int i = 0; i < exBuildListCount; i++)
{ {
// Get example name and category // Get example name and category
@ -1473,7 +1489,7 @@ int main(int argc, char *argv[])
// STEP 3: Run example with arguments: --frames 2 > <example>.out.log // STEP 3: Run example with arguments: --frames 2 > <example>.out.log
// STEP 4: Load <example>.out.log and check "WARNING:" messages -> Some could maybe be ignored // STEP 4: Load <example>.out.log and check "WARNING:" messages -> Some could maybe be ignored
// STEP 5: Generate report with results // STEP 5: Generate report with results
// STEP 1: Load example and inject required code // STEP 1: Load example and inject required code
// PROBLEM: As we need to modify the example source code for building, we need to keep a copy or something // PROBLEM: As we need to modify the example source code for building, we need to keep a copy or something
// WARNING: If we make a copy and something fails, it could not be restored at the end // WARNING: If we make a copy and something fails, it could not be restored at the end
@ -1484,6 +1500,71 @@ int main(int argc, char *argv[])
TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName)); TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName));
char *srcText = LoadFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName)); char *srcText = LoadFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
#define BUILD_TESTING_WEB
#if defined(BUILD_TESTING_WEB)
static const char *mainReplaceText =
"#include <stdio.h>\n"
"#include <string.h>\n"
"#include <stdlib.h>\n"
"#include <emscripten/emscripten.h>\n\n"
"static char logText[1024] = {0};\n"
"static int logTextOffset = 0;\n\n"
"void CustomTraceLog(int msgType, const char *text, va_list args)\n{\n"
" switch (msgType)\n {\n"
" case LOG_INFO: logTextOffset += sprintf(logText + logTextOffset, \"INFO: \"); break;\n"
" case LOG_ERROR: logTextOffset += sprintf(logText + logTextOffset, \"ERROR: \"); break;\n"
" case LOG_WARNING: logTextOffset += sprintf(logText + logTextOffset, \"WARNING: \"); break;\n"
" case LOG_DEBUG: logTextOffset += sprintf(logText + logTextOffset, \"DEBUG: \"); break;\n"
" default: break;\n }\n"
" logTextOffset += vsprintf(logText + logTextOffset, text, args);\n"
" logTextOffset += sprintf(logText + logTextOffset, \"\\n\");\n}\n\n"
"int main(int argc, char *argv[])\n{\n"
" SetTraceLogCallback(CustomTraceLog);\n"
" int requestedTestFrames = 0;\n"
" int testFramesCount = 0;\n"
" if ((argc > 1) && (argc == 3) && (strcmp(argv[1], \"--frames\") != 0)) requestedTestFrames = atoi(argv[2]);\n";
static const char *returnReplaceText =
" char outputLogFile[256] = { 0 };\n"
" TextCopy(outputLogFile, GetFileNameWithoutExt(argv[0]));\n"
" SaveFileText(outputLogFile, logText);\n"
" emscripten_run_script(TextFormat(\"saveFileFromMEMFSToDisk('%s','%s')\", outputLogFile, GetFileName(outputLogFile)));\n\n"
" return 0";
char *srcTextUpdated[4] = { 0 };
srcTextUpdated[0] = TextReplace(srcText, "int main(void)\n{", mainReplaceText);
srcTextUpdated[1] = TextReplace(srcTextUpdated[0], "WindowShouldClose()", "WindowShouldClose() && (testFramesCount < requestedTestFrames)");
srcTextUpdated[2] = TextReplace(srcTextUpdated[1], "EndDrawing();", "EndDrawing(); testFramesCount++;");
srcTextUpdated[3] = TextReplace(srcTextUpdated[2], " return 0", returnReplaceText);
UnloadFileText(srcText);
//SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), srcTextUpdated[3]);
for (int i = 0; i < 4; i++) { MemFree(srcTextUpdated[i]); srcTextUpdated[i] = NULL; }
// Build example for PLATFORM_WEB
// Build: raylib.com/examples/<category>/<category>_example_name.html
// Build: raylib.com/examples/<category>/<category>_example_name.data
// Build: raylib.com/examples/<category>/<category>_example_name.wasm
// Build: raylib.com/examples/<category>/<category>_example_name.js
#if defined(_WIN32)
LOG("INFO: [%s] Building example for PLATFORM_WEB (Host: Win32)\n", exName);
system(TextFormat("mingw32-make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName));
#else
LOG("INFO: [%s] Building example for PLATFORM_WEB (Host: POSIX)\n", exName);
system(TextFormat("make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName));
#endif
// Restore original source code before continue
FileCopy(TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName),
TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName));
FileRemove(TextFormat("%s/%s/%s.original.c", exBasePath, exCategory, exName));
// STEP 3: Run example on browser
ChangeDirectory(TextFormat("%s/%s", exBasePath, exCategory));
system("start python -m http.server 8080");
system(TextFormat("start explorer \"http:\\localhost:8080/%s.html", exName));
#else // BUILD_TESTING_DESKTOP
static const char *mainReplaceText = static const char *mainReplaceText =
"#include <string.h>\n" "#include <string.h>\n"
"#include <stdlib.h>\n" "#include <stdlib.h>\n"
@ -1501,6 +1582,8 @@ int main(int argc, char *argv[])
SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), srcTextUpdated[2]); SaveFileText(TextFormat("%s/%s/%s.c", exBasePath, exCategory, exName), srcTextUpdated[2]);
for (int i = 0; i < 3; i++) { MemFree(srcTextUpdated[i]); srcTextUpdated[i] = NULL; } for (int i = 0; i < 3; i++) { MemFree(srcTextUpdated[i]); srcTextUpdated[i] = NULL; }
MakeDirectory(TextFormat("%s/%s/logs", exBasePath, exCategory));
// STEP 2: Build example for DESKTOP platform // STEP 2: Build example for DESKTOP platform
#if defined(_WIN32) #if defined(_WIN32)
// Set required environment variables // Set required environment variables
@ -1512,7 +1595,8 @@ int main(int argc, char *argv[])
// Build example for PLATFORM_DESKTOP // Build example for PLATFORM_DESKTOP
#if defined(_WIN32) #if defined(_WIN32)
LOG("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: Win32)\n", exName); LOG("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: Win32)\n", exName);
system(TextFormat("mingw32-make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B", exBasePath, exCategory, exName)); system(TextFormat("mingw32-make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B > %s/%s/logs/%s.build.log 2>&1",
exBasePath, exCategory, exName, exBasePath, exCategory, exName));
#else #else
LOG("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: POSIX)\n", exName); LOG("INFO: [%s] Building example for PLATFORM_DESKTOP (Host: POSIX)\n", exName);
system(TextFormat("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B", exBasePath, exCategory, exName)); system(TextFormat("make -C %s %s/%s PLATFORM=PLATFORM_DESKTOP -B", exBasePath, exCategory, exName));
@ -1525,10 +1609,24 @@ int main(int argc, char *argv[])
// STEP 3: Run example with required arguments // STEP 3: Run example with required arguments
// NOTE: Not easy to retrieve process return value from system(), it's platform dependant // NOTE: Not easy to retrieve process return value from system(), it's platform dependant
ChangeDirectory(TextFormat("%s/%s", exBasePath, exCategory)); ChangeDirectory(TextFormat("%s/%s", exBasePath, exCategory));
system(TextFormat("%s --frames 2 > %s.log", exName, exName)); system(TextFormat("%s --frames 2 > logs/%s.log", exName, exName));
// STEP 4: Load and validate log info // STEP 4: Load and validate log info
char *exTestLog = LoadFileText(TextFormat("%s/%s/%s.log", exBasePath, exCategory, exName)); //---------------------------------------------------------------------------------------------
// Load <example_name>.build.log to check for compilation warnings
char *exTestBuildLog = LoadFileText(TextFormat("%s/%s/logs/%s.build.log", exBasePath, exCategory, exName));
int exTestBuildLogLinesCount = 0;
char **exTestBuildLogLines = LoadTextLines(exTestBuildLog, &exTestBuildLogLinesCount);
for (int k = 0, index = 0; k < exTestBuildLogLinesCount; k++)
{
if (TextFindIndex(exTestBuildLogLines[k], "warning:") >= 0) testing[i].buildwarns++;
}
UnloadTextLines(exTestBuildLogLines, exTestBuildLogLinesCount);
UnloadFileText(exTestBuildLog);
char *exTestLog = LoadFileText(TextFormat("%s/%s/logs/%s.log", exBasePath, exCategory, exName));
int exTestLogLinesCount = 0; int exTestLogLinesCount = 0;
char **exTestLogLines = LoadTextLines(exTestLog, &exTestLogLinesCount); char **exTestLogLines = LoadTextLines(exTestLog, &exTestLogLinesCount);
@ -1557,6 +1655,8 @@ int main(int argc, char *argv[])
UnloadTextLines(exTestLogLines, exTestLogLinesCount); UnloadTextLines(exTestLogLines, exTestLogLinesCount);
UnloadFileText(exTestLog); UnloadFileText(exTestLog);
//---------------------------------------------------------------------------------------------
#endif
} }
// STEP 5: Generate testing report/table with results (.md) // STEP 5: Generate testing report/table with results (.md)