You obviously didn't recheck my code, it now is:

void SVGPanel::Paint()
{
        if (!m_pImage->SVGLoaded())
                return;

        int wide,tall;
        BaseClass::GetSize(wide,tall);

        if (m_iTexture!=-1)
                surface()->DrawSetTextureRGBA(m_iTexture, (unsigned char 
*)m_pBuffer,
wide, tall, false, true);

        if ( (m_iTexture==-1) || (!surface()->IsTextureIDValid(m_iTexture)) )
        {
                //unchanged
        }

        surface()->DrawSetColor(Color(0,255,0,255));
        surface()->DrawTexturedRect(0, 0, wide, tall);
}

At first it draws some weapons from the weapons ttf, and later it paints all
kinds of crosshairs.

deathz0rz

Alfred Reynolds writes:

As my earlier email post said, you MUST call  DrawSetTextureFile()
before EVERY DrawTexturedRect() call (or in your case
DrawSetTextureRGBA()). In your ::Paint() function you only call
DrawSetTextureRGBA once.

( here is the code from your paint function:
        if (!m_pImage->SVGLoaded())
                return;

        if ( (m_iTexture==-1) ||
(!surface()->IsTextureIDValid(m_iTexture)) )
        {
        // BAD BAD BAD, need to call something like NeedsRender EVERY
time this is called
                int width,height;
                float ratio;

                m_pImage->SVGGetSize(&width,&height,&ratio);
                NeedsRender(width*0.5,height*0.5);
                if ( (m_iTexture==-1) ||
(!surface()->IsTextureIDValid(m_iTexture)) )
                        return;
        }

        int wide,tall;
        BaseClass::GetSize(wide,tall);

        surface()->DrawSetTexture(m_iTexture);
        //surface()->DrawTexturedRect(0, 0, wide, tall);
        surface()->DrawTexturedRect(0, 0, 512, 1024);

).

- Alfred

_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to