directx with d

ElfQT elf_qt at _deletethis_yahoo.com
Sat Mar 1 08:26:08 PST 2008


ElfQT Wrote:

Finally I have found the time to investigate this issue.
And the winner is...

Same code will follow with phobos then with tango:

//phobos
import std.c.windows.windows;

struct CUSTOMVERTEX { FLOAT x; };
static CUSTOMVERTEX[3] vertices = [ { 150.0f } ];

void main() { printf ("%d",vertices.sizeof); }

Prints 12.

//tango
import tango.sys.win32.Types;
import tango.stdc.stdio;

struct CUSTOMVERTEX { FLOAT x; };
static CUSTOMVERTEX[3] vertices = [ { 150.0f } ];
void main() { printf ("%d",vertices.sizeof); }

Prints 24.

The difference lies:

Phobos, \dmd\src\phobos\std\c\windows\windows.d:
alias float FLOAT;

Tango, D:\D\import\tango\sys\win32\Types.di:
alias double FLOAT;

(Before you ask, I use type FLOAT - uppercase - because I copy some directx code, which already uses that.)
With directx on win32, the phobos approach is working, Tango FLOAT produces errors.

Is this intended in Tango? Is there already code requiring FLOAT to be double?

The problem in the original post is disappears (and the directx triangle appears), if I use float instead of FLOAT (so double in Tango).

ElfQT

> ElfQT Wrote:
> 
> > Extrawurst Wrote:
> > 
> > > i tried your attached app and it works for me with dmd2.010 i just 
> > > changed the depencies to get it working with phobos, cause i dont use tango.
> > > 
> > > 
> > > ElfQT schrieb:
> > > > I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango.
> > > > But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler.
> > > > Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
> > > >
> > > > Bit of a help would be appreciated, the attached code should display a triangle.
> > > >
> > > > http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
> > > >
> > > > Contact me at elf_qt at _deletethis_yahoo.com
> > > >
> > > > ElfQT
> > > >
> > > >
> > > >   
> > 
> > Well, by working you mean you see the triangle (instead of the simple backgroud)?
> > I'll try that with phobos, also with dmd2.010, if that difference causes this then there is an interesting bug somewhere...
> > 
> > Thanks,
> >  ElfQT
> 
> Whoa I see this is what happening. It works with dmdv1.026 and phobos. I am investigating this issue, right now I suspect tango - somebody from there please lend me a hand.




More information about the Digitalmars-d mailing list