Floating Point GDI functions

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
Does the GDI have any floating point (either float or double) functions that mirror the standard ones such as MoveToEx, LineTo, TextOut etc? I'm calling them a lot with floats and get fed up with casting them back to ints all the time.

It won't make any difference to the drawing on the screen, but will make the code neater to not have casts all over the place.

If not, then I'll just put it in as a macro to do the casting.

Ta
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
This might not be a good solution, but you can disable those warning with:
#pragma warning(disable:4244)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,621
Reaction score
2,341
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Better cast, than disable the warning that a implicit cast was done. If you are really unlucky, the calculations do the implicit casting at the wrong point or into the wrong format.

I know casting can be annoying, but the alternative is worse. If you want to reduce the amount of casting, define a inline function for the calculations. often you only do projections for GDI, so it is often the same calculation again and again and again...
 

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
Disabling warnings isn't a good solution. Compilers give you warnings for a good reason and ignoring them or disabling them with a pragma comment or compiler option just to not be notified of them is very bad practise as you may then miss a valid warning (especially when casting as you will miss bad pointers etc). I've defined some macros to do it for me as I guess that GDI doesn't do floating point functions.
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Disabling warnings isn't a good solution. Compilers give you warnings for a good reason and ignoring them or disabling them with a pragma comment or compiler option just to not be notified of them is very bad practise as you may then miss a valid warning (especially when casting as you will miss bad pointers etc). I've defined some macros to do it for me as I guess that GDI doesn't do floating point functions.

Well the VC++ 2008 allows you to show/disable warnings in the main output, so you can see all the warnings by clicking on a button, and hide them by clicking it again. I don't disable warnings, but I don't bother explicitly casting either...
 

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
Well the VC++ 2008 allows you to show/disable warnings in the main output, so you can see all the warnings by clicking on a button, and hide them by clicking it again. I don't disable warnings, but I don't bother explicitly casting either...

Again, this is handy for when you are working through stuff as you can see the filter out the warnings to see the errors etc, but still not good coding practise to leave code that generates compiler warnings.
 
Top