mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-24 21:28:27 -04:00
Compare commits
4 Commits
c58072d595
...
f9e2215c49
| Author | SHA1 | Date | |
|---|---|---|---|
| f9e2215c49 | |||
| d75a6589f0 | |||
| 47c8e897ce | |||
| 1129d42b48 |
@ -54,6 +54,10 @@ features
|
|||||||
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||||
- **Free and open source**
|
- **Free and open source**
|
||||||
|
|
||||||
|
limitations
|
||||||
|
-----------
|
||||||
|
- No support for rendering during resizing or window movement on windows platforms
|
||||||
|
|
||||||
basic example
|
basic example
|
||||||
--------------
|
--------------
|
||||||
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||||
|
|||||||
@ -287,8 +287,14 @@ void ToggleBorderlessWindowed(void)
|
|||||||
CORE.Window.screen.height = mode->height;
|
CORE.Window.screen.height = mode->height;
|
||||||
|
|
||||||
// Set screen position and size
|
// Set screen position and size
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// NOTE: To prevent the fullscreen window from always staying on top, don't pass a monitor at this point.
|
||||||
|
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
|
||||||
|
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
|
||||||
|
#else
|
||||||
glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
|
glfwSetWindowMonitor(platform.handle, monitors[monitor], CORE.Window.position.x, CORE.Window.position.y,
|
||||||
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
|
CORE.Window.screen.width, CORE.Window.screen.height, mode->refreshRate);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
@ -1024,6 +1030,8 @@ const char *GetMonitorName(int monitor)
|
|||||||
// Get window position XY on monitor
|
// Get window position XY on monitor
|
||||||
Vector2 GetWindowPosition(void)
|
Vector2 GetWindowPosition(void)
|
||||||
{
|
{
|
||||||
|
glfwGetWindowPos(platform.handle, &CORE.Window.position.x, &CORE.Window.position.y);
|
||||||
|
|
||||||
return (Vector2){ (float)CORE.Window.position.x, (float)CORE.Window.position.y };
|
return (Vector2){ (float)CORE.Window.position.x, (float)CORE.Window.position.y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
src/rcore.c
24
src/rcore.c
@ -2583,19 +2583,27 @@ const char *GetPrevDirectoryPath(const char *dirPath)
|
|||||||
{
|
{
|
||||||
static char prevDirPath[MAX_FILEPATH_LENGTH] = { 0 };
|
static char prevDirPath[MAX_FILEPATH_LENGTH] = { 0 };
|
||||||
memset(prevDirPath, 0, MAX_FILEPATH_LENGTH);
|
memset(prevDirPath, 0, MAX_FILEPATH_LENGTH);
|
||||||
int dirPathLength = (int)strlen(dirPath);
|
|
||||||
|
|
||||||
if (dirPathLength <= 3) snprintf(prevDirPath, MAX_FILEPATH_LENGTH, "%s", dirPath);
|
const int lastIndex = (int)strlen(dirPath) - 1;
|
||||||
|
bool isFile = IsPathFile(dirPath);
|
||||||
for (int i = (dirPathLength - 1); (i >= 0) && (dirPathLength > 3); i--)
|
for (int i = lastIndex; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
// If the character is a path separator.
|
||||||
if ((dirPath[i] == '\\') || (dirPath[i] == '/'))
|
if ((dirPath[i] == '\\') || (dirPath[i] == '/'))
|
||||||
{
|
{
|
||||||
// Check for root: "C:\" or "/"
|
// If this character is a leading '/' (e.g. the '/' in "/usr") or
|
||||||
if (((i == 2) && (dirPath[1] ==':')) || (i == 0)) i++;
|
// part of a drive root (e.g. "C:\"), include it with the result.
|
||||||
|
if ((i == 0) || ((i == 2) && (dirPath[1] == ':'))) i += 1;
|
||||||
|
// If this character is a trailing path separator (e.g. the last
|
||||||
|
// '/' in "/usr/bin/" or the last '\' in "C:\raylib\"), continue.
|
||||||
|
else if (i == lastIndex) continue;
|
||||||
|
|
||||||
memcpy(prevDirPath, dirPath, i);
|
if (!isFile)
|
||||||
break;
|
{
|
||||||
|
memcpy(prevDirPath, dirPath, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else isFile = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user