[Bf-blender-cvs] [be4d34ca] master: BGE Python API: Completing doc for bge.types.KX_FontObject
Quentin Wenger
noreply at git.blender.org
Wed May 27 17:20:27 CEST 2015
Commit: be4d34ca863757528deb9968578045737fecf868
Author: Quentin Wenger
Date: Wed May 27 17:17:54 2015 +0200
Branches: master
https://developer.blender.org/rBbe4d34ca863757528deb9968578045737fecf868
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
===================================================================
M doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst
===================================================================
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 1961f5e..ca35ff4 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
More information about the Bf-blender-cvs
mailing list