diff --git a/renderer/rsdl/source/gameengine_rsdl/package.d b/renderer/rsdl/source/gameengine_rsdl/package.d index f12b438..eff922c 100644 --- a/renderer/rsdl/source/gameengine_rsdl/package.d +++ b/renderer/rsdl/source/gameengine_rsdl/package.d @@ -6,16 +6,19 @@ import gameengine.math.types; import std.exception; import std.format; +import std.string : toStringz; + class RSDL : Renderer { - this(char* title, IntVec2 size) { + this(string title, IntVec2 size) { const SDLSupport ret = loadSDL(); if(ret != sdlSupport) { - throw new Exception("Couldn't load SDL"); + throw new Exception("Couldn't load SDL library!"); } SDL_Init(SDL_INIT_VIDEO); - window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, size.x, size.y, SDL_WINDOW_RESIZABLE); + window = SDL_CreateWindow(cast(char*)toStringz(title), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + size.x, size.y, SDL_WINDOW_RESIZABLE); if (window is null) { string error = format("Couldn't create window! what: %d", SDL_GetError()); diff --git a/test/source/app.d b/test/source/app.d index 67033f9..0f9ac85 100644 --- a/test/source/app.d +++ b/test/source/app.d @@ -6,10 +6,9 @@ import gameengine.renderer.renderer; import gameengine_rsdl; import core.thread; -import std.string : toStringz; void main() { - Renderer renderer = new RSDL(cast(char*)toStringz("test".dup), IntVec2(800, 600)); + Renderer renderer = new RSDL("test", IntVec2(800, 600)); Engine engine = new Engine(renderer); while (true) {