A simple, easy-to-integrate C++ library for creating a customizable welcome/splash screen for your games. Designed with Raylib in mind, Splashlib aims to give your games a polished entry point, while subtly promoting a healthy message: "Get outside, touch grass!"
Every great game needs a welcoming introduction. Splashlib provides a straightforward way to display your game's title, a catchy message, and perhaps a subtle call to action, all while ensuring a smooth transition into your main game loop. Plus, it carries a positive message about disconnecting and enjoying the real world – because even game developers need to touch grass!
- Customizable Welcome Message: Easily change the text displayed on your splash screen.
- Raylib Integration: Built with Raylib, ensuring compatibility with your existing Raylib projects.
- Simple API: Minimal function calls to get your splash screen up and running.
- Lightweight: Designed to be a small, unobtrusive addition to your game.
- "Touch Grass" Philosophy: A friendly reminder for players (and developers!) to take a break.
- Raylib: Splashlib is built on Raylib. Ensure you have Raylib installed and configured for your development environment.
- C++ Compiler: A C++17 compatible compiler (e.g., g++, Clang, MSVC).
make: For building the library from source.
-
Clone the Repository:
git clone https://github.com/INNOCENT-ops806/Splashlib.git cd Splashlib -
Build the Library:
make
This will typically compile the library and place
libSplash.a(the static library) in thelib/directory.
-
Copy the Library: Copy the
Splashlibfolder (or at least itsinclude/andlib/subdirectories) into your game project'slib/directory.Example (from your main game's root):
cp -r /path/to/Splashlib/include lib/Splashlib/ cp -r /path/to/Splashlib/lib lib/Splashlib/
-
Include the Header: In your
main.cpp(or wherever you want to display the splash screen), include the main header:#include "lib/Splashlib/include/Splash.h" // Or, if you've configured your Makefile to include -Ilib/Splashlib/include // then you can simply use: #include <Splash.h>
-
Update Your Makefile (or Build System): You need to tell your build system where to find Splashlib's headers and where to link against its static library.
Add these to your
Makefile(adjust paths as necessary):# In CXXFLAGS (for compiler to find headers): CXXFLAGS += -Ilib/Splashlib/include # In LDFLAGS (for linker to find the library file and link it): LDFLAGS += -Llib/Splashlib/lib -lSplash
-
Use in Your Code:
#include <raylib.h> #include <Splash.h> // Assuming -I is set up correctly int main() { // Initialize Raylib window InitWindow(5,5,GetScreenWidth - 5, GetScreenHeight -5, "My Awesome Game"); SetTargetFPS(60); // --- Splashlib Usage --- // Display the splash screen. This function should block until it's done. // You might need to pass window dimensions, or have it handle them internally. // Assuming your Splashlib has a function like this: Splash::Draw(); // // If you need to initialize or shutdown Splashlib (like AudioDevice for raylib) //There is a destructor for the entire library // Splashlib::~Splash; // Your main game loop starts here after the splash screen finishes while (!WindowShouldClose()) { BeginDrawing(); ClearBackground(RAYWHITE); DrawText("Welcome to the Game!", 100, 200, 30, BLACK); EndDrawing(); } CloseWindow(); return 0; }
If are still struggling with the examples given above, you can view the example folder where everything has been setup for game development.
Note
Check the Makefile to see how to include the library
If you have ideas for improving Splashlib, feel free to open issues or submit pull requests on GitHub.
Thank you for using Splashlib ^_^
This project is licensed under the MIT License - see the LICENSE file for details.
