glerminal/examples/basic.cpp
Shylie 35902c2803
Some checks failed
Make PNG / build-app (push) Failing after 5s
Add key callbacks, fix buffering issue
2024-05-30 10:57:36 -04:00

43 lines
678 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, nullptr, nullptr);
}