Skip to content

Commit a590126

Browse files
committed
Updated some examples
1 parent 063986f commit a590126

File tree

5 files changed

+14
-22
lines changed

5 files changed

+14
-22
lines changed

examples/core/core_custom_logging.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
#include "raylib.h"
1919

20-
#include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen()
21-
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
20+
#include <stdio.h> // Required for: printf(), vprintf(), fprintf()
21+
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
2222

2323
// Custom logging function
24-
void CustomLog(int msgType, const char *text, va_list args)
24+
void CustomTraceLog(int msgType, const char *text, va_list args)
2525
{
2626
char timeStr[64] = { 0 };
2727
time_t now = time(NULL);
@@ -54,7 +54,7 @@ int main(void)
5454
const int screenHeight = 450;
5555

5656
// Set custom logger
57-
SetTraceLogCallback(CustomLog);
57+
SetTraceLogCallback(CustomTraceLog);
5858

5959
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");
6060

examples/core/core_directory_files.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
#define RAYGUI_IMPLEMENTATION
2121
#include "raygui.h" // Required for GUI controls
2222

23-
#include <string.h> // Required for: strcpy()
24-
25-
#define MAX_FILEPATH_SIZE 2048
23+
#define MAX_FILEPATH_SIZE 1024
2624

2725
//------------------------------------------------------------------------------------
2826
// Program main entry point
@@ -53,12 +51,10 @@ int main(void)
5351
//----------------------------------------------------------------------------------
5452
if (btnBackPressed)
5553
{
56-
strcpy(directory, GetPrevDirectoryPath(directory));
54+
TextCopy(directory, GetPrevDirectoryPath(directory));
5755
UnloadDirectoryFiles(files);
5856
files = LoadDirectoryFiles(directory);
5957
}
60-
61-
6258
//----------------------------------------------------------------------------------
6359

6460
// Draw
@@ -68,7 +64,7 @@ int main(void)
6864

6965
DrawText(directory, 100, 40, 20, DARKGRAY);
7066

71-
btnBackPressed = GuiButton((Rectangle){ 40.0f, 40.0f, 20, 20 }, "<");
67+
btnBackPressed = GuiButton((Rectangle){ 40.0f, 38.0f, 48, 24 }, "<");
7268

7369
for (int i = 0; i < (int)files.count; i++)
7470
{
@@ -78,7 +74,7 @@ int main(void)
7874
{
7975
if (GuiButton((Rectangle){0.0f, 85.0f + 40.0f*(float)i, screenWidth, 40}, ""))
8076
{
81-
strcpy(directory, files.paths[i]);
77+
TextCopy(directory, files.paths[i]);
8278
UnloadDirectoryFiles(files);
8379
files = LoadDirectoryFiles(directory);
8480
continue;

examples/core/core_input_gestures.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,6 @@ int main(void)
118118
//--------------------------------------------------------------------------------------
119119
CloseWindow(); // Close window and OpenGL context
120120
//--------------------------------------------------------------------------------------
121+
122+
return 0;
121123
}

examples/core/core_input_gestures_testbed.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#define GESTURE_LOG_SIZE 20
2323
#define MAX_TOUCH_COUNT 32
2424

25-
//----------------------------------------------------------------------------------
25+
//------------------------------------------------------------------------------------
2626
// Module Functions Declaration
27-
//----------------------------------------------------------------------------------
27+
//------------------------------------------------------------------------------------
2828
static char const *GetGestureName(int gesture); // Get text string for gesture value
2929
static Color GetGestureColor(int gesture); // Get color for gesture value
3030

examples/core/core_input_mouse.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ int main(void)
4040
//----------------------------------------------------------------------------------
4141
if (IsKeyPressed(KEY_H))
4242
{
43-
if (IsCursorHidden())
44-
{
45-
ShowCursor();
46-
}
47-
else
48-
{
49-
HideCursor();
50-
}
43+
if (IsCursorHidden()) ShowCursor();
44+
else HideCursor();
5145
}
5246

5347
ballPosition = GetMousePosition();

0 commit comments

Comments
 (0)