mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
auto float formatting
This commit is contained in:
parent
03e8cbc717
commit
55e83fdc5c
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from PandaModules import *
|
from PandaModules import *
|
||||||
|
|
||||||
|
import types
|
||||||
import OnscreenText
|
import OnscreenText
|
||||||
import DirectUtil
|
import DirectUtil
|
||||||
|
|
||||||
@ -38,7 +39,11 @@ class OnScreenDebug:
|
|||||||
# frame (key roughly equals value):
|
# frame (key roughly equals value):
|
||||||
#isNew = "was"
|
#isNew = "was"
|
||||||
isNew = "~"
|
isNew = "~"
|
||||||
self.onScreenText.appendText("%20s %s %-44s\n"%(k, isNew, v[1]))
|
value = v[1]
|
||||||
|
if type(value) == types.FloatType:
|
||||||
|
value = "% 10.4f"%(value,)
|
||||||
|
# else: other types will be converted to str by the "%s"
|
||||||
|
self.onScreenText.appendText("%20s %s %-44s\n"%(k, isNew, value))
|
||||||
self.onScreenText.appendText(self.text)
|
self.onScreenText.appendText(self.text)
|
||||||
self.frame += 1
|
self.frame += 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user