Skip to content

Scramble is a c++ header only library which prints a collection of strings in a scrambled manner with random characters.

License

Notifications You must be signed in to change notification settings

terslang/scramble-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scramble

Scramble is a c++ header only library which prints a collection of strings in a scrambled manner with random characters. Inspired from this awesome codepen example.

How to use it?

Since this is a header only library add the header file directly in your source code or include directory and use it in your program as shown in the example.

inline void scramble(std::vector<std::string> texts, bool clearAll = true, uint transitionDelay = 100, uint textDelay = 1000);
  • If clearAll is set to true, the text printed will be cleared at the end. Default is true.
  • transitionDelay is time you want in milliseconds between every print. Default is 100 ms.
  • textDelay is the time you want in milliseconds between end of a text print and the start of the next text printing. Default is 1000 ms.

Example

#include "scramble-cpp/scramble.hpp"
#include <vector>

int main() {
    std::vector<std::string> texts = {"Neo,",
                                      "sooner or later",
                                      "you're going to realize",
                                      "just as I did",
                                      "that there's a difference",
                                      "between knowing the path",
                                      "and walking the path"};
    Scramble::scramble(texts, false);
    std::cout << "\n";
    return 0;
}

About

Scramble is a c++ header only library which prints a collection of strings in a scrambled manner with random characters.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages