Hi,
I idea is to implement a scrolling text using the IncrementalTextLayout.
In some cases, I need this scrolled text 90 degrees rotated.
Therefore I have apply a rotate and a transformation before I call the draw
method of the text layout.
The problem seems to be that one a rotation is in effect the result is not
is I would have expected it.
Especially the meaning of the width and heiht properties of the
IncrementalTextLayout is really strange.
I have attached a short example where I try to show what i mean (width the
scrolling)...
Does anybody know how I can achieve a scrolled text rotated by 90 degrees?
Thanks in advance,
Martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
import pyglet
from pyglet import gl
w1 = pyglet.window.Window (640, 480)
label = pyglet.text.layout.IncrementalTextLayout \
( pyglet.text.document.UnformattedDocument ("Hello World")
, width = 200
, height = 45
)
label.x = 100
label.y = 40
label.document.set_style \
( 0, len (label.document.text)
, dict ( color = (255, 0, 0, 255)
, font_size = 36
, font_name = 'Times New Roman'
)
)
label_r = pyglet.text.layout.IncrementalTextLayout \
( pyglet.text.document.UnformattedDocument ("Hello World")
, width = 300
, height = 200
)
label_r.x = 100
label_r.y = 40
label_r.document.set_style \
( 0, len (label.document.text)
, dict ( color = (255, 0, 0, 255)
, font_size = 36
, font_name = 'Times New Roman'
)
)
label1 = pyglet.text.Label\
( 'Hello, world'
, font_name = 'Times New Roman'
, font_size = 36
, x = 100
, y = 0
)
@w1.event
def on_draw () :
gl.glLoadIdentity ()
label.view_x = 50
label.draw ()
label1.draw ()
gl.glRotatef (-90, 0, 0, 1)
gl.glTranslatef (-w1.height, 0, 0)
label_r.view_x = 50
label_r.draw ()
label1.draw ()
pyglet.app.run ()