Fix engine -> core rename goof ups and add basic rsdl update function

This commit is contained in:
Tulpen 2023-05-22 21:42:34 +01:00
parent 80593dcb2b
commit 03a47075a2
7 changed files with 17 additions and 7 deletions

View file

@ -38,6 +38,7 @@ class Engine {
}
void runNodePhysicsProcesses() {
// TODO: See above TODO
// Schade! Have the wrong function content while I figure out how std.datetime.watch works
const float current = watch.peek.total!"msecs" / 1_000;
float delta = (current - previousProcessTick);

View file

@ -16,4 +16,6 @@ abstract class Renderer {
// Util
void setWindowTitle(string title);
public bool keepOpen = true;
}

View file

@ -4,9 +4,9 @@ authors "Tulpenkiste"
copyright "Copyright © 2023, Tulpenkiste"
license "LGPL-3.0"
targetType "none"
dependency "hibis:engine" version="*"
dependency "hibis:core" version="*"
dependency "hibis:rsdl" version="*"
dependency "hibis:test" version="*"
subPackage "engine"
subPackage "core"
subPackage "renderer/rsdl"
subPackage "test"

View file

@ -1,5 +1,5 @@
name "rsdl"
dependency "hibis:engine" version=">=0.0.0"
dependency "hibis:core" version=">=0.0.0"
dependency "bindbc-sdl" version="~>1.3.5"
targetType "library"
targetName "hibis_rsdl"

View file

@ -9,7 +9,7 @@ import std.format;
import std.string : toStringz;
/** \class RSDL
* Renderer implementation using SDL2 Renderer for the game engine
* Renderer implementation using SDL2 Renderer for the Hibis game engine
*/
class RSDL : Renderer {
this(string title, IntVec2 size) {
@ -55,7 +55,13 @@ class RSDL : Renderer {
override void preDraw() {}
override void postDraw() {}
override void update() {}
override void update() {
SDL_Event event;
while(SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) keepOpen = false;
}
}
override void setWindowTitle(string title) {}

View file

@ -5,6 +5,6 @@ copyright "Copyright © 2023, Tulpenkiste"
license "LGPL-3.0"
targetType "executable"
targetName "hibistest.exec"
dependency "hibis:engine" version="*"
dependency "hibis:core" version="*"
dependency "hibis:rsdl" version="*"
sourcePaths "./" "../core" "../renderer/rsdl"

View file

@ -21,7 +21,7 @@ void main() {
ubyte red = 0;
bool increase = true;
while (true) {
while (renderer.keepOpen) {
engine.runNodeProcesses();
// Colour changing background!
@ -36,6 +36,7 @@ void main() {
engine.drawNodes();
renderer.renderCurrent();
renderer.update();
Thread.sleep(16.msecs);
}
}