1#include <Interface/Animation/AnimationSnakes.hpp>
2#include <Interface/Colors.hpp>
3#include <Misc/Utils.hpp>
5AnimationSnakes::AnimationSnakes(
Window* window):
21 (this->lilsnakes.size() < MAX_SNAKES))
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));
76void AnimationSnakes::addSnake()
82 this->lilsnakes.push_back(
LilSnake(newx, newy, size));
void update()
Updates Animation's internal state.
void load()
Loads all internal things.
void draw()
Shows Animation on the screen.
Abstract interface to any kind of Animation.
void start()
Sets a starting point for the timer.
suseconds_t delta_ms()
Returns the milisseconds part of the timer's difference.
A segment of the terminal screen (2D char matrix).
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.
int between(int min, int max)
Random number between min and max.