*** empty log message ***

This commit is contained in:
gregw 2001-03-08 21:28:25 +00:00
parent ee8f10684d
commit 6eaf59ba32
5 changed files with 17 additions and 15 deletions

View File

@ -1,11 +1,9 @@
from ShowBaseGlobal import *
from DirectObject import *
from GuiGlobals import *
import GuiManager
import GuiLabel
import GuiButton
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
class Button(DirectObject):

View File

@ -1,12 +1,9 @@
from ShowBaseGlobal import *
from DirectObject import *
import GuiManager
from GuiGlobals import *
import GuiFrame
import Vec3
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
class Frame(DirectObject):
# special methods

View File

@ -1,6 +1,10 @@
# GuiGlobals.py : global info for the gui package
from ShowBaseGlobal import *
import GuiManager
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(),
base.renderGui.node())
font = loader.loadModelNode("models/fonts/ttf-comic")
@ -10,3 +14,4 @@ def getDefaultFont():
def setDefaultFont(newFont):
global font
font = newFont

View File

@ -38,10 +38,9 @@ class OnscreenText(PandaObject, NodePath):
self.assign(textNodePath)
# position ourselves
self.setXY(x, y)
self.setPos(x, y)
# assume 4:3 aspect ratio
self.setScale( 0.069, 1.0, 0.069)
self.setScale(0.069)
self.isClean = 0
return None
@ -66,13 +65,19 @@ class OnscreenText(PandaObject, NodePath):
"""
self.node().setText(string)
def setXY(self, x, y):
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)
Position the onscreen text in 2d screen space
"""
# render2d has x across and z up
self.setPos(x, 0.0, y)
NodePath.setPos(self, x, 0.0, y)
def setColor(self, color):
self.textNode.setCardColor(color[0],color[1],color[2],color[3])

View File

@ -2,11 +2,8 @@ from ShowBaseGlobal import *
from DirectObject import *
from GuiGlobals import *
import GuiSign
import GuiManager
import GuiLabel
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
class Sign(DirectObject):
def __init__(self, name, label=None, font=getDefaultFont()):