Basic standard graphics

Adam D. Ruppe destructionator at gmail.com
Fri Nov 12 16:24:25 PST 2010


> If you want you may replace the writeln() (and remove std.stdio
> import) with a SDL_WM_SetCaption() (and see if it runs still).

Yes, it worked, with two changes.

      SDL_WM_SetCaption(toStringz("FPS: " ~
            to!string(frameNumber / (totalTime / 1000.0))), null);

I had to import std.conv to do the float -> string conversion and
std.string to get toStringz. This line is getting a little long
with all the parenthesis for toStringz and to!string together!

My SDL headers were also D1 so I had to edit them to add the const to the C
function prototype too. I think that's legal D1 too so I'll leave it that way. My
interface files are just really old.


Anyway, it generally works but cut the FPS in half on my computer (linux
using Blackbox window manager). Updating the window is a little
slow compared to writing to stdout.


More information about the Digitalmars-d mailing list