[Dgame] Sprite loading and setting position in another class
Namespace via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 25 06:22:41 PDT 2015
> Edit:
>
> Basically my code is:
> //Texman.d//////////////////////////////////////
>
> Class TextureManager
> {
> //variables
>
> void addSprite(string sprite_file, string name)
> {
> Surface wiki_img = Surface(sprite_file);
> Texture wiki_tex = Texture(wiki_img);
> sprite_list[name] = new Sprite(wiki_tex);
> sprite_list[name].setPosition(1,1); //tried to
> remedy by this
> }
> }
You have to store your Texture. See "My Sprite is only a white
Rectangle" on http://dgame-dev.de/index.php?controller=faq
I'll change that with v0.7, so that Sprite will manage the
Texture by himself.
More information about the Digitalmars-d-learn
mailing list