Merge branch 'raysan5:master' into sdl-gamepad-fix
This commit is contained in:
commit
0b1be19f01
9 changed files with 567 additions and 486 deletions
|
|
@ -151,7 +151,7 @@ static void CharCallback(GLFWwindow *window, unsigned int codepoint);
|
||||||
static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods); // GLFW3 Mouse Button Callback, runs on mouse button pressed
|
static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods); // GLFW3 Mouse Button Callback, runs on mouse button pressed
|
||||||
static void MouseCursorPosCallback(GLFWwindow *window, double x, double y); // GLFW3 Cursor Position Callback, runs on mouse move
|
static void MouseCursorPosCallback(GLFWwindow *window, double x, double y); // GLFW3 Cursor Position Callback, runs on mouse move
|
||||||
static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Scrolling Callback, runs on mouse wheel
|
static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Scrolling Callback, runs on mouse wheel
|
||||||
static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area
|
static void CursorEnterCallback(GLFWwindow *window, int entered); // GLFW3 Cursor Enter Callback, cursor enters client area
|
||||||
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
||||||
|
|
||||||
// Memory allocator wrappers [used by glfwInitAllocator()]
|
// Memory allocator wrappers [used by glfwInitAllocator()]
|
||||||
|
|
@ -2167,10 +2167,18 @@ static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffs
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Cursor ennter callback, when cursor enters the window
|
// GLFW3: Cursor ennter callback, when cursor enters the window
|
||||||
static void CursorEnterCallback(GLFWwindow *window, int enter)
|
static void CursorEnterCallback(GLFWwindow *window, int entered)
|
||||||
{
|
{
|
||||||
if (enter) CORE.Input.Mouse.cursorOnScreen = true;
|
if (entered)
|
||||||
else CORE.Input.Mouse.cursorOnScreen = false;
|
{
|
||||||
|
// NOTE: Mouse position updated by MouseCursorPosCallback()
|
||||||
|
CORE.Input.Mouse.cursorOnScreen = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CORE.Input.Mouse.cursorOnScreen = false;
|
||||||
|
CORE.Input.Mouse.currentPosition = (Vector2){ 0 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Joystick connected/disconnected callback
|
// GLFW3: Joystick connected/disconnected callback
|
||||||
|
|
|
||||||
|
|
@ -1160,7 +1160,8 @@ RLAPI const char *GetWorkingDirectory(void); // Get curre
|
||||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||||
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
||||||
RLAPI bool IsPathFile(const char *path); // Check if given path is a file or a directory
|
RLAPI bool IsPathFile(const char *path); // Check if given path points to a file
|
||||||
|
RLAPI bool IsPathDirectory(const char *path); // Check if given path points to a directory
|
||||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
||||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
||||||
|
|
|
||||||
20
src/rcore.c
20
src/rcore.c
|
|
@ -2825,10 +2825,24 @@ int ChangeDirectory(const char *dirPath)
|
||||||
// Check if given path point to a file
|
// Check if given path point to a file
|
||||||
bool IsPathFile(const char *path)
|
bool IsPathFile(const char *path)
|
||||||
{
|
{
|
||||||
struct stat result = { 0 };
|
bool result = false;
|
||||||
stat(path, &result);
|
|
||||||
|
|
||||||
return S_ISREG(result.st_mode);
|
struct stat info = { 0 };
|
||||||
|
stat(path, &info);
|
||||||
|
|
||||||
|
if (S_ISREG(info.st_mode)) result = true;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if given path point to a directory
|
||||||
|
bool IsPathDirectory(const char *path)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (!IsPathFile(path)) result = true;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if fileName is valid for the platform/OS
|
// Check if fileName is valid for the platform/OS
|
||||||
|
|
|
||||||
35
src/rtext.c
35
src/rtext.c
|
|
@ -2200,18 +2200,43 @@ char *TextToSnake(const char *text)
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
// Check for next separator to upper case another character
|
// Check for next separator to upper case another character
|
||||||
for (int i = 0, j = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); i++, j++)
|
for (int i = 0, j = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); j++)
|
||||||
{
|
{
|
||||||
if ((text[j] >= 'A') && (text[j] <= 'Z'))
|
if (text[j] == ' ')
|
||||||
{
|
{
|
||||||
if (i >= 1)
|
if ((i > 0) && (buffer[i - 1] != '_'))
|
||||||
{
|
{
|
||||||
buffer[i] = '_';
|
buffer[i] = '_';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
buffer[i] = text[j] + 32;
|
|
||||||
}
|
}
|
||||||
else buffer[i] = text[j];
|
else if ((text[j] >= 'A') && (text[j] <= 'Z'))
|
||||||
|
{
|
||||||
|
if ((i > 0) && (buffer[i - 1] != '_'))
|
||||||
|
{
|
||||||
|
char prev = text[j - 1];
|
||||||
|
char next = text[j + 1];
|
||||||
|
|
||||||
|
// Considering multiple cap leters to be on single word (HTTPRequest --> http_request)
|
||||||
|
if (((prev >= 'a') && (prev <= 'z')) ||
|
||||||
|
(((prev >= 'A') && (prev <= 'Z')) && ((next >= 'a') && (next <= 'z'))))
|
||||||
|
{
|
||||||
|
if (i < MAX_TEXT_BUFFER_LENGTH - 2)
|
||||||
|
{
|
||||||
|
buffer[i] = '_';
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[i] = text[j] + 32;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer[i] = text[j];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4657,7 +4657,18 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "IsPathFile",
|
"name": "IsPathFile",
|
||||||
"description": "Check if given path is a file or a directory",
|
"description": "Check if given path points to a file",
|
||||||
|
"returnType": "bool",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "path"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "IsPathDirectory",
|
||||||
|
"description": "Check if given path points to a directory",
|
||||||
"returnType": "bool",
|
"returnType": "bool",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4177,7 +4177,15 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "IsPathFile",
|
name = "IsPathFile",
|
||||||
description = "Check if given path is a file or a directory",
|
description = "Check if given path points to a file",
|
||||||
|
returnType = "bool",
|
||||||
|
params = {
|
||||||
|
{type = "const char *", name = "path"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "IsPathDirectory",
|
||||||
|
description = "Check if given path points to a directory",
|
||||||
returnType = "bool",
|
returnType = "bool",
|
||||||
params = {
|
params = {
|
||||||
{type = "const char *", name = "path"}
|
{type = "const char *", name = "path"}
|
||||||
|
|
|
||||||
|
|
@ -3033,7 +3033,13 @@
|
||||||
((type "const char *") (name "dirPath"))))
|
((type "const char *") (name "dirPath"))))
|
||||||
|
|
||||||
((name "IsPathFile")
|
((name "IsPathFile")
|
||||||
(description "Check if given path is a file or a directory")
|
(description "Check if given path points to a file")
|
||||||
|
(return-type "bool")
|
||||||
|
(params
|
||||||
|
((type "const char *") (name "path"))))
|
||||||
|
|
||||||
|
((name "IsPathDirectory")
|
||||||
|
(description "Check if given path points to a directory")
|
||||||
(return-type "bool")
|
(return-type "bool")
|
||||||
(params
|
(params
|
||||||
((type "const char *") (name "path"))))
|
((type "const char *") (name "path"))))
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -681,7 +681,7 @@
|
||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="611">
|
<Functions count="612">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
|
|
@ -1115,7 +1115,10 @@
|
||||||
<Function name="ChangeDirectory" retType="int" paramCount="1" desc="Change working directory, returns 0 on success">
|
<Function name="ChangeDirectory" retType="int" paramCount="1" desc="Change working directory, returns 0 on success">
|
||||||
<Param type="const char *" name="dirPath" desc="" />
|
<Param type="const char *" name="dirPath" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="IsPathFile" retType="bool" paramCount="1" desc="Check if given path is a file or a directory">
|
<Function name="IsPathFile" retType="bool" paramCount="1" desc="Check if given path points to a file">
|
||||||
|
<Param type="const char *" name="path" desc="" />
|
||||||
|
</Function>
|
||||||
|
<Function name="IsPathDirectory" retType="bool" paramCount="1" desc="Check if given path points to a directory">
|
||||||
<Param type="const char *" name="path" desc="" />
|
<Param type="const char *" name="path" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="IsFileNameValid" retType="bool" paramCount="1" desc="Check if fileName is valid for the platform/OS">
|
<Function name="IsFileNameValid" retType="bool" paramCount="1" desc="Check if fileName is valid for the platform/OS">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue