hibiscus/test/source/app.d

34 lines
695 B
D
Raw Normal View History

2023-05-20 21:27:42 +00:00
import std.stdio;
import gameengine.core.engine;
2023-05-21 13:02:53 +00:00
import gameengine.math.types;
2023-05-20 21:27:42 +00:00
import gameengine.renderer.renderer;
import gameengine_rsdl;
import core.thread;
void main() {
Renderer renderer = new RSDL("test", IntVec2(800, 600));
2023-05-20 21:27:42 +00:00
Engine engine = new Engine(renderer);
2023-05-21 20:55:02 +00:00
ubyte red = 0;
bool increase = true;
2023-05-20 21:27:42 +00:00
while (true) {
engine.runNodeProcesses();
2023-05-21 20:55:02 +00:00
// Colour changing background!
if ((red == 255 && increase) || (red == 0 && !increase)) {
increase = !increase;
}
if (increase) red += 1;
else red -= 1;
// Clear screen then sleep for ~16ms
renderer.clearScreen(Color(red, 0, 0, 255));
engine.drawNodes();
2023-05-21 13:02:53 +00:00
renderer.renderCurrent();
Thread.sleep(16.msecs);
2023-05-20 21:27:42 +00:00
}
}