glerminal/examples/atlas.cpp
Shylie 4811e4d970
All checks were successful
Make PNG / build-app (push) Successful in 56s
Allow 1-tile offscreen rendering to prevent pop-in effect
2024-06-14 12:20:31 -04:00

46 lines
664 B
C++

#include <glerminal.h>
#include <cstdlib>
namespace
{
void init()
{
glerminal_load_sprites_file("resources/atlas.png");
}
void mainloop(double dt)
{
static double time = 1;
time += dt;
if (time < 1.0f)
{
return;
}
else
{
time = 0;
}
for (int i = 0; i < GRID_WIDTH; i++)
{
for (int j = 0; j < GRID_HEIGHT; j++)
{
for (int k = 0; k < LAYER_COUNT; k++)
{
glerminal_set(i + 1, j + 1, k, rand() % 4);
glerminal_offset(i + 1, j + 1, k, (rand() * rand()) % 64 - 32, (rand() * rand()) % 64 - 32);
}
}
}
glerminal_flush();
}
}
int main(int argc, char** argv)
{
glerminal_run({init, mainloop});
}