Page 1 of 1

Fix32 operations

Posted: Wed Mar 25, 2015 12:24 am
by Arrovs
I know im putting out much topics, but who else i will ask.
As i already know floating points isnt native to genesis and someone have made custom workaround for this.
I want to use them for sprite positions, but im not getting clear with some things.
1. Can i use min max functions on them? Or there isnt one for this.
2. Can if > < operations manage them or i again need to use specific functions?

Please also note other stuff what i could not know too so i dont need to ask again.

Posted: Wed Mar 25, 2015 5:45 am
by bastien
Sgdk sprite exemple in the folder sample use these method.
Maybe you should look into that source code.

Posted: Wed Mar 25, 2015 8:46 am
by Stef
You may try to look at the dedicated wiki as well :)
https://github.com/Stephane-D/SGDK/wiki/Tuto-Maths

fix32 values are comparable as long you compare to fix32 values and you can use min or max functions on them.
Ex:

Code: Select all

fix32 v;

...

if (v > FIX32(5)) ...

Posted: Wed Mar 25, 2015 11:38 am
by Arrovs
Thanks. fixed vars works beautiful.