is a fix32 positive only?

SGDK only sub forum

Moderator: Stef

Post Reply
POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

is a fix32 positive only?

Post by POLYGAMe » Mon Feb 22, 2016 7:30 am

I am having problems with numbers less than zero in scrolling my road. It works fine scrolling right but when I scroll left and it gets below zero it turns to garbled gfx. Is fix32 positive only or perhaps the problem is with the fix32toint function? What other options are there?

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: is a fix32 positive only?

Post by POLYGAMe » Mon Feb 22, 2016 8:16 am

Here's a video showing what I mean:

https://www.youtube.com/watch?v=bAfB155 ... e=youtu.be

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: is a fix32 positive only?

Post by Stef » Mon Feb 22, 2016 8:38 am

Fix32 is signed but it all depends from your code implementation : having a single non signed comparison can make every thing wrong !

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: is a fix32 positive only?

Post by POLYGAMe » Mon Feb 22, 2016 8:47 am

Stef wrote:Fix32 is signed but it all depends from your code implementation : having a single non signed comparison can make every thing wrong !
Good point. I'll take a closer look at my code. I could be using a u16 somewhere...

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: is a fix32 positive only?

Post by POLYGAMe » Mon Feb 22, 2016 9:34 am

Found the culprit - my offset variable was a u16. Oops! All working now :D

Post Reply