*** empty log message ***

This commit is contained in:
David Rose 2001-03-08 23:34:31 +00:00
parent f9b3b006e9
commit 1752901444
3 changed files with 19 additions and 7 deletions

View File

@ -64,13 +64,6 @@ class OnscreenText(PandaObject, NodePath):
Set the text of the onscreen text
"""
self.node().setText(string)
def setScale(self, scale):
"""setScale(self, float)
Override NodePath setScale to account for aspect ratio
"""
# assume 4:3 aspect ratio
NodePath.setScale(self, scale, 1.0, scale * (4.0/3.0))
def setPos(self, x, y):
"""setPos(self, float, float)

View File

@ -74,6 +74,24 @@ class ShowBase:
# Set up a 2-d layer for drawing things behind Gui labels.
self.render2d = NodePath(setupPanda2d(self.win, "render2d"))
# The normal 2-d layer has an aspect ratio that matches the
# window, but its coordinate system is square. This means
# anything we parent to render2d gets stretched. For things
# where that makes a difference, we set up aspect2d, which
# scales things back to the right aspect ratio.
# For now, we assume that the window will have an aspect ratio
# matching that of a traditional PC screen.
self.aspectRatio = 4.0 / 3.0
self.aspect2d = self.render2d.attachNewNode("aspect2d")
self.aspect2d.setScale(1.0 / self.aspectRatio, 1.0, 1.0)
# It's important to know the bounds of the aspect2d screen.
self.a2dTop = 1.0
self.a2dBottom = -1.0
self.a2dLeft = -self.aspectRatio
self.a2dRight = self.aspectRatio
# Set up another 2-d layer for drawing the Gui labels themselves.
self.renderGui = NodePath(setupPanda2d(self.win, "renderGui"))

View File

@ -7,6 +7,7 @@ __builtin__.base = ShowBase()
# Make some global aliases for convenience
__builtin__.render2d = base.render2d
__builtin__.aspect2d = base.aspect2d
__builtin__.render = base.render
__builtin__.hidden = base.hidden
__builtin__.camera = base.camera