Beispiel #1
0
  def __init__(self):
    State.__init__(self)
    
    self.data = []
    for line in open(Config.CREDITS_FILE, 'r').readlines():
      if line.strip() == '':
        continue
      s = Struct()
      if line.startswith('h3. '):
        s.paddingTop = 40
        s.lineheight = 16
        s.fontsize = 24
        s.color = cpp.WHITE
        s.text = line[4::]
      else:
        s.paddingTop = 10
        s.lineheight = 20
        s.fontsize = 30
        s.color = cpp.GREEN
        s.text = line
        
        
      self.data.append(s)
      
      
    self.view = HudView([self.scene])
    self.top = 550

    self.logo = HudQuad("Logo","eRacerXLogoNegative.png", CreditsState.LEFT, self.top-150, 535, 212)
    self.view.Add(self.logo)
Beispiel #2
0
 def __init__(self, stats, parent):
   State.__init__(self)
   self.parent = parent
   self.music = self.parent.music
   self.stats = stats
   self.view = HudView([self.scene])
   self.view.Add(HudQuad("UI-Overlay", Config.UI_TEXTURE, 20, 110, 720, 420, True))
   gameover = HudQuad("GameOverHeadline", "gameover_glow.png", 300, 110, 190, 30)
   gameover.SetCenter(350,125)
   self.view.Add(gameover)    
   
   if not os.path.isdir(os.path.dirname(Config.USER_STATS)):
     os.mkdir(os.path.dirname(Config.USER_STATS))
   # write stats
   with open(Config.USER_STATS, 'a') as f:
     for stat in self.calcstats():
       # i = [player, lap1, lap2, ..., total]
       if stat.player.isAI: continue
       f.write('%s\t%d\t%s\t%.4f\n' % (
         parent.track.classname,
         parent.laps,
         stat.player.name,
         stat.total,
         )
       )
       
       best = min(stat.laps)
       f.write('%s\t%d\t%s\t%.4f\n' % (
         parent.track.classname,
         0,
         stat.player.name,
         best,
         )
       )
Beispiel #3
0
  def __init__(self):
    State.__init__(self)
    self.selected = 0
    
    self.view = HudView([self.scene])

    if MenuState.menuNav == None:
      MenuState.menuNav = cpp.SoundFx();
      MenuState.menuNav.isLooping  = False
      MenuState.menuNav.is3D     = False
      MenuState.menuNav.isPaused = True
      game().sound.sound.LoadSoundFx("MenuNav.wav", self.menuNav)

    if MenuState.menuSel == None:
      MenuState.menuSel = cpp.SoundFx();
      MenuState.menuSel.isLooping  = False
      MenuState.menuSel.is3D     = False
      MenuState.menuSel.isPaused = True
      game().sound.sound.LoadSoundFx("MenuSelect.wav", self.menuSel)

    self.menu = []
    self.menuTop = 50
    self.menuLeft = 100
    self.bg = None
    self.bgFileNames = []
Beispiel #4
0
  def __init__(self, settings, game=None):
    State.__init__(self)
    self.view = HudView([self.scene])
    self.game = game
    
    
    self.mappingQuads = []
    nPlayers = settings.nPlayers
    w = 800
    h = 600

    self.mappingCoords = []
    self.nameStringCoords = []
    
    if nPlayers==1:
      self.mappingCoords.append((0,0,w,h))
      self.nameStringCoords.append((20,20))
    elif nPlayers==2:
      self.mappingCoords.append((w/4,0,w/2,h/2))
      self.mappingCoords.append((w/4,h/2,w/2,h/2))
      self.nameStringCoords.append((20,20))
      self.nameStringCoords.append((20,h/2+20))
    elif nPlayers>2:
      self.mappingCoords.append((0,0,w/2,h/2))
      self.mappingCoords.append((w/2,0,w/2,h/2))
      self.mappingCoords.append((0,h/2,w/2,h/2))
      self.mappingCoords.append((w/2,h/2,w/2,h/2))
      self.nameStringCoords.append((20,     20))
      self.nameStringCoords.append((w/2+20, 20))
      self.nameStringCoords.append((20,     h/2+20))
      self.nameStringCoords.append((w/2+20, h/2+20))
    
    self.names = []
    for i,player in enumerate(settings.players):
      self.mappingQuads.append(HudQuad("%sMapping" % player.name,player.mapping.IMAGE, *self.mappingCoords[i]))
      self.names.append(player.name)
      
    for quad in self.mappingQuads:
      self.view.Add(quad)
    self.settings = settings

    self.isLoaded = False
    PauseMenuState.PreloadMusic()
Beispiel #5
0
 def __init__(self, settings):
   State.__init__(self)
   self.loaded = False
   self.music = None
   self.load(settings)