C ++ D3D9固定的精灵/纹理大小

时间:2018-09-21 18:26:54

标签: c++ textures sprite

我想知道如何调整我的纹理的大小并在不剪切纹理的情况下绘制它们

因此,它应仅缩小比例,例如50x50像素,而不会从图像上剪切掉

                    ss->Begin(D3DXSPRITE_ALPHABLEND);

                    // Texture being used is 64 by 64:
                    D3DXVECTOR2 spriteCentre = D3DXVECTOR2(32.0f, 32.0f);

                    // Screen position of the sprite
                    D3DXVECTOR2 trans = D3DXVECTOR2(10.0f, 80.0f);


                    D3DXMATRIX mat;

                    D3DXVECTOR2 scaling(1.0f, 1.0f); // i want to use width and lenght in pixel if possible


                    D3DXMatrixTransformation2D(&mat, NULL, 0.0, &scaling, &spriteCentre, 0, &trans);


                    ss->SetTransform(&mat);

                    // Draw the sprite 
                    ss->Draw(myTexture, NULL, NULL, NULL, 0xFFFFFFFF);
                    ss->End();

任何帮助将不胜感激:) 再见

0 个答案:

没有答案