Fix engine -> core rename goof ups and add basic rsdl update function
This commit is contained in:
parent
80593dcb2b
commit
03a47075a2
|
@ -38,6 +38,7 @@ class Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
void runNodePhysicsProcesses() {
|
void runNodePhysicsProcesses() {
|
||||||
|
// TODO: See above TODO
|
||||||
// Schade! Have the wrong function content while I figure out how std.datetime.watch works
|
// Schade! Have the wrong function content while I figure out how std.datetime.watch works
|
||||||
const float current = watch.peek.total!"msecs" / 1_000;
|
const float current = watch.peek.total!"msecs" / 1_000;
|
||||||
float delta = (current - previousProcessTick);
|
float delta = (current - previousProcessTick);
|
||||||
|
|
|
@ -16,4 +16,6 @@ abstract class Renderer {
|
||||||
|
|
||||||
// Util
|
// Util
|
||||||
void setWindowTitle(string title);
|
void setWindowTitle(string title);
|
||||||
|
|
||||||
|
public bool keepOpen = true;
|
||||||
}
|
}
|
4
dub.sdl
4
dub.sdl
|
@ -4,9 +4,9 @@ authors "Tulpenkiste"
|
||||||
copyright "Copyright © 2023, Tulpenkiste"
|
copyright "Copyright © 2023, Tulpenkiste"
|
||||||
license "LGPL-3.0"
|
license "LGPL-3.0"
|
||||||
targetType "none"
|
targetType "none"
|
||||||
dependency "hibis:engine" version="*"
|
dependency "hibis:core" version="*"
|
||||||
dependency "hibis:rsdl" version="*"
|
dependency "hibis:rsdl" version="*"
|
||||||
dependency "hibis:test" version="*"
|
dependency "hibis:test" version="*"
|
||||||
subPackage "engine"
|
subPackage "core"
|
||||||
subPackage "renderer/rsdl"
|
subPackage "renderer/rsdl"
|
||||||
subPackage "test"
|
subPackage "test"
|
|
@ -1,5 +1,5 @@
|
||||||
name "rsdl"
|
name "rsdl"
|
||||||
dependency "hibis:engine" version=">=0.0.0"
|
dependency "hibis:core" version=">=0.0.0"
|
||||||
dependency "bindbc-sdl" version="~>1.3.5"
|
dependency "bindbc-sdl" version="~>1.3.5"
|
||||||
targetType "library"
|
targetType "library"
|
||||||
targetName "hibis_rsdl"
|
targetName "hibis_rsdl"
|
||||||
|
|
|
@ -9,7 +9,7 @@ import std.format;
|
||||||
import std.string : toStringz;
|
import std.string : toStringz;
|
||||||
|
|
||||||
/** \class RSDL
|
/** \class RSDL
|
||||||
* Renderer implementation using SDL2 Renderer for the game engine
|
* Renderer implementation using SDL2 Renderer for the Hibis game engine
|
||||||
*/
|
*/
|
||||||
class RSDL : Renderer {
|
class RSDL : Renderer {
|
||||||
this(string title, IntVec2 size) {
|
this(string title, IntVec2 size) {
|
||||||
|
@ -55,7 +55,13 @@ class RSDL : Renderer {
|
||||||
override void preDraw() {}
|
override void preDraw() {}
|
||||||
override void postDraw() {}
|
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) {}
|
override void setWindowTitle(string title) {}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ copyright "Copyright © 2023, Tulpenkiste"
|
||||||
license "LGPL-3.0"
|
license "LGPL-3.0"
|
||||||
targetType "executable"
|
targetType "executable"
|
||||||
targetName "hibistest.exec"
|
targetName "hibistest.exec"
|
||||||
dependency "hibis:engine" version="*"
|
dependency "hibis:core" version="*"
|
||||||
dependency "hibis:rsdl" version="*"
|
dependency "hibis:rsdl" version="*"
|
||||||
sourcePaths "./" "../core" "../renderer/rsdl"
|
sourcePaths "./" "../core" "../renderer/rsdl"
|
|
@ -21,7 +21,7 @@ void main() {
|
||||||
|
|
||||||
ubyte red = 0;
|
ubyte red = 0;
|
||||||
bool increase = true;
|
bool increase = true;
|
||||||
while (true) {
|
while (renderer.keepOpen) {
|
||||||
engine.runNodeProcesses();
|
engine.runNodeProcesses();
|
||||||
|
|
||||||
// Colour changing background!
|
// Colour changing background!
|
||||||
|
@ -36,6 +36,7 @@ void main() {
|
||||||
|
|
||||||
engine.drawNodes();
|
engine.drawNodes();
|
||||||
renderer.renderCurrent();
|
renderer.renderCurrent();
|
||||||
|
renderer.update();
|
||||||
Thread.sleep(16.msecs);
|
Thread.sleep(16.msecs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue