[Dgame] Sprite loading and setting position in another class
Jack via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 25 07:03:06 PDT 2015
On Tuesday, 25 August 2015 at 13:22:43 UTC, Namespace wrote:
>> 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.
Thank you for answering so quickly. If you don't mind me asking
when will v0.7 be out?
More information about the Digitalmars-d-learn
mailing list