Advertisement

How to get the exact coordinate in an Atlas (SFML)

Started by December 16, 2017 03:54 PM
5 comments, last by Satharis 6 years, 11 months ago

I downloaded a pack of sprites, and I was wondering how do you manage to get the exact coordinates of a smaller sprite in an Atlas.

https://en.sfml-dev.org/forums/index.php?topic=4695.0

So every sprite is a rectangle inside your atlas. Find it's start and end pixel and you can read it from the atlas.

Advertisement

I forgot to mention that the pack doesn't come with the coordinates of each sprite, so there's a way to discover it? (seems like your answer depend on it)

2 hours ago, Luhan M. said:

I forgot to mention that the pack doesn't come with the coordinates of each sprite, so there's a way to discover it? (seems like your answer depend on it)

What? I don't get this question, each point is a pixel.

You can open the image in paint or any other image editor. Move the cursor to the start of the sprite, it should tell you the coordinate.

 

Using your eyes is the only way I can think of doing this that is fool proof. Even advance sprite editors depend on maps or the alpha channel. There is no automatic way of detecting sprites that works every time.

1 hour ago, Scouting Ninja said:

What? I don't get this question, each point is a pixel.

You can open the image in paint or any other image editor. Move the cursor to the start of the sprite, it should tell you the coordinate.

 

Using your eyes is the only way I can think of doing this that is fool proof. Even advance sprite editors depend on maps or the alpha channel. There is no automatic way of detecting sprites that works every time.

Yeah, I did opened it in paint and used the coordinates, but I saw some people saying that an atlas should have come with the coordinates of each sprite. I thought there was some kind of way to retrieve each sprite more easy, instead of looking for the coordinates in the image editor.

Unless you're a wizard, using images from a texture atlas would either require uniformly sized images or a file describing the locations of each sub-image.

So yes, normally it should come with something. If no such file exists then you have little option besides figuring out the coordinates manually.

This topic is closed to new replies.

Advertisement