#include <helianthus.h>
#include "tree.h"
#define COUNT 10
double time;
Tree trees[COUNT];
void generate() {
for(int i = 0; i < COUNT; ++i)
treeGenerate(&trees[i]);
}
void init() {
generate();
}
void draw() {
time += worldGetFrameTime();
int w = worldGetWidth();
int h = worldGetHeight();
if (keyWentDown("space")) generate();
saveState();
translate(0.5*w, 0.5*h);
zoom(10);
scale(1, -1);
for(int i = 0; i < COUNT; ++i)
treeDraw(&trees[i], time, TRUE, FALSE);
for(int i = 0; i < COUNT; ++i)
treeDraw(&trees[i], time, FALSE, TRUE);
restoreState();
}
int main() {
worldSetVariableFrameRate();
worldSetResizable(TRUE);
worldSetInit(&init);
worldSetDraw(&draw);
worldRun();
return 0;
}