Updated 10/12/2020 to reflect latest 1.2.4 API
There had to be a way to manage cool screen transitions as easy as possible in C++ without too much difficulty.
There wasn't until now Swoosh, the mini library that immediately adds 100x polish to your game.
Fork the project at https://github.com/TheMaverickProgrammer/Swoosh (https://github.com/TheMaverickProgrammer/Swoosh).
LICENSED under The zlib/libpng License.
Swoosh is easy to integrate and makes your game look pro. Just checkout the super simple game example that ships with it.
See the full video https://streamable.com/qb023 (https://streamable.com/qb023).
(https://media.giphy.com/media/2jsQgGNqmHU3HB3tZN/giphy.gif)
The example project comes with 20+ header-only custom segue effects you can copy and paste directly into your project and it'll just work.
Using segues is as easy as calling push or pop and providing the intent. The intent is a specialized nested class designed to be human readable. Just see for yourself:
ActivityController controller;
controller.push<MainMenuScene>();
...
// User selects settings
using types::segue;
controller.push<segue<SlideInLeft>::to<AppSettingsScene>>();
Popping is the same way.
controller.pop();
controller.pop<segue<SlideIn>>();
And if you're making a legend of zelda clone and the player teleports out of a series of deep dungeons back to overworld... there's a function for that too
bool found = controller.rewind<segue<SlideIn>::to<LOZOverworld>>();
if(!found) {
// Perhaps we're already in overworld. Certain teleport items cannot be used!
}
Take a peak at the full source code for the demo project:
Source Code (https://github.com/TheMaverickProgrammer/Swoosh/tree/master/ExampleDemo)
Swoosh comes with other useful utilities specifically but not limited to games.
- function bool doesCollide(a, b)
- function double angleTo(subject, target)
- function vector2 direction(target, dest)
- function void setOrigin(sprite, fx, fy)
See the rest here:
https://github.com/TheMaverickProgrammer/Swoosh/wiki/Namespaces (https://github.com/TheMaverickProgrammer/Swoosh/wiki/Namespaces)
May this be as useful to you as it is meant to be!
Major updates in v1.2.4 just released today
Some API changes are made to support better mobile and low-end GPU hardware support. See the readme (https://github.com/TheMaverickProgrammer/Swoosh/blob/master/README.md).
Added new "Dream" (https://twitter.com/swooshlib/status/1315143680903254017) transition effect to the supplied src/segue/ folder in the project. Add it to your project by adding #include <Swoosh/Segues/Dream.h>
.
Plug-n-play baby! ;D
https://streamable.com/cw5pev