Move char\* cast to RSDL this
function
This commit is contained in:
parent
cbe861693e
commit
ccd3364d0c
|
@ -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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue