-nan problem???
Denis Koroskin
2korden at gmail.com
Thu Dec 11 15:40:30 PST 2008
On Fri, 12 Dec 2008 02:26:55 +0300, Sheridan <superpeti at freemai.hu> wrote:
> Hi!
>
> I am new in D language. I implement a little 2D/3D engine, and during
> the development I faced an interesting problem.
>
> I have this function:
>
> void addBackgroundToLayer2(char[] textureName, float posx, float posy)
> {
> CTexture tex = new CTexture(textureName); //create the texture
>
> tex.m_itexurePosX = posx;
> tex.m_itexurePosY = posy;
> writefln("X: %f, Y: %f", tex.m_itexurePosX,tex.m_itexurePosY);
>
> m_Layer2~=tex;
> }
>
> The problem is that the value of tex.m_itexurePosX variable will be
> "-nan". But value of posx is good.
>
> If I change the sort of the lines:
>
> void addBackgroundToLayer2(char[] textureName, float posx, float posy)
> {
> CTexture tex = new CTexture(textureName);
>
> m_Layer2~=tex;
>
> tex.m_itexurePosX = posx;
> tex.m_itexurePosY = posy;
> writefln("X: %f, Y: %f", tex.m_itexurePosX,tex.m_itexurePosY);
> }
>
> Then everything works fine. What do I wrong? I do not understand this
> problem. I use dmd 1.037 compiler.
Looks like a bug. Could you please provide a compilable code sample (small one, if possible) so that we could reproduce it?
BTW, you have a typo in 'm_itexurePosX' :)
^^
More information about the Digitalmars-d-learn
mailing list