glerminal/examples/atlas.cpp

46 lines
664 B
C++
Raw Normal View History

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