Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frames are 1 pixel smaller than they should be #5

Open
ghost opened this issue Jan 18, 2017 · 9 comments
Open

Frames are 1 pixel smaller than they should be #5

ghost opened this issue Jan 18, 2017 · 9 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 18, 2017

I'm importing frames and if the frame is supposed to be 13x13, I get an image that's 12x12. Why is that?

@Bryce-Dixon
Copy link
Owner

Bryce-Dixon commented Jan 19, 2017

Random guess: Your xleft and ytop are 1 too little (0, 0 is the top left corner of the sheet, not 0, 1)

I did notice that one image I was using had a horizontal strip missing in the middle, so I'll have to look into and patch/optimize that.

@ghost
Copy link
Author

ghost commented Jan 20, 2017

Both are 0 :x

@Bryce-Dixon
Copy link
Owner

Yeah, looking at this it seems like it's an issue with sf2d which is odd because it only happens with certain sprites (for me, link's standing left/right sprites). I'll do some investigating later

@ghost
Copy link
Author

ghost commented Jan 21, 2017

Please do because it's an annoying bug D: I tried looking on the source what the issue could be but found nothing...

Also, I've noticed that when drawing an animation, the X and Y are sort of offset compared to drawing a spritesheet at the same X and Y. You might want to check that out...

@Bryce-Dixon
Copy link
Owner

Also, I've noticed that when drawing an animation, the X and Y are sort of offset compared to drawing a spritesheet at the same X and Y.

This is because drawing a spritesheet at a given position makes that position the top left while an animation makes that the center. I did this because typically you're not really drawing your whole spritesheet as a character and instead just for testing, so there's no reason to get the position perfect. On the other hand, drawing an animation with the hotspot being in the top left corner can get irritating to recenter, so making the hotspot located at the center is more convenient.

I'll add some notes to the card on Trello for some thoughts that I want to look into. I really appreciate your patience with how slow I've been on getting this bug fixed and getting new features added, it's just that school takes up a ton of my time and I would rather get as far ahead on that as possible before getting caught up in a side project.

@Bryce-Dixon
Copy link
Owner

@ghost
Copy link
Author

ghost commented Jan 21, 2017

Don't worry, thank you for the effort! It makes homebrew developing a million times easier considering the lack of documentation of citro3d and such. I'll probably end up contributing some code, I have a few ideas. I got it to work on C++ so I'll probably commit the changes later.

@ghost
Copy link
Author

ghost commented Feb 6, 2017

I think it might be because you draw the frames from it's center compared to normal spritesheets, when you divide by half the width and height and the frame size is an odd number (like 13 or 15) you get a number with a .5 decimal, like 6.5 or 7.5, and when you draw a sprite in that position you get a skewed sprite since the x and y positions should never have decimals. Just have to put a floor() in the right place, I think.

@Bryce-Dixon
Copy link
Owner

Hey, I'm not dead. Just in college.

So it turns out this is caused by an issue in sf2d (I looked in SpriteTools for like 30 minutes and couldn't see anything changing width/height or positions in the function chain). This means it'll only truly be fixed once I rewrite the low level graphics portion of ST which probably won't happen for a while.

In the mean time, I added a janky "fix" that just rounds the width and height up to the nearest even number. Is this a really stupid thing to do? Yes. Does it work well enough? Also yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant