Skip to content

Navigation Menu

Sign in
Sign up
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Fixed sprite image index copy in getRef() - #161

Open
arnuschky wants to merge 1 commit into
hyperandroid:master from
arnuschky:fix-spriteIndex-in-getRef
Open

Fixed sprite image index copy in getRef() #161
arnuschky wants to merge 1 commit into
hyperandroid:master from
arnuschky:fix-spriteIndex-in-getRef

Conversation

@arnuschky

@arnuschky arnuschky commented Nov 22, 2013

Copy link
Copy Markdown

We're using sprite maps with CAAT: on startup, we load a 2048x2048px map with the preloader and initialize it using the initializeFromMap function. Works like a charm.

In order to use the sprites of the map, we would need to do something along these lines:

var sprite = spriteMap.getRef().setSpriteIndex('name');
var actor = new CAAT.Actor();
actor.setBackgroundImage(sprite, false);
actor.setSize(sprite.getWidth(), sprite.getHeight());

This is obviously quite uncomfortable. Preferably, one would use something like this:

var actor = new CAAT.Actor();
actor.setBackgroundImage(spriteMap.setSpriteIndex('name'), true);

Unfortunately, this does not work because setBackgroundImage calls getRef(), which does not copy the spriteIndex of the image.

We fixed this by copying the spriteIndex in getRef() as well. We can now use the spritemap as describe above, which is really efficient.

eyecatchup added a commit to eyecatchup/CAAT that referenced this pull request Mar 13, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /