textprintf_ex 'problem'
Albin Engström

well, I'll probably drown with links to the manual with this question, but i'm having a really hard time navigating that 'thing'..

anyway, i'm trying to display a value with textprintf_ex but i get some problems..
here's the code:

textprintf_ex(buffer, font, 27, 32, makecol(123,50,50), -1, "X", ((cameraPOS*10+cameraEX)-mouse_y)*100);

where cameraPOS is an integred and cameraEX is float.

replacing X with %d gives me the wrong output but using &f gives me the right, problem is i don't want it to give me the output as float. i want it to cap it.
1135.99123 should be 1135. how to i accomplish this?

Thanks in advance :).

GullRaDriel
textprintf_ex(buffer, font, 27, 32, makecol(123,50,50), -1, "%d", (int)( ( cameraPOS * 10 + cameraEX ) - mouse_y ) *100 );

Albin Engström

Thanks!!! i love this forum..

GullRaDriel

Heh :P

Kitty Cat

Alternatively, you can use
"%.1f", ((cameraPOS * 10 + cameraEX) - mouse_y) * 100
To have it print as 1135.9. Replace the '1' in the string for however many decimal places you want.

Albin Engström

thanks for the additional info ^^!

Thread #591620. Printed from Allegro.cc