The controlling application must load the texture into the engine before using it in a sprite. Below is an example of a main that would produce a single sprite with a texture. The deletion of the engine will call clear on the texture manager so there is on code visible for that. It will also remove sprites but I provided an example of how to remove just one sprite if needed.
#include "Engine.hpp"
int main(int aargc, const char* argv[])
{
Engine* engine = new Engine("Game Engine Test", 800, 600);
int t0 = engine->addTexture("mario.jpg");
Entity* entity = engine->addSprite(t0);
engine->run();
engine->removeSprite(entity);
delete engine;
engine = NULL;
}
Below is some scale, rotation and translation of the sprite. This is seamlessly handled by SFML.
No comments:
Post a Comment