1 #include <Interface/Animation/AnimationSnakes.hpp> 2 #include <Interface/Colors.hpp> 3 #include <Misc/Utils.hpp> 5 AnimationSnakes::AnimationSnakes(
Window* window):
20 if ((addTimer.delta_ms() > delay) &&
21 (this->lilsnakes.size() < MAX_SNAKES))
38 if (updateTimer.delta_ms() > 50)
40 std::vector<LilSnake>::iterator it = this->lilsnakes.begin();
42 while (it != this->lilsnakes.end())
44 if (((*it).y - (*it).size) > (this->window->getH() - 1))
46 it = this->lilsnakes.erase(it);
59 for (
unsigned int i = 0; i < (this->lilsnakes.size()); i++)
64 Colors::pair(COLOR_GREEN, COLOR_DEFAULT,
true));
66 for (
int j = 1; j < (this->lilsnakes[i].size); j++)
70 this->lilsnakes[i].y - j,
71 Colors::pair(COLOR_GREEN, COLOR_DEFAULT));
76 void AnimationSnakes::addSnake()
82 this->lilsnakes.push_back(
LilSnake(newx, newy, size));
void update()
Updates Animation's internal state.
A segment of the terminal screen (2D char matrix).
void draw()
Shows Animation on the screen.
void load()
Loads all internal things.
int between(int min, int max)
Random number between min and max.
Abstract interface to any kind of Animation.
void printChar(int c, int x, int y, ColorPair pair=0)
Shows #c at #x #y with color #pair.
bool booleanWithChance(float percent)
Random boolean with chance of #percent.