Start on texturing

This commit is contained in:
2024-01-15 18:35:35 +08:00
parent 5a51a375a4
commit f78e71f96b
4 changed files with 15 additions and 1 deletions
+12 -1
View File
@@ -10,6 +10,8 @@ static bool init = false;
static unsigned int width;
static unsigned int height;
static sf::Image image;
int firstperson_init(unsigned int _width, unsigned int _height)
{
printf("firstperson_init()\n");
@@ -17,6 +19,9 @@ int firstperson_init(unsigned int _width, unsigned int _height)
width = _width;
height = _height;
init = true;
if (!image.loadFromFile("xd.bmp")) return 0;
return 1;
}
@@ -70,11 +75,17 @@ void firstperson_update(sf::RenderTarget* renderTarget, Camera* camera)
renderTexture.draw(rectangle);
}
sf::Texture imageTexture;
sf::Sprite imageSprite;
imageTexture.loadFromImage(image);
imageSprite.setTexture(imageTexture);
renderTexture.draw(imageSprite);
renderTexture.display();
sf::Sprite sprite(renderTexture.getTexture());
sprite.setPosition(renderTexturePosition);
renderTarget->draw(sprite);
renderTarget->draw(sprite);
}
void firstperson_setTexturePosition(float x, float y)