Replaced getWidth/getHeight with getSize in sf::Texture and sf::Image

This commit is contained in:
Laurent Gomila 2012-03-31 22:37:13 +02:00
parent b2f3787db1
commit 17e6a45a90
12 changed files with 127 additions and 180 deletions

View file

@ -34,7 +34,7 @@ int main()
return EXIT_FAILURE;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getWidth(), image.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getSize().x, image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}

View file

@ -81,7 +81,7 @@ INT WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, INT)
return EXIT_FAILURE;
sf::Sprite sprite1(texture1);
sf::Sprite sprite2(texture2);
sprite1.setOrigin(texture1.getWidth() / 2.f, texture1.getHeight() / 2.f);
sprite1.setOrigin(sf::Vector2f(texture1.getSize()) / 2.f);
sprite1.setPosition(sprite1.getOrigin());
// Create a clock for measuring elapsed time