mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
Updated some examples
This commit is contained in:
parent
063986fdae
commit
a590126351
@ -17,11 +17,11 @@
|
||||
|
||||
#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()
|
||||
|
||||
// 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 };
|
||||
time_t now = time(NULL);
|
||||
@ -54,7 +54,7 @@ int main(void)
|
||||
const int screenHeight = 450;
|
||||
|
||||
// Set custom logger
|
||||
SetTraceLogCallback(CustomLog);
|
||||
SetTraceLogCallback(CustomTraceLog);
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");
|
||||
|
||||
|
||||
@ -20,9 +20,7 @@
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "raygui.h" // Required for GUI controls
|
||||
|
||||
#include <string.h> // Required for: strcpy()
|
||||
|
||||
#define MAX_FILEPATH_SIZE 2048
|
||||
#define MAX_FILEPATH_SIZE 1024
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
@ -53,12 +51,10 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
if (btnBackPressed)
|
||||
{
|
||||
strcpy(directory, GetPrevDirectoryPath(directory));
|
||||
TextCopy(directory, GetPrevDirectoryPath(directory));
|
||||
UnloadDirectoryFiles(files);
|
||||
files = LoadDirectoryFiles(directory);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@ -68,7 +64,7 @@ int main(void)
|
||||
|
||||
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++)
|
||||
{
|
||||
@ -78,7 +74,7 @@ int main(void)
|
||||
{
|
||||
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);
|
||||
files = LoadDirectoryFiles(directory);
|
||||
continue;
|
||||
|
||||
@ -118,4 +118,6 @@ int main(void)
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -22,9 +22,9 @@
|
||||
#define GESTURE_LOG_SIZE 20
|
||||
#define MAX_TOUCH_COUNT 32
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------
|
||||
static char const *GetGestureName(int gesture); // Get text string for gesture value
|
||||
static Color GetGestureColor(int gesture); // Get color for gesture value
|
||||
|
||||
|
||||
@ -40,14 +40,8 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_H))
|
||||
{
|
||||
if (IsCursorHidden())
|
||||
{
|
||||
ShowCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
HideCursor();
|
||||
}
|
||||
if (IsCursorHidden()) ShowCursor();
|
||||
else HideCursor();
|
||||
}
|
||||
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user