On Friday, 19 February 2021 at 23:29:18 UTC, Steven Schveighoffer
wrote:
On 2/19/21 5:26 PM, Decabytes wrote:
raylib-d does not have D wrappers for everything. You are
supposed to use the C functions.
D's string literals are null-terminated. However, the language
only allows actual literals to be implicitly converted to
immutable(char)* as literals, not as general strings.
So this will work:
Texture2D player = LoadTexture("assets/tile_022.png");
And this will work too (because string literals are null
terminated):
string fname = "assets/tile_022.png";
Texture2D player = LoadTexture(fname.ptr);
If you have a string that you aren't sure is a string literal,
you can use std.string.toStringz to convert it, but this will
allocate another string (possibly).
import std.string;
Texture2D player = LoadTexture(fname.toStringz);
-Steve
I see now. Thank you Steve!