Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-07-29 05:24:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-29 05:24:03 +0400
commit26589497529ca3c8da85391d4976d286a371e258 (patch)
treee1549256e9f68706375b64d656ece51e4e1bf152 /doc/python_api/examples/blf.py
parent336a47cdcf909864e080d9917cbc04bd7134da1f (diff)
pep8 cleanup, also print message when attempting to run in animation player mode.
Diffstat (limited to 'doc/python_api/examples/blf.py')
-rw-r--r--doc/python_api/examples/blf.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py
index 3ab7f789ce8..f6e87cf488d 100644
--- a/doc/python_api/examples/blf.py
+++ b/doc/python_api/examples/blf.py
@@ -1,6 +1,7 @@
"""
Hello World Text Example
++++++++++++++++++++++++
+
Blender Game Engine example of using the blf module. For this module to work we
need to use the OpenGL wrapper :class:`~bgl` as well.
"""
@@ -11,31 +12,33 @@ from bge import logic
import bgl
import blf
+
def init():
"""init function - runs once"""
# create a new font object, use external ttf file
font_path = logic.expandPath('//Zeyada.ttf')
- # store the font indice - to use later
+ # store the font indice - to use later
logic.font_id = blf.load(font_path)
- # set the font drawing routine to run every frame
+ # set the font drawing routine to run every frame
scene = logic.getCurrentScene()
- scene.post_draw=[write]
+ scene.post_draw = [write]
+
def write():
"""write on screen"""
width = render.getWindowWidth()
height = render.getWindowHeight()
-
+
# OpenGL setup
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glLoadIdentity()
bgl.gluOrtho2D(0, width, 0, height)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glLoadIdentity()
-
+
# BLF drawing routine
font_id = logic.font_id
- blf.position(font_id, (width*0.2), (height*0.3), 0)
+ blf.position(font_id, (width * 0.2), (height * 0.3), 0)
blf.size(font_id, 50, 72)
blf.draw(font_id, "Hello World")