6 Commits

Author SHA1 Message Date
8d5a106ab3 docs: Update documentation 2026-05-26 16:02:43 +05:30
4e7c53d79f docs: Update README to remove video and add asset link
Removed video demo from README and added a link to GitHub assets.
2026-05-26 15:57:15 +05:30
bb2b60de5b fix: md rendering 2026-05-26 15:52:58 +05:30
1159868e15 docs: Added demo video 2026-05-26 15:51:20 +05:30
e9c939f033 chore: delete binaries 2026-05-26 13:16:19 +05:30
94184c73d0 feat: add a 250ms delay between game window and splash close 2026-05-26 13:15:22 +05:30
3 changed files with 45 additions and 31 deletions

View File

@@ -2,6 +2,8 @@
A fullscreen splash-screen wrapper for launching a game or app. It displays an image (or a fallback black screen), starts your executable, and closes when the process exits or loses focus after launch.
https://github.com/user-attachments/assets/22da49b4-0f1f-4208-8d0b-9eeef14e35e5
## Features
1. Fullscreen, borderless splash screen with hidden cursor (SDL2)
@@ -39,6 +41,36 @@ sudo make install
DESTDIR=/some/staging/path make install
```
## Usage
```bash
gsplash <image_or_video_path> <game_executable> [game_arguments...]
```
Example:
```bash
gsplash assets/splash.jpg /path/to/game --fullscreen --profile=default
# Video splash (supported formats depend on ffmpeg build)
gsplash assets/splash.mp4 /path/to/game --fullscreen --profile=default
```
Gsplash allows you to configure how the image or video is displayed with 3 modes:
- `center` (default): letterbox
- `crop`: fill screen by cropping
- `stretch`: Distort to fill screen
You can set these by using the `-m` or `--mode` flag:
```bash
build/gsplash [--mode=stretch|center|crop] <background> <executable> [args...]
build/gsplash -m stretch|center|crop <background> <executable> [args...]
```
## Testing
Gsplash includes several testing utilities to ensure proper functionality without requiring a heavy game binary.
@@ -71,31 +103,3 @@ For manual testing, a `dummy_game` binary is built alongside `gsplash`. It mimic
./build/gsplash path/to/image.png ./build/dummy_game 10
```
## Usage
```bash
gsplash <image_or_video_path> <game_executable> [game_arguments...]
```
Example:
```bash
gsplash assets/splash.jpg /path/to/game --fullscreen --profile=default
# Video splash (supported formats depend on ffmpeg build)
gsplash assets/splash.mp4 /path/to/game --fullscreen --profile=default
```
Gsplash allows you to configure how the image or video is displayed with 3 modes:
- `center` (default): letterbox
- `crop`: fill screen by cropping
- `stretch`: Distort to fill screen
You can set these by using the `-m` or `--mode` flag:
```bash
build/gsplash [--mode=stretch|center|crop] <background> <executable> [args...]
build/gsplash -m stretch|center|crop <background> <executable> [args...]
```

BIN
docs/assets/demo.mp4 Normal file

Binary file not shown.

View File

@@ -275,6 +275,8 @@ int main(int argc, char *argv[])
// Inside Parent Process: Manage splash screen lifecycle
int running = 1;
SDL_Event event;
bool hide_scheduled = false;
Uint32 hide_time = 0;
while (running)
{
@@ -337,10 +339,11 @@ int main(int argc, char *argv[])
if (event.type == SDL_WINDOWEVENT)
{
// THE MOMENT THE GAME WINDOW STEALS FOCUS:
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST && !hide_scheduled)
{
log_info("Splash window hidden (focus lost)");
SDL_HideWindow(window); // Instantly make splash transparent/invisible
log_info("Splash window hidden (focus lost), scheduling hide");
hide_scheduled = true;
hide_time = SDL_GetTicks() + 250; // 250ms delay to prevent desktop flash
}
// Re-render static image when compositor requests a redraw
if (event.window.event == SDL_WINDOWEVENT_EXPOSED && texture && !video_active)
@@ -369,6 +372,13 @@ int main(int argc, char *argv[])
}
}
if (hide_scheduled && SDL_GetTicks() >= hide_time)
{
log_info("Hiding splash window (delayed)");
SDL_HideWindow(window);
hide_scheduled = false;
}
if (video_active)
{
Uint32 now = SDL_GetTicks();