Go to the documentation of this file.00001 '''
00002 Anoria (c) Gsk 2010
00003 '''
00004
00005
00006
00007
00008 import BigWorld
00009 import Helpers.PyGUI as PyGUI
00010 import GUI
00011 from bwdebug import ERROR_MSG
00012 import types
00013
00014 from Helpers.PyGUI import PyGUIEvent
00015
00016 class AnGUIWindow():
00017 def __init__(self):
00018 pass
00019
00020
00021
00022
00023
00024
00025 def setDimensions(self, width, height):
00026 self.width = width
00027 self.height = height
00028
00029
00030 self.component.widthMode="PIXEL"
00031 self.component.heightMode="PIXEL"
00032 self.component.width=width
00033 self.component.height=height
00034
00035
00036
00037
00038
00039 tex_width = self.component.texture.width
00040 tex_height = self.component.texture.height
00041 u_max = float(width)/float(tex_width)
00042 v_max = float(height)/float(tex_height)
00043 print 'u_max=%f, v_max=%f' % (u_max, v_max)
00044
00045 self.component.mapping = ((0.0,0.0),(0.0,v_max),(u_max,v_max),(u_max,0.0))
00046
00047
00048
00049 class StatsWindow(PyGUI.DraggableWindow, AnGUIWindow ):
00050
00051 factoryString = "AnGUI.StatsWindow"
00052
00053 def __init__( self, component ):
00054 PyGUI.DraggableWindow.__init__( self, component )
00055 self.component.script = self
00056 self.component.materialFX = "BLEND"
00057 self.timeCallback = None
00058
00059
00060 def onActive( self ):
00061 BigWorld.callback( 1.0, self.updateCallback )
00062 self.updateStats()
00063
00064
00065 def updateCallback( self ):
00066 if self.isActive:
00067 BigWorld.callback( 1.0, self.updateCallback )
00068 self.updateStats()
00069
00070
00071 def updateStats( self ):
00072 pass
00073
00074
00075 def active( self, show ):
00076 if self.isActive == show:
00077 return
00078
00079 PyGUI.DraggableWindow.active( self, show )
00080
00081 if show:
00082 self.onActive()
00083
00084
00085 @staticmethod
00086 def create(texture, width=None, height=None):
00087 c = GUI.Window(texture)
00088 win = StatsWindow(c)
00089 if width != None and height != None:
00090 win.setDimensions(width, height)
00091 return win.component
00092