-nan problem???
    Sheridan 
    superpeti at freemai.hu
       
    Thu Dec 11 15:26:55 PST 2008
    
    
  
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. 
    
    
More information about the Digitalmars-d-learn
mailing list