12 def __init__ (self, menu, name, x, y, prev):
23 def AddItem (self, type, name, func, arg, menu):
24 self.items.append ((type,name,func,arg,menu))
26 def Choose (self, item):
32 SELECTOR_XOFFSET = -28
33 def __init__ (self, wad, vid):
42 self.FontABaseLump = self.wad.GetNumForName("FONTA_S")+1
43 self.FontBBaseLump = self.wad.GetNumForName("FONTB_S")+1
45 def AddMenu (self, menu):
46 self.menus.append (menu)
48 def ProcessText (self, text, x, y, baselump, draw=True):
53 patch = self.wad.CacheLumpNum (baselump + ord (c) - 33)
54 (w, h) = struct.unpack_from ('<hh', patch, 0)
56 self.vid.DrawPatch (x, y, patch)
60 def DrawTextA (self, text, x, y):
61 self.ProcessText (text, x, y, self.FontABaseLump)
63 def TextAWidth (self, text):
64 return self.ProcessText (text, 0, 0, self.FontABaseLump, False)
66 def DrawTextB (self, text, x, y):
67 self.ProcessText (text, x, y, self.FontBBaseLump)
69 def TextBWidth (self, text):
70 return self.ProcessText (text, 0, 0, self.FontBBaseLump, False)
74 self.time = self.time + 1
77 self.current = self.old
81 def Deactivate (self):
83 self.old = self.current
86 self.menus[self.current].Draw ()
87 x = self.menus[self.current].x
88 y = self.menus[self.current].y
89 for item in self.menus[self.current].items:
90 self.DrawTextB (item[1], x, y)
91 y = y + Menu.ITEM_HEIGHT
92 y = self.menus[self.current].y+(self.currentitem*Menu.ITEM_HEIGHT)+Menu.SELECTOR_YOFFSET
97 self.vid.DrawPatch(x + Menu.SELECTOR_XOFFSET, y, self.wad.CacheLumpName (selName))