2024-05-09 19:42:12 +00:00
|
|
|
#include <glerminal.h>
|
|
|
|
|
2024-05-15 02:42:49 +00:00
|
|
|
#include <cstdlib>
|
2024-05-26 03:16:23 +00:00
|
|
|
#include <cmath>
|
2024-05-15 02:42:49 +00:00
|
|
|
|
2024-05-14 21:46:30 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
void init()
|
|
|
|
{
|
2024-05-20 02:46:56 +00:00
|
|
|
glerminal_load_sprites_file("resources/basic.png");
|
2024-05-23 14:53:07 +00:00
|
|
|
|
2024-06-14 16:20:31 +00:00
|
|
|
for (int i = 0; i < GRID_WIDTH + 2; i++)
|
2024-05-23 14:53:07 +00:00
|
|
|
{
|
2024-06-14 16:20:31 +00:00
|
|
|
for (int j = 0; j < GRID_HEIGHT + 2; j++)
|
2024-05-23 14:53:07 +00:00
|
|
|
{
|
|
|
|
glerminal_set(i, j, 0, 1);
|
|
|
|
}
|
|
|
|
}
|
2024-05-14 21:46:30 +00:00
|
|
|
}
|
|
|
|
|
2024-06-11 04:40:43 +00:00
|
|
|
void mainloop(double dt)
|
2024-05-14 21:46:30 +00:00
|
|
|
{
|
2024-06-11 04:40:43 +00:00
|
|
|
static double time = 0;
|
2024-05-15 02:42:49 +00:00
|
|
|
|
|
|
|
time += dt;
|
2024-05-23 14:53:07 +00:00
|
|
|
time = fmodf(time, 3.1415926f * 2);
|
2024-05-15 02:42:49 +00:00
|
|
|
|
2024-06-14 16:20:31 +00:00
|
|
|
for (int i = 0; i < GRID_WIDTH + 2; i++)
|
2024-05-15 02:42:49 +00:00
|
|
|
{
|
2024-06-14 16:20:31 +00:00
|
|
|
for (int j = 0; j < GRID_HEIGHT + 2; j++)
|
2024-05-15 02:42:49 +00:00
|
|
|
{
|
2024-05-23 14:53:07 +00:00
|
|
|
glerminal_offset(i, j, 0, cosf(time - i / 3.1415f), sinf(time - j / 3.1415f));
|
2024-05-15 02:42:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-14 21:46:30 +00:00
|
|
|
glerminal_flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-09 19:42:12 +00:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2024-06-11 04:40:43 +00:00
|
|
|
glerminal_run({init, mainloop});
|
2024-05-09 19:42:12 +00:00
|
|
|
}
|