Hi. I think it's the first time I post here.
I've been flirting with D for some time, but now I decided to
start a little project.
Consider the following function:
void RenderText( FontBMP font, int x, int y, const char* text )
{
SDL_Rect rect1, rect2;
rect2.x = x;
rect
Yes, I'm aware of the null-termination thing. I might have pasted
code that I already changed.
But I already messed with sformat, and it seems that it does use
the GC. I've put @nogc in RenderText, and the compiler says
sformat uses GC, so I don't know.
But the thing is, I don't want to buil
I forgot to add that the "RenderText(font,0,0,"FPS:
"~to!string(fps));" was an older version where it wasn't const
char *, but string. And I was using a foreach, so no
null-termination. But that's beyond the point of not using GC.
I figured out what I wanted. Thanks for your answer Mike, sorry
to bother you though.
Here's the result:
void RenderText( FontBMP font, int x, int y, const char* text,
... )
{
SDL_Rect rect1, rect2;
rect2.x = x;
rect2.y = y;
rect2.w = font.width;
rect2.
On Wednesday, 2 March 2016 at 05:04:37 UTC, David G. Maziero
wrote:
char[256] buff;
va_list ap;
va_start( ap, text );
sprintf( buff.ptr, text, ap );
va_end( ap );
Sorry again, where it reads "sprintf" should be "vsprintf".
On Wednesday, 2 March 2016 at 05:04:37 UTC, David G. Maziero
wrote:
void RenderText( FontBMP font, int x, int y, const char* text,
Just one more correction for future reference, RenderText should
be
extern(C) void RenderText...
in order for it to work correctly with va_start/etc.