Skip to content

A simple option selector / file chooser gui written in C++ using SDL2 and SDL2_TTF

License

Notifications You must be signed in to change notification settings

cizia64/selector

 
 

Repository files navigation

SDL Selector Application

Selector is a selection tool built for CrossMix-OS with SDL, designed to offer an intuitive and customizable interface for users to make selections from either files list or from user-specified options.

With support for custom title, background image, and recursive file searching, this application provides a clean, navigable interface using both keyboard or game controller inputs.

Usage

To launch the application, use the following command-line options to customize its behavior:

./selector [options]

Command-Line Options

  • -d <directory>
    Specifies the directory to list files from. The application will display all files in this directory. If omitted, the application defaults to the current directory.

  • -t <title>
    Sets the title displayed at the top of the selection window. You can include line breaks in the title by using \n in the string. Example: "Select a file\nPress Enter to confirm".

  • -i <image_path>
    Provides a path to a background image file. This image will be displayed as the background of the selection window. Ensure the image file format is supported by SDL_image (e.g., PNG, JPEG).

  • -r
    Enables recursive file listing. If used with the -d option, the application will search through subdirectories for files as well.

  • -c <option1> <option2> ...
    Allows you to specify a custom list of options instead of listing files. These options are displayed in the selection window for the user to choose from.

Interactive Controls

  • Arrow Keys / D-Pad
    Navigate through the list of files or options.

  • Enter / A Button
    Select the highlighted item.

  • Escape / B Button
    Exit the application.

Examples

  1. List Files in Current Directory

    ./selector

  2. List Files in a Specific Directory

    ./selector -d /path/to/directory

  3. Custom Title with Line Breaks

    ./selector -t "Choose a file\nUse arrows to navigate\nPress Enter to select"

  4. With Background Image

    ./selector -i /path/to/background.png

  5. Recursive File Listing

    ./selector -d /path/to/directory -r

  6. Custom Options List

    ./selector -c "Option 1" "Option 2" "Option 3" -t "Select an Option" -i /path/to/background.png

Notes

  • Ensure that SDL, SDL_image, and SDL_ttf libraries are properly installed and configured for the application to run smoothly.
  • The custom list feature (-c) can be used with -i or -t but can' be used with file listing options (-d and -r).

https://github.com/cizia64/selector

Help the CrossMix-OS project

Contribute to this repo by making a Pull Request. If you have an improvement to propose and don't know how to use GitHub, send me a message!

Feel free to reach out to me to report bugs, request features, or just chat on Discord or on Github Issues

If you enjoy my work and want to support the countless hours/days invested on CrossMix-OS and its tools, here are my sponsors:

  • Patreon
  • Buy Me a Coffee
  • ko-fi

About

A simple option selector / file chooser gui written in C++ using SDL2 and SDL2_TTF

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.3%
  • Makefile 2.7%