Draws floating-point number as text at specified position.
Takes value (double-precision floating-point number to display), x (X position in pixels, integer), y (Y position in pixels, integer), centre (alignment: 0=left-aligned, 1=centered on x position), font (font handle from b2dLoadFont, positive integer).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
valueDouble
xInt
yInt
centreInt
fontInt
Returns
Void
Quick Summary
Draws floating-point number as text at specified position.
Takes value (double-precision floating-point number to display), x (X position in pixels, integer), y (Y position in pixels, integer), centre (alignment: 0=left-aligned, 1=centered on x position), font (font handle from b2dLoadFont, positive integer).
Returns nothing.
Technical Exegesis...
Draws floating-point number as text at specified position. Takes value (double-precision floating-point number to display), x (X position in pixels, integer), y (Y position in pixels, integer), centre (alignment: 0=left-aligned, 1=centered on x position), font (font handle from b2dLoadFont, positive integer). Returns nothing. Converts double to string automatically using default precision, queues text draw command to deferred rendering buffer.
Draws floating-point number as text at specified position. Takes value (double-precision floating-point number to display), x (X position in pixels, integer), y (Y position in pixels, integer), centre (alignment: 0=left-aligned, 1=centered on x position), font (font handle from b2dLoadFont, positive integer). Returns nothing. Converts double to string automatically using default precision, queues text draw command to deferred rendering buffer. Uses current color state from b2dSetColor and alpha from b2dSetAlpha.
Number formatting: converts double to string representation (uses standard C++ formatting), includes decimal point and fractional part (e.g., 3.14159), handles scientific notation for very large/small values (e.g., 1.23e+10), negative numbers include minus sign (e.g., -42.5).
Performance: same as b2dDrawText (~0.02ms per number), number-to-string conversion minimal overhead (~0.001ms), rendered as textured quads like regular text.
Common patterns: FPS display = b2dDrawTextDouble(1000.0/frameTime, 10, 10, 0, debugFont); position debug = b2dDrawTextDouble(playerX, 10, 30, 0, font); percentage = b2dDrawTextDouble(health/maxHealth*100.0, x, y, 0, font); centered value = b2dDrawTextDouble(score*1.5, screenWidth/2, 50, 1, font).
Precision control: default precision used (typically 6 decimal places), for custom formatting use ToString(value) with b2dDrawText instead, very small values may display in scientific notation.
Related: b2dDrawText draws string text, b2dDrawTextInt draws integer value, b2dLoadFont loads font for rendering, b2dGetStringWidth measures number width (after conversion to string).