So I have separated my texture rendering methods in another file and have run into a problem hence the title name.

#main.d
----------

void render()
{
SDL_RenderClear(renderTarget);
renderSprite(renderTarget);
SDL_RenderPresent(renderTarget);
}
----------
#other_file.d
-----------
void renderSprite(SDL_Renderer _renderTarget)
{

SDL_Texture texture = SDL_CreateTextureFromSurface(_renderTarget, IMG_Load("image.png"));

SDL_RenderCopy(_renderTarget,texture, null,null);
}
----------

Error: cannot implicitly convert expression (null) of type typeof(null) to SDL_Rect Error: cannot implicitly convert expression (null) of type typeof(null) to SDL_Rect

=====================
But when I do this:

#main.d
-------------------

void render()
{
SDL_RenderClear(renderTarget);
SDL_RenderCopy(renderTarget,texture,null,null);
SDL_RenderPresent(renderTarget);
}
--------------------

It works with no problem. I've DerelictSDL2.load and SDL_Init already.
So is this a bug or am I doing something wrong here?

Reply via email to