From be4d34ca863757528deb9968578045737fecf868 Mon Sep 17 00:00:00 2001 From: Quentin Wenger Date: Wed, 27 May 2015 17:17:54 +0200 Subject: [PATCH] BGE Python API: Completing doc for bge.types.KX_FontObject This adds description of the Font object and about its (only one) attribute, as well as an example of use. Reviewers: campbellbarton, fsiddi, dfelinto, moguri Reviewed By: dfelinto Subscribers: lordloki Projects: #documentation, #game_engine Differential Revision: https://developer.blender.org/D863 --- .../rst/bge_types/bge.types.KX_FontObject.rst | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst b/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst index 1961f5e3e92..ca35ff49a08 100644 --- a/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst +++ b/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst @@ -7,6 +7,26 @@ base class --- :class:`KX_GameObject` .. class:: KX_FontObject(KX_GameObject) - TODO. + A Font object. + .. code-block:: python + + # Display a message about the exit key using a Font object. + import bge + + co = bge.logic.getCurrentController() + font = co.owner + + exit_key = bge.events.EventToString(bge.logic.getExitKey()) + + if exit_key.endswith("KEY"): + exit_key = exit_key[:-3] + + font.text = "Press key '%s' to quit the game." % exit_key + + .. attribute:: text + + The text displayed by this Font object. + + :type: string