glerminal/examples/basic.cpp

55 lines
1.4 KiB
C++

#include <glerminal.h>
#include <cstdlib>
namespace
{
void init()
{
glerminal_update_sprite(0xFF00007F, {
0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0xFF00007F, 0x00FF007F,
0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F, 0x00FF007F
});
}
void mainloop(float dt)
{
static float time = 1;
time += dt;
if (time < 0.2f)
{
return;
}
else
{
time = 0;
}
for (int i = 0; i < 40; i++)
{
for (int j = 0; j < 25; j++)
{
for (int k = 0; k < 8; k++)
{
glerminal_set(i, j, k, rand() % 2);
glerminal_offset(i, j, k, (rand() * rand()) % 100 - 50, (rand() * rand()) % 100 - 50);
}
}
}
glerminal_flush();
}
}
int main(int argc, char** argv)
{
glerminal_run(init, mainloop);
}