Fix32 operations

SGDK only sub forum

Moderator: Stef

Post Reply
Arrovs
Interested
Posts: 18
Joined: Wed Sep 11, 2013 3:44 pm

Fix32 operations

Post by Arrovs » Wed Mar 25, 2015 12:24 am

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.

bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien » Wed Mar 25, 2015 5:45 am

Sgdk sprite exemple in the folder sample use these method.
Maybe you should look into that source code.

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

Post by Stef » Wed Mar 25, 2015 8:46 am

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)) ...

Arrovs
Interested
Posts: 18
Joined: Wed Sep 11, 2013 3:44 pm

Post by Arrovs » Wed Mar 25, 2015 11:38 am

Thanks. fixed vars works beautiful.

Post Reply