glerminal/examples/basic.cpp
2024-05-25 23:16:23 -04:00

43 lines
660 B
C++

#include <glerminal.h>
#include <cstdlib>
#include <cmath>
namespace
{
void init()
{
glerminal_load_sprites_file("resources/basic.png");
for (int i = 0; i < GRID_WIDTH; i++)
{
for (int j = 0; j < GRID_HEIGHT; j++)
{
glerminal_set(i, j, 0, 1);
}
}
}
void mainloop(float dt)
{
static float time = 0;
time += dt;
time = fmodf(time, 3.1415926f * 2);
for (int i = 0; i < GRID_WIDTH; i++)
{
for (int j = 0; j < GRID_HEIGHT; j++)
{
glerminal_offset(i, j, 0, cosf(time - i / 3.1415f), sinf(time - j / 3.1415f));
}
}
glerminal_flush();
}
}
int main(int argc, char** argv)
{
glerminal_run(init, mainloop);
}