Re: Having trouble porting basic GLFW C++ example to D
On Saturday, 7 October 2017 at 04:24:07 UTC, Matt Jones wrote: On Saturday, 7 October 2017 at 03:47:27 UTC, Joakim wrote: On Saturday, 7 October 2017 at 03:12:09 UTC, Matt Jones wrote: [...] Heh, that's the problem. [...] I ran into this myself, took me awhile to track it down. I too took the size of dynamic arrays this way: [...] Ah. I should have remembered that problem. Thanks. I'll see if that fixes it. Nice! That worked. Thanks.
Re: Having trouble porting basic GLFW C++ example to D
On Saturday, 7 October 2017 at 03:47:27 UTC, Joakim wrote: On Saturday, 7 October 2017 at 03:12:09 UTC, Matt Jones wrote: [...] Heh, that's the problem. [...] I ran into this myself, took me awhile to track it down. I too took the size of dynamic arrays this way: [...] Ah. I should have remembered that problem. Thanks. I'll see if that fixes it.
Having trouble porting basic GLFW C++ example to D
I've been trying to port a basic GLFW C++ example to D. The C++ version shows the textures correctly. But the D version shows nothing. The code is almost identical. Does anyone know why the D version does not work? https://github.com/workhorsy/d_glfw
Re: Problems with function as parameter
On Thursday, 21 September 2017 at 20:21:58 UTC, Josh wrote: I'm trying to write a callback function for SDL_mixer through Derelict, but this is the first time I've tried to use a function as a parameter, and so I think I'm just making a minor mistake somewhere. [...] Make it a C function, not a D function: extern (C) void channelDone(int channel) { unmuteMusic(); } and use & to reference the function instead of calling it: Mix_ChannelFinished(&channelDone);
Re: How to list all process directories under /proc/
On Tuesday, 19 September 2017 at 13:32:29 UTC, Ky-Anh Huynh wrote: Btw, is that a bit weird that range is not supported in glob pattern :) Is there a design reason for this? That is strange. But then again, every glob library I've seen works a little bit differently.
Re: How to list all process directories under /proc/
On Sunday, 17 September 2017 at 08:37:33 UTC, Ky-Anh Huynh wrote: The official documentation here https://dlang.org/phobos/std_path.html#.globMatch refers to the wiki page https://en.wikipedia.org/wiki/Glob_%28programming%29 . However I think the popular glob rules (man 7 glob) are not supported. The problem with matching "[0123456789]*" is that it will match files like "1blah" and "8stuff". It looks like glob patterns are not robust enough to handle match patterns you want. A regex would probably be enough. Something like this works: string[] getProcNumbers() { import std.file : dirEntries, SpanMode; import std.path : baseName; import std.regex : regex, match; import std.algorithm : map, filter; import std.array : array; auto r = regex(`^/proc/[0-9]*$`); string[] entries = dirEntries("/proc/", SpanMode.shallow) .map!(n => n.name) .filter!(n => match(n, r)) .array(); return entries; } int main() { import std.stdio : stdout; foreach (entry ; getProcNumbers()) { stdout.writefln("%s", entry); } return 0; }
Re: Looking for instructions on how to make a Derelict library
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote: On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up your experience with doing it as either blog post or part of the Derelict documentation (which is already quite good, IMO). I was thinking of doing that. I'll have to figure out the best way to do that, once I get a better understanding of how Derelict works.
Re: Looking for instructions on how to make a Derelict library
On Monday, 18 September 2017 at 00:21:23 UTC, Mike Parker wrote: See the D wiki for links to articles that show how to translate C headers. I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks.
Looking for instructions on how to make a Derelict library
Hey everyone, I wanted to make a version of SQlite3 that uses Derelict to load the sqlite3 DLL when I'm ready. I can't find any instructions for how to make a basic Derelict style library. I looked around at http://derelictorg.github.io/, but could not find anything. Does anyone have any? Thanks.