hey got some neat code that is self contained and solves a very particular problem or is just neat?
spread the joy and drop it here or something
#text crawler snippet
###description:
here is a text crawler, you seen it in many games like rpgs or visual novels, the text prints character by character to the display, this is the smallest i could get it and i feel its to small to be a library or something.
###code:
#include "Pokitto.h"
Pokitto::Core game;
// needs sting for this
#include <string>
// global crawler variables
std::string crawlStr;
int crawlIndex;
void crawlInput(char * input){ crawlIndex = 0; crawlStr = input; }
int main () {
game.begin();
// you can call this too print text on the screen, even in a different function if you need too
crawlInput("hi there, this text is crawling.");
while (game.isRunning()) {
if (game.update()) {
//the actual crawler and simple way to display it
if(crawlIndex < crawlStr.size()) crawlIndex++;
game.display.print(crawlStr.substr(0,crawlIndex).c_str());
}
}
return 1;
}
###extra:
there are some special characters in the ascii string stuff that isnt used by the pokitto print function,
but since its still parsed as a character it delays our draw speed. so use this for dramatic effects
"nothing special here. \t\t\t\t\t\t\t\t\t\t\t\t\t boo!"