def __init__(self, xScale, zScale, textureString, charLimit, align = CENTER):
     NodePath.__init__(self, "InputBox")
     self.mouseEnabled = True
     self.currentIndex = 0
     self.charLimit = charLimit
     self.string = [" "]*charLimit
     MouseDispatcher.registerListener(self, self)
     self.keysEnabled = False
     self.box = loader.loadModel("models/square")
     self.box.setScale(xScale, 1, zScale)
     self.disabledTex = loader.loadTexture("models/" + textureString + "Disabled.bmp")
     self.enabledTex = loader.loadTexture("models/" + textureString + ".bmp")
     self.box.setTexture(self.disabledTex)
     self.box.reparentTo(self)
     
     self.poly1 = CollisionPolygon(bl, br, tr, tl)
     self.cnode = CollisionNode("Goodbye, Kitty") 
     self.cnode.addSolid(self.poly1)
     self.box.attachNewNode(self.cnode)
     
     self.text = TextNode("Text")
     
     self.text.setText("")
     self.text.setAlign(TextNode.ACenter)
     self.text.setFont(palaLino) 
     #self.text.setTextColor(0,0,0,1)
     self.anode = self.attachNewNode(self.text)
     self.anode.setScale(zScale * const * 2.05)
     self.anode.setColor(0, 0, 0, 1)
     if(align == CENTER):
         xPos = -xScale*const/36
     elif(align == LEFT):
         xPos = -xScale * const
 	self.anode.setPos(xPos, -.002, -zScale*const/1.8)
     self.acceptKeys()
Beispiel #2
0
    def __init__(self, x, y, z, h, p, r, xScale, yScale, zScale, strText, parent, cmd, *args):
        self.args = args
        self.parent = parent
        self.cmd = cmd
        self.xo = x
        self.yo = y
        self.zo = z
        blf1 = Point3(- xScale, - yScale, - zScale)
        brf1 = Point3(xScale, - yScale, - zScale)
        trf1 = Point3(xScale, - yScale, zScale)
        tlf1 = Point3(- xScale, - yScale, zScale)
##        blb1 = Point3(- xScale, yScale, - zScale)
##        brb1 = Point3(xScale, yScale, - zScale)
##        tlb1 = Point3(- xScale, yScale, zScale)
##        trb1 = Point3(xScale, yScale, zScale)
        NodePath.__init__(self, "String")
        self.setTransparency(TransparencyAttrib.MAlpha) 
        self.setColor(1, 1, 1, 1)
        self.button = loader.loadModel("models/cube")
        self.buttonTex = loader.loadTexture("models/" + strText + ".bmp")
        self.button.setTexture(self.buttonTex)
        self.button.setScale(xScale,yScale,zScale)
        self.poly1 = CollisionPolygon(blf1, brf1, 
              trf1, tlf1)
        self.node = CollisionNode("boo")
        self.node.addSolid(self.poly1)
        self.attachNewNode(self.node)
        
        MouseDispatcher.registerListener(self, self)
        self.button.reparentTo(self)
        self.reparentTo(parent)
        self.setPosHprScale(x, y, z, h, p, r, xScale, yScale, zScale)
    def __init__(self, text, event, scale, makeText = True):
        self.up = True
        self.title = text
        self.event = event
        NodePath.__init__(self, "Hola, Gato")
        
        if(makeText):
            self.text = TextNode("yuck")
            self.text.setText(text)
            self.text.setAlign(TextNode.ACenter)
            self.text.setFont(palaLino) 
            #self.text.setTextColor(0,0,0,1) this is a weak method
            self.anode = self.attachNewNode(self.text)
            self.anode.setScale(.08,.08,.08)
            self.anode.setPos(-.009, -.001, -.018)
            self.anode.setColor(0, 0, 0, 1)

        self.setTransparency(TransparencyAttrib.MAlpha)
        self.sq = loader.loadModelCopy("models/square")
        self.sq.setScale(scale)
        self.tex = loader.loadTexture("models/" + text + ".bmp")
        self.sq.setTexture(self.tex)
        self.sq.reparentTo(self) 
        MouseDispatcher.registerListener(self, self)
        self.mDownTex = loader.loadTexture("models/" + text + "Down.bmp")
        self.poly1 = CollisionPolygon(bl, br, tr, tl)
        self.cnode = CollisionNode("Goodbye, Kitty") 
        self.cnode.addSolid(self.poly1)
        self.sq.setHpr(180, 0, 0)
        self.sq.attachNewNode(self.cnode)
        self.setPythonTag("self", self)
        self.setTransparent()
 def __init__(self, parent, location, content = None,
              transparency = Cell.OPAQUE,
              state = Cell.UNEXPLORED):
     self.__targetAlpha = 1
     self.__isFadeTaskRunning = False
     self.__highlighted = False
     self.__lossHighlighted = False
     Cube.__init__(self, "GuiCellPeer", *location)
     self.setPythonTag("self", self)
     self.__client = self.attachNewNode("GuiCell client volume")
     self.client.setPos(.5, .5, .5)
     Cell.__init__(self, parent, location, None, transparency, state)
     self.childBinding.addListener(self)
     self.content = content
     if self.hasFullTS:
         self.cube.setTexture(self.field.game.tsCell, self.__ARB_TEXTURE)
     MouseDispatcher.registerListener(self, self.field.game)
    def __init__(self, newGameCmd, args):
        self.newGameCmd = newGameCmd
        self.args = args
        NodePath.__init__(self, "GAh")
        self.smiley = loader.loadModelCopy("models/smiley")
        self.smiley.setScale(.05)
        self.smileTex = loader.loadTexture("models/smiley_0.bmp")
        self.oTex = loader.loadTexture("models/smiley_1.bmp")
        self.dieTex = loader.loadTexture("models/smiley_2.bmp")
        self.winTex = loader.loadTexture("models/smiley_3.bmp")
        self.boredTex = loader.loadTexture("models/smiley_4.bmp")
        
        self.smiley.reparentTo(self)
        self.smiley.setTexture(self.smileTex)
        taskMgr.add(self.tasker, "task")
        self.np = NodePath("self")
        self.np.reparentTo(base.camera)
        self.np.setPos(0, 0, 0)
        
        cs = CollisionSphere(0, 0, 0, 3.34) 
	cnodePath = self.smiley.attachNewNode(CollisionNode('cnode')) 
	cnodePath.node().addSolid(cs) 
	MouseDispatcher.registerListener(self, self)