Skip to content

Commit

Permalink
cStrtoD for betterC
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane authored Jan 6, 2024
1 parent 94e8730 commit efbc889
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sokol/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
module sokol.app;

// helper function to convert a C string to a D string
string cStrTod(T)(scope T c_str) nothrow {
import std.conv: to;
return c_str.to!string;
string cStrTod(T)(inout(char)* c_str) nothrow {
auto start = c_str;
auto end = cast(char*) c_str;
for (; *end; end++){}
return cast(string) c_str[0 .. end - start];
}
enum max_touchpoints = 8;
enum max_mousebuttons = 3;
Expand Down

0 comments on commit efbc889

Please sign in to comment.