SFML community forums

Help => General => Topic started by: Wrapperup on May 18, 2014, 12:54:32 am

Title: Using Sprite Arrays
Post by: Wrapperup on May 18, 2014, 12:54:32 am
Hi, I would like to use sprite arrays for my game's GUI class, as they are very easy to stylize and do fancy stuff.

(http://dl.dropboxusercontent.com/s/sp1s1fu8rw228mh/spriteArray.png)
Resized
(http://dl.dropboxusercontent.com/s/rqks4y8mc514vyx/spriteArrayRes.png)

The sprite array would show up in SFML like so:

(https://dl.dropboxusercontent.com/s/n38nnz7c4aqlgv3/resultofSpriteArray.png)

Some parts will stretch across, some are the corners and the middle will resize to needs.

What would be the best way of achieving this?

Title: Re: Using Sprite Arrays
Post by: eXpl0it3r on May 18, 2014, 02:12:28 am
There's no "best" way.

Just go with whatever way comes into your mind.
Title: Re: Using Sprite Arrays
Post by: Wrapperup on May 18, 2014, 02:33:25 am
Alright, then I'm going to have it set up like this:
Load sprite
Change TextureRect to fit each box (probably have arguments to define the size of each sprite box)
Draw for each box

All the drawing will be put into a RenderTexture, for easy management

Seems to be the best way i can think of.